avr-classes
|
#include <oneshottimer.h>
Public Member Functions | |
OneShotTimer (EventReceiver *receiver, const Event &event, COUNTERTYPE timeout) | |
COUNTERTYPE | getTimeout (void) const |
void | setTimeout (COUNTERTYPE timeout) |
virtual void | onTick (void) override |
void | reset (void) |
void | restart (void) |
![]() | |
TimerService (void) | |
void | start (void) |
void | stop (void) |
bool | isRunning (void) const |
Protected Member Functions | |
virtual void | elapsed (void) |
Countdown timer that sends an event when it has elapsed. A OneShotTimer can be paused using the stop() and start() methods, and reset to the original timeout value using reset(). The OneShotTimer needs to be added to a TimerServiceHost instance. The base tick frequency of the TimerServiceHost specifies the rate at which the timeout value is decremented.
COUNTERTYPE | Data type for timeout value, e.g. uint16_t. |
|
inline |
Constructor.
receiver | Receiver of the elapsed event. |
event | Event to be sent when timer has elapsed. |
timeout | Timeout value, actual time depends on base tick frequency of used TimerServiceHost. |
|
inlineprotectedvirtual |
Method that is called when the timer is running and reaches zero.
Reimplemented in PeriodicTimer< COUNTERTYPE >.
|
inline |
Gets the currently configured timeout value.
|
inlineoverridevirtual |
Callback for base tick events of TimerServiceHost. Called from ISR context.
Implements TimerService.
|
inline |
Resets the timeout value to the start value.
|
inline |
Resets the timeout value to the start value and starts the timer.
|
inline |
Sets the timeout value that is used when restarting the timer.
timeout | New timeout value. |