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

PMIC power output channel base interface. More...

#include <PmicChannelBase.hpp>

Inheritance diagram for PmicChannelBase:
[legend]

Classes

struct  Info
 Static metadata for a single power output channel. More...
 

Public Types

enum class  Type : uint8_t { DCDC = 0 , LDO = 1 }
 Regulator type classification. More...
 

Public Member Functions

virtual ~PmicChannelBase ()=default
 Virtual destructor.
 
virtual bool enable (uint8_t channel, bool enable)=0
 Enable or disable a power output channel.
 
virtual bool isEnabled (uint8_t channel)=0
 Check whether a power output channel is currently enabled.
 
virtual bool setVoltage (uint8_t channel, uint16_t mV)=0
 Set the output voltage of a channel.
 
virtual uint16_t getVoltage (uint8_t channel)=0
 Get the current output voltage of a channel.
 
virtual uint8_t count () const =0
 Get the number of power output channels available on this PMIC.
 
virtual Info getInfo (uint8_t channel) const =0
 Get static metadata for a specific channel.
 

Detailed Description

PMIC power output channel base interface.

Provides unified access to DCDC buck converters and LDO regulators. Each channel is identified by a uint8_t index; the channel-to-rail mapping is chip-specific and documented in the implementation's getInfo() table.

Usage:

pmic.getChannel()->enable(0, true); // Enable DCDC1
pmic.getChannel()->setVoltage(0, 3300); // Set DCDC1 to 3.3V
auto info = pmic.getChannel()->getInfo(0); // Query range & name
PmicAXP192 pmic
PmicChannelBase * getChannel() override
Access the power channel control interface.
virtual bool setVoltage(uint8_t channel, uint16_t mV)=0
Set the output voltage of a channel.
virtual bool enable(uint8_t channel, bool enable)=0
Enable or disable a power output channel.
virtual Info getInfo(uint8_t channel) const =0
Get static metadata for a specific channel.

Definition at line 61 of file PmicChannelBase.hpp.

Member Enumeration Documentation

◆ Type

enum class PmicChannelBase::Type : uint8_t
strong

Regulator type classification.

Enumerator
DCDC 

Switching buck/boost converter.

LDO 

Linear low-dropout regulator.

Definition at line 67 of file PmicChannelBase.hpp.

Constructor & Destructor Documentation

◆ ~PmicChannelBase()

virtual PmicChannelBase::~PmicChannelBase ( )
virtualdefault

Virtual destructor.

Member Function Documentation

◆ count()

virtual uint8_t PmicChannelBase::count ( ) const
pure virtual

Get the number of power output channels available on this PMIC.

Returns
Channel count.

Implemented in AXP192Channel, AXP202Channel, and AXP2101Channel.

Referenced by setup().

◆ enable()

virtual bool PmicChannelBase::enable ( uint8_t  channel,
bool  enable 
)
pure virtual

Enable or disable a power output channel.

Parameters
channelChannel index (0-based, see implementation for mapping).
enabletrue to turn on, false to turn off.
Returns
true on success, false if channel is invalid or I2C error.

Implemented in AXP192Channel, AXP202Channel, and AXP2101Channel.

Referenced by setup().

◆ getInfo()

virtual Info PmicChannelBase::getInfo ( uint8_t  channel) const
pure virtual

Get static metadata for a specific channel.

Parameters
channelChannel index.
Returns
Info struct containing type, voltage range, step, and name. Returns an UNKNOWN entry if the channel index is out of range.

Implemented in AXP192Channel, AXP202Channel, and AXP2101Channel.

Referenced by setup().

◆ getVoltage()

virtual uint16_t PmicChannelBase::getVoltage ( uint8_t  channel)
pure virtual

Get the current output voltage of a channel.

Parameters
channelChannel index.
Returns
Output voltage in millivolts, or 0 on error or invalid channel.

Implemented in AXP192Channel, AXP202Channel, and AXP2101Channel.

Referenced by setup().

◆ isEnabled()

virtual bool PmicChannelBase::isEnabled ( uint8_t  channel)
pure virtual

Check whether a power output channel is currently enabled.

Parameters
channelChannel index.
Returns
true if the channel is enabled, false otherwise.

Implemented in AXP192Channel, AXP202Channel, and AXP2101Channel.

◆ setVoltage()

virtual bool PmicChannelBase::setVoltage ( uint8_t  channel,
uint16_t  mV 
)
pure virtual

Set the output voltage of a channel.

Parameters
channelChannel index.
mVDesired voltage in millivolts. Value will be quantized to the nearest valid step within the channel's range.
Returns
true on success, false if channel is invalid or voltage out of range.
Note
Each channel has a specific range and step defined in getInfo(). Call getVoltage() after setVoltage() to read back the quantized value.

Implemented in AXP192Channel, AXP202Channel, and AXP2101Channel.

Referenced by setup().


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