libdragon
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
20typedef struct rtc_time_t
21{
23 uint16_t year;
25 uint8_t month;
27 uint8_t day;
29 uint8_t hour;
31 uint8_t min;
33 uint8_t sec;
35 uint8_t week_day;
37
38#ifdef __cplusplus
39extern "C" {
40#endif
41
42bool rtc_init( void );
43void rtc_close( void );
44bool rtc_is_writable( void );
45bool rtc_get( rtc_time_t * rtc_time );
46bool rtc_set( rtc_time_t * rtc_time );
47void rtc_normalize_time( rtc_time_t * rtc_time );
48
49#ifdef __cplusplus
50}
51#endif
52 /* rtc */
54
55#endif
uint8_t week_day
Day of week. [0-6] (Sun-Sat)
Definition: rtc.h:35
uint8_t hour
Hours. [0-23].
Definition: rtc.h:29
uint8_t min
Minutes. [0-59].
Definition: rtc.h:31
uint8_t month
Month. [0-11].
Definition: rtc.h:25
uint16_t year
Year. [1900-20XX].
Definition: rtc.h:23
uint8_t sec
Seconds. [0-59].
Definition: rtc.h:33
uint8_t day
Day of month. [1-31].
Definition: rtc.h:27
bool rtc_set(rtc_time_t *write_time)
High-level convenience helper to set the RTC date/time.
Definition: rtc.c:733
bool rtc_init(void)
High-level convenience helper to initialize the RTC subsystem.
Definition: rtc.c:565
void rtc_normalize_time(rtc_time_t *rtc_time)
Calculate sane values for arbitrary time inputs.
Definition: rtc.c:632
bool rtc_is_writable(void)
Determine whether the RTC supports writing the time.
Definition: rtc.c:779
void rtc_close(void)
Close the RTC Subsystem, disabling system hooks.
Definition: rtc.c:599
bool rtc_get(rtc_time_t *rtc_time)
Read the current date/time from the real-time clock.
Definition: rtc.c:692
Structure for storing RTC time data.
Definition: rtc.h:21