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

#include <AXP2101Power.hpp>

Inheritance diagram for AXP2101Power:
[legend]

Public Member Functions

 AXP2101Power (AXP2101Core &core)
 Construct an AXP2101Power instance.
 
 ~AXP2101Power ()=default
 
bool setMinimumSystemVoltage (uint32_t mv) override
 Set the minimum VSYS system voltage (REG 0x14 bits 6:4).
 
uint32_t getMinimumSystemVoltage () const override
 Get the minimum VSYS system voltage (REG 0x14 bits 6:4).
 
bool setInputVoltageLimit (uint32_t mv) override
 Set the VBUS input voltage limit (REG 0x15 bits 3:0).
 
uint32_t getInputVoltageLimit () const override
 Get the VBUS input voltage limit (REG 0x15 bits 3:0).
 
bool setInputCurrentLimit (uint32_t mA) override
 Set the VBUS input current limit (REG 0x16 bits 2:0).
 
uint32_t getInputCurrentLimit () const override
 Get the VBUS input current limit (REG 0x16 bits 2:0).
 
bool enableShipMode (bool enable) override
 Enable or disable ship mode (REG 0x12 bit 3).
 
bool isShipModeEnabled () const override
 Check whether ship mode is currently active (REG 0x12 bit 3).
 
bool setSysPowerDownVoltage (uint16_t millivolt)
 Set the VSYS power-off voltage threshold (REG 0x24 bits 2:0).
 
uint16_t getSysPowerDownVoltage ()
 Get the VSYS power-off voltage threshold (REG 0x24 bits 2:0).
 
void enableInternalDischarge ()
 Enable internal battery discharge resistor (REG 0x10 bit 5).
 
void disableInternalDischarge ()
 Disable internal battery discharge resistor (REG 0x10 bit 5).
 
void softShutdown ()
 Initiate a soft shutdown (REG 0x10 bit 0).
 
void resetSoC ()
 Trigger a system-on-chip reset (REG 0x10 bit 1).
 
bool enableSleep ()
 Enable sleep mode (REG 0x26 bit 0).
 
bool disableSleep ()
 Disable sleep mode (REG 0x26 bit 0).
 
bool enableWakeup ()
 Enable wakeup function (REG 0x26 bit 1).
 
bool disableWakeup ()
 Disable wakeup function (REG 0x26 bit 1).
 
void enablePwrOk ()
 Enable PWROK output (REG 0x25 bit 4).
 
void disablePwrOk ()
 Disable PWROK output (REG 0x25 bit 4).
 
void enablePowerOffDelay ()
 Enable power-off delay (REG 0x25 bit 3).
 
void disablePowerOffDelay ()
 Disable power-off delay (REG 0x25 bit 3).
 
void enablePowerSequence ()
 Enable power-on sequencing (REG 0x25 bit 2).
 
void disablePowerSequence ()
 Disable power-on sequencing (REG 0x25 bit 2).
 
bool setPwrOkDelay (uint8_t opt)
 Set the PWROK delay time (REG 0x25 bits 1:0).
 
uint8_t getPwrOkDelay ()
 Get the PWROK delay time (REG 0x25 bits 1:0).
 
void enableOverTempShutdown ()
 Enable automatic shutdown on over-temperature (REG 0x22 bit 2).
 
void disableOverTempShutdown ()
 Disable automatic shutdown on over-temperature (REG 0x22 bit 2).
 
void enableLongPressShutdown ()
 Enable long-press power-off (REG 0x22 bit 1).
 
void disableLongPressShutdown ()
 Disable long-press power-off (REG 0x22 bit 1).
 
void setLongPressAction (bool restart)
 Set the long-press power key action (REG 0x22 bit 0).
 
void setDCOverVoltageProtection (bool enable)
 Enable or disable DC over-voltage protection (REG 0x23 bit 5).
 
bool isDCOverVoltageProtectionEnabled ()
 Check if DC over-voltage protection is enabled (REG 0x23 bit 5).
 
void setDCLowVoltageProtection (uint8_t dc_id, bool enable)
 Enable or disable under-voltage protection for a DCDC (REG 0x23 bits 0-4).
 
bool isDCLowVoltageProtectionEnabled (uint8_t dc_id)
 Check if under-voltage protection is enabled for a DCDC (REG 0x23 bits 0-4).
 
uint8_t getPowerOnStatus ()
 Read the power-on source status register (REG 0x20, read-only).
 
uint8_t getPowerOffStatus ()
 Read the power-off source status register (REG 0x21, read-only).
 
bool writeGaugeData (uint8_t *data, uint8_t len)
 Write user data to the fuel-gauge backup registers.
 
bool compareGaugeData (uint8_t *data, uint8_t len)
 Compare data against the fuel-gauge backup registers.
 
