DelegateCallbackTimer< TimerApi > Class Template Reference

Class template adding delegate callback method support to the basic CallbackTimer template. More...

#include <Timer.h>

Inheritance diagram for DelegateCallbackTimer< TimerApi >:
[legend]
Collaboration diagram for DelegateCallbackTimer< TimerApi >:
[legend]

Public Member Functions

template<TimeType microseconds>
DelegateCallbackTimerinitializeUs (TimerDelegate delegateFunction)
 Initialise timer in microseconds, with static check. More...
 
template<uint32_t milliseconds>
DelegateCallbackTimerinitializeMs (TimerDelegate delegateFunction)
 Initialise hardware timer in milliseconds, with static check. More...
 
DelegateCallbackTimerinitializeMs (uint32_t milliseconds, TimerDelegate delegateFunction)
 Initialise millisecond timer. More...
 
DelegateCallbackTimerinitializeUs (uint32_t microseconds, TimerDelegate delegateFunction)
 Initialise microsecond timer. More...
 
void setCallback (TimerDelegate delegateFunction)
 Set timer trigger function using Delegate callback method. More...
 
- Public Member Functions inherited from CallbackTimer< TimerApi >
template<NanoTime::Unit unit, TimeType time>
CallbackTimerinitialize (TimerCallback callback, void *arg=nullptr)
 Initialise timer with an interval (static check) and callback. More...
 
template<NanoTime::Unit unit>
CallbackTimerinitialize (TimeType time, TimerCallback callback, void *arg=nullptr)
 Initialise timer with an interval and callback. More...
 
template<TimeType microseconds>
CallbackTimerinitializeUs (TimerCallback callback, void *arg=nullptr)
 Initialise timer in microseconds (static check) with Timer Callback and optional argument. More...
 
template<TimeType microseconds>
CallbackTimerinitializeUs (InterruptCallback callback=nullptr)
 Initialise timer in microseconds (static check) with optional Interrupt Callback (no argument) More...
 
CallbackTimerinitializeUs (TimeType microseconds, TimerCallback callback, void *arg=nullptr)
 Initialise timer in microseconds with Timer Callback and optional argument. More...
 
CallbackTimerinitializeUs (TimeType microseconds, InterruptCallback callback=nullptr)
 Initialise timer in microseconds with optional Interrupt Callback (no arg) More...
 
template<uint32_t milliseconds>
CallbackTimerinitializeMs (TimerCallback callback, void *arg=nullptr)
 Initialise hardware timer in milliseconds (static check) with Timer Callback and optional argument. More...
 
template<uint32_t milliseconds>
CallbackTimerinitializeMs (InterruptCallback callback=nullptr)
 Initialise hardware timer in milliseconds (static check) and optional Interrupt Callback (no arg) More...
 
CallbackTimerinitializeMs (uint32_t milliseconds, TimerCallback callback, void *arg=nullptr)
 Initialise hardware timer in milliseconds with Timer Callback and optional argument. More...
 
CallbackTimerinitializeMs (uint32_t milliseconds, InterruptCallback callback=nullptr)
 Initialise hardware timer in milliseconds with optional Interrupt Callback (no arg) 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...
 
template<TimeType ticks>
void setInterval ()
 Set timer interval in timer ticks (static check) More...
 
template<NanoTime::Unit unit, TimeType time>
void setInterval ()
 Set timer interval in specific time unit (static check) More...
 
template<NanoTime::Unit unit>
bool setInterval (TimeType time)
 Set timer interval in timer ticks. More...
 
bool setIntervalUs (TimeType microseconds)
 Set timer interval in microseconds. More...
 
template<TimeType microseconds>
void setIntervalUs ()
 Set timer interval in microseconds (static check) More...
 
bool setIntervalMs (uint32_t milliseconds)
 Set timer interval in milliseconds. More...
 
template<uint32_t milliseconds>
void setIntervalMs ()
 Set timer interval in milliseconds (static check) More...
 
void setCallback (TimerCallback callback, void *arg=nullptr)
 Set timer trigger callback. More...
 
void setCallback (InterruptCallback callback)
 Set timer trigger callback. More...
 

