Add some explanations about PMU and prevent null pointer judgment

This commit is contained in:
lewishe
2022-09-08 10:45:12 +08:00
parent 35c77ef99c
commit 7d0e16d1b6
3 changed files with 24 additions and 24 deletions

View File

@@ -391,6 +391,12 @@ bool Power::axpChipInit()
}
if (!PMU) {
/*
* In XPowersLib, if the XPowersAXPxxx object is released, Wire.end() will be called at the same time.
* In order not to affect other devices, if the initialization of the PMU fails, Wire needs to be re-initialized once,
* if there are multiple devices sharing the bus.
* * */
Wire.begin(I2C_SDA, I2C_SCL);
return false;
}
@@ -427,16 +433,6 @@ bool Power::axpChipInit()
//disable all axp chip interrupt
PMU->disableIRQ(XPOWERS_AXP192_ALL_IRQ);
/*
PMU->enableIRQ(XPOWERS_AXP192_VBUS_REMOVE_IRQ |
XPOWERS_AXP192_VBUS_INSERT_IRQ |
XPOWERS_AXP192_BAT_CHG_DONE_IRQ |
XPOWERS_AXP192_BAT_CHG_START_IRQ |
XPOWERS_AXP192_BAT_REMOVE_IRQ |
XPOWERS_AXP192_BAT_INSERT_IRQ |
XPOWERS_AXP192_PKEY_SHORT_IRQ
);
*/
if(config.power.charge_current == Config_PowerConfig_ChargeCurrent_MAUnset){
config.power.charge_current = Config_PowerConfig_ChargeCurrent_MA450;