a simple timer
More...
#include <Noiasca_timer.h>
a simple timer
The LittleTimer can be used to fire in a specific interval. Additionally you can limit the timer by a specific amount of intervals. If necessary you can define callback functions.
- Todo:
- tbd methods for pause and restart
◆ getState()
byte LittleTimer::getState |
( |
| ) |
|
|
inline |
get the state of the timer
- Returns
- the current state of the timer
◆ setLimit()
void LittleTimer::setLimit |
( |
uint32_t |
limit | ) |
|
|
inline |
set limit
Set a new limit for the timer.
- Parameters
-
limit | how often should the timer fire |
◆ setIteration()
void LittleTimer::setIteration |
( |
uint32_t |
iteration | ) |
|
|
inline |
set the iteration
Modify the counter of iterations.
- Parameters
-
iteration | how often has the timer fired |
◆ setInterval()
void LittleTimer::setInterval |
( |
uint32_t |
interval | ) |
|
|
inline |
set the interval
Modify the interval of the timer.
- Parameters
-
interval | interval in milliseconds |
◆ start()
void LittleTimer::start |
( |
| ) |
|
|
inline |
start timer
starts the timer.
◆ stop()
void LittleTimer::stop |
( |
| ) |
|
|
inline |
stop timer
Stops the timer.
◆ getIteration()
uint32_t LittleTimer::getIteration |
( |
| ) |
|
|
inline |
get the iteration
Returns the current number of ioterations.
- Returns
- interations of how often the timer has fired.
◆ hasTriggered()
uint16_t LittleTimer::hasTriggered |
( |
| ) |
|
|
inline |
indicate if timer has been triggered
- Returns
- > 0 if interval time is passed since last call. Returns the number of "missed" intervals.
◆ hasEnded()
bool LittleTimer::hasEnded |
( |
| ) |
|
|
inline |
indicate if timer has been ended
- Returns
- true if interval time is over.
◆ update()
void LittleTimer::update |
( |
uint32_t |
currentMillis = millis() | ) |
|
|
inline |
run
call this member function in your loop()