PF1550 Driver 0.1.0
API reference
Loading...
Searching...
No Matches
pf1550_config.hpp
Go to the documentation of this file.
1
16#ifndef PF1550_CONFIG_HPP
17#define PF1550_CONFIG_HPP
18
19#include <array>
20#include <cstddef>
21#include <cstdint>
22
23#include "pf1550_codec.hpp"
24#include "pf1550_detail.hpp"
25#include "pf1550_sequencer.hpp"
26#include "pf1550_types.hpp"
27
28namespace pf1550 {
29
37struct RailLimits {
38 uint16_t min_mv{0};
39 uint16_t max_mv{0};
40 uint16_t max_load_ma{0};
41};
42
45struct Limits {
46 uint16_t cell_max_mv{0};
47 uint16_t cell_max_charge_ma{0};
48 uint16_t input_max_ma{0};
50 0};
52 std::array<RailLimits, kRailCount> rail{};
53};
54
70
72struct RailModes {
73 bool run{false};
74 bool standby{false};
75 bool sleep{false};
76 bool low_power{false};
77};
78
93
95struct LdoConfig {
96 bool apply{false};
99};
100
103 bool apply{false};
105};
106
109 bool apply{false};
111};
112
114struct CoinCell {
115 bool apply{false};
116 bool charge_enable{false};
117 uint16_t voltage_mv{1800};
118};
119
122 bool apply{false};
123 bool enable{false};
124 UsbPhyVoltage voltage{UsbPhyVoltage::V3p3};
125 bool active_discharge{true};
126};
127
129struct LedConfig {
130 bool apply{false};
131 bool enable{false};
132 uint8_t duty_32nds{0};
133 bool ramp{false};
134 LedFrequency frequency{LedFrequency::Hz1};
136 bool software_override{false};
137};
138
141 bool apply{false};
142 bool write_standby{false};
143 StandbyDelay standby_delay{StandbyDelay::Cycles1};
145 false};
146 bool write_debounce{false};
149 bool write_regscp{false};
151 bool write_low_sys_warn{false};
152 LowSysWarn low_sys_warn{LowSysWarn::Mv3300};
153 bool write_reset_paths{false};
156 bool onkey_reset{true};
157 GlobalReset global_reset{GlobalReset::S4};
158 bool write_uvdet{false};
159 Uvdet uvdet{Uvdet::Mv2650};
160};
161
167
177
180 Cold cold{Cold::C0};
181 Hot hot{Hot::C60};
182 Cool cool{Cool::C15};
183 Warm warm{Warm::C45};
184 CvAdjust cv_adjust{CvAdjust::Mv60};
185 CcAdjust cc_adjust{CcAdjust::Pct25};
186};
187
196
207
213
216 bool every_transition{false};
217 bool eoc{false};
218};
219
243
270
272namespace detail {
273
275constexpr bool InRange(uint32_t value, uint32_t low, uint32_t high) noexcept {
276 return (value >= low) && (value <= high);
277}
278
280constexpr const RailLimits& LimitsOf(const Limits& limits, Rail rail) noexcept {
281 return limits.rail[static_cast<std::size_t>(ToUnderlying(rail)) % kRailCount];
282}
283
285constexpr Error ValidateLimits(const Limits& l) noexcept {
286 if (!InRange(l.cell_max_mv, kChargeVoltageMinMv, kChargeVoltageMaxMv) ||
287 !InRange(l.cell_max_charge_ma, kChargeCurrentMinMa, kChargeCurrentMaxMa) ||
288 !InRange(l.input_max_ma, 10_u32, 1500_u32)) {
290 }
291 for (const RailLimits& r : l.rail) {
292 if (r.min_mv > r.max_mv) {
294 }
295 }
296 return Error::Ok;
297}
298
300constexpr Error ValidateChargerValues(const ChargerConfig& c, const Limits& l) noexcept {
301 if (!ChargeVoltageCode(c.charge_voltage_mv).ok() ||
302 !ChargeCurrentCode(c.charge_current_ma).ok() || !TerminationCode(c.termination_ma).ok() ||
303 !InputLimitCode(c.input_limit_ma).ok()) {
305 }
306 if ((c.charge_voltage_mv > l.cell_max_mv) || (c.charge_current_ma > l.cell_max_charge_ma) ||
307 (c.input_limit_ma > l.input_max_ma)) {
308 return Error::OutOfLimits;
309 }
310 return Error::Ok;
311}
312
314template <typename... E>
315constexpr bool AllEnumerators(const E&... values) noexcept {
316 return (IsEnumerator(values) && ...);
317}
318
320constexpr Error ValidateChargerEnums(const ChargerConfig& c) noexcept {
321 const bool ok =
322 AllEnumerators(c.mode, c.vsys_min, c.restart, c.fast_timer, c.eoc_timer, c.precharge_timer,
323 c.thermistor, c.thermal_reg, c.watchdog.time, c.batfet.oc_threshold);
324 const bool vbus_ok =
325 AllEnumerators(c.vbus.dpm, c.vbus.dpm_stop, c.vbus.ovlo_debounce, c.vbus.vbus2sys_debounce,
326 c.vbus.sys_wakeup_delay, c.vbus.vbus2sys_threshold);
327 const bool jeita_ok = AllEnumerators(c.jeita.cold, c.jeita.hot, c.jeita.cool, c.jeita.warm,
328 c.jeita.cv_adjust, c.jeita.cc_adjust);
329 return (ok && vbus_ok && jeita_ok) ? Error::Ok : Error::InvalidArgument;
330}
331
333constexpr bool Unacknowledged(bool downgrade, bool acknowledged) noexcept {
334 return downgrade && !acknowledged;
335}
336
338constexpr bool KeepsClosedOnFault(const FaultPolicy& p) noexcept {
339 return p.keep_closed_on_overvoltage || p.keep_closed_on_watchdog || p.keep_closed_on_thermistor ||
340 p.keep_closed_on_thermal_shutdown || p.keep_closed_on_timer_fault;
341}
342
344constexpr bool ChargerProtectionUnacknowledged(const ChargerConfig& c,
345 const Acknowledgements& a) noexcept {
346 return Unacknowledged(c.fast_timer == FastChargeTimer::Disabled, a.allow_untimed_charge) ||
347 Unacknowledged(c.thermistor == Thermistor::Ignore, a.battery_has_own_ntc_protection) ||
348 Unacknowledged(c.termination_ma < 20U, a.eoc_accuracy_accepted);
349}
350
352constexpr bool BatfetUnacknowledged(const BatfetConfig& b, const Acknowledgements& a) noexcept {
353 const bool oc_off =
354 (b.oc_threshold == BatfetOc::Disabled) || b.oc_keeps_closed || !b.oc_without_vbus;
355 return Unacknowledged(KeepsClosedOnFault(b.fault_policy), a.allow_batfet_closed_on_fault) ||
356 Unacknowledged(oc_off, a.allow_batfet_oc_off) ||
357 Unacknowledged(b.disable, a.allow_batfet_off);
358}
359
361constexpr Error ValidateChargerAcks(const ChargerConfig& c, const Acknowledgements& a) noexcept {
362 const bool unsafe = ChargerProtectionUnacknowledged(c, a) || BatfetUnacknowledged(c.batfet, a);
363 return unsafe ? Error::Unsafe : Error::Ok;
364}
365
367constexpr Error ValidateCharger(const Config& c) noexcept {
368 if (!c.charger.apply) {
369 return Error::Ok;
370 }
371 if (const Error e = ValidateChargerEnums(c.charger); e != Error::Ok) {
372 return e;
373 }
374 if (const Error e = ValidateChargerValues(c.charger, c.limits); e != Error::Ok) {
375 return e;
376 }
377 return ValidateChargerAcks(c.charger, c.ack);
378}
379
381constexpr Error ValidateModes(const RailModes& m, const RailLimits& r,
382 const Acknowledgements& a) noexcept {
383 const bool any = m.run || m.standby || m.sleep;
384 if ((m.standby || m.sleep) && !m.run) {
385 return Error::InvalidArgument; // Table 42: STBY_EN and OMODE act only with EN = 1
386 }
387 if (any && (r.max_mv == 0U)) {
388 return Error::OutOfLimits;
389 }
390 if (m.low_power && !a.load_below_10ma) {
391 return Error::Unsafe;
392 }
393 return Error::Ok;
394}
395
397constexpr Error ValidateVolt(Rail rail, Microvolts v, const Limits& l) noexcept {
398 if (v.value == 0U) {
399 return Error::Ok;
400 }
401 const bool buck = (rail == Rail::Sw1) || (rail == Rail::Sw2);
402 const bool on_grid = buck ? BuckDvsCode(v.value).ok() : LdoCode(rail, v.value).ok();
403 if (!on_grid) {
405 }
406 const RailLimits& r = LimitsOf(l, rail);
407 const uint32_t mv = v.value / 1000U;
408 return ((r.max_mv != 0U) && (mv >= r.min_mv) && (mv <= r.max_mv)) ? Error::Ok
410}
411
413constexpr Error ValidateBuck(const BuckConfig& b, Rail rail, const Config& c) noexcept {
414 if (!b.apply) {
415 return Error::Ok;
416 }
417 if (!IsEnumerator(b.dvs) || !IsEnumerator(b.current_limit) || !IsEnumerator(b.dvs_speed)) {
419 }
420 const bool sets_volt =
421 (b.run_uv.value != 0U) || (b.standby_uv.value != 0U) || (b.sleep_uv.value != 0U);
422 if (sets_volt && ((rail == Rail::Sw3) || (b.dvs != Dvs::Enabled))) {
423 return Error::ReadOnlyRail;
424 }
425 for (const Microvolts v : {b.run_uv, b.standby_uv, b.sleep_uv}) {
426 if (const Error e = ValidateVolt(rail, v, c.limits); e != Error::Ok) {
427 return e;
428 }
429 }
430 return ValidateModes(b.modes, LimitsOf(c.limits, rail), c.ack);
431}
432
434constexpr Error ValidateLdo(const LdoConfig& b, Rail rail, const Config& c) noexcept {
435 if (!b.apply) {
436 return Error::Ok;
437 }
438 if (const Error e = ValidateVolt(rail, b.volt, c.limits); e != Error::Ok) {
439 return e;
440 }
441 return ValidateModes(b.modes, LimitsOf(c.limits, rail), c.ack);
442}
443
445constexpr Error ValidateRails(const Config& c) noexcept {
446 const std::array<Error, 3> buck = {{ValidateBuck(c.sw1, Rail::Sw1, c),
447 ValidateBuck(c.sw2, Rail::Sw2, c),
448 ValidateBuck(c.sw3, Rail::Sw3, c)}};
449 const std::array<Error, 3> ldo = {{ValidateLdo(c.ldo1, Rail::Ldo1, c),
450 ValidateLdo(c.ldo2, Rail::Ldo2, c),
451 ValidateLdo(c.ldo3, Rail::Ldo3, c)}};
452 for (const Error e : buck) {
453 if (e != Error::Ok) {
454 return e;
455 }
456 }
457 for (const Error e : ldo) {
458 if (e != Error::Ok) {
459 return e;
460 }
461 }
462 if (c.vrefddr.apply) {
463 return ValidateModes(c.vrefddr.modes, LimitsOf(c.limits, Rail::VrefDdr), c.ack);
464 }
465 return Error::Ok;
466}
467
469constexpr Error ValidatePeripherals(const Config& c) noexcept {
470 if (c.coin.apply) {
471 if (!CoinVoltageCode(c.coin.voltage_mv).ok()) {
473 }
474 if (c.coin.charge_enable && !c.ack.coin_cell_is_rechargeable) {
475 return Error::Unsafe;
476 }
477 if ((c.coin.voltage_mv > 1800U) && (c.limits.coin_cell_max_mv < 3300U)) {
478 return Error::OutOfLimits;
479 }
480 }
481 if (c.usbphy.apply && !IsEnumerator(c.usbphy.voltage)) {
483 }
484 if (c.led.apply &&
485 ((c.led.duty_32nds > 32U) || !IsEnumerator(c.led.frequency) || !IsEnumerator(c.led.mode))) {
487 }
488 return Error::Ok;
489}
490
492constexpr Error ValidatePowerControl(const PowerConfig& p, const Acknowledgements& a) noexcept {
493 if (!p.apply) {
494 return Error::Ok;
495 }
496 const bool enums = AllEnumerators(p.standby_delay, p.pwron_debounce, p.onkey_debounce,
497 p.low_sys_warn, p.global_reset, p.uvdet);
498 if (!enums) {
500 }
501 const bool unsafe = Unacknowledged(p.write_reset_paths, a.hard_reset_paths) ||
502 Unacknowledged(p.write_uvdet, a.undervoltage_threshold);
503 return unsafe ? Error::Unsafe : Error::Ok;
504}
505
507constexpr Error ValidatePowerDown(const PowerDownConfig& d, const Acknowledgements& a) noexcept {
508 if (!d.apply) {
509 return Error::Ok;
510 }
511 for (const uint8_t v : d.sequence.order) {
512 if (v > kMaxSequenceNumber) {
514 }
515 }
516 return a.power_down_order_reviewed ? Error::Ok : Error::Unsafe;
517}
518
520constexpr Error ValidatePower(const Config& c) noexcept {
521 if (const Error e = ValidatePowerControl(c.power, c.ack); e != Error::Ok) {
522 return e;
523 }
524 return ValidatePowerDown(c.power_down, c.ack);
525}
526
528constexpr Error ValidateOrder(const Config& c) noexcept {
529 std::array<bool, kRailCount> seen{};
530 for (const Rail r : c.rail_order) {
531 if (!IsEnumerator(r)) {
533 }
534 seen[static_cast<std::size_t>(ToUnderlying(r))] = true;
535 }
536 for (const bool s : seen) {
537 if (!s) {
539 }
540 }
541 return IsEnumerator(c.as_found_policy) ? Error::Ok : Error::InvalidArgument;
542}
543
544} // namespace detail
545
557constexpr Error Validate(const Config& config) noexcept {
558 if (const Error e = detail::ValidateLimits(config.limits); e != Error::Ok) {
559 return e;
560 }
561 if (const Error e = detail::ValidateOrder(config); e != Error::Ok) {
562 return e;
563 }
564 if (const Error e = detail::ValidateCharger(config); e != Error::Ok) {
565 return e;
566 }
567 if (const Error e = detail::ValidateRails(config); e != Error::Ok) {
568 return e;
569 }
570 if (const Error e = detail::ValidatePeripherals(config); e != Error::Ok) {
571 return e;
572 }
573 return detail::ValidatePower(config);
574}
575
581constexpr Limits SingleCellLimits() noexcept {
582 Limits l{};
583 l.cell_max_mv = 4200;
584 l.cell_max_charge_ma = 500;
585 l.input_max_ma = 1000;
586 return l;
587}
588
589static_assert(Validate(Config{.limits = SingleCellLimits()}) == Error::Ok);
590static_assert(Validate(Config{}) == Error::InvalidArgument);
591
594} // namespace pf1550
595
596#endif // PF1550_CONFIG_HPP
constexpr uint32_t kChargeCurrentMaxMa
Highest charge current, mA.
Definition pf1550_codec.hpp:37
constexpr uint32_t kChargeCurrentMinMa
Charge current range, mA (Table 159: codes 0 to 18).
Definition pf1550_codec.hpp:35
constexpr Result< uint8_t > LdoCode(Rail rail, uint32_t uv) noexcept
LDO voltage code.
Definition pf1550_codec.hpp:206
constexpr Result< uint8_t > CoinVoltageCode(uint32_t mv) noexcept
VCOIN code for a coin cell charge voltage (1.8 V + 100 mV x code, ambiguity C40).
Definition pf1550_codec.hpp:247
constexpr Result< uint8_t > ChargeCurrentCode(uint32_t ma) noexcept
CHG_CC code for a charge current.
Definition pf1550_codec.hpp:87
constexpr Result< uint8_t > ChargeVoltageCode(uint32_t mv) noexcept
CHGCV code for a charge voltage.
Definition pf1550_codec.hpp:59
constexpr Result< uint8_t > BuckDvsCode(uint32_t uv) noexcept
DVS-mode buck code for a voltage (SW1, SW2: 0.6 V + 12.5 mV x code).
Definition pf1550_codec.hpp:165
constexpr Result< uint8_t > InputLimitCode(uint32_t ma) noexcept
VBUS_LIN_ILIM code for an input current limit.
Definition pf1550_codec.hpp:139
constexpr uint32_t kChargeVoltageMinMv
Lowest charge voltage (CHGCV code 8), mV (Table 160).
Definition pf1550_codec.hpp:31
constexpr Result< uint8_t > TerminationCode(uint32_t ma) noexcept
IEOC code for a termination current.
Definition pf1550_codec.hpp:111
constexpr uint32_t kChargeVoltageMaxMv
Highest charge voltage (CHGCV code 55), mV.
Definition pf1550_codec.hpp:33
constexpr Error Validate(const Config &config) noexcept
Check a configuration without touching the chip.
Definition pf1550_config.hpp:557
constexpr Limits SingleCellLimits() noexcept
A Limits for a 4.2 V single cell charged at up to 500 mA from a 1 A supply; a starting point whose nu...
Definition pf1550_config.hpp:581
constexpr uint8_t kMaxSequenceNumber
Largest sequence number a *_PWRUP_SEQ or *_PWRDN_SEQ field holds.
Definition pf1550_sequencer.hpp:50
Error
Why a call failed. Every call of the driver returns one of these in its Result.
Definition pf1550_types.hpp:38
Uvdet
VSYS undervoltage detect, rising threshold (UVDET, Table 137).
Definition pf1550_types.hpp:430
Vbus2SysThreshold
VBUS to VSYS comparator threshold (VBUS2SYS_THRSH).
Definition pf1550_types.hpp:402
ThermalRegTemp
Junction temperature where charge current folds back (REGTEMP, Table 162).
Definition pf1550_types.hpp:342
UsbPhyVoltage
USBPHY LDO voltage (USBPHY, Table 165).
Definition pf1550_types.hpp:405
BatfetOc
Battery discharge overcurrent threshold (BATFET_OC, Table 161).
Definition pf1550_types.hpp:355
Debounce
Button debounce (PWRONDBNC, ONKEYDBNC; codes 00 and 01 are equal, ambiguity C41).
Definition pf1550_types.hpp:420
constexpr std::size_t kRailCount
Number of rails.
Definition pf1550_types.hpp:259
ShortDebounce
Short debounce times (VBUS_OV_TDB, VBUS2SYS_TDB; code 0 is reserved and not offered).
Definition pf1550_types.hpp:392
ChargerMode
Charger operating mode (CHG_OPER, Table 156).
Definition pf1550_types.hpp:282
LedMode
LED mode (LED_CFG).
Definition pf1550_types.hpp:411
StandbyDelay
STANDBY pin delay in 32 kHz cycles (STANDBYDLY, Table 135).
Definition pf1550_types.hpp:417
Restart
Charge restart threshold below CHGCV (CHG_RESTART, Table 158).
Definition pf1550_types.hpp:319
CvAdjust
JEITA charge voltage reduction (CV_ADJ, Table 168).
Definition pf1550_types.hpp:372
GlobalReset
ONKEY hold time for a global reset (TGRESET, Table 135).
Definition pf1550_types.hpp:427
SwCurrentLimit
Buck current limit, typical (SWx_ILIM, Tables 116, 121, 126).
Definition pf1550_types.hpp:268
Warm
Warm threshold (THM_WARM).
Definition pf1550_types.hpp:369
WatchdogTime
Charger watchdog period (WD_TIME, Table 161; the table prints 0 twice, ambiguity C8).
Definition pf1550_types.hpp:349
AsFoundPolicy
What to do when the charger is found on and unsafe at start-up.
Definition pf1550_types.hpp:436
FastChargeTimer
Fast-charge timer (FCHGTIME, Table 157).
Definition pf1550_types.hpp:289
Dvs
Whether the OTP configured a buck for dynamic voltage scaling (OTP_SWx_DVS_SEL).
Definition pf1550_types.hpp:262
Thermistor
Thermistor behaviour (THM_CNFG, Table 162).
Definition pf1550_types.hpp:334
Cold
Cold threshold (THM_COLD).
Definition pf1550_types.hpp:363
LowSysWarn
Low system voltage warning, rising threshold (LOW_SYS_WARN, Table 137).
Definition pf1550_types.hpp:433
DvsSpeed
DVS slew rate (SWx_DVSSPEED).
Definition pf1550_types.hpp:276
Rail
The power rails the driver configures.
Definition pf1550_types.hpp:249
LedFrequency
LED PWM frequency (LED_FREQ, Table 172).
Definition pf1550_types.hpp:408
CcAdjust
JEITA charge current as a share of IFC (CC_ADJ, Table 168).
Definition pf1550_types.hpp:374
EocTimer
End-of-charge timer (EOCTIME, Table 157): 0 is a 16 s debounce, then 10 min steps.
Definition pf1550_types.hpp:301
SystemMin
Minimum system voltage (VSYSMIN, Table 160).
Definition pf1550_types.hpp:327
Hot
Hot threshold (THM_HOT).
Definition pf1550_types.hpp:365
WakeupDelay
System wake-up delay (SYS_WKUP_DLY, Table 166).
Definition pf1550_types.hpp:399
DpmVoltage
VBUS input regulation (DPM) voltage (VBUS_DPM_REG, Table 164): 3.9 V + 100 mV x code.
Definition pf1550_types.hpp:377
Cool
Cool threshold (THM_COOL).
Definition pf1550_types.hpp:367
PrechargeTimer
Precharge timer (TPRECHG, Table 157).
Definition pf1550_types.hpp:313
DpmStop
DPM panic stop threshold (VIN_DPM_STOP).
Definition pf1550_types.hpp:389
@ OutOfLimits
A valid value outside the caller's Limits; nothing was sent.
@ ReadOnlyRail
SW3, or SW1 or SW2 not declared in DVS mode: its voltage is not written.
@ Ok
The call succeeded.
@ Unsafe
A safety downgrade without its acknowledgement; nothing was sent.
@ C95
95 degC (reset value).
@ Disabled
No protection: needs the acknowledgement allow_batfet_oc_off.
@ A3p2
3.2 A typical (reset value).
@ Ms31
31.25 ms falling, 31.25 ms rising (register code 0).
@ Us100
100 us (register code 1).
@ LinearOnly
Linear regulator on, no battery charging (reset value).
@ OnWhileCharging
On while charging, flashing on a fault, off when done.
@ Mv150
150 mV (reset value).
@ S80
80 s (reset value).
@ Report
Return the error and write nothing (default).
@ Disabled
No timer: needs the acknowledgement allow_untimed_charge.
@ Hours4
4 hours (reset value).
@ Enabled
DVS: voltage is 0.6 V + 12.5 mV x code.
@ Disabled
Non-DVS: the voltage registers are read only and hold the fixed table.
@ Suspend
Charging stops outside cold and hot (reset value).
@ Ignore
Not in control: needs the acknowledgement battery_has_own_ntc_protection.
@ Us2
12.5 mV every 2 us.
@ Ldo3
LDO3, 300 mA, load switch capable.
@ Sw2
Buck 2, 1.0 A, DVS.
@ VrefDdr
DDR reference, 10 mA, fixed voltage.
@ Sw3
Buck 3, 1.0 A, voltage read only.
@ Ldo2
LDO2, 400 mA.
@ Sw1
Buck 1, 1.0 A, DVS.
@ Ldo1
LDO1, 300 mA, load switch capable.
@ Min10
10 min (reset value).
@ Mv4300
4.3 V (recommended, section 8.1).
@ Mv3900
3.9 V (reset value).
The PF1550 driver: everything it declares lives here; internals in detail.
Definition pf1550.hpp:39
Register codecs of the PF1550: voltage and current grids of the data sheet tables,...
Compile-time helpers of the PF1550 driver: typed integer literals, exact hook matching,...
The regulator power-up and power-down sequencer of the PF1550 as pure constexpr data: the pre-program...
Public types of the PF1550 driver: errors, Result<T>, enumerations, units, status and interrupt types...
Explicit acknowledgements; every flag defaults to false.
Definition pf1550_config.hpp:56
bool power_down_order_reviewed
Changing the power-down sequence.
Definition pf1550_config.hpp:67
bool coin_cell_is_rechargeable
Coin cell charger enabled.
Definition pf1550_config.hpp:63
bool allow_untimed_charge
Charge with the fast-charge timer disabled.
Definition pf1550_config.hpp:57
bool load_below_10ma
Low-power mode on a rail (specified to 10 mA).
Definition pf1550_config.hpp:62
bool dvs_on_unlisted_part
DVS declared on a part Table 85 does not list.
Definition pf1550_config.hpp:68
bool eoc_accuracy_accepted
5 or 10 mA termination (wide accuracy band).
Definition pf1550_config.hpp:61
bool battery_has_own_ntc_protection
Thermistor ignored by the charger.
Definition pf1550_config.hpp:58
bool hard_reset_paths
Changing ONKEY, PWRON, restart or TGRESET paths.
Definition pf1550_config.hpp:64
bool undervoltage_threshold
Changing the VSYS undervoltage detect threshold.
Definition pf1550_config.hpp:65
bool allow_batfet_closed_on_fault
BATFET stays closed on a charger fault.
Definition pf1550_config.hpp:59
bool allow_batfet_oc_off
Battery overcurrent protection reduced or off.
Definition pf1550_config.hpp:60
bool allow_batfet_off
DISBATFET: battery path forced off.
Definition pf1550_config.hpp:66
The battery FET (Tables 156, 161, 171).
Definition pf1550_config.hpp:198
bool disable
DISBATFET; needs allow_batfet_off.
Definition pf1550_config.hpp:199
bool oc_keeps_closed
BOVRC_DISBATFET; needs allow_batfet_oc_off.
Definition pf1550_config.hpp:201
FaultPolicy fault_policy
FAULT_BATFET_CNFG; keep closed needs allow_batfet_closed_on_fault.
Definition pf1550_config.hpp:205
BatfetOc oc_threshold
BATFET_OC; Disabled needs allow_batfet_oc_off.
Definition pf1550_config.hpp:200
bool oc_without_vbus
Definition pf1550_config.hpp:202
A buck regulator. apply = false leaves the block as the chip holds it.
Definition pf1550_config.hpp:80
Microvolts sleep_uv
SWx_SLP_VOLT (DVS only); 0 keeps it.
Definition pf1550_config.hpp:85
DvsSpeed dvs_speed
SWx_DVSSPEED (SW1 and SW2).
Definition pf1550_config.hpp:88
SwCurrentLimit current_limit
SWx_ILIM.
Definition pf1550_config.hpp:87
RailModes modes
Enables.
Definition pf1550_config.hpp:86
Microvolts run_uv
SWx_VOLT (DVS only); 0 keeps it.
Definition pf1550_config.hpp:83
bool fpwm_in_dvs
Forced PWM while the voltage steps down.
Definition pf1550_config.hpp:90
Microvolts standby_uv
SWx_STBY_VOLT (DVS only); 0 keeps it.
Definition pf1550_config.hpp:84
Dvs dvs
OTP_SWx_DVS_SEL, which the chip cannot report.
Definition pf1550_config.hpp:82
bool apply
Write this block in Configure().
Definition pf1550_config.hpp:81
bool fpwm
Forced PWM.
Definition pf1550_config.hpp:89
bool output_discharge
Discharge resistor when disabled (RDIS_ENB).
Definition pf1550_config.hpp:91
The charger. apply = false leaves it as found. Voltage, current and input limit have no default: they...
Definition pf1550_config.hpp:222
EocTimer eoc_timer
EOCTIME.
Definition pf1550_config.hpp:232
FastChargeTimer fast_timer
FCHGTIME.
Definition pf1550_config.hpp:231
ThermalRegTemp thermal_reg
REGTEMP.
Definition pf1550_config.hpp:235
Restart restart
CHG_RESTART.
Definition pf1550_config.hpp:230
ChargerMode mode
CHG_OPER, written last.
Definition pf1550_config.hpp:224
VbusOptions vbus
VBUS options.
Definition pf1550_config.hpp:239
bool apply
Write the charger in Configure().
Definition pf1550_config.hpp:223
uint16_t charge_current_ma
CHG_CC, 100 to 1000 step 50; at most cell_max_charge_ma.
Definition pf1550_config.hpp:226
WatchdogConfig watchdog
WDTEN and WD_TIME.
Definition pf1550_config.hpp:237
JeitaConfig jeita
JEITA.
Definition pf1550_config.hpp:240
ChargerInterrupts interrupts
CHG_INT_CNFG.
Definition pf1550_config.hpp:241
BatfetConfig batfet
Battery FET.
Definition pf1550_config.hpp:238
SystemMin vsys_min
VSYSMIN (differs from the reset value 3.5 V).
Definition pf1550_config.hpp:229
PrechargeTimer precharge_timer
TPRECHG.
Definition pf1550_config.hpp:233
bool thermal_foldback
TEMP_FB_EN (differs from the reset value 0).
Definition pf1550_config.hpp:236
uint16_t input_limit_ma
VBUS_LIN_ILIM, one of 21 values; at most input_max_ma.
Definition pf1550_config.hpp:228
Thermistor thermistor
THM_CNFG.
Definition pf1550_config.hpp:234
uint16_t termination_ma
IEOC: 5, 10, 20, 30 or 50.
Definition pf1550_config.hpp:227
uint16_t charge_voltage_mv
CHGCV, 3500 to 4440 step 20; at most cell_max_mv.
Definition pf1550_config.hpp:225
Charger interrupt options (Table 167).
Definition pf1550_config.hpp:215
bool eoc
EOC_INT.
Definition pf1550_config.hpp:217
bool every_transition
CHG_INT_GEN.
Definition pf1550_config.hpp:216
The coin cell charger (Table 111).
Definition pf1550_config.hpp:114
bool charge_enable
COINCHEN; needs coin_cell_is_rechargeable.
Definition pf1550_config.hpp:116
bool apply
Write this block in Configure().
Definition pf1550_config.hpp:115
uint16_t voltage_mv
VCOIN, 1800 to 3300 in 100 mV steps (needs coin_cell_max_mv).
Definition pf1550_config.hpp:117
Everything the driver writes. The constructor stores it with no I/O.
Definition pf1550_config.hpp:245
AsFoundPolicy as_found_policy
What to do with an unsafe charger found on.
Definition pf1550_config.hpp:267
LdoConfig ldo3
LDO3.
Definition pf1550_config.hpp:254
BuckConfig sw3
Buck 3 (voltage read only).
Definition pf1550_config.hpp:251
VrefDdrConfig vrefddr
VREFDDR.
Definition pf1550_config.hpp:255
bool apply_irq_mask
Write irq_mask in Configure().
Definition pf1550_config.hpp:262
BuckConfig sw1
Buck 1.
Definition pf1550_config.hpp:249
PowerDownConfig power_down
Power-down order.
Definition pf1550_config.hpp:261
CoinCell coin
Coin cell charger.
Definition pf1550_config.hpp:257
PowerConfig power
Power control.
Definition pf1550_config.hpp:260
VsnvsConfig vsnvs
VSNVS.
Definition pf1550_config.hpp:256
LdoConfig ldo1
LDO1.
Definition pf1550_config.hpp:252
IrqMask irq_mask
Definition pf1550_config.hpp:263
LedConfig led
LED.
Definition pf1550_config.hpp:259
Acknowledgements ack
Explicit downgrades.
Definition pf1550_config.hpp:247
std::array< Rail, kRailCount > rail_order
The order in which Configure() writes the rails: a buck that feeds an LDO goes first.
Definition pf1550_config.hpp:265
Limits limits
Mandatory.
Definition pf1550_config.hpp:246
ChargerConfig charger
The charger.
Definition pf1550_config.hpp:248
BuckConfig sw2
Buck 2.
Definition pf1550_config.hpp:250
LdoConfig ldo2
LDO2.
Definition pf1550_config.hpp:253
UsbPhyConfig usbphy
USBPHY LDO.
Definition pf1550_config.hpp:258
BATFET behaviour per fault; false opens the BATFET (the reset value, the safe one).
Definition pf1550_config.hpp:189
bool keep_closed_on_watchdog
WDFLT_BFET_EN.
Definition pf1550_config.hpp:191
bool keep_closed_on_thermistor
THMSUS_BFET_EN.
Definition pf1550_config.hpp:192
bool keep_closed_on_thermal_shutdown
TSHDN_BFET_EN.
Definition pf1550_config.hpp:193
bool keep_closed_on_overvoltage
OVFLT_BFET_EN.
Definition pf1550_config.hpp:190
bool keep_closed_on_timer_fault
TMRFLT_BFET_EN.
Definition pf1550_config.hpp:194
Interrupt masks, one byte per group; a set bit masks the source. The default masks every source,...
Definition pf1550_types.hpp:556
JEITA thresholds and reductions (Tables 162, 168).
Definition pf1550_config.hpp:179
CvAdjust cv_adjust
CV_ADJ.
Definition pf1550_config.hpp:184
Cool cool
THM_COOL.
Definition pf1550_config.hpp:182
CcAdjust cc_adjust
CC_ADJ.
Definition pf1550_config.hpp:185
Hot hot
THM_HOT.
Definition pf1550_config.hpp:181
Warm warm
THM_WARM.
Definition pf1550_config.hpp:183
Cold cold
THM_COLD.
Definition pf1550_config.hpp:180
An LDO.
Definition pf1550_config.hpp:95
Microvolts volt
LDOx_VOLT; 0 keeps it.
Definition pf1550_config.hpp:97
bool apply
Write this block in Configure().
Definition pf1550_config.hpp:96
RailModes modes
Enables.
Definition pf1550_config.hpp:98
The charger LED driver (Tables 170 and 172).
Definition pf1550_config.hpp:129
uint8_t duty_32nds
LED_PWM duty n/32, 0 to 32 (ambiguity C43).
Definition pf1550_config.hpp:132
bool software_override
LEDOVRD.
Definition pf1550_config.hpp:136
bool enable
LED_EN.
Definition pf1550_config.hpp:131
bool ramp
LED_RAMP.
Definition pf1550_config.hpp:133
bool apply
Write this block in Configure().
Definition pf1550_config.hpp:130
LedMode mode
LED_CFG.
Definition pf1550_config.hpp:135
LedFrequency frequency
LED_FREQ.
Definition pf1550_config.hpp:134
What the application's hardware tolerates. No defaults: Validate() rejects unset ones.
Definition pf1550_config.hpp:45
uint16_t input_max_ma
What the supply can deliver, 10 to 1500 mA.
Definition pf1550_config.hpp:48
uint16_t cell_max_charge_ma
Highest charge current the cell allows, 100 to 1000 mA.
Definition pf1550_config.hpp:47
uint16_t cell_max_mv
Highest charge voltage the cell allows, 3500 to 4440 mV.
Definition pf1550_config.hpp:46
std::array< RailLimits, kRailCount > rail
Per rail, indexed by Rail.
Definition pf1550_config.hpp:52
uint16_t coin_cell_max_mv
Definition pf1550_config.hpp:49
A voltage in microvolts, so that grids such as 12.5 mV steps stay exact.
Definition pf1550_types.hpp:191
Power control (Tables 135 to 137).
Definition pf1550_config.hpp:140
StandbyDelay standby_delay
STANDBYDLY.
Definition pf1550_config.hpp:143
bool write_regscp
Write ldo_off_on_current_limit.
Definition pf1550_config.hpp:149
bool write_low_sys_warn
Write low_sys_warn.
Definition pf1550_config.hpp:151
bool write_uvdet
Also write uvdet; needs undervoltage_threshold.
Definition pf1550_config.hpp:158
bool onkey_reset
ONKEY_RST_EN.
Definition pf1550_config.hpp:156
bool write_standby
Write standby_delay and standby_inverted.
Definition pf1550_config.hpp:142
bool write_debounce
Write both debounce times.
Definition pf1550_config.hpp:146
bool standby_inverted
STANDBYINV: 1 = the STANDBY pin is active low (flips the state).
Definition pf1550_config.hpp:144
bool apply
Write the fields below whose own write_... flag is set in Configure().
Definition pf1550_config.hpp:141
Debounce onkey_debounce
ONKEYDBNC.
Definition pf1550_config.hpp:148
LowSysWarn low_sys_warn
LOW_SYS_WARN.
Definition pf1550_config.hpp:152
bool pwron_long_press_reset
PWRONRSTEN.
Definition pf1550_config.hpp:154
bool ldo_off_on_current_limit
REGSCPEN.
Definition pf1550_config.hpp:150
Debounce pwron_debounce
PWRONDBNC.
Definition pf1550_config.hpp:147
Uvdet uvdet
UVDET.
Definition pf1550_config.hpp:159
GlobalReset global_reset
TGRESET.
Definition pf1550_config.hpp:157
bool write_reset_paths
Also write the next four fields; needs hard_reset_paths.
Definition pf1550_config.hpp:153
bool restart_on_long_press
RESTARTEN.
Definition pf1550_config.hpp:155
The power-down order (Tables 139 to 145); needs power_down_order_reviewed.
Definition pf1550_config.hpp:163
bool apply
Write the order in Configure().
Definition pf1550_config.hpp:164
PowerDownSequence sequence
Order values 0 to 7 per rail.
Definition pf1550_config.hpp:165
The registers of the power-down sequence (Tables 139 to 145).
Definition pf1550_types.hpp:582
The voltage window and load a rail's consumer tolerates. All zero means "not set".
Definition pf1550_config.hpp:37
uint16_t min_mv
Lowest voltage the load tolerates, mV.
Definition pf1550_config.hpp:38
uint16_t max_load_ma
The load's current, mA; 0 when not declared (informational).
Definition pf1550_config.hpp:40
uint16_t max_mv
Highest voltage the load tolerates, mV; 0 forbids configuring the rail.
Definition pf1550_config.hpp:39
Per-state rail enables (EN, STBY_EN, OMODE, LPWR).
Definition pf1550_config.hpp:72
bool low_power
Low-power mode in STANDBY and SLEEP; needs load_below_10ma.
Definition pf1550_config.hpp:76
bool run
Enabled in RUN.
Definition pf1550_config.hpp:73
bool sleep
Enabled in SLEEP.
Definition pf1550_config.hpp:75
bool standby
Enabled in STANDBY.
Definition pf1550_config.hpp:74
The USBPHY LDO (Table 165).
Definition pf1550_config.hpp:121
bool active_discharge
ACTDISPHY.
Definition pf1550_config.hpp:125
UsbPhyVoltage voltage
USBPHY.
Definition pf1550_config.hpp:124
bool enable
USBPHYLDO.
Definition pf1550_config.hpp:123
bool apply
Write this block in Configure().
Definition pf1550_config.hpp:122
VBUS options (Tables 164, 166, 169).
Definition pf1550_config.hpp:169
WakeupDelay sys_wakeup_delay
SYS_WKUP_DLY.
Definition pf1550_config.hpp:174
ShortDebounce ovlo_debounce
VBUS_OV_TDB.
Definition pf1550_config.hpp:172
DpmVoltage dpm
VBUS_DPM_REG.
Definition pf1550_config.hpp:170
ShortDebounce vbus2sys_debounce
VBUS2SYS_TDB.
Definition pf1550_config.hpp:173
DpmStop dpm_stop
VIN_DPM_STOP.
Definition pf1550_config.hpp:171
Vbus2SysThreshold vbus2sys_threshold
VBUS2SYS_THRSH.
Definition pf1550_config.hpp:175
VREFDDR.
Definition pf1550_config.hpp:102
bool apply
Write this block in Configure().
Definition pf1550_config.hpp:103
RailModes modes
Enables.
Definition pf1550_config.hpp:104
VSNVS.
Definition pf1550_config.hpp:108
bool apply
Write this block in Configure().
Definition pf1550_config.hpp:109
bool local_bandgap_disable
LIBGDIS: saves quiescent current in coin cell mode.
Definition pf1550_config.hpp:110
The charger watchdog. When on, ServiceChargerWatchdog() must run every 16 s or less.
Definition pf1550_config.hpp:209
WatchdogTime time
WD_TIME.
Definition pf1550_config.hpp:211
bool enable
WDTEN.
Definition pf1550_config.hpp:210