void setLowBatWarnThreshold (uint8_t percentage)
 Set the low-battery warning threshold (REG 0x1A bits 7:4).
 
uint8_t getLowBatWarnThreshold ()
 Get the low-battery warning threshold (REG 0x1A bits 7:4).
 
void setLowBatShutdownThreshold (uint8_t percentage)
 Set the low-battery shutdown threshold (REG 0x1A bits 3:0).
 
uint8_t getLowBatShutdownThreshold ()
 Get the low-battery shutdown threshold (REG 0x1A bits 3:0).
 
bool enableDieTempDetection (bool enable)
 Enable or disable die temperature detection.
 
bool isDieTempDetectionEnabled ()
 Check if die temperature detection is enabled.
 
bool setDieTempLevel1Threshold (uint8_t opt)
 Set die over-temperature Level1 threshold (REG 13 bits 2:1).
 
uint8_t getDieTempLevel1Threshold ()
 Get die over-temperature Level1 threshold (REG 13 bits 2:1).
 
bool setDCDCForcePWM (uint8_t dc_id, bool force)
 Force a DCDC converter to always-PWM mode (REG 81 bits 2-5).
 
bool isDCDCForcePWM (uint8_t dc_id)
 Check if a DCDC converter is in forced-PWM mode (REG 81 bits 2-5).
 
bool setDCDCForceCCM (bool enable)
 Force all DCDC1-4 to CCM (continuous conduction mode) (REG 80 bit 6).
 
bool isDCDCForceCCM ()
 Check if all DCDC1-4 are in forced CCM mode (REG 80 bit 6).
 
bool setDVMRampSlow (bool slow)
 Set DVM voltage ramp rate (REG 80 bit 5).
 
bool isDVMRampSlow ()
 Check if DVM ramp is set to slow (REG 80 bit 5).
 
bool setFrequencySpreadEnable (bool enable)
 Enable DCDC frequency spread spectrum (REG 81 bit 7).
 
bool isFrequencySpreadEnabled ()
 Check if frequency spread spectrum is enabled (REG 81 bit 7).
 
bool setFrequencySpreadRange (bool wide)
 Set frequency spread range (REG 81 bit 6).
 
bool getFrequencySpreadRange ()
 Get the frequency spread range (REG 81 bit 6).
 
bool setDCDCUVPDebounce (uint8_t opt)
 Set DCDC UVP debounce time (REG 81 bits 1:0).
 
uint8_t getDCDCUVPDebounce ()
 Get DCDC UVP debounce time (REG 81 bits 1:0).
 
bool enableFastPowerOn (bool enable)
 Enable fast power-on sequence (REG 2B bit 7).
 
bool isFastPowerOnEnabled ()
 Check if fast power-on sequence is enabled (REG 2B bit 7).
 
bool enableFastWakeup (bool enable)
 Enable fast wakeup (REG 2B bit 6).
 
bool isFastWakeupEnabled ()
 Check if fast wakeup is enabled (REG 2B bit 6).
 
bool setFastPowerOnSequence (uint8_t channel, uint8_t seq)
 Set fast power-on start sequence for a channel (REG 28-2B).
 
uint8_t getFastPowerOnSequence (uint8_t channel)
 Get fast power-on start sequence for a channel (REG 28-2B).
 
- 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.
 

Static Public Attributes

static constexpr uint8_t DCDC1 = 0
 
static constexpr uint8_t DCDC2 = 1
 
static constexpr uint8_t DCDC3 = 2
 
static constexpr uint8_t DCDC4 = 3
 
static constexpr uint8_t DCDC5 = 4
 

Detailed Description

Definition at line 35 of file AXP2101Power.hpp.

Constructor & Destructor Documentation

◆ AXP2101Power()

AXP2101Power::AXP2101Power ( AXP2101Core core)
explicit

Construct an AXP2101Power instance.

Parameters
coreReference to the AXP2101Core bus driver.

Definition at line 39 of file AXP2101Power.cpp.

◆ ~AXP2101Power()

AXP2101Power::~AXP2101Power ( )
default

Member Function Documentation

◆ compareGaugeData()

bool AXP2101Power::compareGaugeData ( uint8_t *  data,
uint8_t  len 
)

Compare data against the fuel-gauge backup registers.

Parameters
dataPointer to the expected data buffer.
lenNumber of bytes to compare.
Returns
true if the stored data matches, false otherwise.

Definition at line 322 of file AXP2101Power.cpp.

References axp2101_regs::gauge::BAT_PARAMS, SensorCommWrapper::clrRegBit(), axp2101_regs::gauge::FUEL_GAUGE_CTRL, i, SensorCommWrapper::readReg(), axp2101_regs::ctrl::RESET_FUEL_GAUGE, and SensorCommWrapper::setRegBit().

Referenced by writeGaugeData().

◆ disableInternalDischarge()

