30#include "../../../SensorBuildOpt.h"
31#if !SENSORLIB_EXCLUDE_PMIC_AXP192
41static uint8_t getEnableBit(uint8_t channel)
61 if (val < 0)
return false;
69 uint8_t bit = getEnableBit(channel);
70 if (bit == 0xFF)
return false;
81 if (val < 0)
return false;
82 return (val & 0x02) != 0;
85 uint8_t bit = getEnableBit(channel);
86 if (bit == 0xFF)
return false;
96 if (mV < 700) mV = 700;
97 if (mV > 3500) mV = 3500;
98 uint8_t code = (mV - 700) / 25;
102 if (mV < 700) mV = 700;
103 if (mV > 2275) mV = 2275;
104 uint8_t code = (mV - 700) / 25;
108 if (mV < 700) mV = 700;
109 if (mV > 3500) mV = 3500;
110 uint8_t code = (mV - 700) / 25;
114 if (mV < 1800) mV = 1800;
115 if (mV > 3300) mV = 3300;
116 uint8_t code = (mV - 1800) / 100;
120 if (mV < 1800) mV = 1800;
121 if (mV > 3300) mV = 3300;
122 uint8_t code = (mV - 1800) / 100;
126 if (mV < 1800) mV = 1800;
127 if (mV > 3300) mV = 3300;
128 uint8_t code = (mV - 1800) / 100;
145 if (val < 0)
return 0;
146 return ((val & 0x7F) * 25) + 700;
150 if (val < 0)
return 0;
151 return ((val & 0x3F) * 25) + 700;
155 if (val < 0)
return 0;
156 return (val * 25) + 700;
160 if (val < 0)
return 0;
161 uint8_t code = (val >> 4) & 0x0F;
162 return (code * 100) + 1800;
166 if (val < 0)
return 0;
167 uint8_t code = val & 0x0F;
168 return (code * 100) + 1800;
172 if (val < 0)
return 0;
173 uint8_t code = (val >> 4) & 0x0F;
174 return (code * 100) + 1800;
190 static const Info channelInfo[] = {
202 return channelInfo[channel];
static constexpr uint8_t CH_LDOio
bool setVoltage(uint8_t channel, uint16_t mV) override
Set output voltage for a channel.
static constexpr uint8_t CH_DCDC1
bool enable(uint8_t channel, bool enable) override
Enable or disable a power output channel.
Info getInfo(uint8_t channel) const override
Get channel information (type, name, min/max/step)
static constexpr uint8_t CH_LDO2
static constexpr uint8_t CH_LDO3
static constexpr uint8_t CH_DCDC3
static constexpr uint8_t CH_DCDC2
static constexpr uint8_t CH_EXTEN
uint16_t getVoltage(uint8_t channel) override
Get current output voltage for a channel.
static constexpr uint8_t CHANNEL_COUNT
uint8_t count() const override
Get total number of power output channels.
AXP192Channel(AXP192Core &core)
Construct channel control interface.
bool isEnabled(uint8_t channel) override
Check whether a power output channel is enabled.
@ LDO
Linear low-dropout regulator.
@ DCDC
Switching buck/boost converter.
bool clrRegBit(uint8_t reg, uint8_t bit)
bool getRegBit(uint8_t reg, uint8_t bit)
int readReg(uint8_t reg) const
int writeReg(uint8_t reg, uint8_t val)
int updateBits(uint8_t reg, uint8_t mask, uint8_t value_shifted)
bool setRegBit(uint8_t reg, uint8_t bit)
Static metadata for a single power output channel.
static constexpr uint8_t GPIO0_VOL
static constexpr uint8_t GPIO0_CTL
static constexpr uint8_t LDO23_DC123_EXT_CTL
static constexpr uint8_t LDO23OUT_VOL
static constexpr uint8_t DC1_VOLTAGE
static constexpr uint8_t DC3OUT_VOL
static constexpr uint8_t DC2OUT_VOL