PMIC (Power Management IC)
Charge current control reg
This is register REG02. It sets the fast charge current limit (ICHG).
See also: batteryChargeCurrent() in the Power Manager API is the recommended way to set the charge current, since it also persists the setting and reapplies it at every boot.
setChargeCurrent()
// PROTOTYPES
bool setChargeCurrent(bool bit7, bool bit6, bool bit5, bool bit4, bool bit3, bool bit2);
bool setChargeCurrent(uint16_t current);
The total charge current is the 512mA + the combination of the current that the following bits represent
- bit7 = 2048mA
- bit6 = 1024mA
- bit5 = 512mA
- bit4 = 256mA
- bit3 = 128mA
- bit2 = 64mA
For example, to set a 1408 mA charge current:
PMIC pmic;
pmic.setChargeCurrent(0,0,1,1,1,0);
- 512mA + (0+0+512mA+256mA+128mA+0) = 1408mA
There is also an overload that takes the desired charge current directly in milliamps, which rounds down to the nearest valid 64 mA step:
PMIC pmic;
pmic.setChargeCurrent(1408);
The valid range is 512 to 4544 mA (bq24195) or 512 to 2496 mA (bq24195L), though in practice it's rarely useful to charge at a current higher than the input current limit allows.
getChargeCurrent()
byte getChargeCurrent(void);
Returns the charge current register. This is the direct register value from the BQ24195 PMIC. The bits in this register correspond to the bits you pass into setChargeCurrent.
- bit7 is the MSB, value 0x80
- bit2 is the LSB, value 0x04
getChargeCurrentValue()
uint16_t getChargeCurrentValue();
Returns the currently configured fast charge current limit, decoded to milliamps, unlike getChargeCurrent() which returns the raw register value.
See also: batteryChargeCurrent().