void AXP2101Power::disableInternalDischarge ( )

Disable internal battery discharge resistor (REG 0x10 bit 5).

Definition at line 140 of file AXP2101Power.cpp.

References SensorCommWrapper::clrRegBit(), and axp2101_regs::ctrl::COMMON_CFG.

◆ disableLongPressShutdown()

void AXP2101Power::disableLongPressShutdown ( )

Disable long-press power-off (REG 0x22 bit 1).

Definition at line 245 of file AXP2101Power.cpp.

References SensorCommWrapper::clrRegBit(), and axp2101_regs::pmu::PWROFF_EN.

◆ disableOverTempShutdown()

void AXP2101Power::disableOverTempShutdown ( )

Disable automatic shutdown on over-temperature (REG 0x22 bit 2).

Definition at line 235 of file AXP2101Power.cpp.

References SensorCommWrapper::clrRegBit(), and axp2101_regs::pmu::PWROFF_EN.

◆ disablePowerOffDelay()

void AXP2101Power::disablePowerOffDelay ( )

Disable power-off delay (REG 0x25 bit 3).

Definition at line 196 of file AXP2101Power.cpp.

References SensorCommWrapper::clrRegBit(), and axp2101_regs::pmu::PWROK_SEQU_CTRL.

◆ disablePowerSequence()

void AXP2101Power::disablePowerSequence ( )

Disable power-on sequencing (REG 0x25 bit 2).

Definition at line 206 of file AXP2101Power.cpp.

References SensorCommWrapper::clrRegBit(), and axp2101_regs::pmu::PWROK_SEQU_CTRL.

◆ disablePwrOk()

void AXP2101Power::disablePwrOk ( )

Disable PWROK output (REG 0x25 bit 4).

Definition at line 186 of file AXP2101Power.cpp.

References SensorCommWrapper::clrRegBit(), and axp2101_regs::pmu::PWROK_SEQU_CTRL.

◆ disableSleep()

bool AXP2101Power::disableSleep ( )

Disable sleep mode (REG 0x26 bit 0).

Returns
true on success.

Definition at line 164 of file AXP2101Power.cpp.

References SensorCommWrapper::clrRegBit(), and axp2101_regs::pmu::SLEEP_WAKEUP_CTRL.

◆ disableWakeup()

bool AXP2101Power::disableWakeup ( )

Disable wakeup function (REG 0x26 bit 1).

Returns
true on success.

Definition at line 174 of file AXP2101Power.cpp.

References SensorCommWrapper::clrRegBit(), and axp2101_regs::pmu::SLEEP_WAKEUP_CTRL.

◆ enableDieTempDetection()

bool AXP2101Power::enableDieTempDetection ( bool  enable)

Enable or disable die temperature detection.

Parameters
enabletrue to enable (default), false to disable.
Returns
true on success.

Definition at line 377 of file AXP2101Power.cpp.

References SensorCommWrapper::clrRegBit(), axp2101_regs::ctrl::DIE_TEMP_CFG, and SensorCommWrapper::setRegBit().

◆ enableFastPowerOn()

bool AXP2101Power::enableFastPowerOn ( bool  enable)

Enable fast power-on sequence (REG 2B bit 7).

Parameters
enabletrue to enable, false to disable (default).
Returns
true on success.

Definition at line 480 of file AXP2101Power.cpp.

References SensorCommWrapper::clrRegBit(), axp2101_regs::pmu::FAST_PWRON_CTRL, and SensorCommWrapper::setRegBit().

◆ enableFastWakeup()

bool AXP2101Power::enableFastWakeup ( bool  enable)

Enable fast wakeup (REG 2B bit 6).

Parameters
enabletrue to enable, false to disable (default).
Returns
true on success.

Definition at line 491 of file AXP2101Power.cpp.

References SensorCommWrapper::clrRegBit(), axp2101_regs::pmu::FAST_PWRON_CTRL, and SensorCommWrapper::setRegBit().

◆ enableInternalDischarge()

void AXP2101Power::enableInternalDischarge ( )

Enable internal battery discharge resistor (REG 0x10 bit 5).

Definition at line 135 of file AXP2101Power.cpp.

References axp2101_regs::ctrl::COMMON_CFG, and SensorCommWrapper::setRegBit().

◆ enableLongPressShutdown()

void AXP2101Power::enableLongPressShutdown ( )

Enable long-press power-off (REG 0x22 bit 1).

Definition at line 240 of file AXP2101Power.cpp.

References axp2101_regs::pmu::PWROFF_EN, and SensorCommWrapper::setRegBit().

◆ enableOverTempShutdown()

void AXP2101Power::enableOverTempShutdown ( )

Enable automatic shutdown on over-temperature (REG 0x22 bit 2).

Definition at line 230 of file AXP2101Power.cpp.

