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

High-level driver facade for the X-Powers AXP517 PMIC. More...

#include <PmicAXP517.hpp>

Inheritance diagram for PmicAXP517:
[legend]

Public Types

using Module = AXP517Core::Module
 

Public Member Functions

 PmicAXP517 ()
 Construct an uninitialized AXP517 facade.
 
bool begin (SensorCommCustom::CustomCallback callback, SensorCommCustomHal::CustomHalCallback hal_cb, uint8_t addr)
 Initialization using a custom communication interface.
 
bool begin (SensorCommCustom::CustomCallback callback, SensorCommCustomHal::CustomHalCallback hal_cb, uint8_t addr, int irqPin)
 Initialize using custom callbacks and configure the PD IRQ pin.
 
void end ()
 Deinitialize the driver.
 
PmicCapability::Capability getCapabilities () const override
 Return the capabilities supported by this driver.
 
const PmicConfiggetConfig () const override
 Return static PMIC configuration metadata.
 
AXP517Adcadc ()
 Access the AXP517 ADC driver.
 
AXP517Irqirq ()
 Access the AXP517 IRQ driver.
 
PmicPowerBasegetPower () override
 Access the generic PMIC power-path interface.
 
PmicChargerBasegetCharger () override
 Access the generic PMIC charger interface.
 
PmicAdcBasegetAdc () override
 Access the generic PMIC ADC interface.
 
PmicGpioBasegetGpio () override
 Access the generic PMIC GPIO interface.
 
PmicIrqBasegetIrq () override
 Access the generic PMIC IRQ interface.
 
AXP517Chargercharger ()
 Access the AXP517 charger driver.
 
AXP517Bc12bc12 ()
 Access the AXP517 BC1.2 driver.
 
PmicLedBasegetLed () override
 Access the generic PMIC LED interface.
 
AXP517Ledled ()
 Access the AXP517 LED driver.
 
AXP517Powerpower ()
 Access the AXP517 power-path driver.
 
AXP517Gpiogpio ()
 Access the AXP517 GPIO driver.
 
AXP517Bc12bc12_2 ()
 Access the secondary BC1.2 driver alias.
 
AXP517Tcpctcpc ()
 Access the low-level AXP517 TCPC helper.
 
AXP517PdpdProtocol ()
 Access the low-level USB-PD protocol helper.
 
AXP517PdNegotiatorpd ()
 Access the USB-PD sink negotiator.
 
AXP517PdNegotiatorpdNegotiator ()
 Access the USB-PD sink negotiator.
 
bool setPdIrqPin (int irqPin)
 Configure the IRQ pin required for USB-PD negotiation.
 
bool initPdSink (int irqPin)
 Initialize the TCPC and PD sink receive path.
 
bool requestPd (uint16_t targetMv, uint32_t timeoutMs=6000, AXP517PdNegotiator::SourceCaps *outCaps=nullptr)
 Request a fixed USB-PD voltage from the attached source.
 
bool enableModule (Module module, bool enable)
 Enable or disable a functional module.
 
bool isModuleEnabled (Module module)
 Check if a module is enabled.
 
AXP517Corecore ()
 Access the shared low-level AXP517 core.
 
const char * getChipName () const override
 Return the chip name string.
 
- Public Member Functions inherited from PmicBase
virtual ~PmicBase ()=default
 Virtual destructor.
 
virtual PmicChannelBasegetChannel ()
 Get power output channel interface.
 

Detailed Description

High-level driver facade for the X-Powers AXP517 PMIC.

The facade owns the shared register transport and exposes charger, ADC, power-path, GPIO, IRQ, LED, BC1.2, Type-C, and USB-PD helpers through a single object.

Definition at line 62 of file PmicAXP517.hpp.

Member Typedef Documentation

◆ Module

Definition at line 65 of file PmicAXP517.hpp.

Constructor & Destructor Documentation

◆ PmicAXP517()

PmicAXP517::PmicAXP517 ( )
inline

Construct an uninitialized AXP517 facade.

Definition at line 70 of file PmicAXP517.hpp.

Member Function Documentation

◆ adc()

AXP517Adc & PmicAXP517::adc ( )
inline

Access the AXP517 ADC driver.

Definition at line 242 of file PmicAXP517.hpp.

