rtc.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef _HARDWARE_RTC_H
8 #define _HARDWARE_RTC_H
9 
10 #include "pico.h"
11 #include "hardware/structs/rtc.h"
12 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
40 typedef void (*rtc_callback_t)(void);
41 
45 void rtc_init(void);
46 
58 
66 
71 bool rtc_running(void);
72 
79 void rtc_set_alarm(datetime_t *t, rtc_callback_t user_callback);
80 
84 void rtc_enable_alarm(void);
85 
89 void rtc_disable_alarm(void);
90 
91 #ifdef __cplusplus
92 }
93 #endif
94 
95 #endif
void(* rtc_callback_t)(void)
Definition: rtc.h:40
void rtc_disable_alarm(void)
Disable the RTC alarm (if active)
Definition: rtc.c:185
bool rtc_get_datetime(datetime_t *t)
Get the current time from the RTC.
Definition: rtc.c:88
bool rtc_set_datetime(datetime_t *t)
Set the RTC to the specified time.
Definition: rtc.c:55
void rtc_enable_alarm(void)
Enable the RTC alarm (if inactive)
Definition: rtc.c:109
bool rtc_running(void)
Is the RTC running?
Definition: rtc.c:18
void rtc_init(void)
Initialise the RTC system.
Definition: rtc.c:22
void rtc_set_alarm(datetime_t *t, rtc_callback_t user_callback)
Set a time in the future for the RTC to call a user provided callback.
Definition: rtc.c:147
Structure containing date and time information.
Definition: types.h:81