References axp2101_regs::pmu::PWROFF_EN, and SensorCommWrapper::setRegBit().

◆ enablePowerOffDelay()

void AXP2101Power::enablePowerOffDelay ( )

Enable power-off delay (REG 0x25 bit 3).

Definition at line 191 of file AXP2101Power.cpp.

References axp2101_regs::pmu::PWROK_SEQU_CTRL, and SensorCommWrapper::setRegBit().

◆ enablePowerSequence()

void AXP2101Power::enablePowerSequence ( )

Enable power-on sequencing (REG 0x25 bit 2).

Definition at line 201 of file AXP2101Power.cpp.

References axp2101_regs::pmu::PWROK_SEQU_CTRL, and SensorCommWrapper::setRegBit().

◆ enablePwrOk()

void AXP2101Power::enablePwrOk ( )

Enable PWROK output (REG 0x25 bit 4).

Definition at line 181 of file AXP2101Power.cpp.

References axp2101_regs::pmu::PWROK_SEQU_CTRL, and SensorCommWrapper::setRegBit().

◆ enableShipMode()

bool AXP2101Power::enableShipMode ( bool  enable)
overridevirtual

Enable or disable ship mode (REG 0x12 bit 3).

When ship mode is enabled the BATFET is opened, disconnecting the battery from the system for ultra-low-power storage.

Parameters
enabletrue to enter ship mode (BATFET off), false for normal operation.
Returns
true on success.

Reimplemented from PmicPowerBase.

Definition at line 100 of file AXP2101Power.cpp.

References axp2101_regs::ctrl::BATFET_CTRL, SensorCommWrapper::clrRegBit(), and SensorCommWrapper::setRegBit().

◆ enableSleep()

bool AXP2101Power::enableSleep ( )

Enable sleep mode (REG 0x26 bit 0).

Returns
true on success.

Definition at line 159 of file AXP2101Power.cpp.

References SensorCommWrapper::setRegBit(), and axp2101_regs::pmu::SLEEP_WAKEUP_CTRL.

◆ enableWakeup()

bool AXP2101Power::enableWakeup ( )

Enable wakeup function (REG 0x26 bit 1).

Returns
true on success.

Definition at line 169 of file AXP2101Power.cpp.

References SensorCommWrapper::setRegBit(), and axp2101_regs::pmu::SLEEP_WAKEUP_CTRL.

◆ getDCDCUVPDebounce()

uint8_t AXP2101Power::getDCDCUVPDebounce ( )

Get DCDC UVP debounce time (REG 81 bits 1:0).

Returns
Debounce option (0=60us, 1=120us, 2=180us, 3=240us).

Definition at line 471 of file AXP2101Power.cpp.

References axp2101_regs::dcdc::FORCE_PWM_CTRL, and SensorCommWrapper::readReg().

◆ getDieTempLevel1Threshold()

uint8_t AXP2101Power::getDieTempLevel1Threshold ( )

Get die over-temperature Level1 threshold (REG 13 bits 2:1).

Returns
Threshold option (0=115°C, 1=125°C, 2=135°C).

Definition at line 398 of file AXP2101Power.cpp.

References axp2101_regs::ctrl::DIE_TEMP_CFG, and SensorCommWrapper::readReg().

◆ getFastPowerOnSequence()

uint8_t AXP2101Power::getFastPowerOnSequence ( uint8_t  channel)

Get fast power-on start sequence for a channel (REG 28-2B).

Parameters
channelChannel index (0-13 for DCDC1-DLDO2).
Returns
Sequence level (0-2 for start order, 3=disabled).

Definition at line 537 of file AXP2101Power.cpp.

References axp2101_regs::pmu::FAST_PWRON_CTRL, axp2101_regs::pmu::FAST_PWRON_SET0, axp2101_regs::pmu::FAST_PWRON_SET1, axp2101_regs::pmu::FAST_PWRON_SET2, and SensorCommWrapper::readReg().

◆ getFrequencySpreadRange()

bool AXP2101Power::getFrequencySpreadRange ( )

Get the frequency spread range (REG 81 bit 6).

Returns
true if wide (100kHz), false if narrow (50kHz).

Definition at line 460 of file AXP2101Power.cpp.

References axp2101_regs::dcdc::FORCE_PWM_CTRL, and SensorCommWrapper::getRegBit().

◆ getInputCurrentLimit()

uint32_t AXP2101Power::getInputCurrentLimit ( ) const
overridevirtual

Get the VBUS input current limit (REG 0x16 bits 2:0).

Returns
Current in milliamps.

Implements PmicPowerBase.

Definition at line 90 of file AXP2101Power.cpp.

References axp2101_regs::ctrl::INPUT_CURR_LIMIT, and SensorCommWrapper::readReg().

◆ getInputVoltageLimit()