Referenced by loop(), and setup().

◆ bc12()

AXP517Bc12 & PmicAXP517::bc12 ( )
inline

Access the AXP517 BC1.2 driver.

Definition at line 290 of file PmicAXP517.hpp.

Referenced by loop(), readStatusSnapshot(), and setup().

◆ bc12_2()

AXP517Bc12 & PmicAXP517::bc12_2 ( )
inline

Access the secondary BC1.2 driver alias.

Definition at line 320 of file PmicAXP517.hpp.

◆ begin() [1/2]

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

Initialization using a custom communication interface.

Parameters
callbackCustom callback function for communication.
hal_cbOptional custom HAL callback; may be nullptr.
addrAXP517 I2C address.
Return values
trueon success, false on communication or device-ID failure.

Implements PmicBase.

Definition at line 171 of file PmicAXP517.hpp.

References I2CDeviceWithHal::begin().

Referenced by setup().

◆ begin() [2/2]

bool PmicAXP517::begin ( SensorCommCustom::CustomCallback  callback,
SensorCommCustomHal::CustomHalCallback  hal_cb,
uint8_t  addr,
int  irqPin 
)
inline

Initialize using custom callbacks and configure the PD IRQ pin.

Parameters
callbackCustom communication callback.
hal_cbOptional custom HAL callback; may be nullptr.
addrAXP517 I2C address.
irqPinPlatform GPIO connected to PMIC_IRQ.
Return values
trueon success, false on communication, device-ID, or IRQ configuration failure.

Definition at line 186 of file PmicAXP517.hpp.

References I2CDeviceWithHal::begin().

◆ charger()

AXP517Charger & PmicAXP517::charger ( )
inline

Access the AXP517 charger driver.

Definition at line 284 of file PmicAXP517.hpp.

Referenced by isVbusPresentNow(), readStatusSnapshot(), and setup().

◆ core()

AXP517Core & PmicAXP517::core ( )
inline

Access the shared low-level AXP517 core.

Definition at line 412 of file PmicAXP517.hpp.

◆ enableModule()

bool PmicAXP517::enableModule ( Module  module,
bool  enable 
)
inline

Enable or disable a functional module.

Note
This is the master switch for boost, buck, charger, LED, BC1.2, TCPC, gauge, watchdog, and related PMIC modules.
Parameters
moduleModule to enable or disable.
enabletrue to enable, false to disable.
Return values
trueon success, false on register access failure.

Definition at line 393 of file PmicAXP517.hpp.

References AXP517Core::enableModule().

Referenced by setup().

◆ end()

void PmicAXP517::end ( )
inlinevirtual

Deinitialize the driver.

Note
This facade currently has no owned platform resources to release.

Implements PmicBase.

Definition at line 199 of file PmicAXP517.hpp.

◆ getAdc()

PmicAdcBase & PmicAXP517::getAdc ( )
inlineoverridevirtual

Access the generic PMIC ADC interface.

Implements PmicBase.

Definition at line 266 of file PmicAXP517.hpp.

◆ getCapabilities()

◆ getCharger()

PmicChargerBase * PmicAXP517::getCharger ( )
inlineoverridevirtual

Access the generic PMIC charger interface.

Reimplemented from PmicBase.

Definition at line 260 of file PmicAXP517.hpp.

Referenced by loop(), and setup().

◆ getChipName()

const char * PmicAXP517::getChipName ( ) const
inlineoverridevirtual

Return the chip name string.

Returns
Constant string "AXP517".

Implements PmicBase.

Definition at line 421 of file PmicAXP517.hpp.

◆ getConfig()

◆ getGpio()

PmicGpioBase * PmicAXP517::getGpio ( )
inlineoverridevirtual

Access the generic PMIC GPIO interface.

Reimplemented from PmicBase.

Definition at line 272 of file PmicAXP517.hpp.

◆ getIrq()

PmicIrqBase * PmicAXP517::getIrq ( )
inlineoverridevirtual

Access the generic PMIC IRQ interface.

Reimplemented from PmicBase.

Definition at line 278 of file PmicAXP517.hpp.

◆ getLed()

PmicLedBase & PmicAXP517::getLed ( )
inlineoverridevirtual

Access the generic PMIC LED interface.

