libdragon
Loading...
Searching...
No Matches
rtc.h
Go to the documentation of this file.
1
8#ifndef __LIBDRAGON_RTC_H
9#define __LIBDRAGON_RTC_H
10
11#include <stdint.h>
12#include <stdbool.h>
13
103typedef struct rtc_time_t
104{
106 uint16_t year;
108 uint8_t month;
110 uint8_t day;
112 uint8_t hour;
114 uint8_t min;
116 uint8_t sec;
118 uint8_t week_day;
119} rtc_time_t;
120
121#ifdef __cplusplus
122extern "C" {
123#endif
124
144bool rtc_init( void );
145
158void rtc_close( void );
159
177bool rtc_is_writable( void );
178
203bool rtc_get( rtc_time_t * rtc_time );
204
221bool rtc_set( rtc_time_t * rtc_time );
222
248void rtc_normalize_time( rtc_time_t * rtc_time );
249
250#ifdef __cplusplus
251}
252#endif
253
/* rtc */
255
256#endif
uint8_t week_day
Day of week. [0-6] (Sun-Sat)
Definition rtc.h:118
uint8_t hour
Hours. [0-23].
Definition rtc.h:112
uint8_t min
Minutes. [0-59].
Definition rtc.h:114
uint8_t month
Month. [0-11].
Definition rtc.h:108
uint16_t year
Year. [1900-20XX].
Definition rtc.h:106
uint8_t sec
Seconds. [0-59].
Definition rtc.h:116
uint8_t day
Day of month. [1-31].
Definition rtc.h:110
bool rtc_set(rtc_time_t *rtc_time)
High-level convenience helper to set the RTC date/time.
Definition rtc.c:556
bool rtc_init(void)
High-level convenience helper to initialize the RTC subsystem.
Definition rtc.c:465
void rtc_normalize_time(rtc_time_t *rtc_time)
Calculate sane values for arbitrary time inputs.
Definition rtc.c:495
bool rtc_is_writable(void)
Determine whether the RTC supports writing the time.
Definition rtc.c:585
void rtc_close(void)
Close the RTC Subsystem, disabling system hooks.
Definition rtc.c:487
bool rtc_get(rtc_time_t *rtc_time)
Read the current date/time from the real-time clock.
Definition rtc.c:531
Structure for storing RTC time data.
Definition rtc.h:104