uint32_t AXP2101Power::getInputVoltageLimit ( ) const
overridevirtual

Get the VBUS input voltage limit (REG 0x15 bits 3:0).

Returns
Voltage in millivolts (3880-5080).

Implements PmicPowerBase.

Definition at line 67 of file AXP2101Power.cpp.

References axp2101_regs::ctrl::INPUT_VOLT_LIMIT, and SensorCommWrapper::readReg().

◆ getLowBatShutdownThreshold()

uint8_t AXP2101Power::getLowBatShutdownThreshold ( )

Get the low-battery shutdown threshold (REG 0x1A bits 3:0).

Returns
Shutdown level percentage (0-15%).

Definition at line 368 of file AXP2101Power.cpp.

References axp2101_regs::ctrl::LOW_BAT_WARN_SET, and SensorCommWrapper::readReg().

◆ getLowBatWarnThreshold()

uint8_t AXP2101Power::getLowBatWarnThreshold ( )

Get the low-battery warning threshold (REG 0x1A bits 7:4).

Returns
Warning level percentage (5-20%).

Definition at line 351 of file AXP2101Power.cpp.

References axp2101_regs::ctrl::LOW_BAT_WARN_SET, and SensorCommWrapper::readReg().

◆ getMinimumSystemVoltage()

uint32_t AXP2101Power::getMinimumSystemVoltage ( ) const
overridevirtual

Get the minimum VSYS system voltage (REG 0x14 bits 6:4).

Returns
Voltage in millivolts (4100-4800).

Implements PmicPowerBase.

Definition at line 52 of file AXP2101Power.cpp.

References axp2101_regs::ctrl::MIN_SYS_VOLTAGE, and SensorCommWrapper::readReg().

◆ getPowerOffStatus()

uint8_t AXP2101Power::getPowerOffStatus ( )

Read the power-off source status register (REG 0x21, read-only).

Returns
Bitmask indicating the source that powered the device off.

Definition at line 299 of file AXP2101Power.cpp.

References axp2101_regs::pmu::PWROFF_STATUS, and SensorCommWrapper::readReg().

◆ getPowerOnStatus()

uint8_t AXP2101Power::getPowerOnStatus ( )

Read the power-on source status register (REG 0x20, read-only).

Returns
Bitmask indicating the source that powered the device on.

Definition at line 293 of file AXP2101Power.cpp.

References axp2101_regs::pmu::PWRON_STATUS, and SensorCommWrapper::readReg().

◆ getPwrOkDelay()

uint8_t AXP2101Power::getPwrOkDelay ( )

Get the PWROK delay time (REG 0x25 bits 1:0).

Returns
Delay option (0=8ms, 1=16ms, 2=32ms, 3=64ms).

Definition at line 221 of file AXP2101Power.cpp.

References axp2101_regs::pmu::PWROK_SEQU_CTRL, and SensorCommWrapper::readReg().

◆ getSysPowerDownVoltage()

uint16_t AXP2101Power::getSysPowerDownVoltage ( )

Get the VSYS power-off voltage threshold (REG 0x24 bits 2:0).

Returns
Threshold in millivolts (2600-3300).

Definition at line 126 of file AXP2101Power.cpp.

References SensorCommWrapper::readReg(), and axp2101_regs::pmu::VOFF_SET.

◆ isDCDCForceCCM()

bool AXP2101Power::isDCDCForceCCM ( )

Check if all DCDC1-4 are in forced CCM mode (REG 80 bit 6).

Returns
true if forced CCM is active.

Definition at line 427 of file AXP2101Power.cpp.

References SensorCommWrapper::getRegBit(), and axp2101_regs::dcdc::ONOFF_DVM_CTRL.

◆ isDCDCForcePWM()

bool AXP2101Power::isDCDCForcePWM ( uint8_t  dc_id)

Check if a DCDC converter is in forced-PWM mode (REG 81 bits 2-5).

Parameters
dc_idDCDC index (1-4 for DCDC1-DCDC4). DCDC5 has no PWM control.
Returns
true if forced-PWM is active, false for auto PWM/PFM.

Definition at line 415 of file AXP2101Power.cpp.

References axp2101_regs::dcdc::FORCE_PWM_CTRL, and SensorCommWrapper::getRegBit().

◆ isDCLowVoltageProtectionEnabled()

bool AXP2101Power::isDCLowVoltageProtectionEnabled ( uint8_t  dc_id)

Check if under-voltage protection is enabled for a DCDC (REG 0x23 bits 0-4).

Parameters
dc_idDCDC index (0-4 for DCDC1-DCDC5).
Returns
true if enabled.

Definition at line 285 of file AXP2101Power.cpp.

References axp2101_regs::pmu::DC_OVP_UVP_CTRL, and SensorCommWrapper::getRegBit().

