Hardware timer class.
More...
#include <HardwareTimer.h>
Hardware_Timer::Hardware_Timer |
( |
| ) |
|
void __forceinline IRAM_ATTR Hardware_Timer::call |
( |
| ) |
|
|
inline |
Call timer callback.
- Note
- Calls the timer callback function
uint32_t Hardware_Timer::getIntervalMs |
( |
| ) |
|
Get timer interval.
- Return values
-
uint32_t | Timer interval in milliseconds |
uint32_t Hardware_Timer::getIntervalUs |
( |
| ) |
|
Get timer interval.
- Return values
-
uint32_t | Timer interval in microseconds |
Hardware_Timer& IRAM_ATTR Hardware_Timer::initializeMs |
( |
uint32_t |
milliseconds, |
|
|
InterruptCallback |
callback = NULL |
|
) |
| |
Initialise hardware timer.
- Parameters
-
milliseconds | Timer interval in milliseconds |
callback | Callback function to call when timer triggers (Default: none) |
- Return values
-
Hardware_Timer& | Reference to timer |
Hardware_Timer& IRAM_ATTR Hardware_Timer::initializeUs |
( |
uint32_t |
microseconds, |
|
|
InterruptCallback |
callback = NULL |
|
) |
| |
Initialise hardware timer.
- Parameters
-
microseconds | Timer interval in microseconds |
callback | Callback function to call when timer triggers (Default: none) |
- Return values
-
Hardware_Timer& | Reference to timer |
bool Hardware_Timer::isStarted |
( |
| ) |
|
Check if timer is started.
- Return values
-
bool IRAM_ATTR Hardware_Timer::restart |
( |
| ) |
|
Restart timer.
- Return values
-
bool | True if timer started |
- Note
- Timer is stopped then started with current configuration
void IRAM_ATTR Hardware_Timer::setCallback |
( |
InterruptCallback |
callback | ) |
|
Set timer trigger callback.
- Parameters
-
callback | Function to call when timer triggers |
bool IRAM_ATTR Hardware_Timer::setIntervalMs |
( |
uint32_t |
milliseconds = 1000000 | ) |
|
Set timer interval.
- Parameters
-
milliseconds | Interval time in milliseconds (Default: 1s) |
bool IRAM_ATTR Hardware_Timer::setIntervalUs |
( |
uint32_t |
microseconds = 1000000 | ) |
|
Set timer interval.
- Parameters
-
microseconds | Interval time in microseconds (Default: 1ms) |
bool IRAM_ATTR Hardware_Timer::start |
( |
bool |
repeating = true | ) |
|
Start timer running.
- Parameters
-
repeating | True to restart timer when it triggers, false for one-shot (Default: true) |
- Return values
-
bool | True if timer started |
bool __forceinline IRAM_ATTR Hardware_Timer::startOnce |
( |
| ) |
|
|
inline |
Start one-shot timer.
- Return values
-
bool | True if timer started |
- Note
- Timer starts and will run for configured period then stop
bool IRAM_ATTR Hardware_Timer::stop |
( |
| ) |
|
Stops timer.
- Return values
-
- Todo:
- Why always return false from Hardware_timer::stop()?