19#ifndef COMPONENT_HANDLER_PF1550_HANDLER_H_
20#define COMPONENT_HANDLER_PF1550_HANDLER_H_
27#include "base/BaseGpio.h"
28#include "base/BaseI2c.h"
30#include "core/hf-core-drivers/external/hf-pf1550-driver/inc/pf1550.hpp"
42 HalPf1550Comm(BaseI2c& i2c, BaseGpio* standby_gpio, BaseGpio* usb_vbus_en_gpio,
43 BaseGpio* usb_otg_en_gpio)
noexcept;
46 bool Write(uint8_t addr, uint8_t reg,
const uint8_t* data,
size_t len)
noexcept;
48 bool Read(uint8_t addr, uint8_t reg, uint8_t* data,
size_t len)
noexcept;
52 void GpioSet(pf1550::CtrlPin pin, pf1550::GpioSignal signal)
noexcept;
54 void DelayUs(uint32_t us)
noexcept;
95 BaseGpio* usb_vbus_en_gpio =
nullptr,
96 BaseGpio* usb_otg_en_gpio =
nullptr) noexcept;
110 bool ApplyProfile(std::span<const pf1550::profiles::RegisterWrite> profile)
noexcept;
128 bool SetUsbRails(
bool vbus_en,
bool otg_en) noexcept;
CRTP pf1550::BusInterface adapter mapping driver calls onto BaseI2c + optional BaseGpio strap pins.
Definition Pf1550Handler.h:40
bool Read(uint8_t addr, uint8_t reg, uint8_t *data, size_t len) noexcept
Repeated-start read of len bytes from register reg.
Definition Pf1550Handler.cpp:52
void GpioSet(pf1550::CtrlPin pin, pf1550::GpioSignal signal) noexcept
Drive a CtrlPin strap GPIO Active/Inactive.
Definition Pf1550Handler.cpp:62
BaseGpio * usb_vbus_en_gpio_
Definition Pf1550Handler.h:59
bool EnsureInitialized() noexcept
Idempotently bring up the underlying I²C peripheral.
Definition Pf1550Handler.cpp:60
BaseI2c & i2c_
Definition Pf1550Handler.h:57
bool Write(uint8_t addr, uint8_t reg, const uint8_t *data, size_t len) noexcept
Write len data bytes after register pointer reg.
Definition Pf1550Handler.cpp:36
BaseGpio * usb_otg_en_gpio_
Definition Pf1550Handler.h:60
void DelayUs(uint32_t us) noexcept
Coarse µs-precision delay used between profile writes.
Definition Pf1550Handler.cpp:78
BaseGpio * standby_gpio_
Definition Pf1550Handler.h:58
RtosMutex i2c_mutex_
Definition Pf1550Handler.h:61
Thread-safe PF1550 PMIC HAL handler.
Definition Pf1550Handler.h:82
BaseI2c & i2c_
Definition Pf1550Handler.h:181
bool ensureInitializedLocked() noexcept
Definition Pf1550Handler.cpp:96
bool SetUsbRails(bool vbus_en, bool otg_en) noexcept
Drive USB_VBUS_EN / USB_OTG_EN straps.
Definition Pf1550Handler.cpp:152
std::unique_ptr< HalPf1550Comm > comm_
Definition Pf1550Handler.h:185
BaseGpio * usb_vbus_en_gpio_
Definition Pf1550Handler.h:183
bool RunPowerSelfTest(pf1550::SelfTestResult &out) noexcept
Run boot-time self-test (uses internal snapshot path).
Definition Pf1550Handler.cpp:195
bool initialized_
Definition Pf1550Handler.h:187
bool RefreshStatusSnapshot() noexcept
Refresh the status part of the cached snapshot only (driver RefreshStatusSnapshot); identity and rail...
Definition Pf1550Handler.cpp:177
bool SetPowerMode(pf1550::PowerMode mode) noexcept
Drive STANDBY strap to RUN or STANDBY.
Definition Pf1550Handler.cpp:144
bool have_full_snapshot_
cached_snapshot_ holds a successful full read
Definition Pf1550Handler.h:189
bool IsInitialized() const noexcept
Has EnsureInitialized ever succeeded?
Definition Pf1550Handler.h:104
pf1550::DiagnosticSnapshot cached_snapshot_
Definition Pf1550Handler.h:188
BaseGpio * usb_otg_en_gpio_
Definition Pf1550Handler.h:184
bool HasMcuAffectingFault() noexcept
Convenience: are any currently-latched faults of severity kCritical or kMcuKill?
Definition Pf1550Handler.cpp:216
bool RefreshDiagnosticSnapshot() noexcept
Refresh the cached snapshot by re-reading the PMIC.
Definition Pf1550Handler.cpp:168
bool EnsureInitialized() noexcept
Idempotent — verify DEVICE_ID and prime the bus adapter.
Definition Pf1550Handler.cpp:114
bool ApplyPortentaH7Profile() noexcept
Driver-named Arduino Portenta H7 eval sequence (legacy VFR order).
Definition Pf1550Handler.cpp:128
bool ApplyPortentaH7CarrierProfile() noexcept
Driver-named Portenta-H7-on-carrier eval sequence (SW1-first).
Definition Pf1550Handler.cpp:136
bool ReadPmicStatus(uint8_t &status) noexcept
Read STATE_INFO (0x67).
Definition Pf1550Handler.cpp:160
Pf1550Driver * GetDriver() noexcept
Expose raw driver (advanced use only — does not lock).
Definition Pf1550Handler.cpp:226
bool ReadDiagnosticSnapshot(pf1550::DiagnosticSnapshot &out) noexcept
Copy the cached snapshot out (zero-copy not provided to keep the API thread-safe).
Definition Pf1550Handler.cpp:189
pf1550::PF1550< HalPf1550Comm > Pf1550Driver
Alias for the templated driver type.
Definition Pf1550Handler.h:85
RtosMutex handler_mutex_
Definition Pf1550Handler.h:190
bool ApplyProfile(std::span< const pf1550::profiles::RegisterWrite > profile) noexcept
Apply an ordered register-write sequence.
Definition Pf1550Handler.cpp:119
std::unique_ptr< Pf1550Driver > driver_
Definition Pf1550Handler.h:186
BaseGpio * standby_gpio_
Definition Pf1550Handler.h:182
bool ClearLatchedFaults() noexcept
Clear every RW1C latched fault status register.
Definition Pf1550Handler.cpp:208