SensorLib 0.5.0
Multi-platform sensor driver library for Arduino, PlatformIO, and ESP-IDF
Loading...
Searching...
No Matches
AXP1xxPower< Regs > Class Template Reference

#include <AXP1xxPower.hpp>

Inheritance diagram for AXP1xxPower< Regs >:
[legend]

Public Member Functions

 AXP1xxPower (SensorCommWrapper &core)
 Construct power management interface.
 
bool setMinimumSystemVoltage (uint32_t mv) override
 Set minimum system voltage.
 
uint32_t getMinimumSystemVoltage () const override
 Get minimum system voltage.
 
bool setInputVoltageLimit (uint32_t mv) override
 Set input voltage limit (not supported by AXP1xx).
 
uint32_t getInputVoltageLimit () const override
 Get input voltage limit (not supported by AXP1xx).
 
bool setInputCurrentLimit (uint32_t mA) override
 Set input current limit.
 
uint32_t getInputCurrentLimit () const override
 Get input current limit.
 
bool enableShipMode (bool enable) override
 Enable or disable ship mode.
 
bool isShipModeEnabled () const override
 Check if ship mode is enabled.
 
- Public Member Functions inherited from PmicPowerBase
virtual bool enableBoost (bool enable)
 Enable boost functionality.
 
virtual bool isBoostEnabled () const
 Check if boost functionality is enabled.
 
virtual bool setBoostVoltage (uint16_t mv)
 Set the boost voltage.
 
virtual uint16_t getBoostVoltage () const
 Get the boost voltage.
 
virtual ~PmicPowerBase ()=default
 Virtual destructor.
 

Detailed Description

template<typename Regs>
class AXP1xxPower< Regs >

Definition at line 46 of file AXP1xxPower.hpp.

Constructor & Destructor Documentation

◆ AXP1xxPower()

template<typename Regs >
AXP1xxPower< Regs >::AXP1xxPower ( SensorCommWrapper core)
inlineexplicit

Construct power management interface.

Parameters
coreReference to the I2C communication wrapper.

Definition at line 53 of file AXP1xxPower.hpp.

Member Function Documentation

◆ enableShipMode()

template<typename Regs >
bool AXP1xxPower< Regs >::enableShipMode ( bool  enable)
inlineoverridevirtual

Enable or disable ship mode.

Ship mode disconnects the battery from the system by setting OFF_CTL register bit 7. When enabled and no external power is present, the system is completely powered down.

Parameters
enabletrue to enter ship mode, false to exit.
Return values
trueMode was set successfully.
falseI2C communication failed.

Reimplemented from PmicPowerBase.

Definition at line 145 of file AXP1xxPower.hpp.

References SensorCommWrapper::clrRegBit(), and SensorCommWrapper::setRegBit().

◆ getInputCurrentLimit()

template<typename Regs >
uint32_t AXP1xxPower< Regs >::getInputCurrentLimit ( ) const
inlineoverridevirtual

Get input current limit.

Returns
Input current limit in milliamps (0, 100, 500, or 900), or 0 on error.

Implements PmicPowerBase.

Definition at line 127 of file AXP1xxPower.hpp.

References SensorCommWrapper::readReg().

◆ getInputVoltageLimit()

template<typename Regs >
uint32_t AXP1xxPower< Regs >::getInputVoltageLimit ( ) const
inlineoverridevirtual

Get input voltage limit (not supported by AXP1xx).

Returns
Always 0.

Implements PmicPowerBase.

Definition at line 100 of file AXP1xxPower.hpp.

◆ getMinimumSystemVoltage()

template<typename Regs >
uint32_t AXP1xxPower< Regs >::getMinimumSystemVoltage ( ) const
inlineoverridevirtual

Get minimum system voltage.

Returns
Minimum system voltage in millivolts, or 0 on error.

Implements PmicPowerBase.

Definition at line 78 of file AXP1xxPower.hpp.

References SensorCommWrapper::readReg().

◆ isShipModeEnabled()

template<typename Regs >
bool AXP1xxPower< Regs >::isShipModeEnabled ( ) const
inlineoverridevirtual

Check if ship mode is enabled.

Returns
true if ship mode is active, false otherwise.

Reimplemented from PmicPowerBase.

Definition at line 157 of file AXP1xxPower.hpp.

References SensorCommWrapper::getRegBit().

◆ setInputCurrentLimit()

template<typename Regs >
bool AXP1xxPower< Regs >::setInputCurrentLimit ( uint32_t  mA)
inlineoverridevirtual

Set input current limit.

Configures the maximum input current drawn from VBUS via the IPS_SET register (bits 1-0). Exact encoding differs between AXP192 and AXP202 and is provided by Regs::pmu::encodeInputCurrentLimit().

Parameters
mAInput current limit in milliamps. Request values are quantized to chip-supported levels.
Return values
trueCurrent limit was set successfully.
falseI2C communication failed.

Implements PmicPowerBase.

Definition at line 117 of file AXP1xxPower.hpp.

References SensorCommWrapper::updateBits().

◆ setInputVoltageLimit()

template<typename Regs >
bool AXP1xxPower< Regs >::setInputVoltageLimit ( uint32_t  mv)
inlineoverridevirtual

Set input voltage limit (not supported by AXP1xx).

Parameters
mvVoltage in millivolts (ignored).
Returns
Always false.

Implements PmicPowerBase.

Definition at line 90 of file AXP1xxPower.hpp.

◆ setMinimumSystemVoltage()

template<typename Regs >
bool AXP1xxPower< Regs >::setMinimumSystemVoltage ( uint32_t  mv)
inlineoverridevirtual

Set minimum system voltage.

Configures the minimum system voltage (VSYS) threshold via the VOFF_SET register. The value is clamped to the valid range and quantized to 100mV steps.

Parameters
mvDesired minimum system voltage in millivolts (2600-3300mV).
Return values
trueVoltage was set successfully.
falseI2C communication failed.

Implements PmicPowerBase.

Definition at line 66 of file AXP1xxPower.hpp.

References SensorCommWrapper::updateBits().


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