Skip to content

Commit d399ee3

Browse files
committed
nicla-system: Increase safety charge time from 3 to 9 hours.
1 parent 14117b6 commit d399ee3

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

libraries/Nicla_System/src/Nicla_System.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,13 @@ bool nicla::enableCharging(uint16_t mA)
150150
// Also sets the input current limit to 350mA.
151151
_pmic.writeByte(BQ25120A_ADDRESS, BQ25120A_ILIM_UVLO_CTRL, 0x3F);
152152

153+
// Set safety timer to 9 hours (Bit 1+2 0b10) to give the battery enough of time to charge.
154+
// Set it to 0b11 to disable safety timers. See: Table 24 in the datasheet.
155+
uint8_t dpmTimerRegisterData = _pmic.readByte(BQ25120A_ADDRESS, BQ25120A_VIN_DPM);
156+
dpmTimerRegisterData |= 0b00000100; // Set Bit 2 to 1
157+
dpmTimerRegisterData &= 0b11111101; // Set Bit 1 to 0
158+
_pmic.writeByte(BQ25120A_ADDRESS, BQ25120A_VIN_DPM, dpmTimerRegisterData);
159+
153160
return _pmic.getFastChargeControlRegister() == _fastChargeRegisterData;
154161
}
155162

0 commit comments

Comments
 (0)