LwWDG

group LWWDG

Lightweight watchdog for RTOS in embedded systems.

Functions

uint8_t lwwdg_init(void)

Initialize watchdog module.

Returns

1 on success, 0 otherwise

uint8_t lwwdg_add(lwwdg_wdg_t *wdg, uint32_t timeout)

Add new watchdog timer instance to internal linked list.

Parameters
  • wdg – Watchdog handle. Must not be local variable

  • timeout – Max allowed timeout in milliseconds

Returns

1 on success, 0 otherwise

uint8_t lwwdg_reload(lwwdg_wdg_t *wdg)

Reload thread watchdog.

Note

Reload will not be successful, if there was a timeout before. This will ensure that main thread won’t reload hardware watchdog, resulting system to reset

Parameters

wdg – Watchdog handle to reload

Returns

1 on success, 0 otherwise

uint8_t lwwdg_process(void)

Process and check system timers.

Function will check all timers and will return OK, if all timers are within max timeout state

Returns

1 if hardware watchdog can be reset, 0 if at least one timer hasn’t been reloaded within maximum timeout

struct lwwdg_wdg_t
#include <lwwdg.h>

Watchdog structure.

Public Members

struct lwwdg_wdg *next

Next entry on a list

uint32_t timeout

Timeout in milliseconds

uint32_t last_reload_time

Last reload time in milliseconds