Additional Inherited Members

- Public Types inherited from CallbackTimer< TimerApi >
using Millis = NanoTime::TimeSource< Clock, NanoTime::Milliseconds, uint32_t >
 
using Micros = NanoTime::TimeSource< Clock, NanoTime::Microseconds, TimeType >
 
- Static Public Member Functions inherited from CallbackTimer< TimerApi >
static constexpr Millis millis ()
 Get a millisecond time source. More...
 
static constexpr Micros micros ()
 Get a microsecond time source. More...
 
template<uint64_t us>
static constexpr uint64_t usToTicks ()
 Convert microsecond count into timer ticks. More...
 
static TickType usToTicks (TimeType time)
 Convert microsecond count into timer ticks. More...
 
template<uint64_t ticks>
static constexpr uint64_t ticksToUs ()
 Convert timer ticks into microseconds. More...
 
static TimeType ticksToUs (TickType ticks)
 Convert timer ticks into microseconds. More...
 
template<uint64_t ticks>
static constexpr void checkInterval ()
 Check timer interval in ticks is valid (static check) More...
 
template<NanoTime::Unit unit, uint64_t time>
static constexpr void checkInterval ()
 Check timer interval in specific time unit is valid (static check) More...
 
template<uint64_t milliseconds>
static constexpr void checkIntervalMs ()
 Check timer interval in milliseconds is valid (static check) More...
 
template<uint64_t microseconds>
static constexpr void checkIntervalUs ()
 Check timer interval in microseconds is valid (static check) More...
 
- Protected Attributes inherited from CallbackTimer< TimerApi >
bool callbackSet = false
 User has provided callback function. More...
 
bool intervalSet = false
 User has set valid time interval. More...
 
bool repeating = false
 Timer is auto-repeat. More...
 
bool started = false
 Timer is active, or has fired. More...
 

Detailed Description

template<typename TimerApi>
class DelegateCallbackTimer< TimerApi >

Class template adding delegate callback method support to the basic CallbackTimer template.

Member Function Documentation

◆ initializeMs() [1/2]

template<typename TimerApi>
template<uint32_t milliseconds>
DelegateCallbackTimer& DelegateCallbackTimer< TimerApi >::initializeMs ( TimerDelegate  delegateFunction)
inline

Initialise hardware timer in milliseconds, with static check.

Template Parameters
millisecondsTimer interval in milliseconds
Parameters
delegateFunctionFunction to call when timer triggers
Return values
ExtendedCallbackTimer&Reference to timer

◆ initializeMs() [2/2]

template<typename TimerApi>
DelegateCallbackTimer& DelegateCallbackTimer< TimerApi >::initializeMs ( uint32_t  milliseconds,
TimerDelegate  delegateFunction 
)
inline

Initialise millisecond timer.

Parameters
millisecondsDuration of timer in milliseconds
delegateFunctionFunction to call when timer triggers
Note
Delegate callback method

◆ initializeUs() [1/2]

template<typename TimerApi>
template<TimeType microseconds>
DelegateCallbackTimer& DelegateCallbackTimer< TimerApi >::initializeUs ( TimerDelegate  delegateFunction)
inline

Initialise timer in microseconds, with static check.

Template Parameters
microsecondsTimer interval in microseconds
Parameters
delegateFunctionFunction to call when timer triggers
Return values
ExtendedCallbackTimer&Reference to timer

◆ initializeUs() [2/2]

template<typename TimerApi>
DelegateCallbackTimer& DelegateCallbackTimer< TimerApi >::initializeUs ( uint32_t  microseconds,
TimerDelegate  delegateFunction 
)
inline

Initialise microsecond timer.

Parameters
microsecondsDuration of timer in milliseconds
delegateFunctionFunction to call when timer triggers
Note
Delegate callback method

◆ setCallback()

template<typename TimerApi>
void DelegateCallbackTimer< TimerApi >::setCallback ( TimerDelegate  delegateFunction)
inline

Set timer trigger function using Delegate callback method.

Parameters
delegateFunctionFunction to be called on timer trigger
Note
Don't use this for interrupt timers

The documentation for this class was generated from the following file: