Min-Max Times¶
-
template <class Timer>
classMinMaxTimes
: public Profiling::MinMax<uint32_t>, public Timer¶ Public Types
-
template<>
usingMillis
= NanoTime::TimeSource<Clock, NanoTime::Milliseconds, uint32_t>¶
-
template<>
usingMicros
= NanoTime::TimeSource<Clock, NanoTime::Microseconds, TimeType>¶
Public Functions
-
void
update
()¶
-
size_t
printTo
(Print &p) const¶
-
const String &
getTitle
() const
-
void
clear
()
-
void
update
(T value)
-
T
getMin
() const
-
T
getMax
() const
-
T
getTotal
() const
-
T
getAverage
() const
-
unsigned
getCount
() const
-
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
-
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
-
CallbackTimer &
initializeUs
(TimerCallback callback, void *arg = nullptr)¶ Initialise timer in microseconds (static check) with Timer Callback and optional argument.
-
CallbackTimer &
initializeUs
(InterruptCallback callback = nullptr)¶ Initialise timer in microseconds (static check) with optional Interrupt Callback (no argument)
-
CallbackTimer &
initializeUs
(TimeType microseconds, TimerCallback callback, void *arg = nullptr)¶ Initialise timer in microseconds with Timer Callback and optional argument.
-
CallbackTimer &
initializeUs
(TimeType microseconds, InterruptCallback callback = nullptr)¶ Initialise timer in microseconds with optional Interrupt Callback (no arg)
-
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
-
CallbackTimer &
initializeMs
(TimerCallback callback, void *arg = nullptr)¶ Initialise hardware timer in milliseconds (static check) with Timer Callback and optional argument.
-
CallbackTimer &
initializeMs
(InterruptCallback callback = nullptr)¶ Initialise hardware timer in milliseconds (static check) and optional Interrupt Callback (no arg)
-
CallbackTimer &
initializeMs
(uint32_t milliseconds, TimerCallback callback, void *arg = nullptr)¶ Initialise hardware timer in milliseconds with Timer Callback and optional argument.
-
CallbackTimer &
initializeMs
(uint32_t milliseconds, InterruptCallback callback = nullptr)¶ Initialise hardware timer in milliseconds with optional Interrupt Callback (no arg)
-
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
-
void
setCallback
(TimerCallback callback, void *arg = nullptr)¶ Set timer trigger callback.
- Parameters
callback
: Function to call when timer triggersarg
: Optional argument passed to callback
-
void
setCallback
(InterruptCallback callback)¶ Set timer trigger callback.
- Note
- Provided for convenience where callback argument not required
- Parameters
callback
: Function to call when timer triggers
-
CallbackTimer &
initialize
(TimerCallback callback, void *arg = nullptr)¶ Initialise timer with an interval (static check) and callback.
- Note
- If interval out of range compilation will fail with error
- Template Parameters
unit
: Time unit for intervaltime
: Timer interval
- Parameters
callback
: Callback function to call when timer triggersarg
: Optional argument passed to callback
- Return Value
CallbackTimer&
: Reference to timer
-
CallbackTimer &
initialize
(TimeType time, TimerCallback callback, void *arg = nullptr)¶ Initialise timer with an interval and callback.
- Template Parameters
unit
: Time unit for interval
- Parameters
time
: Timer intervalcallback
: Callback function to call when timer triggersarg
: Optional argument passed to callback
- Return Value
CallbackTimer&
: Reference to timer
-
bool
start
(bool repeating = true)¶ Start timer running.
- Parameters
repeating
: True to restart timer when it triggers, false for one-shot (Default: true)
- Return Value
bool
: True if timer started
-
bool
startOnce
()¶ Start one-shot timer.
- Note
- Timer starts and will run for configured period then stop
- Return Value
bool
: True if timer started
-
void
stop
()¶ Stops timer.
-
bool
restart
()¶ Restart timer.
- Note
- Timer is stopped then started with current configuration
- Return Value
bool
: True if timer started
-
bool
isStarted
() const¶ Check if timer is started.
- Return Value
bool
: True if started
-
TickType
getInterval
() const¶ Get timer interval in clock ticks.
-
bool
checkInterval
(TickType ticks) const¶ Check timer interval is valid.
- Parameters
ticks
: Interval to check
- Return Value
bool
: true if interval is within acceptable range for this timer
-
bool
setInterval
(TickType ticks)¶ Set timer interval in timer ticks.
- Parameters
ticks
: Interval in timer ticks
-
void
setInterval
()¶ Set timer interval in timer ticks (static check)
- Note
- On error, compilation fails with error message
- Template Parameters
ticks
: Interval in ticks
-
void
setInterval
() Set timer interval in specific time unit (static check)
- Note
- On error, compilation fails with error message
- Template Parameters
unit
:time
: Interval to set
-
bool
setInterval
(TimeType time)¶ Set timer interval in timer ticks.
- Template Parameters
unit
:
- Parameters
time
: Interval in given units
-
bool
setIntervalUs
(TimeType microseconds)¶ Set timer interval in microseconds.
-
void
setIntervalUs
()¶ Set timer interval in microseconds (static check)
-
bool
setIntervalMs
(uint32_t milliseconds)¶ Set timer interval in milliseconds.
-
void
setIntervalMs
()¶ Set timer interval in milliseconds (static check)
Public Static Functions
-
static constexpr Millis
millis
()¶ Get a millisecond time source.
-
static constexpr Micros
micros
()¶ Get a microsecond time source.
-
static constexpr uint64_t
usToTicks
()¶ Convert microsecond count into timer ticks.
-
static TickType
usToTicks
(TimeType time)¶ Convert microsecond count into timer ticks.
-
static constexpr uint64_t
ticksToUs
()¶ Convert timer ticks into microseconds.
-
static TimeType
ticksToUs
(TickType ticks)¶ Convert timer ticks into microseconds.
-
static constexpr void
checkInterval
()¶ Check timer interval in ticks is valid (static check)
- Note
- On error, compilation fails with error message
- Template Parameters
ticks
: Timer interval to check
-
static constexpr void
checkInterval
() Check timer interval in specific time unit is valid (static check)
- Note
- On error, compilation fails with error message
- Template Parameters
unit
: Time unit for intervaltime
: Interval to check
-
static constexpr void
checkIntervalMs
()¶ Check timer interval in milliseconds is valid (static check)
-
static constexpr void
checkIntervalUs
()¶ Check timer interval in microseconds is valid (static check)
Protected Types
-
template<>
usingClock
= OsTimerApi::Clock¶
-
template<>
usingTickType
= uint64_t¶
-
template<>
usingTimeType
= uint64_t¶
-
template<>