PMU small corrections
This commit is contained in:
parent
c3bad526a7
commit
1daaac6fc6
@ -18,8 +18,7 @@ void pover_event_IRQ(void) {
|
|||||||
if (pmu.isVbusOverVoltageIRQ())
|
if (pmu.isVbusOverVoltageIRQ())
|
||||||
ESP_LOGI(TAG, "USB voltage %.1fV too high.", pmu.getVbusVoltage());
|
ESP_LOGI(TAG, "USB voltage %.1fV too high.", pmu.getVbusVoltage());
|
||||||
if (pmu.isVbusPlugInIRQ())
|
if (pmu.isVbusPlugInIRQ())
|
||||||
ESP_LOGI(TAG, "USB plugged, %.0fmAh @ %.1fV", pmu.getVbusCurrent(),
|
ESP_LOGI(TAG, "USB plugged.");
|
||||||
pmu.getVbusVoltage());
|
|
||||||
if (pmu.isVbusRemoveIRQ())
|
if (pmu.isVbusRemoveIRQ())
|
||||||
ESP_LOGI(TAG, "USB unplugged.");
|
ESP_LOGI(TAG, "USB unplugged.");
|
||||||
|
|
||||||
@ -59,16 +58,16 @@ void pover_event_IRQ(void) {
|
|||||||
void AXP192_power(bool on) {
|
void AXP192_power(bool on) {
|
||||||
|
|
||||||
if (on) {
|
if (on) {
|
||||||
pmu.setPowerOutPut(AXP192_LDO2, AXP202_ON);
|
pmu.setPowerOutPut(AXP192_LDO2, AXP202_ON); // Lora on T-Beam V1.0
|
||||||
pmu.setPowerOutPut(AXP192_LDO3, AXP202_ON);
|
pmu.setPowerOutPut(AXP192_LDO3, AXP202_ON); // Gps on T-Beam V1.0
|
||||||
pmu.setPowerOutPut(AXP192_DCDC2, AXP202_ON);
|
|
||||||
pmu.setPowerOutPut(AXP192_EXTEN, AXP202_ON);
|
|
||||||
pmu.setPowerOutPut(AXP192_DCDC1, AXP202_ON);
|
pmu.setPowerOutPut(AXP192_DCDC1, AXP202_ON);
|
||||||
pmu.setChgLEDMode(AXP20X_LED_LOW_LEVEL);
|
pmu.setPowerOutPut(AXP192_DCDC3, AXP202_ON);
|
||||||
|
pmu.setPowerOutPut(AXP192_EXTEN, AXP202_ON);
|
||||||
|
pmu.setChgLEDMode(AXP20X_LED_BLINK_1HZ);
|
||||||
} else {
|
} else {
|
||||||
pmu.setPowerOutPut(AXP192_DCDC1, AXP202_OFF);
|
|
||||||
pmu.setPowerOutPut(AXP192_EXTEN, AXP202_OFF);
|
pmu.setPowerOutPut(AXP192_EXTEN, AXP202_OFF);
|
||||||
pmu.setPowerOutPut(AXP192_DCDC2, AXP202_OFF);
|
pmu.setPowerOutPut(AXP192_DCDC3, AXP202_OFF);
|
||||||
|
pmu.setPowerOutPut(AXP192_DCDC1, AXP202_OFF);
|
||||||
pmu.setPowerOutPut(AXP192_LDO3, AXP202_OFF);
|
pmu.setPowerOutPut(AXP192_LDO3, AXP202_OFF);
|
||||||
pmu.setPowerOutPut(AXP192_LDO2, AXP202_OFF);
|
pmu.setPowerOutPut(AXP192_LDO2, AXP202_OFF);
|
||||||
pmu.setChgLEDMode(AXP20X_LED_OFF);
|
pmu.setChgLEDMode(AXP20X_LED_OFF);
|
||||||
@ -78,16 +77,14 @@ void AXP192_power(bool on) {
|
|||||||
void AXP192_displaypower(void) {
|
void AXP192_displaypower(void) {
|
||||||
if (pmu.isBatteryConnect())
|
if (pmu.isBatteryConnect())
|
||||||
if (pmu.isChargeing())
|
if (pmu.isChargeing())
|
||||||
ESP_LOGI(TAG, "Battery charging %.0fmAh @ Temp %.1f°C",
|
ESP_LOGI(TAG, "Battery charging @ %.0fmAh", pmu.getBattChargeCurrent());
|
||||||
pmu.getBattChargeCurrent(), pmu.getTSTemp());
|
|
||||||
else
|
else
|
||||||
ESP_LOGI(TAG, "Battery not charging, Temp %.1f°C", pmu.getTSTemp());
|
ESP_LOGI(TAG, "Battery not charging");
|
||||||
else
|
else
|
||||||
ESP_LOGI(TAG, "No Battery");
|
ESP_LOGI(TAG, "No Battery");
|
||||||
|
|
||||||
if (pmu.isVBUSPlug())
|
if (pmu.isVBUSPlug())
|
||||||
ESP_LOGI(TAG, "USB present, %.0fmAh @ %.1fV", pmu.getVbusCurrent(),
|
ESP_LOGI(TAG, "USB present");
|
||||||
pmu.getVbusVoltage());
|
|
||||||
else
|
else
|
||||||
ESP_LOGI(TAG, "USB not present");
|
ESP_LOGI(TAG, "USB not present");
|
||||||
}
|
}
|
||||||
@ -102,10 +99,13 @@ void AXP192_init(void) {
|
|||||||
else {
|
else {
|
||||||
|
|
||||||
// switch power on
|
// switch power on
|
||||||
pmu.setDCDC1Voltage(3300);
|
pmu.setDCDC1Voltage(3300); // for external OLED display
|
||||||
pmu.adc1Enable(AXP202_BATT_CUR_ADC1, 1);
|
pmu.adc1Enable(AXP202_BATT_CUR_ADC1, 1);
|
||||||
AXP192_power(true);
|
AXP192_power(true);
|
||||||
|
|
||||||
|
// set TS pin mode off to save power
|
||||||
|
pmu.setTSmode(AXP_TS_PIN_MODE_DISABLE);
|
||||||
|
|
||||||
// I2C access of AXP202X library currently is not mutexable
|
// I2C access of AXP202X library currently is not mutexable
|
||||||
// so we better should disable AXP interrupts... ?
|
// so we better should disable AXP interrupts... ?
|
||||||
#ifdef PMU_INT
|
#ifdef PMU_INT
|
||||||
@ -117,7 +117,7 @@ void AXP192_init(void) {
|
|||||||
pmu.clearIRQ();
|
pmu.clearIRQ();
|
||||||
#endif // PMU_INT
|
#endif // PMU_INT
|
||||||
|
|
||||||
ESP_LOGI(TAG, "AXP192 PMU initialized, chip Temp %.1f°C", pmu.getTemp());
|
ESP_LOGI(TAG, "AXP192 PMU initialized, chip temp %.1f°C", pmu.getTemp());
|
||||||
AXP192_displaypower();
|
AXP192_displaypower();
|
||||||
}
|
}
|
||||||
I2C_MUTEX_UNLOCK(); // release i2c bus access
|
I2C_MUTEX_UNLOCK(); // release i2c bus access
|
||||||
|
Loading…
Reference in New Issue
Block a user