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

AXP202 power channel enable and voltage control. More...

#include <AXP202Channel.hpp>

Inheritance diagram for AXP202Channel:
[legend]

Public Member Functions

 AXP202Channel (AXP202Core &core)
 Construct AXP202 channel control interface.
 
 ~AXP202Channel ()=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 of a power channel.
 
uint16_t getVoltage (uint8_t channel) override
 Get the current output voltage of a power channel.
 
uint8_t count () const override
 Get the number of available power channels.
 
Info getInfo (uint8_t channel) const override
 Get information about a specific channel.
 
- Public Member Functions inherited from PmicChannelBase
virtual ~PmicChannelBase ()=default
 Virtual destructor.
 

Static Public Attributes

static constexpr uint8_t CHANNEL_COUNT = 7
 
static constexpr uint8_t CH_DCDC2 = 0
 
static constexpr uint8_t CH_DCDC3 = 1
 
static constexpr uint8_t CH_LDO2 = 2
 
static constexpr uint8_t CH_LDO3 = 3
 
static constexpr uint8_t CH_LDO4 = 4
 
static constexpr uint8_t CH_LDOio = 5
 
static constexpr uint8_t CH_EXTEN = 6
 

Additional Inherited Members

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

Detailed Description

AXP202 power channel enable and voltage control.

Implements PmicChannelBase to provide enable/disable and voltage setting for all seven AXP202 output rails. Each channel maps to a unique register and bit position in the power control register map.

Definition at line 61 of file AXP202Channel.hpp.

Constructor & Destructor Documentation

◆ AXP202Channel()

AXP202Channel::AXP202Channel ( AXP202Core core)
explicit

Construct AXP202 channel control interface.

Parameters
coreReference to AXP202 core communication

Definition at line 42 of file AXP202Channel.cpp.

◆ ~AXP202Channel()

AXP202Channel::~AXP202Channel ( )
default

Member Function Documentation

◆ count()

uint8_t AXP202Channel::count ( ) const
overridevirtual

Get the number of available power channels.

Returns
Always 7 (CHANNEL_COUNT)

Implements PmicChannelBase.

Definition at line 214 of file AXP202Channel.cpp.

References CHANNEL_COUNT.

◆ enable()

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

Enable or disable a power output channel.

Parameters
channelChannel identifier (CH_DCDC2 .. CH_EXTEN)
enabletrue to turn on, false to turn off
Returns
true on success

Implements PmicChannelBase.

Definition at line 46 of file AXP202Channel.cpp.

References axp202_regs::BIT_DCDC2, axp202_regs::BIT_DCDC3, axp202_regs::BIT_EXTEN, axp202_regs::BIT_LDO2, axp202_regs::BIT_LDO3, axp202_regs::BIT_LDO4, CH_DCDC2, CH_DCDC3, CH_EXTEN, CH_LDO2, CH_LDO3, CH_LDO4, CH_LDOio, CHANNEL_COUNT, SensorCommWrapper::clrRegBit(), enable(), axp202_regs::gpio::GPIO0_CTL, axp202_regs::pmu::LDO234_DC23_CTL, SensorCommWrapper::readReg(), SensorCommWrapper::setRegBit(), and SensorCommWrapper::writeReg().

Referenced by enable().

◆ getInfo()

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

Get information about a specific channel.

Parameters
channelChannel identifier
Returns
Info struct describing the channel capabilities

Implements PmicChannelBase.

Definition at line 219 of file AXP202Channel.cpp.

References CH_DCDC2, CH_DCDC3, CH_EXTEN, CH_LDO2, CH_LDO3, CH_LDO4, CH_LDOio, CHANNEL_COUNT, PmicChannelBase::DCDC, and PmicChannelBase::LDO.

◆ getVoltage()

uint16_t AXP202Channel::getVoltage ( uint8_t  channel)
overridevirtual

Get the current output voltage of a power channel.

Parameters
channelChannel identifier
Returns
Voltage in millivolts, or 0 on error

Implements PmicChannelBase.

Definition at line 165 of file AXP202Channel.cpp.

References CH_DCDC2, CH_DCDC3, CH_EXTEN, CH_LDO2, CH_LDO3, CH_LDO4, CH_LDOio, CHANNEL_COUNT, axp202_regs::pmu::DC2OUT_VOL, axp202_regs::pmu::DC3OUT_VOL, axp202_regs::gpio::GPIO0_VOL, axp202_regs::pmu::LDO24OUT_VOL, axp202_regs::pmu::LDO3OUT_VOL, and SensorCommWrapper::readReg().

◆ isEnabled()

bool AXP202Channel::isEnabled ( uint8_t  channel)
overridevirtual

◆ setVoltage()

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

Set the output voltage of a power channel.

Parameters
channelChannel identifier (DCDC2, DCDC3, LDO2, LDO3, LDO4, or LDOio)
mVDesired voltage in millivolts
Valid ranges per channel:
  • DCDC2: 700-2275mV, 25mV steps
  • DCDC3: 700-3500mV, 25mV steps
  • LDO2: 1800-3300mV, 100mV steps
  • LDO3: 700-3500mV, 25mV steps
  • LDO4: 1250-3300mV, discrete table (clamped to nearest entry)
  • LDOio: 1800-3300mV, 100mV steps
  • EXTEN: Not applicable (returns false)
Returns
true on success

Implements PmicChannelBase.

Definition at line 111 of file AXP202Channel.cpp.

References CH_DCDC2, CH_DCDC3, CH_EXTEN, CH_LDO2, CH_LDO3, CH_LDO4, CH_LDOio, CHANNEL_COUNT, axp202_regs::pmu::DC2OUT_VOL, axp202_regs::pmu::DC3OUT_VOL, axp202_regs::gpio::GPIO0_VOL, i, axp202_regs::pmu::LDO24OUT_VOL, axp202_regs::pmu::LDO3OUT_VOL, and SensorCommWrapper::updateBits().

Member Data Documentation

◆ CH_DCDC2

constexpr uint8_t AXP202Channel::CH_DCDC2 = 0
staticconstexpr

Definition at line 66 of file AXP202Channel.hpp.

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

◆ CH_DCDC3

constexpr uint8_t AXP202Channel::CH_DCDC3 = 1
staticconstexpr

Definition at line 67 of file AXP202Channel.hpp.

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

◆ CH_EXTEN

constexpr uint8_t AXP202Channel::CH_EXTEN = 6
staticconstexpr

Definition at line 72 of file AXP202Channel.hpp.

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

◆ CH_LDO2

constexpr uint8_t AXP202Channel::CH_LDO2 = 2
staticconstexpr

Definition at line 68 of file AXP202Channel.hpp.

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

◆ CH_LDO3

constexpr uint8_t AXP202Channel::CH_LDO3 = 3
staticconstexpr

Definition at line 69 of file AXP202Channel.hpp.

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

◆ CH_LDO4

constexpr uint8_t AXP202Channel::CH_LDO4 = 4
staticconstexpr

Definition at line 70 of file AXP202Channel.hpp.

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

◆ CH_LDOio

constexpr uint8_t AXP202Channel::CH_LDOio = 5
staticconstexpr

Definition at line 71 of file AXP202Channel.hpp.

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

◆ CHANNEL_COUNT

constexpr uint8_t AXP202Channel::CHANNEL_COUNT = 7
staticconstexpr

Definition at line 64 of file AXP202Channel.hpp.

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


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