Low Power Timout.
More...
#include <LowPowerTimeout.h>
Low Power Timout.
- Note
- Synchronization level: Interrupt safe
Definition at line 38 of file LowPowerTimeout.h.
◆ clock
Clock to use with attach_absolute, guaranteeing running only while attached or manually locked.
Definition at line 43 of file LowPowerTimeout.h.
◆ steady_clock
Clock to use with attach_absolute, running always.
Definition at line 46 of file LowPowerTimeout.h.
◆ scheduled_time()
LowPowerClock::time_point scheduled_time |
( |
| ) |
const |
Return scheduled callback time.
- Returns
- scheduled callback time
- Note
- if the callback is overdue, or has already run, the returned value will be in the past
Definition at line 54 of file LowPowerTimeout.h.
◆ attach_absolute()
void attach_absolute |
( |
F && |
func, |
|
|
LowPowerClock::time_point |
abs_time |
|
) |
| |
Attach a function to be called by the Timeout, specifying the absolute time.
- Parameters
-
func | pointer to the function to be called |
abs_time | the absolute time for the call, referenced to LowPowerClock |
- Note
- setting abs_time to a time in the past means the event will be scheduled immediately resulting in an instant call to the function.
Definition at line 69 of file LowPowerTimeout.h.
◆ remaining_time()
std::chrono::microseconds remaining_time |
( |
| ) |
const |
|
inherited |
Return time remaining until callback.
- Returns
- time remaining until callback is due
- Note
- if the callback is overdue, or has already run, the returned value will be negative
Definition at line 68 of file Timeout.h.
◆ attach() [1/2]
Attach a function to be called by the Ticker, specifying the interval in seconds.
The method forwards its arguments to attach_us() rather than copying them which may not be trivial depending on the callback copied. The function is forcibly inlined to not use floating-point operations. This is possible given attach_us() expects an integer value for the callback interval.
- Parameters
-
func | pointer to the function to be called |
t | the time between calls in seconds |
- Deprecated:
- Pass a chrono duration, not a float second count. For example use
10ms
rather than 0.01f
.
Definition at line 92 of file Ticker.h.
◆ attach() [2/2]
void attach |
( |
Callback< void()> |
func, |
|
|
std::chrono::microseconds |
t |
|
) |
| |
|
inherited |
Attach a function to be called by the Ticker, specifying the interval in microseconds.
- Parameters
-
func | pointer to the function to be called |
t | the time between calls in micro-seconds |
- Note
- setting t to a value shorter than it takes to process the ticker callback causes the system to hang. Ticker callback is called constantly with no time for threads scheduling.
◆ attach_us()
Attach a function to be called by the Ticker, specifying the interval in microseconds.
- Parameters
-
func | pointer to the function to be called |
t | the time between calls in micro-seconds |
- Note
- setting t to a value shorter than it takes to process the ticker callback causes the system to hang. Ticker callback is called constantly with no time for threads scheduling.
- Deprecated:
- Pass a chrono duration, not an integer microsecond count. For example use
10ms
rather than 10000
.
◆ detach()