◆ isDCOverVoltageProtectionEnabled()

bool AXP2101Power::isDCOverVoltageProtectionEnabled ( )

Check if DC over-voltage protection is enabled (REG 0x23 bit 5).

Returns
true if enabled.

Definition at line 270 of file AXP2101Power.cpp.

References axp2101_regs::pmu::DC_OVP_UVP_CTRL, and SensorCommWrapper::getRegBit().

◆ isDieTempDetectionEnabled()

bool AXP2101Power::isDieTempDetectionEnabled ( )

Check if die temperature detection is enabled.

Returns
true if enabled.

Definition at line 383 of file AXP2101Power.cpp.

References axp2101_regs::ctrl::DIE_TEMP_CFG, and SensorCommWrapper::getRegBit().

◆ isDVMRampSlow()

bool AXP2101Power::isDVMRampSlow ( )

Check if DVM ramp is set to slow (REG 80 bit 5).

Returns
true if slow ramp is active.

Definition at line 438 of file AXP2101Power.cpp.

References SensorCommWrapper::getRegBit(), and axp2101_regs::dcdc::ONOFF_DVM_CTRL.

◆ isFastPowerOnEnabled()

bool AXP2101Power::isFastPowerOnEnabled ( )

Check if fast power-on sequence is enabled (REG 2B bit 7).

Returns
true if enabled.

Definition at line 486 of file AXP2101Power.cpp.

References axp2101_regs::pmu::FAST_PWRON_CTRL, and SensorCommWrapper::getRegBit().

◆ isFastWakeupEnabled()

bool AXP2101Power::isFastWakeupEnabled ( )

Check if fast wakeup is enabled (REG 2B bit 6).

Returns
true if enabled.

Definition at line 497 of file AXP2101Power.cpp.

References axp2101_regs::pmu::FAST_PWRON_CTRL, and SensorCommWrapper::getRegBit().

◆ isFrequencySpreadEnabled()

bool AXP2101Power::isFrequencySpreadEnabled ( )

Check if frequency spread spectrum is enabled (REG 81 bit 7).

Returns
true if enabled.

Definition at line 449 of file AXP2101Power.cpp.

References axp2101_regs::dcdc::FORCE_PWM_CTRL, and SensorCommWrapper::getRegBit().

◆ isShipModeEnabled()

bool AXP2101Power::isShipModeEnabled ( ) const
overridevirtual

Check whether ship mode is currently active (REG 0x12 bit 3).

Returns
true if ship mode is enabled (BATFET off).

Reimplemented from PmicPowerBase.

Definition at line 108 of file AXP2101Power.cpp.

References axp2101_regs::ctrl::BATFET_CTRL, and SensorCommWrapper::getRegBit().

◆ resetSoC()

void AXP2101Power::resetSoC ( )

Trigger a system-on-chip reset (REG 0x10 bit 1).

Definition at line 152 of file AXP2101Power.cpp.

References axp2101_regs::ctrl::COMMON_CFG, and SensorCommWrapper::setRegBit().

Referenced by PmicAXP2101::reset().

◆ setDCDCForceCCM()

bool AXP2101Power::setDCDCForceCCM ( bool  enable)

Force all DCDC1-4 to CCM (continuous conduction mode) (REG 80 bit 6).

Parameters
enabletrue to force CCM, false for auto.
Returns
true on success.

Definition at line 421 of file AXP2101Power.cpp.

References SensorCommWrapper::clrRegBit(), axp2101_regs::dcdc::ONOFF_DVM_CTRL, and SensorCommWrapper::setRegBit().

◆ setDCDCForcePWM()

bool AXP2101Power::setDCDCForcePWM ( uint8_t  dc_id,
bool  force 
)

Force a DCDC converter to always-PWM mode (REG 81 bits 2-5).

Parameters
dc_idDCDC index (1-4 for DCDC1-DCDC4). DCDC5 has no PWM control.
forcetrue for always-PWM, false for auto PWM/PFM.
Returns
true on success. Returns false if dc_id is 0 or >4.

Definition at line 407 of file AXP2101Power.cpp.

References SensorCommWrapper::clrRegBit(), axp2101_regs::dcdc::FORCE_PWM_CTRL, and SensorCommWrapper::setRegBit().

◆ setDCDCUVPDebounce()

bool AXP2101Power::setDCDCUVPDebounce ( uint8_t  opt)

Set DCDC UVP debounce time (REG 81 bits 1:0).

Parameters
opt0=60us, 1=120us, 2=180us, 3=240us.
Returns
true on success.

Definition at line 465 of file AXP2101Power.cpp.

References axp2101_regs::dcdc::FORCE_PWM_CTRL, and SensorCommWrapper::updateBits().

◆ setDCLowVoltageProtection()

void AXP2101Power::setDCLowVoltageProtection ( uint8_t  dc_id,
bool  enable 
)

