50 Serial.println(
"\n=== AXP517 Basic Example ===\n");
54 Serial.println(
"Failed to init AXP517!");
55 while (1) delay(1000);
57 Serial.println(
"AXP517 initialized");
65 Serial.println(
"Modules enabled");
67 Serial.println(
"\n--- Charger Test ---");
73 charger->setFastChargeCurrent(1000);
74 charger->setPreChargeCurrent(128);
75 charger->enableCharging(
true);
76 Serial.println(
"Charger configured");
78 Serial.print(charger->getChargeVoltage());
79 Serial.println(
" mV");
80 Serial.print(
"ICC: ");
81 Serial.print(charger->getFastChargeCurrent());
82 Serial.println(
" mA");
85 Serial.println(
"\n--- ADC Test ---");
103 Serial.println(
"\n=== Setup Complete ===\n");
108 static uint32_t lastPrint = 0;
110 if (millis() - lastPrint > 2000) {
111 lastPrint = millis();
113 Serial.println(
"\n--- Status ---");
119 Serial.print(
"Charger: ");
120 Serial.println(status.charging ?
"Charging" :
"Idle");
121 Serial.print(
"Vbus: ");
122 Serial.println(status.vbusPresent ?
"Present" :
"Absent");
129 Serial.print(
"VBUS: ");
131 Serial.println(
" mV");
134 Serial.print(
"VBAT: ");
136 Serial.println(
" mV");
139 Serial.print(
"IBAT: ");
141 Serial.println(
" mA");
144 Serial.print(
"TEMP: ");
146 Serial.println(
" C");
149 Serial.print(
"VSYS: ");
151 Serial.println(
" mV");
bool enableChannels(uint32_t mask) override
Enable one or more ADC channels.
bool setManualState(ManualState state) override
Set the LED manual state.
bool setMode(Mode mode) override
Set the LED mode.
High-level driver facade for the X-Powers AXP517 PMIC.
PmicChargerBase * getCharger() override
Access the generic PMIC charger interface.
AXP517Adc & adc()
Access the AXP517 ADC driver.
bool enableModule(Module module, bool enable)
Enable or disable a functional module.
AXP517Led & led()
Access the AXP517 LED driver.
bool begin(SensorCommCustom::CustomCallback callback, SensorCommCustomHal::CustomHalCallback hal_cb, uint8_t addr)
Initialization using a custom communication interface.
@ DIE_TEMPERATURE
Die temperature.
@ BAT_VOLTAGE
Battery voltage.
@ BAT_TEMPERATURE
Battery temperature.
@ BAT_CURRENT
Battery current.
@ VBUS_CURRENT
VBUS current.
@ VBUS_VOLTAGE
VBUS voltage.
@ VSYS_VOLTAGE
VSYS voltage.
virtual bool setChargeVoltage(uint16_t mV)=0
Set charge voltage (CV mode voltage)
virtual Status getStatus()=0
Get current charger status.
@ MANUAL
Manual control through registers.