SensorLib 0.5.0
Multi-platform sensor driver library for Arduino, PlatformIO, and ESP-IDF
Loading...
Searching...
No Matches
PmicAXP192 Class Reference

AXP192 PMIC Unified Interface. More...

#include <PmicAXP192.hpp>

Inheritance diagram for PmicAXP192:
[legend]

Public Member Functions

 PmicAXP192 ()
 
bool begin (SensorCommCustom::CustomCallback callback, SensorCommCustomHal::CustomHalCallback hal_cb, uint8_t addr)
 Initialise the AXP192 with custom communication callbacks.
 
void end ()
 Deinitialize PMIC and release resources.
 
PmicCapability::Capability getCapabilities () const override
 Get supported capabilities bitmask.
 
const PmicConfiggetConfig () const override
 Get PMIC configuration structure.
 
PmicPowerBasegetPower () override
 Access the power management interface.
 
PmicChargerBasegetCharger () override
 Access the charger interface.
 
PmicAdcBasegetAdc () override
 Access the ADC interface.
 
PmicGpioBasegetGpio () override
 Get GPIO interface.
 
PmicLedBasegetLed () override
 Access the LED interface.
 
PmicChannelBasegetChannel () override
 Access the power channel control interface.
 
PmicIrqBasegetIrq () override
 Get interrupt interface.
 
const char * getChipName () const override
 Get the chip name string.
 
AXP1xxIrq< axp192_regs > & irq ()
 Access the IRQ subsystem.
 
AXP1xxCharger< axp192_regs > & charger ()
 Access the charger subsystem.
 
AXP1xxLed< axp192_regs > & led ()
 Access the LED module.
 
AXP192Gpiogpio ()
 Access the GPIO interface.
 
AXP1xxPwron< axp192_regs > & pwron ()
 Access the power-on control subsystem.
 
AXP1xxTimer< axp192_regs > & timer ()
 Access the countdown timer subsystem.
 
AXP192Adcadc ()
 Access the chip-specific ADC interface.
 
AXP192Corecore ()
 Access the core communication object.
 
uint16_t getStatus ()
 Read combined status registers (STATUS + MODE_CHGSTATUS)
 
bool isVbusGood ()
 Check if VBUS power is present and good.
 
bool isBatteryConnect ()
 Check if a battery is connected.
 
bool isCharging ()
 Check if the battery is currently charging.
 
uint8_t getChipID ()
 Read the AXP192 chip identification register.
 
void shutdown ()
 Shut down the AXP192 (soft power-off)
 
void reset ()
 Reset the AXP192.
 
- Public Member Functions inherited from PmicBase
virtual ~PmicBase ()=default
 Virtual destructor.
 

Detailed Description

AXP192 PMIC Unified Interface.

Top-level driver that composes all AXP192 functional blocks and exposes them through a consistent API. Supports begin() with Arduino Wire, ESP-IDF I2C legacy, ESP-IDF I2C new driver, or custom communication wrappers.

Note
Charger, power, IRQ, power-on, timer, and LED implementations are shared via the axp1xx template family parameterised on the axp192_regs register map.

Definition at line 92 of file PmicAXP192.hpp.

Constructor & Destructor Documentation

◆ PmicAXP192()

PmicAXP192::PmicAXP192 ( )
inline

Definition at line 95 of file PmicAXP192.hpp.

Member Function Documentation

◆ adc()

AXP192Adc & PmicAXP192::adc ( )
inline

Access the chip-specific ADC interface.

Returns
Reference to AXP192Adc instance

Definition at line 330 of file PmicAXP192.hpp.

Referenced by loop(), and setup().

◆ begin()

bool PmicAXP192::begin ( SensorCommCustom::CustomCallback  callback,
SensorCommCustomHal::CustomHalCallback  hal_cb,
uint8_t  addr 
)
inlinevirtual

Initialise the AXP192 with custom communication callbacks.

Parameters
callbackCustom I2C read/write callback
hal_cbCustom HAL callback
addrI2C slave address
Returns
true on success, false on failure

Implements PmicBase.

Definition at line 152 of file PmicAXP192.hpp.

References I2CDeviceWithHal::begin().

Referenced by setup().

◆ charger()

AXP1xxCharger< axp192_regs > & PmicAXP192::charger ( )
inline

Access the charger subsystem.

Returns
Reference to AXP1xxCharger instance

Definition at line 285 of file PmicAXP192.hpp.

◆ core()

AXP192Core & PmicAXP192::core ( )
inline

Access the core communication object.

Returns
Reference to AXP192Core instance

Definition at line 339 of file PmicAXP192.hpp.

◆ end()

void PmicAXP192::end ( )
inlinevirtual

Deinitialize PMIC and release resources.

Implements PmicBase.

Definition at line 159 of file PmicAXP192.hpp.

◆ getAdc()

PmicAdcBase & PmicAXP192::getAdc ( )
inlineoverridevirtual

Access the ADC interface.

Returns
Reference to AXP192Adc instance

Implements PmicBase.

Definition at line 230 of file PmicAXP192.hpp.

◆ getCapabilities()

PmicCapability::Capability PmicAXP192::getCapabilities ( ) const
inlineoverridevirtual

◆ getChannel()

PmicChannelBase * PmicAXP192::getChannel ( )
inlineoverridevirtual

Access the power channel control interface.

Returns
Pointer to AXP192Channel instance

Reimplemented from PmicBase.

Definition at line 253 of file PmicAXP192.hpp.

Referenced by setup().

◆ getCharger()

PmicChargerBase * PmicAXP192::getCharger ( )
inlineoverridevirtual

Access the charger interface.

Returns
Pointer to AXP1xxCharger instance

Reimplemented from PmicBase.

