Mistake on this page?
Report an issue in GitHub or email us
Public Member Functions | Static Public Member Functions
Watchdog Class Reference

Hardware system timer that will reset the system in the case of system failures or malfunctions. More...

#include <Watchdog.h>

Inheritance diagram for Watchdog:
NonCopyable< Watchdog >

Public Member Functions

bool start ()
 Start the watchdog timer with the maximum timeout available on a target. More...
 
bool start (uint32_t timeout)
 Start the watchdog timer. More...
 
bool stop ()
 Stops 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 refresh value for the current platform in milliseconds. More...
 
bool is_running () const
 Check if watchdog is already running. More...
 
void kick ()
 Kick watchdog. More...
 

Static Public Member Functions

static Watchdogget_instance ()
 As Watchdog might not stop ever, there is just one instance - we use single instance. More...
 

Detailed Description

Hardware system timer that will reset the system in the case of system failures or malfunctions.

There is only one instance in the system.

Example:

Watchdog &watchdog = Watchdog::get_instance();
watchdog.start();
while (true) {
// kick watchdog regularly within provided timeout
watchdog.kick();
// Application code
}
Note
Synchronization level: Interrupt safe

Definition at line 52 of file Watchdog.h.

Member Function Documentation

static Watchdog& get_instance ( )
static

As Watchdog might not stop ever, there is just one instance - we use single instance.

This ensures we keep Watchdog alive. To operate watchdog, use start/stop methods.

Definition at line 58 of file Watchdog.h.

uint32_t get_max_timeout ( ) const

Get the maximum refresh value for the current platform in milliseconds.

Returns
Maximum refresh value supported by the watchdog for the current platform in milliseconds
uint32_t get_timeout ( ) const

Get the watchdog timer refresh value.

This function returns the refresh timeout of the watchdog timer.

Returns
Reload value for the watchdog timer in milliseconds.
bool is_running ( ) const

Check if watchdog is already running.

Returns
true if watchdog is running, false otherwise
void kick ( )

Kick watchdog.

This method is useful to control kicking by application in ticker callback periodically

bool start ( )

Start the watchdog timer with the maximum timeout available on a target.

Timeout is defined as get_max_timeout()

Returns
status true if the watchdog timer was started successfully. assert if one of the input parameters is out of range for the current platform. false if watchdog timer was not started
bool start ( uint32_t  timeout)

Start the watchdog timer.

Parameters
timeoutWatchdog timeout
Returns
status true if the watchdog timer was started successfully. assert if one of the input parameters is out of range for the current platform. false if watchdog timer was not started
bool stop ( )

Stops the watchdog timer.

Calling this function will attempt to disable any currently running watchdog timers if supported by the current platform.

Returns
Returns true if the watchdog timer was successfully stopped, Returns false if the watchdog cannot be disabled on the current platform or if the timer was never started.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.