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

AXP192 Power Output Channel Control. More...

#include <AXP192Channel.hpp>

Inheritance diagram for AXP192Channel:
[legend]

Public Member Functions

 AXP192Channel (AXP192Core &core)
 Construct channel control interface.
 
 ~AXP192Channel ()=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 output voltage for a channel.
 
uint16_t getVoltage (uint8_t channel) override
 Get current output voltage for a channel.
 
uint8_t count () const override
 Get total number of power output channels.
 
Info getInfo (uint8_t channel) const override
 Get channel information (type, name, min/max/step)
 
- Public Member Functions inherited from PmicChannelBase
virtual ~PmicChannelBase ()=default
 Virtual destructor.
 

Static Public Attributes

static constexpr uint8_t DCDC_COUNT = 3
 
static constexpr uint8_t LDO_COUNT = 4
 
static constexpr uint8_t CHANNEL_COUNT = 7
 
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_LDO2 = 3
 
static constexpr uint8_t CH_LDO3 = 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

AXP192 Power Output Channel Control.

Provides enable/disable, voltage get/set, and channel enumeration for all 7 power output channels (3 DCDC + 4 LDO-type). Voltage setters automatically quantize to the nearest valid step. Inherits from PmicChannelBase for polymorphic PMIC integration.

Definition at line 59 of file AXP192Channel.hpp.

Constructor & Destructor Documentation

◆ AXP192Channel()

AXP192Channel::AXP192Channel ( AXP192Core core)
explicit

Construct channel control interface.

Parameters
coreReference to AXP192 core communication object

Definition at line 37 of file AXP192Channel.cpp.

◆ ~AXP192Channel()

AXP192Channel::~AXP192Channel ( )
default

Member Function Documentation

◆ count()

uint8_t AXP192Channel::count ( ) const
overridevirtual

Get total number of power output channels.

Returns
Always 7 (3 DCDC + 4 LDO-type)

Implements PmicChannelBase.

Definition at line 183 of file AXP192Channel.cpp.

References CHANNEL_COUNT.

◆ enable()

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

Enable or disable a power output channel.

Parameters
channelChannel identifier (CH_DCDC1 through CH_EXTEN)
enabletrue to turn on, false to turn off
Returns
true on success, false on I2C error

Implements PmicChannelBase.

Definition at line 55 of file AXP192Channel.cpp.

References CH_LDOio, CHANNEL_COUNT, SensorCommWrapper::clrRegBit(), enable(), axp192_regs::gpio::GPIO0_CTL, axp192_regs::pwr::LDO23_DC123_EXT_CTL, SensorCommWrapper::readReg(), SensorCommWrapper::setRegBit(), and SensorCommWrapper::writeReg().

Referenced by enable().

◆ getInfo()

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

Get channel information (type, name, min/max/step)

Parameters
channelChannel identifier
Returns
Info struct containing channel metadata

Implements PmicChannelBase.

Definition at line 188 of file AXP192Channel.cpp.

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

◆ getVoltage()

uint16_t AXP192Channel::getVoltage ( uint8_t  channel)
overridevirtual

Get current output voltage for a channel.

Parameters
channelChannel identifier
Returns
Voltage in millivolts, or 0 on error / non-configurable channel

Implements PmicChannelBase.

Definition at line 138 of file AXP192Channel.cpp.

References CH_DCDC1, CH_DCDC2, CH_DCDC3, CH_EXTEN, CH_LDO2, CH_LDO3, CH_LDOio, CHANNEL_COUNT, axp192_regs::pwr::DC1_VOLTAGE, axp192_regs::pwr::DC2OUT_VOL, axp192_regs::pwr::DC3OUT_VOL, axp192_regs::gpio::GPIO0_VOL, axp192_regs::pwr::LDO23OUT_VOL, and SensorCommWrapper::readReg().

◆ isEnabled()

bool AXP192Channel::isEnabled ( uint8_t  channel)
overridevirtual

Check whether a power output channel is enabled.

Parameters
channelChannel identifier (CH_DCDC1 through CH_EXTEN)
Returns
true if enabled, false otherwise

Implements PmicChannelBase.

Definition at line 75 of file AXP192Channel.cpp.

References CH_LDOio, CHANNEL_COUNT, SensorCommWrapper::getRegBit(), axp192_regs::gpio::GPIO0_CTL, axp192_regs::pwr::LDO23_DC123_EXT_CTL, and SensorCommWrapper::readReg().

◆ setVoltage()

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

Set output voltage for a channel.

Valid ranges and step sizes:

  • DCDC1/2/3: 700-3500mV, 25mV steps
  • LDO2/3: 1800-3300mV, 100mV steps
  • LDOio: 1800-3300mV, 100mV steps
  • EXTEN: No voltage control (returns false)
Parameters
channelChannel identifier
mVDesired voltage in millivolts
Returns
true on success, false if channel has no voltage control or on I2C error

Implements PmicChannelBase.

Definition at line 90 of file AXP192Channel.cpp.

References CH_DCDC1, CH_DCDC2, CH_DCDC3, CH_EXTEN, CH_LDO2, CH_LDO3, CH_LDOio, CHANNEL_COUNT, axp192_regs::pwr::DC1_VOLTAGE, axp192_regs::pwr::DC2OUT_VOL, axp192_regs::pwr::DC3OUT_VOL, axp192_regs::gpio::GPIO0_VOL, axp192_regs::pwr::LDO23OUT_VOL, and SensorCommWrapper::updateBits().

Member Data Documentation

◆ CH_DCDC1

constexpr uint8_t AXP192Channel::CH_DCDC1 = 0
staticconstexpr

Definition at line 66 of file AXP192Channel.hpp.

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

◆ CH_DCDC2

constexpr uint8_t AXP192Channel::CH_DCDC2 = 1
staticconstexpr

Definition at line 67 of file AXP192Channel.hpp.

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

◆ CH_DCDC3

constexpr uint8_t AXP192Channel::CH_DCDC3 = 2
staticconstexpr

Definition at line 68 of file AXP192Channel.hpp.

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

◆ CH_EXTEN

constexpr uint8_t AXP192Channel::CH_EXTEN = 6
staticconstexpr

Definition at line 72 of file AXP192Channel.hpp.

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

◆ CH_LDO2

constexpr uint8_t AXP192Channel::CH_LDO2 = 3
staticconstexpr

Definition at line 69 of file AXP192Channel.hpp.

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

◆ CH_LDO3

constexpr uint8_t AXP192Channel::CH_LDO3 = 4
staticconstexpr

Definition at line 70 of file AXP192Channel.hpp.

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

◆ CH_LDOio

constexpr uint8_t AXP192Channel::CH_LDOio = 5
staticconstexpr

Definition at line 71 of file AXP192Channel.hpp.

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

◆ CHANNEL_COUNT

constexpr uint8_t AXP192Channel::CHANNEL_COUNT = 7
staticconstexpr

Definition at line 64 of file AXP192Channel.hpp.

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

◆ DCDC_COUNT

constexpr uint8_t AXP192Channel::DCDC_COUNT = 3
staticconstexpr

Definition at line 62 of file AXP192Channel.hpp.

◆ LDO_COUNT

constexpr uint8_t AXP192Channel::LDO_COUNT = 4
staticconstexpr

Definition at line 63 of file AXP192Channel.hpp.


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