Provides timer functions.
More...
Provides timer functions.
uint32_t Timer::getIntervalMs |
( |
| ) |
|
Get timer interval.
- Return values
-
uint32_t | Timer interval in milliseconds |
uint64_t Timer::getIntervalUs |
( |
| ) |
|
Get timer interval.
- Return values
-
uint64_t | Timer interval in microseconds |
Timer& IRAM_ATTR Timer::initializeMs |
( |
uint32_t |
milliseconds, |
|
|
InterruptCallback |
callback = NULL |
|
) |
| |
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 = NULL |
|
) |
| |
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 = NULL |
|
) |
| |
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 = NULL |
|
) |
| |
Initialise microsecond timer.
- Parameters
-
microseconds | Duration of timer in milliseconds |
delegateFunction | Function to call when timer triggers |
- Note
- Delegate callback method
bool Timer::isStarted |
( |
| ) |
|
Check if timer is started.
- Return values
-
bool | True if timer is running |
void IRAM_ATTR Timer::restart |
( |
| ) |
|
Restarts timer.
- Note
- Restarts the timer from zero, extending duration.
void IRAM_ATTR Timer::setCallback |
( |
InterruptCallback |
interrupt = NULL | ) |
|
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::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) |
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. |
void __forceinline 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.