|
SensorLib 0.5.0
Multi-platform sensor driver library for Arduino, PlatformIO, and ESP-IDF
|
Top-level unified interface for the AXP2101 PMIC. More...
#include <PmicAXP2101.hpp>
Public Types | |
| using | Module = AXP2101Core::Module |
Public Member Functions | |
| PmicAXP2101 () | |
| Construct the AXP2101 PMIC interface, initialising all sub-modules. | |
| bool | begin (SensorCommCustom::CustomCallback callback, SensorCommCustomHal::CustomHalCallback hal_cb, uint8_t addr) |
| Initialise the AXP2101 with custom communication callbacks. | |
| void | end () |
| De-initialise the PMIC (no-op for AXP2101). | |
| PmicCapability::Capability | getCapabilities () const override |
| Get the supported PMIC capabilities bitmask. | |
| const PmicConfig & | getConfig () const override |
| Get the PMIC configuration descriptor. | |
| PmicPowerBase & | getPower () override |
| Get the power management interface. | |
| PmicChargerBase * | getCharger () override |
| Get the charger interface (pointer for optional support). | |
| PmicAdcBase & | getAdc () override |
| Get the ADC interface. | |
| PmicLedBase & | getLed () override |
| Get the LED interface. | |
| PmicChannelBase * | getChannel () override |
| Get the power output channel interface. | |
| PmicIrqBase * | getIrq () override |
| Get interrupt interface. | |
| const char * | getChipName () const override |
| Get the human-readable chip name. | |
| AXP2101Irq & | irq () |
| Get the chip-specific IRQ controller. | |
| AXP2101Charger & | charger () |
| Get the chip-specific charger interface. | |
| AXP2101Led & | led () |
| Get the chip-specific LED module. | |
| AXP2101Pwron & | pwron () |
| Get the chip-specific power button interface. | |
| AXP2101Watchdog & | watchdog () |
| Get the chip-specific watchdog interface. | |
| AXP2101Adc & | adc () |
| Get the chip-specific ADC interface. | |
| AXP2101Core & | core () |
| Get the core I2C communication interface. | |
| AXP2101Power & | power () |
| Get the chip-specific power management interface. | |
| bool | enableModule (Module module, bool enable) |
| Enable or disable an internal functional module. | |
| bool | isModuleEnabled (Module module) |
| Check whether an internal module is enabled. | |
| uint16_t | getStatus () |
| Read the combined STATUS1 and STATUS2 registers. | |
| bool | isVbusGood () |
| Check if a valid VBUS power source is present. | |
| bool | isBatteryConnect () |
| Check if a battery is connected. | |
| bool | isCharging () |
| Check if the battery is currently charging. | |
| uint8_t | getChipID () |
| Read the AXP2101 chip ID / version register. | |
| void | shutdown () |
| Soft power-off the PMIC. | |
| void | reset () |
| Reset (restart) the SoC system. | |
Public Member Functions inherited from PmicBase | |
| virtual | ~PmicBase ()=default |
| Virtual destructor. | |
| virtual PmicGpioBase * | getGpio () |
| Get GPIO interface. | |
Top-level unified interface for the AXP2101 PMIC.
Aggregates all AXP2101 sub-modules (ADC, IRQ, charger, LED, power, power button, watchdog, and power channels) into a single convenient class. Provides I2C initialisation across multiple platforms (Arduino, ESP-IDF, custom HAL) and exposes both the polymorphic base-class accessors and chip-specific module references.
Capabilities:
Definition at line 71 of file PmicAXP2101.hpp.
Definition at line 74 of file PmicAXP2101.hpp.
|
inline |
Construct the AXP2101 PMIC interface, initialising all sub-modules.
Definition at line 79 of file PmicAXP2101.hpp.
|
inline |
Get the chip-specific ADC interface.
Definition at line 301 of file PmicAXP2101.hpp.
|
inlinevirtual |
Initialise the AXP2101 with custom communication callbacks.
| callback | Custom I2C callback. |
| hal_cb | Custom HAL callback. |
| addr | I2C slave address. |
Implements PmicBase.
Definition at line 133 of file PmicAXP2101.hpp.
References I2CDeviceWithHal::begin().
Referenced by setup().
|
inline |
Get the chip-specific charger interface.
Definition at line 265 of file PmicAXP2101.hpp.
|
inline |
Get the core I2C communication interface.
Definition at line 310 of file PmicAXP2101.hpp.
|
inline |
Enable or disable an internal functional module.
Convenience wrapper for AXP2101Core::enableModule().
| module | Module identifier. |
| enable | true to enable, false to disable. |
Definition at line 335 of file PmicAXP2101.hpp.
References AXP2101Core::enableModule().
Referenced by setup().
|
inlinevirtual |
De-initialise the PMIC (no-op for AXP2101).
Implements PmicBase.
Definition at line 143 of file PmicAXP2101.hpp.
|
inlineoverridevirtual |
Get the ADC interface.
Implements PmicBase.
Definition at line 213 of file PmicAXP2101.hpp.
|
inlineoverridevirtual |
Get the supported PMIC capabilities bitmask.
Implements PmicBase.
Definition at line 151 of file PmicAXP2101.hpp.
References PmicCapability::PmicSupportAdc, PmicCapability::PmicSupportChannel, PmicCapability::PmicSupportCharger, PmicCapability::PmicSupportIrq, PmicCapability::PmicSupportLed, PmicCapability::PmicSupportPower, and PmicCapability::PmicSupportPowerBtn.
|
inlineoverridevirtual |
Get the power output channel interface.
Reimplemented from PmicBase.
Definition at line 231 of file PmicAXP2101.hpp.
Referenced by setup().
|
inlineoverridevirtual |
Get the charger interface (pointer for optional support).
Reimplemented from PmicBase.
Definition at line 204 of file PmicAXP2101.hpp.
|
inline |
Read the AXP2101 chip ID / version register.
Definition at line 399 of file PmicAXP2101.hpp.
References axp2101_regs::bmu::IC_TYPE, and SensorCommWrapper::readReg().
Referenced by setup().
|
inlineoverridevirtual |
Get the human-readable chip name.
Implements PmicBase.
Definition at line 245 of file PmicAXP2101.hpp.
|
inlineoverridevirtual |
Get the PMIC configuration descriptor.
Implements PmicBase.
Definition at line 166 of file PmicAXP2101.hpp.
References PmicConfig::chipName, PmicCapability::PmicSupportAdc, PmicCapability::PmicSupportChannel, PmicCapability::PmicSupportCharger, PmicCapability::PmicSupportIrq, PmicCapability::PmicSupportLed, PmicCapability::PmicSupportPower, and PmicCapability::PmicSupportPowerBtn.
|
inlineoverridevirtual |
Get interrupt interface.
Reimplemented from PmicBase.
Definition at line 236 of file PmicAXP2101.hpp.
|
inlineoverridevirtual |
Get the LED interface.
Implements PmicBase.
Definition at line 222 of file PmicAXP2101.hpp.
|
inlineoverridevirtual |
Get the power management interface.
Implements PmicBase.
Definition at line 195 of file PmicAXP2101.hpp.
|
inline |
Read the combined STATUS1 and STATUS2 registers.
Definition at line 360 of file PmicAXP2101.hpp.
References SensorCommWrapper::readReg(), axp2101_regs::bmu::STATUS1, and axp2101_regs::bmu::STATUS2.
|
inline |
Get the chip-specific IRQ controller.
Definition at line 256 of file PmicAXP2101.hpp.
|
inline |
Check if a battery is connected.
Definition at line 381 of file PmicAXP2101.hpp.
References SensorCommWrapper::getRegBit(), and axp2101_regs::bmu::STATUS1.
Referenced by loop().
|
inline |
Check if the battery is currently charging.
Definition at line 390 of file PmicAXP2101.hpp.
References AXP2101Charger::isCharging().
|
inline |
Check whether an internal module is enabled.
Convenience wrapper for AXP2101Core::isModuleEnabled().
| module | Module identifier. |
Definition at line 348 of file PmicAXP2101.hpp.
References AXP2101Core::isModuleEnabled().
|
inline |
Check if a valid VBUS power source is present.
Definition at line 372 of file PmicAXP2101.hpp.
References SensorCommWrapper::getRegBit(), and axp2101_regs::bmu::STATUS1.
Referenced by loop().
|
inline |
Get the chip-specific LED module.
Definition at line 274 of file PmicAXP2101.hpp.
Referenced by loop().
|
inline |
Get the chip-specific power management interface.
Definition at line 319 of file PmicAXP2101.hpp.
|
inline |
Get the chip-specific power button interface.
Definition at line 283 of file PmicAXP2101.hpp.
Referenced by setup().
|
inline |
Reset (restart) the SoC system.
Definition at line 417 of file PmicAXP2101.hpp.
References AXP2101Power::resetSoC().
|
inline |
Soft power-off the PMIC.
Definition at line 409 of file PmicAXP2101.hpp.
References AXP2101Power::softShutdown().
|
inline |
Get the chip-specific watchdog interface.
Definition at line 292 of file PmicAXP2101.hpp.