AXP192 charge current user settings

This commit is contained in:
Klaus K Wilting 2020-05-09 13:42:08 +02:00
parent 2a7c020e1b
commit b2254540c2
2 changed files with 8 additions and 6 deletions

View File

@ -31,7 +31,7 @@ Reset -> reset device
#define HAS_BUTTON GPIO_NUM_38 // middle on board button #define HAS_BUTTON GPIO_NUM_38 // middle on board button
#define HAS_PMU 1 // AXP192 power management chip #define HAS_PMU 1 // AXP192 power management chip
#define PMU_INT GPIO_NUM_35 // AXP192 interrupt #define PMU_INT GPIO_NUM_35 // AXP192 interrupt
#define PMU_CHGC AXP1XX_CHARGE_CUR_280MA // AXP102 battery charge current #define PMU_CHGC AXP1XX_CHARGE_CUR_1000MA // AXP102 battery charge current
// possible AXP192 battery charge current values (mA): // possible AXP192 battery charge current values (mA):
// 100/190/280/360/450/550/630/700/780/880/960/1000/1080/1160/1240/1320 // 100/190/280/360/450/550/630/700/780/880/960/1000/1080/1160/1240/1320
#define HAS_LED NOT_A_PIN #define HAS_LED NOT_A_PIN

View File

@ -124,11 +124,6 @@ void AXP192_init(void) {
pmu.setTimeOutShutdown(false); // no automatic shutdown pmu.setTimeOutShutdown(false); // no automatic shutdown
pmu.setTSmode(AXP_TS_PIN_MODE_DISABLE); // TS pin mode off to save power pmu.setTSmode(AXP_TS_PIN_MODE_DISABLE); // TS pin mode off to save power
// set charge current according to user setting if we have
#ifdef PMU_CHGC
pmu.setChargeControlCur(PMU_CHGC);
#endif
// switch ADCs on // switch ADCs on
pmu.adc1Enable(AXP202_BATT_VOL_ADC1, true); pmu.adc1Enable(AXP202_BATT_VOL_ADC1, true);
pmu.adc1Enable(AXP202_BATT_CUR_ADC1, true); pmu.adc1Enable(AXP202_BATT_CUR_ADC1, true);
@ -148,6 +143,13 @@ void AXP192_init(void) {
pmu.clearIRQ(); pmu.clearIRQ();
#endif // PMU_INT #endif // PMU_INT
// set charge current according to user setting if we have
#ifdef PMU_CHGC
pmu.setChargeControlCur(PMU_CHGC);
pmu.setChargingTargetVoltage(AXP202_TARGET_VOL_4_2V);
pmu.enableChargeing(true);
#endif
ESP_LOGI(TAG, "AXP192 PMU initialized"); ESP_LOGI(TAG, "AXP192 PMU initialized");
} }
} }