The friendly Operating System for the Internet of Things

Low-level RTC (Real Time Clock) peripheral driver. More...

Detailed Description

Note
The values used for setting and getting the time/alarm should conform to the struct tm specification. Compare: http://pubs.opengroup.org/onlinepubs/7908799/xsh/time.h.html

Files

file  rtc.h
 Low-level RTC peripheral driver interface definitions.
 

Typedefs

typedef void(* rtc_alarm_cb_t) (void *arg)
 Signature for alarm Callback. More...
 

Functions

void rtc_init (void)
 Initialize RTC module.
 
int rtc_set_time (struct tm *time)
 Set RTC to given time. More...
 
int rtc_get_time (struct tm *time)
 Get current RTC time. More...
 
int rtc_set_alarm (struct tm *time, rtc_alarm_cb_t cb, void *arg)
 Set an alarm for RTC to the specified value. More...
 
int rtc_get_alarm (struct tm *time)
 Gets the current alarm setting. More...
 
void rtc_clear_alarm (void)
 Clear any set alarm, do nothing if nothing set.
 
void rtc_poweron (void)
 Turns the RTC hardware module on.
 
void rtc_poweroff (void)
 Turns the RTC hardware module off.
 

Typedef Documentation

typedef void(* rtc_alarm_cb_t) (void *arg)
Parameters
[in]argoptional argument to put the callback in the right context

Definition at line 44 of file rtc.h.

Function Documentation

int rtc_get_alarm ( struct tm time)
Parameters
[out]timePointer to structure to receive alarm time
Returns
0 for success
-1 an error occurred
int rtc_get_time ( struct tm time)
Parameters
[out]timePointer to the struct to write the time to.
Returns
0 for success
-1 an error occurred
int rtc_set_alarm ( struct tm time,
rtc_alarm_cb_t  cb,
void *  arg 
)
Note
Any already set alarm will be overwritten.
Parameters
[in]timeThe value to trigger an alarm when hit.
[in]cbCallback executed when alarm is hit.
[in]argArgument passed to callback when alarm is hit.
Returns
0 for success
-2 invalid time parameter
-1 other errors
int rtc_set_time ( struct tm time)
Parameters
[in]timePointer to the struct holding the time to set.
Returns
0 for success
-1 an error occurred