libdragon
Loading...
Searching...
No Matches
rtc.h
Go to the documentation of this file.
1
6#ifndef __LIBDRAGON_RTC_H
7#define __LIBDRAGON_RTC_H
8
9#include <stdint.h>
10#include <stdbool.h>
11
101typedef struct rtc_time_t
102{
104 uint16_t year;
106 uint8_t month;
108 uint8_t day;
110 uint8_t hour;
112 uint8_t min;
114 uint8_t sec;
116 uint8_t week_day;
117} rtc_time_t;
118
119#ifdef __cplusplus
120extern "C" {
121#endif
122
142bool rtc_init( void );
143
156void rtc_close( void );
157
175bool rtc_is_writable( void );
176
201bool rtc_get( rtc_time_t * rtc_time );
202
219bool rtc_set( rtc_time_t * rtc_time );
220
246void rtc_normalize_time( rtc_time_t * rtc_time );
247
248#ifdef __cplusplus
249}
250#endif
251
/* rtc */
253
254#endif
uint8_t week_day
Day of week. [0-6] (Sun-Sat)
Definition rtc.h:116
uint8_t hour
Hours. [0-23].
Definition rtc.h:110
uint8_t min
Minutes. [0-59].
Definition rtc.h:112
uint8_t month
Month. [0-11].
Definition rtc.h:106
uint16_t year
Year. [1900-20XX].
Definition rtc.h:104
uint8_t sec
Seconds. [0-59].
Definition rtc.h:114
uint8_t day
Day of month. [1-31].
Definition rtc.h:108
bool rtc_set(rtc_time_t *rtc_time)
High-level convenience helper to set the RTC date/time.
Definition rtc.c:555
bool rtc_init(void)
High-level convenience helper to initialize the RTC subsystem.
Definition rtc.c:464
void rtc_normalize_time(rtc_time_t *rtc_time)
Calculate sane values for arbitrary time inputs.
Definition rtc.c:494
bool rtc_is_writable(void)
Determine whether the RTC supports writing the time.
Definition rtc.c:584
void rtc_close(void)
Close the RTC Subsystem, disabling system hooks.
Definition rtc.c:486
bool rtc_get(rtc_time_t *rtc_time)
Read the current date/time from the real-time clock.
Definition rtc.c:530
Structure for storing RTC time data.
Definition rtc.h:102