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

Power output channel (DCDC / LDO) control for the AXP2101 PMIC. More...

#include <AXP2101Channel.hpp>

Inheritance diagram for AXP2101Channel:
[legend]

Public Member Functions

 AXP2101Channel (AXP2101Core &core)
 
 ~AXP2101Channel ()=default
 
bool enable (uint8_t channel, bool enable) override
 Enable or disable a power output channel.
 
bool isEnabled (uint8_t channel) override
 Check whether a power output channel is enabled.
 
bool setVoltage (uint8_t channel, uint16_t mV) override
 Set the output voltage for a DCDC or LDO channel.
 
uint16_t getVoltage (uint8_t channel) override
 Get the current output voltage setting for a channel.
 
uint8_t count () const override
 Get the total number of available power channels.
 
Info getInfo (uint8_t channel) const override
 Get information about a specific power channel.
 
- Public Member Functions inherited from PmicChannelBase
virtual ~PmicChannelBase ()=default
 Virtual destructor.
 

Static Public Attributes

static constexpr uint8_t DCDC_COUNT = 5
 Number of DCDC converters.
 
static constexpr uint8_t LDO_COUNT = 9
 Number of LDO regulators.
 
static constexpr uint8_t CHANNEL_COUNT = DCDC_COUNT + LDO_COUNT
 Total number of power channels.
 
static constexpr uint8_t CH_DCDC1 = 0
 
static constexpr uint8_t CH_DCDC2 = 1
 
static constexpr uint8_t CH_DCDC3 = 2
 
static constexpr uint8_t CH_DCDC4 = 3
 
static constexpr uint8_t CH_DCDC5 = 4
 
static constexpr uint8_t CH_ALDO1 = 5
 
static constexpr uint8_t CH_ALDO2 = 6
 
static constexpr uint8_t CH_ALDO3 = 7
 
static constexpr uint8_t CH_ALDO4 = 8
 
static constexpr uint8_t CH_BLDO1 = 9
 
static constexpr uint8_t CH_BLDO2 = 10
 
static constexpr uint8_t CH_CPUSLDO = 11
 
static constexpr uint8_t CH_DLDO1 = 12
 
static constexpr uint8_t CH_DLDO2 = 13
 

Additional Inherited Members

- Public Types inherited from PmicChannelBase
enum class  Type : uint8_t { DCDC = 0 , LDO = 1 }
 Regulator type classification. More...
 

Detailed Description

Power output channel (DCDC / LDO) control for the AXP2101 PMIC.

The AXP2101 provides 5 DCDC converters and 9 LDO regulators (14 channels total). Each channel can be independently enabled/disabled and its output voltage set.

Parameters

  • DCDC1: 1500-3400mV, 100mV steps
  • DCDC2: 500-1540mV, dual-range (10mV / 20mV steps)
  • DCDC3: 500-3400mV, triple-range (10mV / 20mV / 100mV steps)
  • DCDC4: 500-1840mV, dual-range (10mV / 20mV steps)
  • DCDC5: 1200-3700mV, 100mV steps
  • ALDO1-4: 500-3500mV, 100mV steps
  • BLDO1-2: 500-3500mV, 100mV steps
  • CPUSLDO: 500-1400mV, 50mV steps
  • DLDO1: 500-3300mV, 100mV steps, This only applies to the linear version; it does not apply to the DC charging version.
  • DLDO2: 500-1400mV, 50mV steps, This only applies to the linear version; it does not apply to the DC charging version.
Note
Input voltages outside a channel's valid range will be clamped and/or quantized to the nearest valid register value.

Definition at line 56 of file AXP2101Channel.hpp.

Constructor & Destructor Documentation

◆ AXP2101Channel()

AXP2101Channel::AXP2101Channel ( AXP2101Core core)
explicit

Definition at line 37 of file AXP2101Channel.cpp.

◆ ~AXP2101Channel()

AXP2101Channel::~AXP2101Channel ( )
default

Member Function Documentation

◆ count()

