调试PMIC

This commit is contained in:
YuXifeng 2025-04-07 17:57:04 +08:00
parent 10c3520006
commit 504aeaae01
2 changed files with 7 additions and 2 deletions

View File

@ -401,7 +401,7 @@ uint32_t AXP20X_Class::getBattDischargeCoulomb(void)
return (buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + buffer[3]; return (buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + buffer[3];
} }
float AXP20X_Class::getCoulombData(void) float AXP20X_Class::getCoulombData(void)//返回充放了多少mah
{ {
if (!_init) if (!_init)
return AXP_NOT_INIT; return AXP_NOT_INIT;

View File

@ -248,6 +248,10 @@ extern "C" void Axp202_task(void *pvParameter)
axp_config(); axp_config();
axp.ClearCoulombcounter();
axp.EnableCoulombcounter();
axp.enableIRQ(AXP202_ALL_IRQ, true); axp.enableIRQ(AXP202_ALL_IRQ, true);
axp.clearIRQ(); axp.clearIRQ();
@ -258,7 +262,8 @@ extern "C" void Axp202_task(void *pvParameter)
if (io_num == AXP_ISR_GPIO) { if (io_num == AXP_ISR_GPIO) {
axp.readIRQ(); axp.readIRQ();
if (axp.isPEKLongtPressIRQ()) { if (axp.isPEKLongtPressIRQ()) {
ESP_LOGI(TAG, "AXP202 PEK key Click"); ESP_LOGI(TAG, "AXP202 PEK key Click:%.2f,%.2f,%.2f,%d",axp.getBattVoltage(),axp.getCoulombData(),axp.getBattDischargeCurrent(),axp.getBattPercentage());
// axp.shutdown();
} }
axp.clearIRQ(); axp.clearIRQ();
} }