@web-font-path: "roboto-debian.css";
High Level "Always on Timer" Abstraction. More...
Functions | |
void | aon_timer_start_with_timeofday (void) |
Start the AON timer running using the result from the gettimeofday() function as the current time. | |
bool | aon_timer_start (const struct timespec *ts) |
Start the AON timer running using the specified timespec as the current time. | |
bool | aon_timer_start_calendar (const struct tm *tm) |
Start the AON timer running using the specified calendar date/time as the current time. | |
void | aon_timer_stop (void) |
Stop the AON timer. | |
bool | aon_timer_set_time (const struct timespec *ts) |
Set the current time of the AON timer. | |
bool | aon_timer_set_time_calendar (const struct tm *tm) |
Set the current time of the AON timer to the given calendar date/time. | |
bool | aon_timer_get_time (struct timespec *ts) |
Get the current time of the AON timer. | |
bool | aon_timer_get_time_calendar (struct tm *tm) |
Get the current time of the AON timer as a calendar date/time. | |
void | aon_timer_get_resolution (struct timespec *ts) |
Get the resolution of the AON timer. | |
aon_timer_alarm_handler_t | aon_timer_enable_alarm (const struct timespec *ts, aon_timer_alarm_handler_t handler, bool wakeup_from_low_power) |
Enable an AON timer alarm for a specified time. | |
aon_timer_alarm_handler_t | aon_timer_enable_alarm_calendar (const struct tm *tm, aon_timer_alarm_handler_t handler, bool wakeup_from_low_power) |
Enable an AON timer alarm for a specified calendar date/time. | |
void | aon_timer_disable_alarm (void) |
Disable the currently enabled AON timer alarm if any. | |
bool | aon_timer_is_running (void) |
Check if the AON timer is running. | |
High Level "Always on Timer" Abstraction.
This library uses the RTC on RP2040.
This library supports both aon_timer_xxx_calendar()
methods which use a calendar date/time (as struct tm), and aon_timer_xxx()
methods which use a linear time value relative an internal reference time (via struct timespec).
On RP2040 the non 'calendar date/time' methods must convert the linear time value to a calendar date/time internally; these methods are:
This conversion is handled by the pico_localtime_r method. By default, this pulls in the C library local_time_r
method which can lead to a big increase in binary size. The default implementation of pico_localtime_r
is weak, so it can be overridden if a better/smaller alternative is available, otherwise you might consider the method variants ending in _calendar()
instead on RP2040.
aon_timer_alarm_handler_t aon_timer_enable_alarm | ( | const struct timespec * | ts, |
aon_timer_alarm_handler_t | handler, | ||
bool | wakeup_from_low_power ) |
Enable an AON timer alarm for a specified time.
On RP2040 the alarm will not fire if it is in the past.
See caveats for using this method on RP2040
ts | the alarm time |
handler | a callback to call when the timer fires (can be NULL for wakeup_from_low_power = true) |
wakeup_from_low_power | true if the AON timer is to be used to wake up from a DORMANT state |
aon_timer_alarm_handler_t aon_timer_enable_alarm_calendar | ( | const struct tm * | tm, |
aon_timer_alarm_handler_t | handler, | ||
bool | wakeup_from_low_power ) |
Enable an AON timer alarm for a specified calendar date/time.
On RP2040 the alarm will not fire if it is in the past.
tm | the alarm calendar date/time |
handler | a callback to call when the timer fires (can be NULL for wakeup_from_low_power = true) |
wakeup_from_low_power | true if the AON timer is to be used to wake up from a DORMANT state |
void aon_timer_get_resolution | ( | struct timespec * | ts | ) |
Get the resolution of the AON timer.
ts | out value for the resolution of the AON timer |
bool aon_timer_get_time | ( | struct timespec * | ts | ) |
Get the current time of the AON timer.
See caveats for using this method on RP2040
ts | out value for the current time |
bool aon_timer_get_time_calendar | ( | struct tm * | tm | ) |
Get the current time of the AON timer as a calendar date/time.
tm | out value for the current calendar date/time |
bool aon_timer_is_running | ( | void | ) |
Check if the AON timer is running.
bool aon_timer_set_time | ( | const struct timespec * | ts | ) |
Set the current time of the AON timer.
See caveats for using this method on RP2040
ts | the new current time |
bool aon_timer_set_time_calendar | ( | const struct tm * | tm | ) |
Set the current time of the AON timer to the given calendar date/time.
tm | the new current time |
bool aon_timer_start | ( | const struct timespec * | ts | ) |
Start the AON timer running using the specified timespec as the current time.
See caveats for using this method on RP2040
ts | the time to set as 'now' |
bool aon_timer_start_calendar | ( | const struct tm * | tm | ) |
Start the AON timer running using the specified calendar date/time as the current time.
tm | the calendar date/time to set as 'now' |
void aon_timer_start_with_timeofday | ( | void | ) |
Start the AON timer running using the result from the gettimeofday() function as the current time.
See caveats for using this method on RP2040