Timer¶
The Timer
class is the most flexible way to use software timers, supporting extended time intervals
and delegate callback functions so you can use it with class methods, capturing lambdas, etc.
-
group
timer
Extended timer queue class.
Typedefs
-
typedef std::function<void()>
TimerDelegateStdFunction
¶
-
template<class
TimerClass
>
classOsTimer64Api
: public CallbackTimerApi<OsTimer64Api<TimerClass>>¶ - #include <Timer.h>
Class template implementing an extended OS Timer with 64-bit microsecond times and delegate callback support.
-
template<typename
TimerApi
>
classDelegateCallbackTimer
: public CallbackTimer<TimerApi>¶ - #include <Timer.h>
Class template adding delegate callback method support to the basic CallbackTimer template.
Public Functions
-
template<TimeType
microseconds
>
DelegateCallbackTimer &initializeUs
(TimerDelegate delegateFunction)¶ Initialise timer in microseconds, with static check.
- Template Parameters
microseconds
: Timer interval in microseconds
- Parameters
delegateFunction
: Function to call when timer triggers
- Return Value
ExtendedCallbackTimer&
: Reference to timer
-
template<uint32_t
milliseconds
>
DelegateCallbackTimer &initializeMs
(TimerDelegate delegateFunction)¶ Initialise hardware timer in milliseconds, with static check.
- Template Parameters
milliseconds
: Timer interval in milliseconds
- Parameters
delegateFunction
: Function to call when timer triggers
- Return Value
ExtendedCallbackTimer&
: Reference to timer
-
DelegateCallbackTimer &
initializeMs
(uint32_t milliseconds, TimerDelegate delegateFunction)¶ Initialise millisecond timer.
- Note
Delegate callback method
- Parameters
milliseconds
: Duration of timer in millisecondsdelegateFunction
: Function to call when timer triggers
-
DelegateCallbackTimer &
initializeUs
(uint32_t microseconds, TimerDelegate delegateFunction)¶ Initialise microsecond timer.
- Note
Delegate callback method
- Parameters
microseconds
: Duration of timer in millisecondsdelegateFunction
: Function to call when timer triggers
-
void
setCallback
(TimerDelegate delegateFunction)¶ Set timer trigger function using Delegate callback method.
- Note
Don’t use this for interrupt timers
- Parameters
delegateFunction
: Function to be called on timer trigger
-
template<TimeType
-
class
Timer
: public DelegateCallbackTimer<OsTimer64Api<Timer>>¶ - #include <Timer.h>
Callback timer class.
Subclassed by Profiling::MinMaxTimes< Timer >
-
class
AutoDeleteTimer
: public DelegateCallbackTimer<OsTimer64Api<AutoDeleteTimer>>¶ - #include <Timer.h>
Auto-delete callback timer class.
-
typedef std::function<void()>