Definition at line 221 of file PmicAXP192.hpp.

Referenced by loop(), and setup().

◆ getChipID()

uint8_t PmicAXP192::getChipID ( )
inline

Read the AXP192 chip identification register.

Returns
Chip ID byte (expected 0x03), or 0 on read error

Definition at line 387 of file PmicAXP192.hpp.

References axp192_regs::bmu::IC_TYPE, and SensorCommWrapper::readReg().

◆ getChipName()

const char * PmicAXP192::getChipName ( ) const
inlineoverridevirtual

Get the chip name string.

Returns
Pointer to "AXP192"

Implements PmicBase.

Definition at line 267 of file PmicAXP192.hpp.

◆ getConfig()

const PmicConfig & PmicAXP192::getConfig ( ) const
inlineoverridevirtual

◆ getGpio()

PmicGpioBase * PmicAXP192::getGpio ( )
inlineoverridevirtual

Get GPIO interface.

Returns
Pointer to GPIO interface, nullptr if not supported
Note
GPIO support is optional across PMICs. Callers should check for nullptr before use and/or verify capability flags.

Reimplemented from PmicBase.

Definition at line 235 of file PmicAXP192.hpp.

◆ getIrq()

PmicIrqBase * PmicAXP192::getIrq ( )
inlineoverridevirtual

Get interrupt interface.

Returns
Pointer to interrupt interface, nullptr if not supported
Note
This accessor uses the "getXxx" style intentionally because IRQ support is optional across PMICs. Callers should check for nullptr before use (similar to getCharger()).
Chip-specific drivers may additionally expose irq() returning a concrete IRQ type (for chip-specific helper APIs). Use getIrq() when working through a PmicBase pointer/reference.

Reimplemented from PmicBase.

Definition at line 258 of file PmicAXP192.hpp.

◆ getLed()

PmicLedBase & PmicAXP192::getLed ( )
inlineoverridevirtual

Access the LED interface.

Returns
Reference to AXP1xxLed instance

Implements PmicBase.

Definition at line 244 of file PmicAXP192.hpp.

◆ getPower()

PmicPowerBase & PmicAXP192::getPower ( )
inlineoverridevirtual

Access the power management interface.

Returns
Reference to AXP1xxPower instance

Implements PmicBase.

Definition at line 212 of file PmicAXP192.hpp.

◆ getStatus()

uint16_t PmicAXP192::getStatus ( )
inline

Read combined status registers (STATUS + MODE_CHGSTATUS)

Returns
16-bit value: high byte = STATUS (0x00), low byte = MODE_CHGSTATUS (0x01)

Definition at line 348 of file PmicAXP192.hpp.

References axp192_regs::bmu::MODE_CHGSTATUS, SensorCommWrapper::readReg(), and axp192_regs::bmu::STATUS.

◆ gpio()

AXP192Gpio & PmicAXP192::gpio ( )
inline

Access the GPIO interface.

Returns
Reference to AXP192Gpio instance

Definition at line 303 of file PmicAXP192.hpp.

◆ irq()

AXP1xxIrq< axp192_regs > & PmicAXP192::irq ( )
inline

Access the IRQ subsystem.

Returns
Reference to AXP1xxIrq instance

Definition at line 276 of file PmicAXP192.hpp.

Referenced by loop(), and setup().

◆ isBatteryConnect()

bool PmicAXP192::isBatteryConnect ( )
inline

Check if a battery is connected.

Returns
true if battery is detected

Definition at line 369 of file PmicAXP192.hpp.

References SensorCommWrapper::getRegBit(), and axp192_regs::bmu::MODE_CHGSTATUS.

◆ isCharging()

bool PmicAXP192::isCharging ( )
inline

Check if the battery is currently charging.

Returns
true if charging, false otherwise

Definition at line 378 of file PmicAXP192.hpp.

References AXP1xxCharger< Regs >::isCharging().

◆ isVbusGood()

bool PmicAXP192::isVbusGood ( )
inline

Check if VBUS power is present and good.

Returns
true if VBUS is good

Definition at line 360 of file PmicAXP192.hpp.

References SensorCommWrapper::getRegBit(), and axp192_regs::bmu::STATUS.

◆ led()

AXP1xxLed< axp192_regs > & PmicAXP192::led ( )
inline

Access the LED module.

Returns
Reference to AXP1xxLed instance

Definition at line 294 of file PmicAXP192.hpp.

Referenced by setup().

◆ pwron()

AXP1xxPwron< axp192_regs > & PmicAXP192::pwron ( )
inline

Access the power-on control subsystem.

Returns
Reference to AXP1xxPwron instance

Definition at line 312 of file PmicAXP192.hpp.

◆ reset()

void PmicAXP192::reset ( )
inline

Reset the AXP192.

Triggers a system reset by setting the PEK reset bit in OFF_CTL.

Definition at line 410 of file PmicAXP192.hpp.

References axp192_regs::pmu::OFF_CTL, and SensorCommWrapper::setRegBit().

◆ shutdown()

void PmicAXP192::shutdown ( )
inline

Shut down the AXP192 (soft power-off)

Sets the OFF bit to put the PMIC into shutdown mode. The system will remain off until the power key is pressed or VBUS is reapplied.

Definition at line 400 of file PmicAXP192.hpp.

References axp192_regs::pmu::OFF_CTL, and SensorCommWrapper::setRegBit().

◆ timer()

AXP1xxTimer< axp192_regs > & PmicAXP192::timer ( )
inline

Access the countdown timer subsystem.

Returns
Reference to AXP1xxTimer instance

Definition at line 321 of file PmicAXP192.hpp.

Referenced by loop(), and setup().


The documentation for this class was generated from the following file: