<alp/wdt.h> — Watchdog Timer
System-watchdog control. A missed feed reboots the SoC.
Header
#include <alp/wdt.h>
Quick example
alp_wdt_t *wdt = alp_wdt_open(&(alp_wdt_config_t){
.wdt_id = ALP_E1M_WDT0,
.timeout_ms = 5000,
.on_timeout = ALP_WDT_RESET_SOC,
});
while (running) {
do_work();
alp_wdt_feed(wdt); // every iteration; must be < 5 s
}
alp_wdt_open() arms the timer immediately on return — feed before timeout_ms elapses or the configured on_timeout action fires.
:::note v0.9.0 signature change
The watchdog id moved into alp_wdt_config_t as wdt_id (ALP_E1M_WDT0..ALP_E1M_WDT1), so alp_wdt_open is now a single-arg config-taking open matching every other peripheral. There is no 2-arg compatibility shim.
:::
See also
Questions about this page? Discuss in Community Forum