7#ifndef _PICO_AON_TIMER_H
8#define _PICO_AON_TIMER_H
14#include "hardware/regs/intctrl.h"
73#ifndef AON_TIMER_IRQ_NUM
75#define AON_TIMER_IRQ_NUM() RTC_IRQ
77#define AON_TIMER_IRQ_NUM() POWMAN_IRQ_TIMER
81typedef void (*aon_timer_alarm_handler_t)(void);
228aon_timer_alarm_handler_t
aon_timer_enable_alarm(
const struct timespec *ts, aon_timer_alarm_handler_t handler,
bool wakeup_from_low_power);
266static inline uint aon_timer_get_irq_num(
void) {
bool aon_timer_is_running(void)
Check if the AON timer is running.
Definition aon_timer.c:252
bool aon_timer_start(const struct timespec *ts)
Start the AON timer running using the specified timespec as the current time.
Definition aon_timer.c:195
void aon_timer_disable_alarm(void)
Disable the currently enabled AON timer alarm if any.
Definition aon_timer.c:174
bool aon_timer_start_calendar(const struct tm *tm)
Start the AON timer running using the specified calendar date/time as the current time.
Definition aon_timer.c:213
void aon_timer_start_with_timeofday(void)
Start the AON timer running using the result from the gettimeofday() function as the current time.
Definition aon_timer.c:186
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.
Definition aon_timer.c:111
bool aon_timer_get_time(struct timespec *ts)
Get the current time of the AON timer.
Definition aon_timer.c:77
#define AON_TIMER_IRQ_NUM()
Returns the irq_num_t for interrupts for the actual hardware backing the AON timer abstraction.
Definition aon_timer.h:77
bool aon_timer_get_time_calendar(struct tm *tm)
Get the current time of the AON timer as a calendar date/time.
Definition aon_timer.c:90
void aon_timer_get_resolution(struct timespec *ts)
Get the resolution of the AON timer.
Definition aon_timer.c:240
static absolute_time_t aon_timer_make_timeout_time_ms(uint32_t ms)
Convenience method to get the timestamp a number of milliseconds from the current time of the AON tim...
Definition aon_timer.h:197
absolute_time_t aon_timer_get_absolute_time(void)
Get the current time of the AON timer as an absolute time.
Definition aon_timer.c:105
bool aon_timer_set_time(const struct timespec *ts)
Set the current time of the AON timer.
Definition aon_timer.c:42
void aon_timer_stop(void)
Stop the AON timer.
Definition aon_timer.c:230
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.
Definition aon_timer.c:152
bool aon_timer_set_time_calendar(const struct tm *tm)
Set the current time of the AON timer to the given calendar date/time.
Definition aon_timer.c:56
static absolute_time_t delayed_by_ms(const absolute_time_t t, uint32_t ms)
Return a timestamp value obtained by adding a number of milliseconds to another timestamp.
Definition time.h:130
uint64_t absolute_time_t
An opaque 64 bit timestamp in microseconds.
Definition types.h:43