|
SensorLib 0.5.0
Multi-platform sensor driver library for Arduino, PlatformIO, and ESP-IDF
|
High-level driver facade for the X-Powers AXP517 PMIC. More...
#include <PmicAXP517.hpp>
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 PmicConfig & | getConfig () const override |
| Return static PMIC configuration metadata. | |
| AXP517Adc & | adc () |
| Access the AXP517 ADC driver. | |
| AXP517Irq & | irq () |
| Access the AXP517 IRQ driver. | |
| PmicPowerBase & | getPower () override |
| Access the generic PMIC power-path interface. | |
| PmicChargerBase * | getCharger () override |
| Access the generic PMIC charger interface. | |
| PmicAdcBase & | getAdc () override |
| Access the generic PMIC ADC interface. | |
| PmicGpioBase * | getGpio () override |
| Access the generic PMIC GPIO interface. | |
| PmicIrqBase * | getIrq () override |
| Access the generic PMIC IRQ interface. | |
| AXP517Charger & | charger () |
| Access the AXP517 charger driver. | |
| AXP517Bc12 & | bc12 () |
| Access the AXP517 BC1.2 driver. | |
| PmicLedBase & | getLed () override |
| Access the generic PMIC LED interface. | |
| AXP517Led & | led () |
| Access the AXP517 LED driver. | |
| AXP517Power & | power () |
| Access the AXP517 power-path driver. | |
| AXP517Gpio & | gpio () |
| Access the AXP517 GPIO driver. | |
| AXP517Bc12 & | bc12_2 () |
| Access the secondary BC1.2 driver alias. | |
| AXP517Tcpc & | tcpc () |
| Access the low-level AXP517 TCPC helper. | |
| AXP517Pd & | pdProtocol () |
| Access the low-level USB-PD protocol helper. | |
| AXP517PdNegotiator & | pd () |
| Access the USB-PD sink negotiator. | |
| AXP517PdNegotiator & | pdNegotiator () |
| 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. | |
| AXP517Core & | core () |
| 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 PmicChannelBase * | getChannel () |
| Get power output channel interface. | |
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.
| using PmicAXP517::Module = AXP517Core::Module |
Definition at line 65 of file PmicAXP517.hpp.
|
inline |
Construct an uninitialized AXP517 facade.
Definition at line 70 of file PmicAXP517.hpp.
|
inline |
Access the AXP517 ADC driver.
Definition at line 242 of file PmicAXP517.hpp.
|
inline |
Access the AXP517 BC1.2 driver.
Definition at line 290 of file PmicAXP517.hpp.
Referenced by loop(), readStatusSnapshot(), and setup().
|
inline |
Access the secondary BC1.2 driver alias.
Definition at line 320 of file PmicAXP517.hpp.
|
inlinevirtual |
Initialization using a custom communication interface.
| callback | Custom callback function for communication. |
| hal_cb | Optional custom HAL callback; may be nullptr. |
| addr | AXP517 I2C address. |
| true | on success, false on communication or device-ID failure. |
Implements PmicBase.
Definition at line 171 of file PmicAXP517.hpp.
References I2CDeviceWithHal::begin().
Referenced by setup().
|
inline |
Initialize using custom callbacks and configure the PD IRQ pin.
| callback | Custom communication callback. |
| hal_cb | Optional custom HAL callback; may be nullptr. |
| addr | AXP517 I2C address. |
| irqPin | Platform GPIO connected to PMIC_IRQ. |
| true | on success, false on communication, device-ID, or IRQ configuration failure. |
Definition at line 186 of file PmicAXP517.hpp.
References I2CDeviceWithHal::begin().
|
inline |
Access the AXP517 charger driver.
Definition at line 284 of file PmicAXP517.hpp.
Referenced by isVbusPresentNow(), readStatusSnapshot(), and setup().
|
inline |
Access the shared low-level AXP517 core.
Definition at line 412 of file PmicAXP517.hpp.
|
inline |
Enable or disable a functional module.
| module | Module to enable or disable. |
| enable | true to enable, false to disable. |
| true | on success, false on register access failure. |
Definition at line 393 of file PmicAXP517.hpp.
References AXP517Core::enableModule().
Referenced by setup().
|
inlinevirtual |
Deinitialize the driver.
Implements PmicBase.
Definition at line 199 of file PmicAXP517.hpp.
|
inlineoverridevirtual |
Access the generic PMIC ADC interface.
Implements PmicBase.
Definition at line 266 of file PmicAXP517.hpp.
|
inlineoverridevirtual |
Return the capabilities supported by this driver.
Implements PmicBase.
Definition at line 206 of file PmicAXP517.hpp.
References PmicCapability::PmicSupportAdc, PmicCapability::PmicSupportBc12, PmicCapability::PmicSupportCharger, PmicCapability::PmicSupportGpio, PmicCapability::PmicSupportIrq, PmicCapability::PmicSupportLed, PmicCapability::PmicSupportPower, and PmicCapability::PmicSupportTypeC.
|
inlineoverridevirtual |
Access the generic PMIC charger interface.
Reimplemented from PmicBase.
Definition at line 260 of file PmicAXP517.hpp.
|
inlineoverridevirtual |
Return the chip name string.
Implements PmicBase.
Definition at line 421 of file PmicAXP517.hpp.
|
inlineoverridevirtual |
Return static PMIC configuration metadata.
Implements PmicBase.
Definition at line 216 of file PmicAXP517.hpp.
References PmicConfig::chipName, PmicCapability::PmicSupportAdc, PmicCapability::PmicSupportBc12, PmicCapability::PmicSupportCharger, PmicCapability::PmicSupportGpio, PmicCapability::PmicSupportIrq, PmicCapability::PmicSupportLed, PmicCapability::PmicSupportPower, and PmicCapability::PmicSupportTypeC.
|
inlineoverridevirtual |
Access the generic PMIC GPIO interface.
Reimplemented from PmicBase.
Definition at line 272 of file PmicAXP517.hpp.
|
inlineoverridevirtual |
Access the generic PMIC IRQ interface.
Reimplemented from PmicBase.
Definition at line 278 of file PmicAXP517.hpp.
|
inlineoverridevirtual |
Access the generic PMIC LED interface.
Implements PmicBase.
Definition at line 296 of file PmicAXP517.hpp.
|
inlineoverridevirtual |
Access the generic PMIC power-path interface.
Implements PmicBase.
Definition at line 254 of file PmicAXP517.hpp.
|
inline |
Access the AXP517 GPIO driver.
Definition at line 314 of file PmicAXP517.hpp.
Referenced by configurePdIrqOutput().
|
inline |
Initialize the TCPC and PD sink receive path.
| irqPin | Platform GPIO connected to PMIC_IRQ. |
| true | on success, false on IRQ or TCPC initialization failure. |
Definition at line 364 of file PmicAXP517.hpp.
References AXP517PdNegotiator::initSink().
|
inline |
Access the AXP517 IRQ driver.
Definition at line 248 of file PmicAXP517.hpp.
Referenced by handleIrqOnce(), handlePmicIrq(), printPmicIrqLine(), requestPdVoltage(), resetPdState(), and setup().
|
inline |
Check if a module is enabled.
| module | Module to check. |
| true | if the module is enabled, false otherwise. |
Definition at line 404 of file PmicAXP517.hpp.
References AXP517Core::isModuleEnabled().
|
inline |
Access the AXP517 LED driver.
Definition at line 302 of file PmicAXP517.hpp.
|
inline |
Access the USB-PD sink negotiator.
Definition at line 338 of file PmicAXP517.hpp.
Referenced by resetPdState().
|
inline |
Access the USB-PD sink negotiator.
Definition at line 344 of file PmicAXP517.hpp.
|
inline |
Access the low-level USB-PD protocol helper.
Definition at line 332 of file PmicAXP517.hpp.
|
inline |
Access the AXP517 power-path driver.
Definition at line 308 of file PmicAXP517.hpp.
|
inline |
Request a fixed USB-PD voltage from the attached source.
| targetMv | Requested fixed PDO voltage in millivolts. |
| timeoutMs | Negotiation timeout in milliseconds. |
| outCaps | Optional destination for parsed source capabilities. |
| true | when 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().
|
inline |
Configure the IRQ pin required for USB-PD negotiation.
| irqPin | Platform GPIO connected to PMIC_IRQ. |
| true | on success, false when irqPin is invalid. |
Definition at line 354 of file PmicAXP517.hpp.
References AXP517PdNegotiator::setIrqPin().
|
inline |
Access the low-level AXP517 TCPC helper.
Definition at line 326 of file PmicAXP517.hpp.
Referenced by isTcpcDetachAlert(), isVbusPresentNow(), printVbus(), readStatusSnapshot(), and resetPdState().