Watchdog Timer - MarekBykowski/readme GitHub Wiki

A hardware counter that resets the CPU if not "petted" (reset) within a timeout. Prevents firmware from hanging silently.

// Initialise watchdog with 1s timeout
watchdog_init(1000);  // 1000ms

// Main loop — must pet before timeout
while (1) {
    watchdog_kick();   // reset the counter ("I'm alive")
    do_work();
}

// If do_work() hangs → watchdog fires → CPU reset → system recovers