Enable or disable under-voltage protection for a DCDC (REG 0x23 bits 0-4).

Parameters
dc_idDCDC index (0-4 for DCDC1-DCDC5).
enabletrue to enable, false to disable.

Definition at line 275 of file AXP2101Power.cpp.

References SensorCommWrapper::clrRegBit(), axp2101_regs::pmu::DC_OVP_UVP_CTRL, and SensorCommWrapper::setRegBit().

◆ setDCOverVoltageProtection()

void AXP2101Power::setDCOverVoltageProtection ( bool  enable)

Enable or disable DC over-voltage protection (REG 0x23 bit 5).

Parameters
enabletrue to enable, false to disable.

Definition at line 261 of file AXP2101Power.cpp.

References SensorCommWrapper::clrRegBit(), axp2101_regs::pmu::DC_OVP_UVP_CTRL, and SensorCommWrapper::setRegBit().

◆ setDieTempLevel1Threshold()

bool AXP2101Power::setDieTempLevel1Threshold ( uint8_t  opt)

Set die over-temperature Level1 threshold (REG 13 bits 2:1).

Parameters
opt0=115°C, 1=125°C (default), 2=135°C. 3=reserved.
Returns
true on success.

Definition at line 388 of file AXP2101Power.cpp.

References axp2101_regs::ctrl::DIE_TEMP_CFG, SensorCommWrapper::readReg(), and SensorCommWrapper::writeReg().

◆ setDVMRampSlow()

bool AXP2101Power::setDVMRampSlow ( bool  slow)

Set DVM voltage ramp rate (REG 80 bit 5).

Parameters
slowtrue for 31.250us/step, false for 15.625us/step (default).
Returns
true on success.

Definition at line 432 of file AXP2101Power.cpp.

References SensorCommWrapper::clrRegBit(), axp2101_regs::dcdc::ONOFF_DVM_CTRL, and SensorCommWrapper::setRegBit().

◆ setFastPowerOnSequence()

bool AXP2101Power::setFastPowerOnSequence ( uint8_t  channel,
uint8_t  seq 
)

Set fast power-on start sequence for a channel (REG 28-2B).

Parameters
channelChannel index (0-13 for DCDC1-DLDO2). Use AXP2101Channel::CH_xxx constants.
seqSequence level (0-2 for start order, 3=disable).
Returns
true on success.

Definition at line 502 of file AXP2101Power.cpp.

References axp2101_regs::pmu::FAST_PWRON_CTRL, axp2101_regs::pmu::FAST_PWRON_SET0, axp2101_regs::pmu::FAST_PWRON_SET1, axp2101_regs::pmu::FAST_PWRON_SET2, and SensorCommWrapper::updateBits().

◆ setFrequencySpreadEnable()

bool AXP2101Power::setFrequencySpreadEnable ( bool  enable)

Enable DCDC frequency spread spectrum (REG 81 bit 7).

Parameters
enabletrue to enable, false to disable (default).
Returns
true on success.

Definition at line 443 of file AXP2101Power.cpp.

References SensorCommWrapper::clrRegBit(), axp2101_regs::dcdc::FORCE_PWM_CTRL, and SensorCommWrapper::setRegBit().

◆ setFrequencySpreadRange()

bool AXP2101Power::setFrequencySpreadRange ( bool  wide)

Set frequency spread range (REG 81 bit 6).

Parameters
widetrue for 100kHz, false for 50kHz (default).
Returns
true on success.

Definition at line 454 of file AXP2101Power.cpp.

References SensorCommWrapper::clrRegBit(), axp2101_regs::dcdc::FORCE_PWM_CTRL, and SensorCommWrapper::setRegBit().

◆ setInputCurrentLimit()

bool AXP2101Power::setInputCurrentLimit ( uint32_t  mA)
overridevirtual

Set the VBUS input current limit (REG 0x16 bits 2:0).

Parameters
mACurrent in milliamps. Valid values: 100, 500, 900, 1000, 1500, 2000.
Returns
true on success.

Implements PmicPowerBase.

Definition at line 74 of file AXP2101Power.cpp.

References i, axp2101_regs::ctrl::INPUT_CURR_LIMIT, and SensorCommWrapper::updateBits().

◆ setInputVoltageLimit()

bool AXP2101Power::setInputVoltageLimit ( uint32_t  mv)
overridevirtual

Set the VBUS input voltage limit (REG 0x15 bits 3:0).

Parameters
mvVoltage in millivolts (3880-5080, 80mV steps).
Returns
true on success.

Implements PmicPowerBase.

Definition at line 59 of file AXP2101Power.cpp.

References axp2101_regs::ctrl::INPUT_VOLT_LIMIT, and SensorCommWrapper::updateBits().

◆ setLongPressAction()