Implements PmicBase.

Definition at line 296 of file PmicAXP517.hpp.

◆ getPower()

PmicPowerBase & PmicAXP517::getPower ( )
inlineoverridevirtual

Access the generic PMIC power-path interface.

Implements PmicBase.

Definition at line 254 of file PmicAXP517.hpp.

◆ gpio()

AXP517Gpio & PmicAXP517::gpio ( )
inline

Access the AXP517 GPIO driver.

Definition at line 314 of file PmicAXP517.hpp.

Referenced by configurePdIrqOutput().

◆ initPdSink()

bool PmicAXP517::initPdSink ( int  irqPin)
inline

Initialize the TCPC and PD sink receive path.

Parameters
irqPinPlatform GPIO connected to PMIC_IRQ.
Return values
trueon success, false on IRQ or TCPC initialization failure.

Definition at line 364 of file PmicAXP517.hpp.

References AXP517PdNegotiator::initSink().

◆ irq()

AXP517Irq & PmicAXP517::irq ( )
inline

Access the AXP517 IRQ driver.

Definition at line 248 of file PmicAXP517.hpp.

Referenced by handleIrqOnce(), handlePmicIrq(), printPmicIrqLine(), requestPdVoltage(), resetPdState(), and setup().

◆ isModuleEnabled()

bool PmicAXP517::isModuleEnabled ( Module  module)
inline

Check if a module is enabled.

Note
This function checks the status of a specific module.
Parameters
moduleModule to check.
Return values
trueif the module is enabled, false otherwise.

Definition at line 404 of file PmicAXP517.hpp.

References AXP517Core::isModuleEnabled().

◆ led()

AXP517Led & PmicAXP517::led ( )
inline

Access the AXP517 LED driver.

Definition at line 302 of file PmicAXP517.hpp.

Referenced by loop(), and setup().

◆ pd()

AXP517PdNegotiator & PmicAXP517::pd ( )
inline

Access the USB-PD sink negotiator.

Definition at line 338 of file PmicAXP517.hpp.

Referenced by resetPdState().

◆ pdNegotiator()

AXP517PdNegotiator & PmicAXP517::pdNegotiator ( )
inline

Access the USB-PD sink negotiator.

Definition at line 344 of file PmicAXP517.hpp.

◆ pdProtocol()

AXP517Pd & PmicAXP517::pdProtocol ( )
inline

Access the low-level USB-PD protocol helper.

Definition at line 332 of file PmicAXP517.hpp.

◆ power()

AXP517Power & PmicAXP517::power ( )
inline

Access the AXP517 power-path driver.

Definition at line 308 of file PmicAXP517.hpp.

Referenced by loop(), and setup().

◆ requestPd()

bool PmicAXP517::requestPd ( uint16_t  targetMv,
uint32_t  timeoutMs = 6000,
AXP517PdNegotiator::SourceCaps outCaps = nullptr 
)
inline

Request a fixed USB-PD voltage from the attached source.

Note
A valid PMIC_IRQ pin must be configured before this call can succeed.
Parameters
targetMvRequested fixed PDO voltage in millivolts.
timeoutMsNegotiation timeout in milliseconds.
outCapsOptional destination for parsed source capabilities.
Return values
truewhen the requested PD contract reaches PS_RDY.

Definition at line 377 of file PmicAXP517.hpp.

References AXP517PdNegotiator::negotiate(), and AXP517PdNegotiator::RequestParams::targetMv.

Referenced by requestPdVoltage(), and setup().

◆ setPdIrqPin()

bool PmicAXP517::setPdIrqPin ( int  irqPin)
inline

Configure the IRQ pin required for USB-PD negotiation.

Parameters
irqPinPlatform GPIO connected to PMIC_IRQ.
Return values
trueon success, false when irqPin is invalid.

Definition at line 354 of file PmicAXP517.hpp.

References AXP517PdNegotiator::setIrqPin().

◆ tcpc()

AXP517Tcpc & PmicAXP517::tcpc ( )
inline

Access the low-level AXP517 TCPC helper.

Definition at line 326 of file PmicAXP517.hpp.

Referenced by isTcpcDetachAlert(), isVbusPresentNow(), printVbus(), readStatusSnapshot(), and resetPdState().


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