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

#include <AXP202PowerEx.hpp>

Public Types

enum class  LDO3Mode : uint8_t { LDO = 0 , DCIN = 1 }
 

Public Member Functions

 AXP202PowerEx (AXP202Core &core)
 
void enableLongPressShutdown ()
 Enable automatic power-off when the power key is held.
 
void disableLongPressShutdown ()
 Disable automatic power-off when the power key is held.
 
bool setLDO3Mode (LDO3Mode mode)
 Select the LDO3 regulated output or DCIN pass-through path.
 
bool setDCDC2PWMMode (bool pwm)
 Force DCDC2 to PWM mode (REG 80H bit 2)
 
bool isDCDC2PWMMode ()
 
bool setDCDC3PWMMode (bool pwm)
 Force DCDC3 to PWM mode (REG 80H bit 1)
 
bool isDCDC3PWMMode ()
 
bool setAPSWarningLevel1 (uint8_t opt)
 Set APS warning level 1 voltage (REG 3AH)
 
uint8_t getAPSWarningLevel1 ()
 
bool setAPSWarningLevel2 (uint8_t opt)
 Set APS warning level 2 voltage (REG 3BH)
 
uint8_t getAPSWarningLevel2 ()
 
bool enableOverTemperatureShutdown (bool enable)
 Enable over-temperature shutdown (REG 8FH bit 2)
 
bool isOverTemperatureShutdownEnabled ()
 
bool setDCDCFrequency (uint8_t freq)
 Set DCDC switching frequency (REG 37H)
 
uint8_t getDCDCFrequency ()
 
bool enableVBUSDetection (bool enable)
 Enable VBUS Valid detection (REG 8BH bit 3)
 
bool isVBUSDetectionEnabled ()
 

Detailed Description

Definition at line 16 of file AXP202PowerEx.hpp.

Member Enumeration Documentation

◆ LDO3Mode

enum class AXP202PowerEx::LDO3Mode : uint8_t
strong
Enumerator
LDO 
DCIN 

Definition at line 19 of file AXP202PowerEx.hpp.

Constructor & Destructor Documentation

◆ AXP202PowerEx()

AXP202PowerEx::AXP202PowerEx ( AXP202Core core)
inlineexplicit

Definition at line 24 of file AXP202PowerEx.hpp.

Member Function Documentation

◆ disableLongPressShutdown()

void AXP202PowerEx::disableLongPressShutdown ( )
inline

Disable automatic power-off when the power key is held.

Definition at line 39 of file AXP202PowerEx.hpp.

References SensorCommWrapper::clrRegBit(), and axp202_regs::pmu::POK_SET.

◆ enableLongPressShutdown()

void AXP202PowerEx::enableLongPressShutdown ( )
inline

Enable automatic power-off when the power key is held.

Definition at line 31 of file AXP202PowerEx.hpp.

References axp202_regs::pmu::POK_SET, and SensorCommWrapper::setRegBit().

◆ enableOverTemperatureShutdown()

bool AXP202PowerEx::enableOverTemperatureShutdown ( bool  enable)
inline

Enable over-temperature shutdown (REG 8FH bit 2)

Parameters
enabletrue to enable shutdown on over-temp
Returns
true on success

Definition at line 138 of file AXP202PowerEx.hpp.

References SensorCommWrapper::clrRegBit(), axp202_regs::pmu::HOTOVER_CTL, and SensorCommWrapper::setRegBit().

◆ enableVBUSDetection()

bool AXP202PowerEx::enableVBUSDetection ( bool  enable)
inline

Enable VBUS Valid detection (REG 8BH bit 3)

Parameters
enabletrue to enable
Returns
true on success

Definition at line 173 of file AXP202PowerEx.hpp.

References SensorCommWrapper::clrRegBit(), SensorCommWrapper::setRegBit(), and axp202_regs::pmu::VBUS_DET_SRP.

◆ getAPSWarningLevel1()

uint8_t AXP202PowerEx::getAPSWarningLevel1 ( )
inline

◆ getAPSWarningLevel2()

uint8_t AXP202PowerEx::getAPSWarningLevel2 ( )
inline

◆ getDCDCFrequency()

uint8_t AXP202PowerEx::getDCDCFrequency ( )
inline

◆ isDCDC2PWMMode()

bool AXP202PowerEx::isDCDC2PWMMode ( )
inline

◆ isDCDC3PWMMode()

bool AXP202PowerEx::isDCDC3PWMMode ( )
inline

◆ isOverTemperatureShutdownEnabled()

bool AXP202PowerEx::isOverTemperatureShutdownEnabled ( )
inline

◆ isVBUSDetectionEnabled()

bool AXP202PowerEx::isVBUSDetectionEnabled ( )
inline

◆ setAPSWarningLevel1()

bool AXP202PowerEx::setAPSWarningLevel1 ( uint8_t  opt)
inline

Set APS warning level 1 voltage (REG 3AH)

Parameters
optRaw value. Voltage = 2.8672V + opt * 5.6mV. Range 0-255.
Returns
true on success

Definition at line 104 of file AXP202PowerEx.hpp.

References axp202_regs::pmu::APS_WARNING1, and SensorCommWrapper::updateBits().

◆ setAPSWarningLevel2()

bool AXP202PowerEx::setAPSWarningLevel2 ( uint8_t  opt)
inline

Set APS warning level 2 voltage (REG 3BH)

Parameters
optRaw value. Same formula as level 1.
Returns
true on success

Definition at line 120 of file AXP202PowerEx.hpp.

References axp202_regs::pmu::APS_WARNING2, and SensorCommWrapper::updateBits().

◆ setDCDC2PWMMode()

bool AXP202PowerEx::setDCDC2PWMMode ( bool  pwm)
inline

Force DCDC2 to PWM mode (REG 80H bit 2)

Parameters
pwmtrue=forced PWM, false=auto PWM/PFM
Returns
true on success

Definition at line 70 of file AXP202PowerEx.hpp.

References SensorCommWrapper::clrRegBit(), axp202_regs::pmu::DCDC_MODESET, and SensorCommWrapper::setRegBit().

◆ setDCDC3PWMMode()

bool AXP202PowerEx::setDCDC3PWMMode ( bool  pwm)
inline

Force DCDC3 to PWM mode (REG 80H bit 1)

Parameters
pwmtrue=forced PWM, false=auto PWM/PFM
Returns
true on success

Definition at line 86 of file AXP202PowerEx.hpp.

References SensorCommWrapper::clrRegBit(), axp202_regs::pmu::DCDC_MODESET, and SensorCommWrapper::setRegBit().

◆ setDCDCFrequency()

bool AXP202PowerEx::setDCDCFrequency ( uint8_t  freq)
inline

Set DCDC switching frequency (REG 37H)

Parameters
freqFrequency code. Consult datasheet for valid values.
Returns
true on success

Definition at line 155 of file AXP202PowerEx.hpp.

References axp202_regs::pmu::DCDC_FREQSET, and SensorCommWrapper::writeReg().

◆ setLDO3Mode()

bool AXP202PowerEx::setLDO3Mode ( LDO3Mode  mode)
inline

Select the LDO3 regulated output or DCIN pass-through path.

Parameters
modeLDO for regulated output, DCIN for pass-through
Returns
true on success

Definition at line 51 of file AXP202PowerEx.hpp.

References SensorCommWrapper::clrRegBit(), DCIN, LDO, axp202_regs::pmu::LDO3OUT_VOL, and SensorCommWrapper::setRegBit().


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