3.31. watchdog
— Hardware watchdog¶
Source code: src/drivers/watchdog.h, src/drivers/watchdog.c
Typedefs
-
typedef void (*
watchdog_isr_fn_t
)(void)¶
Functions
-
int
watchdog_module_init
(void)¶ Initialize the watchdog driver module. This function must be called before calling any other function in this module.
The module will only be initialized once even if this function is called multiple times.
- Return
- zero(0) or negative error code.
-
int
watchdog_start_ms
(int timeout, watchdog_isr_fn_t on_interrupt)¶ Start the watchdog with given timeout. Use
watchdog_kick()
to periodically restart the timer.- Return
- zero(0) or negative error code.
- Parameters
timeout
: Watchdog timeout in milliseconds.on_interrupt
: Function callback called when a watchdog interrupt occurs. Not all MCU:s supports this feature.
-
int
watchdog_stop
(void)¶ Stop the watchdog.
- Return
- zero(0) or negative error code.
-
int
watchdog_kick
(void)¶ Kick the watchdog. Restarts the watchdog timer with its original timeout given to
watchdog_start_ms()
. The board will be reset if this function is not called before the watchdog timer expires.- Return
- zero(0) or negative error code.