48 constexpr uint16_t kTable[7] = {1100, 1200, 1350, 1500, 1800, 2500, 3000};
49 const uint8_t c =
static_cast<uint8_t
>(code & 0x3FU);
50 return c < 7U ? kTable[c] : 3300U;
58 return static_cast<uint16_t
>(600U + (
static_cast<uint32_t
>(code & 0x3FU) * 25U + 1U) / 2U);
70 for (uint8_t code = 0; code < 64U; ++code) {
83 return static_cast<uint16_t
>(1800U + 100U * (code & 0x0FU));
94 case 1100:
return 0x00;
95 case 1200:
return 0x01;
96 case 1350:
return 0x02;
97 case 1500:
return 0x03;
98 case 1800:
return 0x04;
99 case 2500:
return 0x05;
100 case 3000:
return 0x06;
101 case 3300:
return 0x07;
102 default:
return 0xFFU;
119 const uint8_t c =
static_cast<uint8_t
>(code & 0x1FU);
122 return static_cast<uint16_t
>(1800U + 100U * c);
127 return static_cast<uint16_t
>(750U + 50U * c);
129 return static_cast<uint16_t
>(1800U + 100U * (c - 0x10U));
159 const uint8_t code =
static_cast<uint8_t
>((reg_value >> 3U) & 0x1FU);
162 return static_cast<uint16_t
>(10U + 5U * code);
166 case 0x09:
return 100;
167 case 0x0A:
return 150;
168 case 0x0B:
return 200;
169 case 0x0C:
return 300;
170 case 0x0D:
return 400;
171 case 0x0E:
return 500;
172 case 0x0F:
return 600;
173 case 0x10:
return 700;
174 case 0x11:
return 800;
175 case 0x12:
return 900;
176 case 0x13:
return 1000;
177 case 0x14:
return 1500;
189 uint8_t code = 0xFFU;
191 case 10: code = 0x00;
break;
192 case 100: code = 0x09;
break;
193 case 500: code = 0x0E;
break;
194 case 1000: code = 0x13;
break;
195 case 1500: code = 0x14;
break;
197 return (code == 0xFFU) ? 0xFFU :
static_cast<uint8_t
>(code << 3U);
210 switch (code & 0x03U) {
225 switch (reg & 0x3FU) {
237 switch (reg & 0x0FU) {
258static_assert(
SwCodeToMillivolts(0x06) == 3000,
"SW code 0x06 → 3.00 V (Portenta SW1 RUN)");
260 "SwVoltageCode::V3_3 must decode to 3.30 V");
262 "SW3 code 0x0D → 3.10 V (Table 37)");
263static_assert(
SwCodeToMillivolts(0x0D) == 3300,
"SW1/SW2 DVS-disabled: every code ≥ 7 is 3.30 V");
266 "SW1/SW2 DVS-enabled: 0.6 V + 12.5 mV steps");
269 "DVS encode is the inverse of SwDvsCodeToMillivolts");
273 "LDO1 code 0x05 → 1.0 V");
275 "LDO2 code 0x00 → 1.8 V");
277 "LDO3 code 0x09 → 1.2 V");
279 "Portenta sets 0xA0 (code 0x14) → 1500 mA per VBUS_IN_LIM_CNFG lookup");
281 "VbusLimitMilliampsToReg(1500) must round-trip to 0xA0");
constexpr uint8_t SwMillivoltsToCode(uint16_t mv) noexcept
Build a 6-bit SW voltage code from millivolts (Portenta-verified codes).
Definition pf1550_voltage_tables.hpp:92
@ V1_8
1.800 V (LDO2 — code 0)
constexpr uint8_t SwDvsMillivoltsToCode(uint16_t mv) noexcept
Encode a DVS-enabled SW1 / SW2 voltage (Table 31, left column).
Definition pf1550_voltage_tables.hpp:69
constexpr ChargerState DecodeChargerSense(uint8_t reg) noexcept
Convert CHG_SNS (0x87) into a typed ChargerState.
Definition pf1550_voltage_tables.hpp:236
constexpr uint16_t VbusLimitRegToMilliamps(uint8_t reg_value) noexcept
Decode VBUS_IN_LIM_CNFG (absolute address 0x94) register byte to mA.
Definition pf1550_voltage_tables.hpp:158
constexpr uint16_t SwCodeToMillivolts(uint8_t code) noexcept
SW1 / SW2 output voltage, DVS disabled (OTP_SWx_DVS_SEL = 1).
Definition pf1550_voltage_tables.hpp:47
constexpr uint16_t LdoCodeToMillivolts(uint8_t code, bool is_ldo2) noexcept
Decode a 5-bit LDO voltage register field to millivolts.
Definition pf1550_voltage_tables.hpp:118
constexpr uint16_t SwDvsCodeToMillivolts(uint8_t code) noexcept
SW1 / SW2 output voltage, DVS enabled (OTP_SWx_DVS_SEL = 0): 0.6000 V + 12.5 mV × code (Table 31,...
Definition pf1550_voltage_tables.hpp:57
constexpr uint16_t Sw3CodeToMillivolts(uint8_t code) noexcept
SW3 output voltage (Table 37): 1.80 V + 100 mV × SW3_VOLT[3:0].
Definition pf1550_voltage_tables.hpp:82
PmicState
STATE_INFO[5:0] values (Reg 0x67) describing the PMIC state machine.
Definition pf1550_registers.hpp:226
@ Wait
Wait / start-up before regulators are sequenced.
@ RegsDisable
REGS_DISABLE — all regulators off (post PWRON long-press).
@ Sleep
SLEEP / LPSR — minimal regulators.
@ Standby
STANDBY — standby-enabled regulators only.
@ Run
RUN — all OTP-sequenced regulators enabled.
ChargerState
CHG_SNS[3:0] values (Reg 0x87) describing the charger sub-state.
Definition pf1550_registers.hpp:236
@ LinearOnly
Linear-only mode, no charge.
@ TempShutdown
Off because TJ > TSHDN.
@ FastCC
Fast-charge constant-current.
@ ThermSuspend
Thermistor suspend.
@ PreCharge
Precharge mode (V_BATT < V_PRECHG.LB).
@ EndOfCharge
End-of-charge (I_BAT = I_EOC).
@ Off
Input invalid or charger disabled.
@ BatteryOv
Battery overvoltage.
@ Done
Done — battery full.
@ FastCV
Fast-charge constant-voltage.
constexpr uint8_t VbusLimitMilliampsToReg(uint16_t mA) noexcept
Encode mA → VBUS_IN_LIM_CNFG (0x94) register byte (bits 7:3).
Definition pf1550_voltage_tables.hpp:188
@ V3_1
SW3 Table 37 code for 3.100 V (SW3 is OTP-loaded, read-only; SW1/SW2 decode 0x0D as 3....
@ V3_3
3.300 V (SW2 RUN on Portenta — carrier +3V3)
constexpr PmicState DecodeStateInfo(uint8_t reg) noexcept
Convert STATE_INFO (0x67) full byte into a typed PmicState.
Definition pf1550_voltage_tables.hpp:224
constexpr uint16_t SwCurrentLimitCodeToMilliamps(uint8_t code) noexcept
Decode the SW3_CTRL1[1:0] (or SW1/SW2_CTRL1) current limit field.
Definition pf1550_voltage_tables.hpp:209
NXP PF1550 family I2C register map, bit-field constants, and OTP keys.