void AXP2101Power::setLongPressAction ( bool  restart)

Set the long-press power key action (REG 0x22 bit 0).

Parameters
restarttrue for restart on long press, false for shutdown.

Definition at line 250 of file AXP2101Power.cpp.

References SensorCommWrapper::clrRegBit(), axp2101_regs::pmu::PWROFF_EN, and SensorCommWrapper::setRegBit().

◆ setLowBatShutdownThreshold()

void AXP2101Power::setLowBatShutdownThreshold ( uint8_t  percentage)

Set the low-battery shutdown threshold (REG 0x1A bits 3:0).

Parameters
percentageShutdown level (0-15%).

Definition at line 358 of file AXP2101Power.cpp.

References axp2101_regs::ctrl::LOW_BAT_WARN_SET, SensorCommWrapper::readReg(), and SensorCommWrapper::writeReg().

◆ setLowBatWarnThreshold()

void AXP2101Power::setLowBatWarnThreshold ( uint8_t  percentage)

Set the low-battery warning threshold (REG 0x1A bits 7:4).

Parameters
percentageWarning level (5-20%).

Definition at line 341 of file AXP2101Power.cpp.

References axp2101_regs::ctrl::LOW_BAT_WARN_SET, SensorCommWrapper::readReg(), and SensorCommWrapper::writeReg().

◆ setMinimumSystemVoltage()

bool AXP2101Power::setMinimumSystemVoltage ( uint32_t  mv)
overridevirtual

Set the minimum VSYS system voltage (REG 0x14 bits 6:4).

Parameters
mvVoltage in millivolts (4100-4800, 100mV steps).
Returns
true on success.

Implements PmicPowerBase.

Definition at line 45 of file AXP2101Power.cpp.

References axp2101_regs::ctrl::MIN_SYS_VOLTAGE, and SensorCommWrapper::updateBits().

◆ setPwrOkDelay()

bool AXP2101Power::setPwrOkDelay ( uint8_t  opt)

Set the PWROK delay time (REG 0x25 bits 1:0).

Parameters
opt0=8ms, 1=16ms, 2=32ms, 3=64ms.
Returns
true on success, false if opt is out of range.

Definition at line 211 of file AXP2101Power.cpp.

References axp2101_regs::pmu::PWROK_SEQU_CTRL, SensorCommWrapper::readReg(), and SensorCommWrapper::writeReg().

◆ setSysPowerDownVoltage()

bool AXP2101Power::setSysPowerDownVoltage ( uint16_t  millivolt)

Set the VSYS power-off voltage threshold (REG 0x24 bits 2:0).

Parameters
millivoltThreshold in millivolts (2600-3300, 100mV steps).
Returns
true on success, false if millivolt is out of range.

Definition at line 115 of file AXP2101Power.cpp.

References SensorCommWrapper::readReg(), axp2101_regs::pmu::VOFF_SET, and SensorCommWrapper::writeReg().

◆ softShutdown()

void AXP2101Power::softShutdown ( )

Initiate a soft shutdown (REG 0x10 bit 0).

Definition at line 147 of file AXP2101Power.cpp.

References axp2101_regs::ctrl::COMMON_CFG, and SensorCommWrapper::setRegBit().

Referenced by PmicAXP2101::shutdown().

◆ writeGaugeData()

bool AXP2101Power::writeGaugeData ( uint8_t *  data,
uint8_t  len 
)

Write user data to the fuel-gauge backup registers.

Parameters
dataPointer to the data buffer to write.
lenNumber of bytes to write.
Returns
true on success.

Definition at line 307 of file AXP2101Power.cpp.

References axp2101_regs::gauge::BAT_PARAMS, SensorCommWrapper::clrRegBit(), compareGaugeData(), axp2101_regs::gauge::FUEL_GAUGE_CTRL, i, axp2101_regs::ctrl::RESET_FUEL_GAUGE, SensorCommWrapper::setRegBit(), and SensorCommWrapper::writeReg().

Member Data Documentation

◆ DCDC1

constexpr uint8_t AXP2101Power::DCDC1 = 0
staticconstexpr

Definition at line 39 of file AXP2101Power.hpp.

◆ DCDC2

constexpr uint8_t AXP2101Power::DCDC2 = 1
staticconstexpr

Definition at line 40 of file AXP2101Power.hpp.

◆ DCDC3

constexpr uint8_t AXP2101Power::DCDC3 = 2
staticconstexpr

Definition at line 41 of file AXP2101Power.hpp.

◆ DCDC4

constexpr uint8_t AXP2101Power::DCDC4 = 3
staticconstexpr

Definition at line 42 of file AXP2101Power.hpp.

◆ DCDC5

constexpr uint8_t AXP2101Power::DCDC5 = 4
staticconstexpr

Definition at line 43 of file AXP2101Power.hpp.


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