The RTC hal provides a low level interface to the Real Time Counter (RTC) of a target. More...
Modules | |
RTC hal tests | |
The RTC test validate proper implementation of the RTC hal. | |
Functions | |
void | rtc_init (void) |
Initialize the RTC peripheral. More... | |
void | rtc_free (void) |
Deinitialize RTC. More... | |
int | rtc_isenabled (void) |
Check if the RTC has the time set and is counting. More... | |
time_t | rtc_read (void) |
Get the current time from the RTC peripheral. More... | |
void | rtc_write (time_t t) |
Write the current time in seconds to the RTC peripheral. More... | |
The RTC hal provides a low level interface to the Real Time Counter (RTC) of a target.
void rtc_free | ( | void | ) |
Deinitialize RTC.
Powerdown the RTC in preparation for sleep, powerdown or reset. That should only affect the CPU domain and not the time keeping logic. After this function is called no other RTC functions should be called except for rtc_init.
Example Implementation Pseudo Code:
void rtc_init | ( | void | ) |
Initialize the RTC peripheral.
Powerup the RTC in perpetration for access. This function must be called before any other RTC functions ares called. This does not change the state of the RTC. It just enables access to it.
Example Implementation Pseudo Code:
int rtc_isenabled | ( | void | ) |
Check if the RTC has the time set and is counting.
0 | The time reported by the RTC is not valid |
1 | The time has been set the RTC is counting |
Example Implementation Pseudo Code:
time_t rtc_read | ( | void | ) |
Get the current time from the RTC peripheral.
Example implementation for an unsynchronized ripple counter: