Watchdog Service¶
- group Watchdog Service
Safety mechanism to recover from software freezes.
The Watchdog service is a high-priority driver that interfaces directly with the MCU’s hardware timer.
- group Types
State containers for the watchdog.
-
struct watchdog_t¶
- #include <watchdog.h>
Watchdog Service State Object.
Holds the runtime state of the watchdog driver.
-
struct watchdog_t¶
- group Public API
Functions for managing system safety.
Functions
-
void watchdog_init(watchdog_t *watchdog)¶
Initialize the Hardware Watchdog.
Configures the hardware timer with the timeout specified in the configuration. Once initialized, the watchdog typically cannot be disabled until a reset.
- Parameters:
wd – [out] Pointer to the watchdog service instance.
-
void watchdog_pet(watchdog_t *watchdog)¶
Reset the watchdog timer (kicking/petting).
Refreshes the hardware counter to prevent a system reset. Updates the
last_pet_tickin the software struct for debugging.- Parameters:
watchdog – [inout] Pointer to the watchdog service instance.
-
void watchdog_force_reset(watchdog_t *watchdog)¶
Intentionally trigger a system reset.
Useful for “safe mode” transitions or recovering from unrecoverable errors. This function will block until the hardware resets the device.
- Parameters:
watchdog – [in] Pointer to the watchdog service instance.
-
void watchdog_init(watchdog_t *watchdog)¶