rtc.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 Thomas Eichinger <thomas.eichinger@fu-berlin.de>
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser General
5  * Public License v2.1. See the file LICENSE in the top level directory for more
6  * details.
7  */
8 
26 #ifndef RTC_H
27 #define RTC_H
28 
29 #include <time.h>
30 #include "periph_conf.h"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 /* guard file in case no RTC device was specified */
37 #if RTC_NUMOF
38 
44 typedef void(*rtc_alarm_cb_t)(void *arg);
45 
49 void rtc_init(void);
50 
59 int rtc_set_time(struct tm *time);
60 
69 int rtc_get_time(struct tm *time);
70 
84 int rtc_set_alarm(struct tm *time, rtc_alarm_cb_t cb, void *arg);
85 
94 int rtc_get_alarm(struct tm *time);
95 
99 void rtc_clear_alarm(void);
100 
104 void rtc_poweron(void);
105 
109 void rtc_poweroff(void);
110 
111 #endif /* RTC_NUMOF */
112 
113 #ifdef __cplusplus
114 }
115 #endif
116 
117 #endif /* RTC_H */
118 
void rtc_init(void)
Initialize RTC module.
void rtc_clear_alarm(void)
Clear any set alarm, do nothing if nothing set.
int rtc_set_time(struct tm *time)
Set RTC to given time.
void rtc_poweroff(void)
Turns the RTC hardware module off.
void rtc_poweron(void)
Turns the RTC hardware module on.
void(* rtc_alarm_cb_t)(void *arg)
Signature for alarm Callback.
Definition: rtc.h:44
int rtc_get_alarm(struct tm *time)
Gets the current alarm setting.
Datatype to represent time.
int rtc_set_alarm(struct tm *time, rtc_alarm_cb_t cb, void *arg)
Set an alarm for RTC to the specified value.
int rtc_get_time(struct tm *time)
Get current RTC time.