DMCP interface
03.15_020
|
RTC related functions. More...
Data Structures | |
struct | rtc_time_regs_t |
RTC time stamp parts. More... | |
struct | rtc_ticks_stat_t |
RTC ticks state. More... | |
Macros | |
#define | RTCREGS_SS_PER_SEC 256 |
Resolution of ticks reading. | |
Functions | |
void | rtc_read (tm_t *tm, dt_t *dt) |
Read current data and time. More... | |
void | rtc_write (tm_t *tm, dt_t *dt) |
Set date and time. More... | |
void | rtc_update_time_sec (int delta_sec) |
Shift time by given amount of seconds. More... | |
uint8_t | rtc_read_century () |
Read current century. More... | |
void | rtc_write_century (uint8_t cent) |
Write century. More... | |
uint8_t | rtc_read_min () |
Reads current minute. More... | |
uint8_t | rtc_read_sec () |
Reads current second. More... | |
void | rtc_wakeup_delay () |
Workaround for CPU bug. More... | |
void | rtc_check_unset () |
Check whether RTC was updated from cold start state. Displays set time and set date dialogs if it wasn't. More... | |
uint32_t | get_rtc_ticks () |
Get time ticks (linear time) More... | |
rtc_ticks_stat_t * | rtc_update_ticks () |
Returns pointer to currently updated RTC ticks structure. | |
void | rtc_set_alarm (tm_t *tm, dt_t *dt) |
Plants RTC alarm at given time. More... | |
void | rtc_cancel_alarm () |
Cancels any pending RTC alarm. | |
RTC related functions.
uint32_t get_rtc_ticks | ( | ) |
Get time ticks (linear time)
Returns current time ticks value in 24.8 format, therefore ticks resolution is 1/256 of second.
void rtc_check_unset | ( | ) |
Check whether RTC was updated from cold start state. Displays set time and set date dialogs if it wasn't.
This function is called during system restart and usually is not needed to be used by user program.
Read current data and time.
[out] | tm | Time structure |
[out] | dt | Date structure |
uint8_t rtc_read_century | ( | ) |
uint8_t rtc_read_min | ( | ) |
Reads current minute.
uint8_t rtc_read_sec | ( | ) |
Reads current second.
Plants RTC alarm at given time.
When RTC reaches given date and time CPU is woken-up and program gains control. Further alarms are disabled.
tm | Wake-up time |
dt | Wake-up date |
void rtc_update_time_sec | ( | int | delta_sec | ) |
Shift time by given amount of seconds.
delta_sec | Number of seconds |
void rtc_wakeup_delay | ( | ) |
Workaround for CPU bug.
This function should be called before first RTC read after wakeup from sleep to avoid wrong RTC reading.
void rtc_write_century | ( | uint8_t | cent | ) |
Write century.
cent | Century (as number i.e. year/100) |
Note that here is the century taken as a number not a sociocultural notion.
Hardware accommodates only two digit year, thus century has to be handled in software. Default value is set by system to 20 and program has to set century beyond this (e.g. after reset from user's profile).