Max8819.h - Max8819 class to allow access to single pins.
More...
#include <max8819.h>
Max8819.h - Max8819 class to allow access to single pins.
The low level interface code is based on Pins.h from David Michael Betz.
Requires a 10k resistor from MAX8819A::CEN to 5V USB.
- Todo:
- Add support (is it neccessary?) For the "timer fault" condition (figure 3, page 18 of datasheet) when CHG outputs a 2Hz square wave.
- Author
- SRLM (srlm@.nosp@m.srlm.nosp@m.produ.nosp@m.ctio.nosp@m.ns.co.nosp@m.m)
- Date
- 1-1-2013
Enumerator |
---|
HIGH |
|
MEDIUM |
|
LOW |
|
OFF |
|
bool Max8819::GetCharge |
( |
) | |
|
|
inline |
Checks to see if the battery is being charged.
- Todo:
- If SetCharge is set to off, and it's plugged in, what does GetCharge return?
- Returns
- the charging status of the battery. True indicates charging, false indicates no charging.
bool Max8819::GetPluggedIn |
( |
void |
) | |
|
|
inline |
void Max8819::Off |
( |
void |
) | |
|
|
inline |
Turn the power system off.
- Warning
- includes Propeller power, so this had better be the last thing in the program.
Turn the power system on.
The I/O holds the power on until Off() is called.
void Max8819::SetCharge |
( |
int |
rate) | |
|
|
inline |
Sets the charge rate.
Valid constants are: -OFF -LOW -MEDIUM -HIGH Note: The rate is set even if there is currently no external power, and stays in effect until next called (possibly during the connection of external power).
- Warning
- If set to OFF it cuts off all power from the USB port. This means that if there is no battery the system will turn off!
-
If it's set to something other than OFF then the maximum current from the USB port is limited. If there is no battery then you must make sure that the total current consumed is less than the maximum, otherwise the MAX8819 might reset.
With a 3kOhm CISET resistor, we have the following charge rates: -LOW == 95 mA -MEDIUM == 475 mA -HIGH == 1000 mA
From the datasheet: It is not necessary to limit the charge current based on the capabilities of the expected AC-toDC adapter or USB/DC input current limit, the system load, or thermal limitations of the PCB. The IC automatically lowers the charging current as necessary to accommodate for these factors.
- Parameters
-
rate | a constant specifying the rate of charge. |
void Max8819::Start |
( |
int |
CENpin, |
|
|
int |
CHGpin, |
|
|
int |
ENpin, |
|
|
int |
DLIM1pin, |
|
|
int |
DLIM2pin |
|
) |
| |
|
inline |
Create the MAX8819 object, turn the power on, and turn off charging.
- Warning
- pmic->SetCharge(Max8819::HIGH); (SRLM): There is some sort of bug where this must be in the code, otherwise it causes a reset.
The pins from the Propeller to the MAX8819 can be connected directly: no need for current limiting resistors.
- Parameters
-
CENpin | The pin connected to Charge Enable on the MAX8819 |
CHGpin | The pin connected to (is) Charge(ing?) pin on the MAX8819 |
ENpin | The pin connected to Enable123 pin on the MAX8819 |
DLIM1pin | The pin connected to DLIM1 pin on the MAX8819 |
DLIM2pin | The pin connected to DLIM2 pin on the MAX8819 |
The documentation for this class was generated from the following file: