|
SensorLib 0.5.0
Multi-platform sensor driver library for Arduino, PlatformIO, and ESP-IDF
|
AXP517 low-level core driver. More...
#include <AXP517Core.hpp>
Public Types | |
| enum class | Module : uint8_t { BC12 , TYPEC , GAUGE , WATCHDOG , GAUGE_LOW_POWER , BOOST , BUCK , CHGLED , CHARGE , MPPT } |
| Functional module switches exposed by AXP517. More... | |
Public Member Functions | |
| AXP517Core ()=default | |
| Construct an uninitialized AXP517 core object. | |
| ~AXP517Core ()=default | |
| bool | enableModule (Module module, bool enable) |
| Enable or disable a module. | |
| bool | isModuleEnabled (Module module) |
| Check if a module is enabled. | |
| uint32_t | millis () |
| Return the current platform millisecond counter. | |
| void | delayMs (uint32_t ms) |
| Delay using the active platform HAL. | |
| void | pinMode (uint8_t pin, uint8_t mode) |
| Configure a platform GPIO pin through the active HAL. | |
| uint8_t | digitalRead (uint8_t pin) |
| Read a platform GPIO pin through the active HAL. | |
Public Member Functions inherited from I2CDeviceWithHal | |
| bool | begin (SensorCommCustom::CustomCallback cb, SensorCommCustomHal::CustomHalCallback hal_cb, uint8_t addr) |
| Initialize the sensor using custom callback interface. | |
Public Member Functions inherited from DeviceBeginCommon | |
| virtual | ~DeviceBeginCommon () |
| uint8_t | getAddress () const |
| uint8_t | getInterface () const |
Public Member Functions inherited from SensorCommWrapper | |
| SensorCommWrapper ()=default | |
| int | readReg (uint8_t reg) const |
| int | readRegBuff (uint8_t reg, uint8_t *buf, size_t len) const |
| int | readBuff (uint8_t *buf, size_t len) const |
| int | writeReg (uint8_t reg, uint8_t val) |
| int | writeRegBuff (uint8_t reg, uint8_t *buf, size_t len) |
| int | writeBuff (uint8_t *buf, size_t len) |
| int | writeThenRead (const uint8_t *write_buffer, size_t write_len, uint8_t *read_buffer, size_t read_len) |
| bool | setRegBit (uint8_t reg, uint8_t bit) |
| bool | clrRegBit (uint8_t reg, uint8_t bit) |
| bool | getRegBit (uint8_t reg, uint8_t bit) |
| int | updateBits (uint8_t reg, uint8_t mask, uint8_t value_shifted) |
| void | setAddress (uint8_t address) |
| void | setAck (bool enable) |
Public Member Functions inherited from SensorCommInterface | |
| virtual | ~SensorCommInterface ()=default |
Additional Inherited Members | |
Protected Member Functions inherited from I2CDeviceWithHal | |
| bool | ensureValid () const override |
| Ensure the communication interface is valid. | |
Protected Member Functions inherited from DeviceBeginCommon | |
| DeviceBeginCommon ()=default | |
| virtual SensorCommBase * | getComm () const override |
| virtual void | beforeBegin () |
| virtual void | afterCommReady () |
| virtual void | afterInitSuccess (uint8_t param) |
| virtual void | onBeginFail () |
| bool | fail () |
| void | clearCommState () |
| template<typename CreateComm > | |
| bool | beginLifecycle (uint8_t addr, uint8_t iface, uint8_t initParam, CreateComm createComm) |
Protected Attributes inherited from DeviceBeginCommon | |
| std::unique_ptr< SensorCommBase > | comm |
| std::unique_ptr< SensorHal > | hal |
| std::unique_ptr< SensorCommStatic > | staticComm |
| uint8_t | _addr = 0 |
| uint8_t | _iface = COMM_CUSTOM |
AXP517 low-level core driver.
This class owns the shared I2C/HAL transport, performs chip and TCPC vendor identification during initialization, and exposes common module enable controls used by the feature-specific AXP517 drivers.
Definition at line 42 of file AXP517Core.hpp.
|
strong |
Functional module switches exposed by AXP517.
Definition at line 55 of file AXP517Core.hpp.
|
default |
Construct an uninitialized AXP517 core object.
|
default |
|
inline |
Delay using the active platform HAL.
| ms | Delay duration in milliseconds. |
Definition at line 104 of file AXP517Core.hpp.
References DeviceBeginCommon::hal.
Referenced by AXP517Tcpc::delayMs(), and AXP517Tcpc::init().
|
inline |
Read a platform GPIO pin through the active HAL.
| pin | Platform GPIO number. |
Definition at line 128 of file AXP517Core.hpp.
References DeviceBeginCommon::hal.
Referenced by AXP517Tcpc::digitalRead().
| bool AXP517Core::enableModule | ( | Module | module, |
| bool | enable | ||
| ) |
Enable or disable a module.
| module | The module to enable/disable. |
| enable | true to enable, false to disable. |
| true | on success, false on register access failure. |
Definition at line 44 of file AXP517Core.cpp.
References BC12, BOOST, BUCK, CHARGE, CHGLED, SensorCommWrapper::clrRegBit(), GAUGE, GAUGE_LOW_POWER, axp517_regs::bmu::MODULE_EN0, axp517_regs::ctrl::MODULE_EN1, MPPT, axp517_regs::ctrl::MPPT_CFG, SensorCommWrapper::setRegBit(), TYPEC, and WATCHDOG.
Referenced by PmicAXP517::enableModule(), and AXP517Tcpc::init().
| bool AXP517Core::isModuleEnabled | ( | Module | module | ) |
Check if a module is enabled.
| module | The module to check. |
| true | if the module is enabled, false otherwise. |
Definition at line 71 of file AXP517Core.cpp.
References BC12, BOOST, BUCK, CHARGE, CHGLED, GAUGE, GAUGE_LOW_POWER, SensorCommWrapper::getRegBit(), axp517_regs::bmu::MODULE_EN0, axp517_regs::ctrl::MODULE_EN1, MPPT, axp517_regs::ctrl::MPPT_CFG, SensorCommWrapper::readReg(), TYPEC, and WATCHDOG.
Referenced by PmicAXP517::isModuleEnabled().
|
inline |
Return the current platform millisecond counter.
Definition at line 95 of file AXP517Core.hpp.
References DeviceBeginCommon::hal.
Referenced by AXP517Tcpc::millis().
|
inline |
Configure a platform GPIO pin through the active HAL.
| pin | Platform GPIO number. |
| mode | Platform-specific pin mode value. |
Definition at line 116 of file AXP517Core.hpp.
References DeviceBeginCommon::hal.
Referenced by AXP517Tcpc::pinMode().