uint8_t AXP2101Channel::count ( ) const
overridevirtual

Get the total number of available power channels.

Returns
Channel count (14).

Implements PmicChannelBase.

Definition at line 215 of file AXP2101Channel.cpp.

References CHANNEL_COUNT.

◆ enable()

bool AXP2101Channel::enable ( uint8_t  channel,
bool  enable 
)
overridevirtual

Enable or disable a power output channel.

Parameters
channelChannel index (0-13).
enabletrue to power on, false to power off.
Returns
true on success.

Implements PmicChannelBase.

Definition at line 41 of file AXP2101Channel.cpp.

References CHANNEL_COUNT, SensorCommWrapper::clrRegBit(), DCDC_COUNT, enable(), axp2101_regs::ldo::ONOFF_CTRL0, axp2101_regs::ldo::ONOFF_CTRL1, axp2101_regs::dcdc::ONOFF_DVM_CTRL, and SensorCommWrapper::setRegBit().

Referenced by enable().

◆ getInfo()

PmicChannelBase::Info AXP2101Channel::getInfo ( uint8_t  channel) const
overridevirtual

Get information about a specific power channel.

Parameters
channelChannel index (0-13).
Returns
Info structure containing type, voltage range, and step.

Implements PmicChannelBase.

Definition at line 220 of file AXP2101Channel.cpp.

References CH_ALDO1, CH_ALDO2, CH_ALDO3, CH_ALDO4, CH_BLDO1, CH_BLDO2, CH_CPUSLDO, CH_DCDC1, CH_DCDC2, CH_DCDC3, CH_DCDC4, CH_DCDC5, CH_DLDO1, CH_DLDO2, CHANNEL_COUNT, PmicChannelBase::DCDC, and PmicChannelBase::LDO.

◆ getVoltage()

◆ isEnabled()

bool AXP2101Channel::isEnabled ( uint8_t  channel)
overridevirtual

Check whether a power output channel is enabled.

Parameters
channelChannel index (0-13).
Returns
true if the channel is powered on.

Implements PmicChannelBase.

Definition at line 56 of file AXP2101Channel.cpp.

References CHANNEL_COUNT, DCDC_COUNT, SensorCommWrapper::getRegBit(), axp2101_regs::ldo::ONOFF_CTRL0, axp2101_regs::ldo::ONOFF_CTRL1, and axp2101_regs::dcdc::ONOFF_DVM_CTRL.

◆ setVoltage()

bool AXP2101Channel::setVoltage ( uint8_t  channel,
uint16_t  mV 
)
overridevirtual

Set the output voltage for a DCDC or LDO channel.

Value will be clamped to the channel's valid range and quantized to the nearest valid step size.

Parameters
channelChannel index (0-13).
mVDesired output voltage in millivolts.
Returns
true on success.

Implements PmicChannelBase.

Definition at line 70 of file AXP2101Channel.cpp.

References CH_DCDC1, CH_DCDC2, CH_DCDC3, CH_DCDC4, CH_DCDC5, CHANNEL_COUNT, DCDC_COUNT, SensorCommWrapper::updateBits(), axp2101_regs::dcdc::VOL0_CTRL, axp2101_regs::ldo::VOL0_CTRL, axp2101_regs::dcdc::VOL1_CTRL, axp2101_regs::ldo::VOL1_CTRL, axp2101_regs::dcdc::VOL2_CTRL, axp2101_regs::ldo::VOL2_CTRL, axp2101_regs::dcdc::VOL3_CTRL, axp2101_regs::ldo::VOL3_CTRL, axp2101_regs::dcdc::VOL4_CTRL, axp2101_regs::ldo::VOL4_CTRL, axp2101_regs::ldo::VOL5_CTRL, axp2101_regs::ldo::VOL6_CTRL, axp2101_regs::ldo::VOL7_CTRL, and axp2101_regs::ldo::VOL8_CTRL.

Member Data Documentation

◆ CH_ALDO1

constexpr uint8_t AXP2101Channel::CH_ALDO1 = 5
staticconstexpr

