Auto-delete callback timer class. More...
#include <Timer.h>
Public Types | |
using | Millis = NanoTime::TimeSource< Clock, NanoTime::Milliseconds, uint32_t > |
using | Micros = NanoTime::TimeSource< Clock, NanoTime::Microseconds, TimeType > |
Public Member Functions | |
DelegateCallbackTimer & | initializeUs (TimerDelegate delegateFunction) |
Initialise timer in microseconds, with static check. More... | |
DelegateCallbackTimer & | initializeUs (uint32_t microseconds, TimerDelegate delegateFunction) |
Initialise microsecond timer. More... | |
CallbackTimer & | initializeUs (TimerCallback callback, void *arg=nullptr) |
Initialise timer in microseconds (static check) with Timer Callback and optional argument. More... | |
CallbackTimer & | initializeUs (InterruptCallback callback=nullptr) |
Initialise timer in microseconds (static check) with optional Interrupt Callback (no argument) More... | |
CallbackTimer & | initializeUs (TimeType microseconds, TimerCallback callback, void *arg=nullptr) |
Initialise timer in microseconds with Timer Callback and optional argument. More... | |
CallbackTimer & | initializeUs (TimeType microseconds, InterruptCallback callback=nullptr) |
Initialise timer in microseconds with optional Interrupt Callback (no arg) More... | |
DelegateCallbackTimer & | initializeMs (TimerDelegate delegateFunction) |
Initialise hardware timer in milliseconds, with static check. More... | |
DelegateCallbackTimer & | initializeMs (uint32_t milliseconds, TimerDelegate delegateFunction) |
Initialise millisecond timer. More... | |
CallbackTimer & | initializeMs (TimerCallback callback, void *arg=nullptr) |
Initialise hardware timer in milliseconds (static check) with Timer Callback and optional argument. More... | |
CallbackTimer & | initializeMs (InterruptCallback callback=nullptr) |
Initialise hardware timer in milliseconds (static check) and optional Interrupt Callback (no arg) More... | |
CallbackTimer & | initializeMs (uint32_t milliseconds, TimerCallback callback, void *arg=nullptr) |
Initialise hardware timer in milliseconds with Timer Callback and optional argument. More... | |
CallbackTimer & | initializeMs (uint32_t milliseconds, InterruptCallback callback=nullptr) |
Initialise hardware timer in milliseconds with optional Interrupt Callback (no arg) More... | |
void | setCallback (TimerDelegate delegateFunction) |
Set timer trigger function using Delegate callback method. More... | |
void | setCallback (TimerCallback callback, void *arg=nullptr) |
Set timer trigger callback. More... | |
void | setCallback (InterruptCallback callback) |
Set timer trigger callback. More... | |
CallbackTimer & | initialize (TimerCallback callback, void *arg=nullptr) |
Initialise timer with an interval (static check) and callback. More... | |
CallbackTimer & | initialize (TimeType time, TimerCallback callback, void *arg=nullptr) |
Initialise timer with an interval and callback. More... | |
bool | start (bool repeating=true) |
Start timer running. More... | |
bool | startOnce () |
Start one-shot timer. More... | |
void | stop () |
Stops timer. More... | |
bool | restart () |
Restart timer. More... | |
bool | isStarted () const |
Check if timer is started. More... | |
NanoTime::Time< TimeType > | getIntervalUs () const |
Get timer interval in microseconds. More... | |
NanoTime::Time< uint32_t > | getIntervalMs () const |
Get timer interval in milliseconds. More... | |
TickType | getInterval () const |
Get timer interval in clock ticks. More... | |
bool | checkInterval (TickType ticks) const |
Check timer interval is valid. More... | |
bool | setInterval (TickType ticks) |
Set timer interval in timer ticks. More... | |
void | setInterval () |
Set timer interval in timer ticks (static check) More... | |
void | setInterval () |
Set timer interval in specific time unit (static check) More... | |
bool | setInterval (TimeType time) |
Set timer interval in timer ticks. More... | |
bool | setIntervalUs (TimeType microseconds) |
Set timer interval in microseconds. More... | |
void | setIntervalUs () |
Set timer interval in microseconds (static check) More... | |
bool | setIntervalMs (uint32_t milliseconds) |
Set timer interval in milliseconds. More... | |
void | setIntervalMs () |
Set timer interval in milliseconds (static check) More... | |
Static Public Member Functions | |
static constexpr Millis | millis () |
Get a millisecond time source. More... | |
static constexpr Micros | micros () |
Get a microsecond time source. More... | |
static constexpr uint64_t | usToTicks () |
Convert microsecond count into timer ticks. More... | |
static TickType | usToTicks (TimeType time) |
Convert microsecond count into timer ticks. More... | |
static constexpr uint64_t | ticksToUs () |
Convert timer ticks into microseconds. More... | |
static TimeType | ticksToUs (TickType ticks) |
Convert timer ticks into microseconds. More... | |
static constexpr void | checkInterval () |
Check timer interval in ticks is valid (static check) More... | |
static constexpr void | checkInterval () |
Check timer interval in specific time unit is valid (static check) More... | |
static constexpr void | checkIntervalMs () |
Check timer interval in milliseconds is valid (static check) More... | |
static constexpr void | checkIntervalUs () |
Check timer interval in microseconds is valid (static check) More... | |
Protected Types | |
using | Clock = OsTimerApi::Clock |
using | TickType = uint64_t |
using | TimeType = uint64_t |
Protected Member Functions | |
~AutoDeleteTimer () | |
void | expired () |
bool | isArmed () const |
TickType | ticks () const |
void | arm (bool repeating) |
void | disarm () |
void | longTick () |
String | name () const |
String | toString () const |
operator String () const | |
Static Protected Member Functions | |
static constexpr const char * | typeName () |
static constexpr TickType | minTicks () |
static constexpr TickType | maxTicks () |
Protected Attributes | |
friend | OsTimer64Api< AutoDeleteTimer > |
bool | callbackSet |
User has provided callback function. More... | |
bool | intervalSet |
User has set valid time interval. More... | |
bool | repeating |
Timer is auto-repeat. More... | |
bool | started |
Timer is active, or has fired. More... | |
TimerCallback | func |
void * | arg |
Detailed Description
Auto-delete callback timer class.
Member Typedef Documentation
◆ Clock
|
inherited |
◆ Micros
|
inherited |
◆ Millis
|
inherited |
◆ TickType
|
inherited |
◆ TimeType
|
inherited |
Constructor & Destructor Documentation
◆ ~AutoDeleteTimer()
|
inlineprotected |
Member Function Documentation
◆ arm()
|
inlineinherited |
◆ checkInterval() [1/3]
|
inlineinherited |
Check timer interval is valid.
- Parameters
-
ticks Interval to check
- Return values
-
bool true if interval is within acceptable range for this timer
◆ checkInterval() [2/3]
|
inlinestaticinherited |
Check timer interval in ticks is valid (static check)
- Template Parameters
-
ticks Timer interval to check
- Note
- On error, compilation fails with error message
◆ checkInterval() [3/3]
|
inlinestaticinherited |
Check timer interval in specific time unit is valid (static check)
- Template Parameters
-
unit Time unit for interval time Interval to check
- Note
- On error, compilation fails with error message
◆ checkIntervalMs()
|
inlinestaticinherited |
Check timer interval in milliseconds is valid (static check)
◆ checkIntervalUs()
|
inlinestaticinherited |
Check timer interval in microseconds is valid (static check)
◆ disarm()
|
inlineinherited |
◆ expired()
|
inlineprotected |
◆ getInterval()
|
inlineinherited |
Get timer interval in clock ticks.
◆ getIntervalMs()
|
inlineinherited |
Get timer interval in milliseconds.
◆ getIntervalUs()
|
inlineinherited |
Get timer interval in microseconds.
◆ initialize() [1/2]
|
inlineinherited |
Initialise timer with an interval (static check) and callback.
- Template Parameters
-
unit Time unit for interval time Timer interval
- Parameters
-
callback Callback function to call when timer triggers arg Optional argument passed to callback
- Return values
-
CallbackTimer& Reference to timer
- Note
- If interval out of range compilation will fail with error
◆ initialize() [2/2]
|
inlineinherited |
Initialise timer with an interval and callback.
- Template Parameters
-
unit Time unit for interval
- Parameters
-
time Timer interval callback Callback function to call when timer triggers arg Optional argument passed to callback
- Return values
-
CallbackTimer& Reference to timer
◆ initializeMs() [1/6]
|
inlineinherited |
Initialise hardware timer in milliseconds (static check) with Timer Callback and optional argument.
◆ initializeMs() [2/6]
|
inlineinherited |
Initialise hardware timer in milliseconds (static check) and optional Interrupt Callback (no arg)
◆ initializeMs() [3/6]
|
inlineinherited |
Initialise hardware timer in milliseconds with Timer Callback and optional argument.
◆ initializeMs() [4/6]
|
inlineinherited |
Initialise hardware timer in milliseconds with optional Interrupt Callback (no arg)
◆ initializeMs() [5/6]
|
inlineinherited |
Initialise hardware timer in milliseconds, with static check.
- Template Parameters
-
milliseconds Timer interval in milliseconds
- Parameters
-
delegateFunction Function to call when timer triggers
- Return values
-
ExtendedCallbackTimer& Reference to timer
◆ initializeMs() [6/6]
|
inlineinherited |
Initialise millisecond timer.
- Parameters
-
milliseconds Duration of timer in milliseconds delegateFunction Function to call when timer triggers
- Note
- Delegate callback method
◆ initializeUs() [1/6]
|
inlineinherited |
Initialise timer in microseconds (static check) with Timer Callback and optional argument.
◆ initializeUs() [2/6]
|
inlineinherited |
Initialise timer in microseconds (static check) with optional Interrupt Callback (no argument)
◆ initializeUs() [3/6]
|
inlineinherited |
Initialise timer in microseconds with Timer Callback and optional argument.
◆ initializeUs() [4/6]
|
inlineinherited |
Initialise timer in microseconds with optional Interrupt Callback (no arg)
◆ initializeUs() [5/6]
|
inlineinherited |
Initialise timer in microseconds, with static check.
- Template Parameters
-
microseconds Timer interval in microseconds
- Parameters
-
delegateFunction Function to call when timer triggers
- Return values
-
ExtendedCallbackTimer& Reference to timer
◆ initializeUs() [6/6]
|
inlineinherited |
Initialise microsecond timer.
- Parameters
-
microseconds Duration of timer in milliseconds delegateFunction Function to call when timer triggers
- Note
- Delegate callback method
◆ isArmed()
|
inlineinherited |
◆ isStarted()
|
inlineinherited |
Check if timer is started.
- Return values
-
bool True if started
◆ longTick()
|
protectedinherited |
◆ maxTicks()
|
inlinestaticinherited |
◆ micros()
|
inlinestaticinherited |
Get a microsecond time source.
◆ millis()
|
inlinestaticinherited |
Get a millisecond time source.
◆ minTicks()
|
inlinestaticinherited |
◆ name()
|
inlineinherited |
◆ operator String()
|
inlineinherited |
◆ restart()
|
inlineinherited |
Restart timer.
- Return values
-
bool True if timer started
- Note
- Timer is stopped then started with current configuration
◆ setCallback() [1/3]
|
inlineinherited |
Set timer trigger function using Delegate callback method.
- Parameters
-
delegateFunction Function to be called on timer trigger
- Note
- Don't use this for interrupt timers
◆ setCallback() [2/3]
|
inlineinherited |
Set timer trigger callback.
- Parameters
-
callback Function to call when timer triggers arg Optional argument passed to callback
◆ setCallback() [3/3]
|
inlineinherited |
Set timer trigger callback.
- Parameters
-
callback Function to call when timer triggers
- Note
- Provided for convenience where callback argument not required
◆ setInterval() [1/4]
|
inlineinherited |
Set timer interval in timer ticks.
- Parameters
-
ticks Interval in timer ticks
◆ setInterval() [2/4]
|
inlineinherited |
Set timer interval in timer ticks (static check)
- Template Parameters
-
ticks Interval in ticks
- Note
- On error, compilation fails with error message
◆ setInterval() [3/4]
|
inlineinherited |
Set timer interval in specific time unit (static check)
- Template Parameters
-
unit time Interval to set
- Note
- On error, compilation fails with error message
◆ setInterval() [4/4]
|
inlineinherited |
Set timer interval in timer ticks.
- Template Parameters
-
unit
- Parameters
-
time Interval in given units
◆ setIntervalMs() [1/2]
|
inlineinherited |
Set timer interval in milliseconds.
◆ setIntervalMs() [2/2]
|
inlineinherited |
Set timer interval in milliseconds (static check)
◆ setIntervalUs() [1/2]
|
inlineinherited |
Set timer interval in microseconds.
◆ setIntervalUs() [2/2]
|
inlineinherited |
Set timer interval in microseconds (static check)
◆ start()
|
inherited |
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
◆ startOnce()
|
inlineinherited |
Start one-shot timer.
- Return values
-
bool True if timer started
- Note
- Timer starts and will run for configured period then stop
◆ stop()
|
inlineinherited |
Stops timer.
◆ ticks()
|
inlineinherited |
◆ ticksToUs() [1/2]
|
inlinestaticinherited |
Convert timer ticks into microseconds.
◆ ticksToUs() [2/2]
|
inlinestaticinherited |
Convert timer ticks into microseconds.
◆ toString()
|
inlineinherited |
◆ typeName()
|
inlinestaticinherited |
◆ usToTicks() [1/2]
|
inlinestaticinherited |
Convert microsecond count into timer ticks.
◆ usToTicks() [2/2]
|
inlinestaticinherited |
Convert microsecond count into timer ticks.
Member Data Documentation
◆ arg
|
inherited |
◆ callbackSet
|
protectedinherited |
User has provided callback function.
◆ func
|
inherited |
◆ intervalSet
|
protectedinherited |
User has set valid time interval.
◆ OsTimer64Api< AutoDeleteTimer >
|
protected |
◆ repeating
|
protectedinherited |
Timer is auto-repeat.
◆ started
|
protectedinherited |
Timer is active, or has fired.
The documentation for this class was generated from the following file: