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

Charging indicator LED control for the AXP2101 PMIC. More...

#include <AXP2101Led.hpp>

Inheritance diagram for AXP2101Led:
[legend]

Public Member Functions

 AXP2101Led (AXP2101Core &core)
 
 ~AXP2101Led ()=default
 
bool setOutputType (OutputType type) override
 Set the LED output driver type.
 
bool setMode (Mode mode) override
 Set the LED operating mode.
 
Mode getMode () override
 Get the current LED operating mode.
 
bool setManualState (ManualState state) override
 For manual mode, set the LED output state.
 
ManualState getManualState () override
 Get the current manual LED state.
 
- Public Member Functions inherited from PmicLedBase
virtual ~PmicLedBase ()=default
 

Additional Inherited Members

- Public Types inherited from PmicLedBase
enum class  OutputType : uint8_t { OpenDrain = 0 , PushPull = 1 }
 
enum class  Mode : uint8_t {
  AUTO = 0 , MANUAL = 1 , BREATH = 2 , DISABLE = 3 ,
  VENDOR = 255
}
 High-level LED operating mode (portable subset). More...
 
enum class  ManualState : uint8_t {
  HiZ = 0 , LEVEL_LOW = 1 , LEVEL_HIGH = 2 , BLINK_1HZ = 3 ,
  BLINK_4HZ = 4 , UNDEFINED = 255
}
 Manual LED state (portable subset). More...
 

Detailed Description

Charging indicator LED control for the AXP2101 PMIC.

Controls the CHGLED pin (register 0x69) which can be configured as:

  • Automatic mode: LED follows charge state (on during charging, off when charged/standby)
  • Manual mode: LED forced on or off or blinking
  • Output type: push-pull or open-drain

Definition at line 44 of file AXP2101Led.hpp.

Constructor & Destructor Documentation

◆ AXP2101Led()

AXP2101Led::AXP2101Led ( AXP2101Core core)
explicit

Definition at line 38 of file AXP2101Led.cpp.

◆ ~AXP2101Led()

AXP2101Led::~AXP2101Led ( )
default

Member Function Documentation

◆ getManualState()

AXP2101Led::ManualState AXP2101Led::getManualState ( )
overridevirtual

Get the current manual LED state.

Returns
Current ManualState setting.

Implements PmicLedBase.

Definition at line 96 of file AXP2101Led.cpp.

References PmicLedBase::BLINK_1HZ, PmicLedBase::BLINK_4HZ, axp2101_regs::chg::CHGLED_CFG, PmicLedBase::LEVEL_HIGH, PmicLedBase::LEVEL_LOW, SensorCommWrapper::readReg(), and PmicLedBase::UNDEFINED.

Referenced by loop().

◆ getMode()

AXP2101Led::Mode AXP2101Led::getMode ( )
overridevirtual

Get the current LED operating mode.

Returns
Current Mode setting.

Implements PmicLedBase.

Definition at line 63 of file AXP2101Led.cpp.

References PmicLedBase::AUTO, axp2101_regs::chg::CHGLED_CFG, PmicLedBase::DISABLE, PmicLedBase::MANUAL, SensorCommWrapper::readReg(), and PmicLedBase::VENDOR.

◆ setManualState()

bool AXP2101Led::setManualState ( ManualState  state)
overridevirtual

For manual mode, set the LED output state.

Parameters
stateOn or Off.
Returns
true on success.

Implements PmicLedBase.

Definition at line 79 of file AXP2101Led.cpp.

References PmicLedBase::BLINK_1HZ, PmicLedBase::BLINK_4HZ, axp2101_regs::chg::CHGLED_CFG, PmicLedBase::HiZ, PmicLedBase::LEVEL_HIGH, PmicLedBase::LEVEL_LOW, and SensorCommWrapper::updateBits().

Referenced by loop().

◆ setMode()

bool AXP2101Led::setMode ( Mode  mode)
overridevirtual

Set the LED operating mode.

Parameters
modeAutomatic or Manual control mode.
Returns
true on success.

Implements PmicLedBase.

Definition at line 49 of file AXP2101Led.cpp.

References PmicLedBase::AUTO, axp2101_regs::chg::CHGLED_CFG, PmicLedBase::DISABLE, PmicLedBase::MANUAL, and SensorCommWrapper::updateBits().

Referenced by loop().

◆ setOutputType()

bool AXP2101Led::setOutputType ( OutputType  type)
overridevirtual

Set the LED output driver type.

Parameters
typePushPull or OpenDrain configuration.
Returns
true on success.

Implements PmicLedBase.

Definition at line 43 of file AXP2101Led.cpp.


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