File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
libraries/Nicla_System/src Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments