@web-font-path: "roboto-debian.css";
v2.2.0 (RP2040)
Loading...
Searching...
No Matches
aon_timer.h
Go to the documentation of this file.
/*
* Copyright (c) 2024 Raspberry Pi (Trading) Ltd.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef _PICO_AON_TIMER_H
#define _PICO_AON_TIMER_H
#include "pico.h"
#include <time.h>
#include "pico/util/datetime.h"
#include "hardware/regs/intctrl.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifndef AON_TIMER_IRQ_NUM
#if HAS_RP2040_RTC
#define AON_TIMER_IRQ_NUM() RTC_IRQ
#elif HAS_POWMAN_TIMER
#define AON_TIMER_IRQ_NUM() POWMAN_IRQ_TIMER
#endif
#endif
typedef void (*aon_timer_alarm_handler_t)(void);
void aon_timer_start_with_timeofday(void);
bool aon_timer_start(const struct timespec *ts);
bool aon_timer_start_calendar(const struct tm *tm);
void aon_timer_stop(void);
bool aon_timer_set_time(const struct timespec *ts);
bool aon_timer_set_time_calendar(const struct tm *tm);
bool aon_timer_get_time(struct timespec *ts);
bool aon_timer_get_time_calendar(struct tm *tm);
void aon_timer_get_resolution(struct timespec *ts);
aon_timer_alarm_handler_t aon_timer_enable_alarm(const struct timespec *ts, aon_timer_alarm_handler_t handler, bool wakeup_from_low_power);
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);
void aon_timer_disable_alarm(void);
bool aon_timer_is_running(void);
static inline uint aon_timer_get_irq_num(void) {
return AON_TIMER_IRQ_NUM();
}
#ifdef __cplusplus
}
#endif
#endif
datetime.h
aon_timer_is_running
bool aon_timer_is_running(void)
Check if the AON timer is running.
Definition aon_timer.c:245
aon_timer_start
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:188
aon_timer_disable_alarm
void aon_timer_disable_alarm(void)
Disable the currently enabled AON timer alarm if any.
Definition aon_timer.c:168
aon_timer_start_calendar
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:206
aon_timer_start_with_timeofday
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:179
aon_timer_enable_alarm
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:105
aon_timer_get_time
bool aon_timer_get_time(struct timespec *ts)
Get the current time of the AON timer.
Definition aon_timer.c:77
aon_timer_get_time_calendar
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
aon_timer_get_resolution
void aon_timer_get_resolution(struct timespec *ts)
Get the resolution of the AON timer.
Definition aon_timer.c:233
aon_timer_set_time
bool aon_timer_set_time(const struct timespec *ts)
Set the current time of the AON timer.
Definition aon_timer.c:42
aon_timer_stop
void aon_timer_stop(void)
Stop the AON timer.
Definition aon_timer.c:223
aon_timer_enable_alarm_calendar
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:146
aon_timer_set_time_calendar
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
pico.h