rtc.h¶
Low-level RTC peripheral driver interface definitions.
-
void(*
rtc_alarm_cb_t
()¶ Signature for alarm Callback.
Parameters
arg: optional argument to put the callback in the right context
-
void
rtc_init
(void)¶ Initialize RTC module.
-
int
rtc_set_time
(struct tm * time)¶ Set RTC to given time.
Parameters
time: Pointer to the struct holding the time to set. Return values
- 0 for success
- -1 an error occurred
-
int
rtc_get_time
(struct tm * time)¶ Get current RTC time.
Parameters
time: Pointer to the struct to write the time to. Return values
- 0 for success
- -1 an error occurred
-
int
rtc_set_alarm
(struct tm * time,rtc.h::rtc_alarm_cb_t
cb, void * arg)¶ Set an alarm for RTC to the specified value.
Note
Any already set alarm will be overwritten.
Parameters
time: The value to trigger an alarm when hit. cb: Callback executed when alarm is hit. arg: Argument passed to callback when alarm is hit. Return values
- 0 for success
- -2 invalid
time
parameter - -1 other errors
-
int
rtc_get_alarm
(struct tm * time)¶ Gets the current alarm setting.
Parameters
time: Pointer to structure to receive alarm time Return values
- 0 for success
- -1 an error occurred
-
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.