FastLED 3.9.15
Loading...
Searching...
No Matches
watchdog.h File Reference

Detailed Description

Unified cross-platform Watchdog Timer API for FastLED.

Accessed via the FastLED god-object: FastLED.watchdog().

See FastLED#2731 for the full design rationale and per-platform capability matrix.

Three tiers:

  • Tier 0 — universal (every supported platform, incl. AVR)
  • Tier 1 — pre-reset callback, pause-on-debug, flash crash log, bootloader reboot
  • Tier 2 — window mode, decoded CrashReport

Naming: spelled-out (watchdog, not wdt). Macros: FL_WATCHDOG_*, not FL_WDT_*.

Usage:

void setup() {
FastLED.watchdog().begin(15000);
if (FastLED.watchdog().isInSafeMode()) {
// skip LED init, wait for new firmware
while (true) {}
}
}
void loop() {
doWork();
FastLED.watchdog().feed(); // after the dangerous work
FastLED.watchdog().markCleanShutdown();
}
void setup()
void loop()
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.

Definition in file watchdog.h.

#include "fl/stl/stdint.h"
#include "fl/stl/noexcept.h"
#include "fl/stl/compiler_control.h"
#include "fl/stl/span.h"
#include "fl/stl/function.h"
#include "fl/stl/string_view.h"
+ Include dependency graph for watchdog.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  fl::ResetInfo
 Detailed reset information bundling the normalized cause with a platform-specific subcause id and the raw cause-register value. More...
 
class  fl::ScopedWatchdog
 RAII watchdog guard for the canonical loop()-top use case. More...
 
class  fl::Watchdog
 Unified cross-platform watchdog interface. More...
 
struct  fl::WatchdogCrashReport
 Decoded crash report (Tier 2). More...
 

Namespaces

namespace  fl
 Base definition for an LED controller.
 

Macros

#define FL_WATCHDOG__CONCAT(a, b)
 
#define FL_WATCHDOG__CONCAT_INNER(a, b)
 
#define FL_WATCHDOG_AUTO(...)
 

Typedefs

using fl::WatchdogTimeoutCallback = void(*)(void* user_data)
 ISR-safe C function pointer callback for onTimeout().
 

Enumerations

enum class  fl::ResetCause : fl::u8 {
  fl::UNKNOWN = 0 , fl::POWER_ON , fl::BROWNOUT , fl::EXTERNAL_PIN ,
  fl::WATCHDOG , fl::SOFTWARE , fl::LOCKUP , fl::DEBUGGER ,
  fl::PANIC
}
 Cause of the previous boot. Call once early in setup(). More...
 

Functions

fl::string_view fl::resetCauseName (ResetCause c) FL_NOEXCEPT
 Return a static-lifetime name for c — zero-cost, no allocation.
 

Class Documentation

◆ fl::WatchdogCrashReport

struct fl::WatchdogCrashReport
Class Members
u32 fault_address
u32 fault_status
const char * fault_type
u32 lr
u32 pc
u32 psr
bool valid