Hi there, many thanks in advance, i’m starting with Platformio. Please sorry my bad english.
I trying to see what AXP192 chip of my lilygo ttgo-tbeam t22_v1.0 (20190612) board not initialized.
I pasted this piece of code of github project ESP-32 Paxcounter of Cyberman54 ESP32-Paxcounter/src at master · cyberman54/ESP32-Paxcounter · GitHub
But fails in the line
if (pmu.begin(Wire, (AXP192_PRIMARY_ADDRESS)))
I have in platformio.ini:
build_flags = -DCORE_DEBUG_LEVEL=5
But no se any errors in debug terminal or console terminal
Any idea?
Thanks!
// Basic config
#include "Arduino.h"
#include "axp20x.h"
AXP20X_Class pmu;
void AXP192_power(bool on) {
if (on) {
pmu.setPowerOutPut(AXP192_LDO2, AXP202_ON); // Lora on T-Beam V1.0
pmu.setPowerOutPut(AXP192_LDO3, AXP202_ON); // Gps on T-Beam V1.0
pmu.setPowerOutPut(AXP192_DCDC1, AXP202_ON); // OLED on T-Beam v1.0
// pmu.setChgLEDMode(AXP20X_LED_LOW_LEVEL);
pmu.setChgLEDMode(AXP20X_LED_BLINK_1HZ);
} else {
pmu.setChgLEDMode(AXP20X_LED_OFF);
pmu.setPowerOutPut(AXP192_DCDC1, AXP202_OFF);
pmu.setPowerOutPut(AXP192_LDO3, AXP202_OFF);
pmu.setPowerOutPut(AXP192_LDO2, AXP202_OFF);
}
}
void AXP192_init() {
if (pmu.begin(Wire, (0x34))) {
Serial.println("AXP192 PMU initialization failed");
}
else {
Serial.println("Initialzation...");
// configure AXP192
pmu.setDCDC1Voltage(3500); // for external OLED display
pmu.setTimeOutShutdown(false); // no automatic shutdown
pmu.setTSmode(AXP_TS_PIN_MODE_DISABLE); // TS pin mode off to save power
// switch ADCs on
pmu.adc1Enable(AXP202_BATT_VOL_ADC1, true);
pmu.adc1Enable(AXP202_BATT_CUR_ADC1, true);
pmu.adc1Enable(AXP202_VBUS_VOL_ADC1, true);
pmu.adc1Enable(AXP202_VBUS_CUR_ADC1, true);
// switch power rails on
AXP192_power(true);
Serial.println("AXP192 PMU initialized");
}
}
void setup() {
Serial.begin(115200);
// put your setup code here, to run once:
AXP192_init();
AXP192_power(true);
}
void loop() {}