322#define FL_WATCHDOG__CONCAT_INNER(a, b) a##b
323#define FL_WATCHDOG__CONCAT(a, b) FL_WATCHDOG__CONCAT_INNER(a, b)
324#define FL_WATCHDOG_AUTO(...) \
325 ::fl::ScopedWatchdog FL_WATCHDOG__CONCAT(_fl_wdt_, __LINE__) { __VA_ARGS__ }
ScopedWatchdog() FL_NO_EXCEPT
Default construct with the library default timeout (15 000 ms).
RAII watchdog guard for the canonical loop()-top use case.
fl::u16 mSafeModeThreshold
void disable() FL_NO_EXCEPT
bool writeCrashLog(fl::span< const fl::u8 > payload) FL_NO_EXCEPT
static Watchdog & instance() FL_NO_EXCEPT
bool shouldEscapeToBootloader() const FL_NO_EXCEPT
True when the escape is enabled and the board has hit the consecutive-watchdog-reset threshold.
fl::u16 bootloaderEscapeThreshold() const FL_NO_EXCEPT
Boot-loop escape hatch: drop to the bootloader instead of looping forever, so an unattended host can ...
fl::size readCrashLog(fl::span< fl::u8 > out) const FL_NO_EXCEPT
fl::u32 bootGuardCount() const FL_NO_EXCEPT
Early-boot loop guard counter (see fl/wdt/boot_guard.h): consecutive boots since the last markBootHea...
void setSafeModeThreshold(fl::u16 threshold) FL_NO_EXCEPT
void begin(fl::u32 timeout_ms) FL_NO_EXCEPT
bool isInSafeMode() const FL_NO_EXCEPT
fl::u16 safeModeThreshold() const FL_NO_EXCEPT
bool lastResetWasWatchdog() const FL_NO_EXCEPT
WatchdogCrashReport readCrashReport() const FL_NO_EXCEPT
fl::u8 persistRead(fl::size idx) const FL_NO_EXCEPT
void persistWrite(fl::size idx, fl::u8 v) FL_NO_EXCEPT
void markBootHealthy() FL_NO_EXCEPT
Tell the early-boot guard this boot is healthy, zeroing its counter.
FL_NO_RETURN void reboot() FL_NO_EXCEPT
bool setPauseOnDebug(bool pause) FL_NO_EXCEPT
void setBootloaderEscapeThreshold(fl::u16 threshold) FL_NO_EXCEPT
Set the consecutive-watchdog-reset count that triggers the escape.
fl::u16 mBootloaderEscapeThreshold
ResetInfo lastResetInfo() const FL_NO_EXCEPT
Detailed reset information including platform raw register + subcause id.
fl::u16 consecutiveCrashCount() const FL_NO_EXCEPT
Watchdog() FL_NO_EXCEPT=default
void markCleanShutdown() FL_NO_EXCEPT
ResetCause lastResetCause() const FL_NO_EXCEPT
bool onTimeout(WatchdogTimeoutCallback cb, void *user_data=nullptr) FL_NO_EXCEPT
bool hasCrashReport() const FL_NO_EXCEPT
bool escapeToBootloaderIfLooping() FL_NO_EXCEPT
Reboot into the bootloader if this looks like a boot loop.
bool rebootIntoBootloader() FL_NO_EXCEPT
void clearCrashReport() FL_NO_EXCEPT
bool setWindow(fl::u32 window_min_ms, fl::u32 window_max_ms) FL_NO_EXCEPT
u8 u8 fract8 blur_amount FL_NO_EXCEPT
ResetCause
Cause of the previous boot. Call once early in setup().
void(*)(void *user_data) WatchdogTimeoutCallback
ISR-safe C function pointer callback for onTimeout().
@ UNKNOWN
Unknown or unspecified error.
fl::string_view resetCauseName(ResetCause c) FL_NO_EXCEPT
Return a static-lifetime name for c — zero-cost, no allocation.
Base definition for an LED controller.
Decoded crash report (Tier 2).
ResetCause cause
Normalized cross-platform enum.
fl::u32 rawRegister
Raw value of the platform's reset-cause register.
fl::size describe(fl::span< char > out, bool verbose=false) const FL_NO_EXCEPT
Write a single-line human-readable description into the caller's buffer.
fl::string_view subcauseName() const FL_NO_EXCEPT
Platform-specific subcause name (zero-cost, static string_view).
fl::string_view causeName() const FL_NO_EXCEPT
Cause name (zero-cost, static string_view).
fl::u8 subcauseId
Platform-specific subcause id (0 = none)
Detailed reset information bundling the normalized cause with a platform-specific subcause id and the...