2.27. watchdog — Hardware watchdog

Source code: src/drivers/watchdog.h, src/drivers/watchdog.c


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)

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.

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.