Definition at line 71 of file AXP2101Channel.hpp.

Referenced by getInfo(), and setup().

◆ CH_ALDO2

constexpr uint8_t AXP2101Channel::CH_ALDO2 = 6
staticconstexpr

Definition at line 72 of file AXP2101Channel.hpp.

Referenced by getInfo().

◆ CH_ALDO3

constexpr uint8_t AXP2101Channel::CH_ALDO3 = 7
staticconstexpr

Definition at line 73 of file AXP2101Channel.hpp.

Referenced by getInfo().

◆ CH_ALDO4

constexpr uint8_t AXP2101Channel::CH_ALDO4 = 8
staticconstexpr

Definition at line 74 of file AXP2101Channel.hpp.

Referenced by getInfo().

◆ CH_BLDO1

constexpr uint8_t AXP2101Channel::CH_BLDO1 = 9
staticconstexpr

Definition at line 75 of file AXP2101Channel.hpp.

Referenced by getInfo().

◆ CH_BLDO2

constexpr uint8_t AXP2101Channel::CH_BLDO2 = 10
staticconstexpr

Definition at line 76 of file AXP2101Channel.hpp.

Referenced by getInfo().

◆ CH_CPUSLDO

constexpr uint8_t AXP2101Channel::CH_CPUSLDO = 11
staticconstexpr

Definition at line 77 of file AXP2101Channel.hpp.

Referenced by getInfo().

◆ CH_DCDC1

constexpr uint8_t AXP2101Channel::CH_DCDC1 = 0
staticconstexpr

Definition at line 66 of file AXP2101Channel.hpp.

Referenced by getInfo(), getVoltage(), setup(), and setVoltage().

◆ CH_DCDC2

constexpr uint8_t AXP2101Channel::CH_DCDC2 = 1
staticconstexpr

Definition at line 67 of file AXP2101Channel.hpp.

Referenced by getInfo(), getVoltage(), and setVoltage().

◆ CH_DCDC3

constexpr uint8_t AXP2101Channel::CH_DCDC3 = 2
staticconstexpr

Definition at line 68 of file AXP2101Channel.hpp.

Referenced by getInfo(), getVoltage(), and setVoltage().

◆ CH_DCDC4

constexpr uint8_t AXP2101Channel::CH_DCDC4 = 3
staticconstexpr

Definition at line 69 of file AXP2101Channel.hpp.

Referenced by getInfo(), getVoltage(), and setVoltage().

◆ CH_DCDC5

constexpr uint8_t AXP2101Channel::CH_DCDC5 = 4
staticconstexpr

Definition at line 70 of file AXP2101Channel.hpp.

Referenced by getInfo(), getVoltage(), and setVoltage().

◆ CH_DLDO1

constexpr uint8_t AXP2101Channel::CH_DLDO1 = 12
staticconstexpr

Definition at line 78 of file AXP2101Channel.hpp.

Referenced by getInfo().

◆ CH_DLDO2

constexpr uint8_t AXP2101Channel::CH_DLDO2 = 13
staticconstexpr

Definition at line 79 of file AXP2101Channel.hpp.

Referenced by getInfo().

◆ CHANNEL_COUNT

constexpr uint8_t AXP2101Channel::CHANNEL_COUNT = DCDC_COUNT + LDO_COUNT
staticconstexpr

Total number of power channels.

Definition at line 64 of file AXP2101Channel.hpp.

Referenced by count(), enable(), getInfo(), getVoltage(), isEnabled(), and setVoltage().

◆ DCDC_COUNT

constexpr uint8_t AXP2101Channel::DCDC_COUNT = 5
staticconstexpr

Number of DCDC converters.

Definition at line 60 of file AXP2101Channel.hpp.

Referenced by enable(), getVoltage(), isEnabled(), and setVoltage().

◆ LDO_COUNT

constexpr uint8_t AXP2101Channel::LDO_COUNT = 9
staticconstexpr

Number of LDO regulators.

Definition at line 62 of file AXP2101Channel.hpp.


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