A hardware watchdog timer that resets the system in the case of system failures or malfunctions. More...
#include <Watchdog.h>
Public Member Functions | |
| bool | start () |
| Start the Watchdog timer with the maximum timeout value available for the target. More... | |
| bool | start (uint32_t timeout) |
| Start the Watchdog timer. More... | |
| bool | stop () |
| Stop the Watchdog timer. More... | |
| uint32_t | get_timeout () const |
| Get the Watchdog timer refresh value. More... | |
| uint32_t | get_max_timeout () const |
| Get the maximum Watchdog refresh value for this platform. More... | |
| bool | is_running () const |
| Check if the Watchdog timer is already running. More... | |
| void | kick () |
| Refresh the Watchdog timer. More... | |
Static Public Member Functions | |
| static Watchdog & | get_instance () |
| Get a reference to the single Watchdog instance in the system. More... | |
A hardware watchdog timer that resets the system in the case of system failures or malfunctions.
If you fail to refresh the Watchdog timer periodically, it resets the system after a set period of time.
There is only one instance of the Watchdog class in the system, which directly maps to the hardware. Use Watchdog::get_instance to obtain a reference.
Watchdog::start initializes a system timer with a time period specified in timeout param. This timer counts down and triggers a system reset when it wraps. To prevent the system reset, you must periodically kick or refresh the timer by calling Watchdog::kick, which resets the countdown to the initial value.
Example:
Definition at line 64 of file Watchdog.h.
|
static |
Get a reference to the single Watchdog instance in the system.
Definition at line 71 of file Watchdog.h.
| uint32_t get_max_timeout | ( | ) | const |
| uint32_t get_timeout | ( | ) | const |
| bool is_running | ( | ) | const |
| void kick | ( | ) |
| bool start | ( | ) |
Start the Watchdog timer with the maximum timeout value available for the target.
If the Watchdog timer is already running, this function does nothing.
| bool start | ( | uint32_t | timeout | ) |
Start the Watchdog timer.
| timeout | Watchdog timeout in milliseconds. |