|
SensorLib 0.5.0
Multi-platform sensor driver library for Arduino, PlatformIO, and ESP-IDF
|
Unified AXP202 PMIC driver. More...
#include <PmicAXP202.hpp>
Public Member Functions | |
| PmicAXP202 () | |
| Construct the AXP202 driver with all sub-modules. | |
| bool | begin (SensorCommCustom::CustomCallback callback, SensorCommCustomHal::CustomHalCallback hal_cb, uint8_t addr) |
| Initialise the PMIC using custom communication callbacks. | |
| void | end () |
| De-initialise the PMIC (no-op) | |
| PmicCapability::Capability | getCapabilities () const override |
| Get the PMIC capability flags. | |
| const PmicConfig & | getConfig () const override |
| Get the PMIC configuration descriptor. | |
| PmicPowerBase & | getPower () override |
| Access the power management interface. | |
| PmicChargerBase * | getCharger () override |
| Access the charger interface. | |
| PmicAdcBase & | getAdc () override |
| Access the ADC interface. | |
| PmicGpioBase * | getGpio () override |
| Get GPIO interface. | |
| PmicLedBase & | getLed () override |
| Access the LED control interface. | |
| PmicChannelBase * | getChannel () override |
| Access the power channel control interface. | |
| PmicIrqBase * | getIrq () override |
| Get interrupt interface. | |
| const char * | getChipName () const override |
| Get the chip name string. | |
| AXP1xxIrq< axp202_regs > & | irq () |
| Access the IRQ (interrupt) interface. | |
| AXP1xxTimer< axp202_regs > & | timer () |
| Access the countdown timer subsystem. | |
| AXP1xxCharger< axp202_regs > & | charger () |
| Access the charger interface (chip-specific) | |
| AXP202Gpio & | gpio () |
| Access the GPIO interface. | |
| AXP202Adc & | adc () |
| Access the ADC interface (chip-specific) | |
| AXP202Core & | core () |
| Access the core communication interface. | |
| AXP202PowerEx & | power () |
| Access AXP202-specific power extensions (DCDC mode, APS warning) | |
| AXP202ChargerEx & | chargerEx () |
| Access AXP202-specific charger extensions (thermal, backup, timeout) | |
| AXP202Coulomb & | coulomb () |
| Access coulomb counter for charge/discharge energy measurement. | |
| AXP1xxLed< axp202_regs > & | led () |
| AXP1xxPwron< axp202_regs > & | pwron () |
| Access the power-button timing/control interface. | |
| uint16_t | getStatus () |
| Read combined STATUS and MODE_CHGSTATUS registers. | |
| bool | isVbusGood () |
| Check if VBUS is present and valid. | |
| bool | isBatteryConnect () |
| Check if a battery is connected. | |
| bool | isCharging () |
| Check if the battery is currently charging. | |
| uint8_t | getChipID () |
| Read the AXP202 chip ID register. | |
| void | shutdown () |
| Power off the PMIC (shutdown) | |
| bool | enableSleep (bool en) |
| Enable or disable sleep mode. | |
Public Member Functions inherited from PmicBase | |
| virtual | ~PmicBase ()=default |
| Virtual destructor. | |
Unified AXP202 PMIC driver.
Wraps all AXP202 sub-modules and provides a single entry point for initialisation, status query, and system control (shutdown, sleep).
Definition at line 84 of file PmicAXP202.hpp.
|
inline |
Construct the AXP202 driver with all sub-modules.
Definition at line 90 of file PmicAXP202.hpp.
|
inline |
Access the ADC interface (chip-specific)
Definition at line 316 of file PmicAXP202.hpp.
|
inlinevirtual |
Initialise the PMIC using custom communication callbacks.
| callback | Custom I2C callback function |
| hal_cb | Custom HAL-level callback |
| addr | I2C slave address |
Implements PmicBase.
Definition at line 148 of file PmicAXP202.hpp.
References I2CDeviceWithHal::begin().
Referenced by setup().
|
inline |
Access the charger interface (chip-specific)
Definition at line 298 of file PmicAXP202.hpp.
|
inline |
Access AXP202-specific charger extensions (thermal, backup, timeout)
Definition at line 343 of file PmicAXP202.hpp.
|
inline |
Access the core communication interface.
Definition at line 325 of file PmicAXP202.hpp.
|
inline |
Access coulomb counter for charge/discharge energy measurement.
Definition at line 352 of file PmicAXP202.hpp.
|
inline |
Enable or disable sleep mode.
| en | true to enter sleep, false to wake |
Definition at line 444 of file PmicAXP202.hpp.
References SensorCommWrapper::clrRegBit(), SensorCommWrapper::setRegBit(), and axp202_regs::pmu::VOFF_SET.
|
inlinevirtual |
|
inlineoverridevirtual |
Access the ADC interface.
Implements PmicBase.
Definition at line 232 of file PmicAXP202.hpp.
|
inlineoverridevirtual |
Get the PMIC capability flags.
Implements PmicBase.
Definition at line 166 of file PmicAXP202.hpp.
References PmicCapability::PmicSupportAdc, PmicCapability::PmicSupportChannel, PmicCapability::PmicSupportCharger, PmicCapability::PmicSupportGpio, PmicCapability::PmicSupportIrq, PmicCapability::PmicSupportLed, PmicCapability::PmicSupportPower, and PmicCapability::PmicSupportPowerBtn.
|
inlineoverridevirtual |
Access the power channel control interface.
Reimplemented from PmicBase.
Definition at line 255 of file PmicAXP202.hpp.
Referenced by setup().
|
inlineoverridevirtual |
Access the charger interface.
Reimplemented from PmicBase.
Definition at line 223 of file PmicAXP202.hpp.
|
inline |
Read the AXP202 chip ID register.
Definition at line 416 of file PmicAXP202.hpp.
References axp202_regs::bmu::IC_TYPE, and SensorCommWrapper::readReg().
|
inlineoverridevirtual |
Get the chip name string.
Implements PmicBase.
Definition at line 269 of file PmicAXP202.hpp.
|
inlineoverridevirtual |
Get the PMIC configuration descriptor.
Implements PmicBase.
Definition at line 183 of file PmicAXP202.hpp.
References PmicConfig::chipName, PmicCapability::PmicSupportAdc, PmicCapability::PmicSupportChannel, PmicCapability::PmicSupportCharger, PmicCapability::PmicSupportGpio, PmicCapability::PmicSupportIrq, PmicCapability::PmicSupportLed, PmicCapability::PmicSupportPower, and PmicCapability::PmicSupportPowerBtn.
|
inlineoverridevirtual |
Get GPIO interface.
Reimplemented from PmicBase.
Definition at line 237 of file PmicAXP202.hpp.
|
inlineoverridevirtual |
Get interrupt interface.
Reimplemented from PmicBase.
Definition at line 260 of file PmicAXP202.hpp.
|
inlineoverridevirtual |
Access the LED control interface.
Implements PmicBase.
Definition at line 246 of file PmicAXP202.hpp.
|
inlineoverridevirtual |
Access the power management interface.
Implements PmicBase.
Definition at line 214 of file PmicAXP202.hpp.
|
inline |
Read combined STATUS and MODE_CHGSTATUS registers.
Definition at line 377 of file PmicAXP202.hpp.
References axp202_regs::bmu::MODE_CHGSTATUS, SensorCommWrapper::readReg(), and axp202_regs::bmu::STATUS.
|
inline |
Access the GPIO interface.
Definition at line 307 of file PmicAXP202.hpp.
|
inline |
Access the IRQ (interrupt) interface.
Definition at line 280 of file PmicAXP202.hpp.
|
inline |
Check if a battery is connected.
Definition at line 398 of file PmicAXP202.hpp.
References SensorCommWrapper::getRegBit(), and axp202_regs::bmu::MODE_CHGSTATUS.
|
inline |
Check if the battery is currently charging.
Definition at line 407 of file PmicAXP202.hpp.
References AXP1xxCharger< Regs >::isCharging().
|
inline |
Check if VBUS is present and valid.
Definition at line 389 of file PmicAXP202.hpp.
References SensorCommWrapper::getRegBit(), and axp202_regs::bmu::STATUS.
|
inline |
Definition at line 357 of file PmicAXP202.hpp.
Referenced by setup().
|
inline |
Access AXP202-specific power extensions (DCDC mode, APS warning)
Definition at line 334 of file PmicAXP202.hpp.
|
inline |
Access the power-button timing/control interface.
Definition at line 366 of file PmicAXP202.hpp.
|
inline |
Power off the PMIC (shutdown)
Sets the OFF_CTL register bit 7 to initiate a system power-down. The PMIC will remain off until the power key is pressed or VBUS is applied.
Definition at line 432 of file PmicAXP202.hpp.
References axp202_regs::pmu::OFF_CTL, and SensorCommWrapper::setRegBit().
|
inline |
Access the countdown timer subsystem.
Definition at line 289 of file PmicAXP202.hpp.