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

#include <AXP1xxLed.hpp>

Inheritance diagram for AXP1xxLed< Regs >:
[legend]

Public Member Functions

 AXP1xxLed (SensorCommWrapper &core)
 Construct LED control interface.
 
bool setOutputType (OutputType type) override
 Set LED output type (no-op, always succeeds).
 
bool setMode (Mode mode) override
 Set LED operating mode.
 
Mode getMode () override
 Get the current LED operating mode.
 
bool setManualState (ManualState state) override
 Set the LED state in manual mode.
 
ManualState getManualState () override
 Get the current LED state in manual mode.
 
- 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

template<typename Regs>
class AXP1xxLed< Regs >

Definition at line 42 of file AXP1xxLed.hpp.

Constructor & Destructor Documentation

◆ AXP1xxLed()

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

Construct LED control interface.

Parameters
coreReference to the I2C communication wrapper.

Definition at line 49 of file AXP1xxLed.hpp.

Member Function Documentation

◆ getManualState()

template<typename Regs >
ManualState AXP1xxLed< Regs >::getManualState ( )
inlineoverridevirtual

Get the current LED state in manual mode.

Returns
Current ManualState, or ManualState::UNDEFINED if in auto mode or on error.

Implements PmicLedBase.

Definition at line 139 of file AXP1xxLed.hpp.

References PmicLedBase::BLINK_1HZ, PmicLedBase::BLINK_4HZ, SensorCommWrapper::getRegBit(), PmicLedBase::HiZ, PmicLedBase::LEVEL_LOW, SensorCommWrapper::readReg(), and PmicLedBase::UNDEFINED.

◆ getMode()

template<typename Regs >
Mode AXP1xxLed< Regs >::getMode ( )
inlineoverridevirtual

Get the current LED operating mode.

Returns
Current Mode value.

Implements PmicLedBase.

Definition at line 93 of file AXP1xxLed.hpp.

References PmicLedBase::AUTO, SensorCommWrapper::getRegBit(), and PmicLedBase::MANUAL.

◆ setManualState()

template<typename Regs >
bool AXP1xxLed< Regs >::setManualState ( ManualState  state)
inlineoverridevirtual

Set the LED state in manual mode.

Automatically switches to manual mode if not already set. Programs bits 5-4 of the OFF_CTL register.

Parameters
stateDesired LED state. LEVEL_LOW: drive pin low (0x30). BLINK_1HZ: blink at 1 Hz (0x10). BLINK_4HZ: blink at 4 Hz (0x20). HiZ: high-impedance (0x00).
Note
ManualState::LEVEL_HIGH is not supported by AXP1xx CHGLED hardware.
Return values
trueState was set successfully.
falseInvalid state or I2C communication failed.

Implements PmicLedBase.

Definition at line 117 of file AXP1xxLed.hpp.

References PmicLedBase::BLINK_1HZ, PmicLedBase::BLINK_4HZ, PmicLedBase::HiZ, PmicLedBase::LEVEL_HIGH, PmicLedBase::LEVEL_LOW, SensorCommWrapper::setRegBit(), and SensorCommWrapper::updateBits().

Referenced by setup().

◆ setMode()

template<typename Regs >
bool AXP1xxLed< Regs >::setMode ( Mode  mode)
inlineoverridevirtual

Set LED operating mode.

Controls OFF_CTL register bit 3.

  • AUTO: LED indicates charge state automatically (bit 3 = 0).
  • MANUAL: LED controlled by setManualState() (bit 3 = 1).
  • DISABLE: LED forced high-impedance (bit 3 = 1, control bits = 00).
Parameters
modeLED operating mode.
Return values
trueMode was set successfully.
falseInvalid mode or I2C communication failed.

Implements PmicLedBase.

Definition at line 74 of file AXP1xxLed.hpp.

References PmicLedBase::AUTO, SensorCommWrapper::clrRegBit(), PmicLedBase::DISABLE, PmicLedBase::MANUAL, SensorCommWrapper::setRegBit(), and SensorCommWrapper::updateBits().

Referenced by setup().

◆ setOutputType()

template<typename Regs >
bool AXP1xxLed< Regs >::setOutputType ( OutputType  type)
inlineoverridevirtual

Set LED output type (no-op, always succeeds).

Parameters
typeOutput type (ignored).
Returns
Always true.

Implements PmicLedBase.

Definition at line 56 of file AXP1xxLed.hpp.


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