FastArduino v1.10
C++ library to build fast but small Arduino/AVR projects
|
Simple API to use watchdog timer as a real-time clock. More...
#include <fastarduino/watchdog.h>
Public Member Functions | |
WatchdogRTT () | |
Construct a new watchdog-based clock that will count elapsed milliseconds since it was started with begin() . More... | |
void | begin (TimeOut timeout=TimeOut::TO_16ms) |
Start the watchdog clock with the given timeout period. More... | |
uint32_t | millis () const |
Get the number of milliseconds that elapsed since begin() was called. More... | |
void | reset () |
Reset current counter to 0. More... | |
void | delay (uint32_t ms) |
Delay program execution for the given amount of milliseconds. More... | |
Public Member Functions inherited from watchdog::WatchdogSignal | |
void | begin (TimeOut timeout=TimeOut::TO_16ms) |
Start the watchdog timer with the given timeout period. More... | |
void | end () |
Stop this watchdog timer. More... | |
Friends | |
struct | isr_handler |
Simple API to use watchdog timer as a real-time clock.
For this to work correctly, you need to register the proper ISR through REGISTER_WATCHDOG_RTT_ISR()
macro first.
Definition at line 203 of file watchdog.h.
|
inline |
Construct a new watchdog-based clock that will count elapsed milliseconds since it was started with begin()
.
Definition at line 211 of file watchdog.h.
|
inline |
Start the watchdog clock with the given timeout
period.
From now on, watchdog interrupts get generated at timeout
period, and the MCU gets awakened at this period too, if sleeping.
timeout | the watchdog timeout period |
Definition at line 222 of file watchdog.h.
|
inline |
Get the number of milliseconds that elapsed since begin()
was called.
Note: the precision is limited by the timeout
value used with begin()
.
Definition at line 242 of file watchdog.h.
|
inline |
|
inline |
Delay program execution for the given amount of milliseconds.
Contrarily to time::delay_ms()
, this method does not perform a busy loop, but it calls time::yield()
which will put the MCU in sleep mode but will be awakened by the watchdog interrupt and check if required delay has elapsed already. Note that the delay precision depends on the actual timeout value passed when begin()
has been called.
ms | the number of milliseconds to hold program execution |
Definition at line 268 of file watchdog.h.
|
friend |
Definition at line 292 of file watchdog.h.