Provides basic OS timer functions.
More...
Provides basic OS timer functions.
Provides timer functions.
uint32_t Timer::getIntervalMs |
( |
| ) |
|
|
inline |
Get timer interval.
- Return values
-
uint32_t | Timer interval in milliseconds |
uint64_t Timer::getIntervalUs |
( |
| ) |
|
|
inline |
Get timer interval.
- Return values
-
uint64_t | Timer interval in microseconds |
Timer& IRAM_ATTR Timer::initializeMs |
( |
uint32_t |
milliseconds, |
|
|
InterruptCallback |
callback = nullptr |
|
) |
| |
Initialise millisecond timer.
- Parameters
-
milliseconds | Duration of timer in milliseconds |
callback | Function to call when timer triggers |
- Note
- Classic c-style callback method
Timer& IRAM_ATTR Timer::initializeMs |
( |
uint32_t |
milliseconds, |
|
|
TimerDelegate |
delegateFunction = nullptr |
|
) |
| |
Timer& IRAM_ATTR Timer::initializeMs |
( |
uint32_t |
milliseconds, |
|
|
TimerDelegateStdFunction |
delegateFunction = nullptr |
|
) |
| |
Initialise millisecond timer.
- Parameters
-
milliseconds | Duration of timer in milliseconds |
delegateFunction | Function to call when timer triggers |
- Note
- Delegate callback method
Timer& IRAM_ATTR Timer::initializeUs |
( |
uint32_t |
microseconds, |
|
|
InterruptCallback |
callback = nullptr |
|
) |
| |
Initialise microsecond timer.
- Parameters
-
microseconds | Duration of timer in milliseconds |
callback | Function to call when timer triggers |
- Note
- Classic c-style callback method
Timer& IRAM_ATTR Timer::initializeUs |
( |
uint32_t |
microseconds, |
|
|
TimerDelegate |
delegateFunction = nullptr |
|
) |
| |
Timer& IRAM_ATTR Timer::initializeUs |
( |
uint32_t |
microseconds, |
|
|
TimerDelegateStdFunction |
delegateFunction = nullptr |
|
) |
| |
Initialise microsecond timer.
- Parameters
-
microseconds | Duration of timer in milliseconds |
delegateFunction | Function to call when timer triggers |
- Note
- Delegate callback method
bool Timer::isStarted |
( |
| ) |
|
|
inline |
Check if timer is started.
- Return values
-
bool | True if timer is running |
__forceinline void IRAM_ATTR Timer::restart |
( |
| ) |
|
|
inline |
Restarts timer.
- Note
- Restarts the timer from zero, extending duration.
void IRAM_ATTR Timer::setCallback |
( |
InterruptCallback |
interrupt = nullptr | ) |
|
Set timer trigger function.
- Parameters
-
interrupt | Function to be called on timer trigger |
- Note
- Classic c-type callback method
void IRAM_ATTR Timer::setCallback |
( |
TimerDelegate |
delegateFunction | ) |
|
Set timer trigger function.
- Parameters
-
delegateFunction | Function to be called on timer trigger |
- Note
- Delegate callback method
void IRAM_ATTR Timer::setCallback |
( |
const TimerDelegateStdFunction & |
delegateFunction | ) |
|
Set timer trigger function.
- Parameters
-
delegateFunction | Function to be called on timer trigger |
- Note
- Delegate callback method
void IRAM_ATTR Timer::setIntervalMs |
( |
uint32_t |
milliseconds = 1000000 | ) |
|
Set timer interval.
- Parameters
-
milliseconds | Interval in milliseconds. (Default: 1s) |
void IRAM_ATTR Timer::setIntervalUs |
( |
uint64_t |
microseconds = 1000000 | ) |
|
Set timer interval.
- Parameters
-
microseconds | Interval in microseconds. (Default: 1ms) |
SimpleTimer::SimpleTimer |
( |
| ) |
|
|
inline |
void IRAM_ATTR Timer::start |
( |
bool |
repeating = true | ) |
|
Start timer running.
- Parameters
-
repeating | Set to true for repeating timer. Set to false for one-shot. |
__forceinline void IRAM_ATTR Timer::startOnce |
( |
| ) |
|
|
inline |
Start one-shot timer running.
- Note
- Will start timer and trigger once after configured duration.
void IRAM_ATTR Timer::stop |
( |
| ) |
|
Stop timer.
- Note
- Stops a running timer. Has no effect on stopped timer.
virtual timer loop() method
- Note
- Can be override in class derivations. If overwriten, no classic other callbacks are working.