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_trtc_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.
 

Detailed Description

RTC related functions.

Function Documentation

◆ get_rtc_ticks()

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.

Returns
(sec) Time tick in 24.8 format

◆ rtc_check_unset()

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.

◆ rtc_read()

void rtc_read ( tm_t tm,
dt_t dt 
)

Read current data and time.

Parameters
[out]tmTime structure
[out]dtDate structure

◆ rtc_read_century()

uint8_t rtc_read_century ( )

Read current century.

Returns
century (as number i.e. year/100)

See rtc_write_century() for details.

◆ rtc_read_min()

uint8_t rtc_read_min ( )

Reads current minute.

Returns
[0-59] Current minute

◆ rtc_read_sec()

uint8_t rtc_read_sec ( )

Reads current second.

Returns
[0-59] Current second

◆ rtc_set_alarm()

void rtc_set_alarm ( tm_t tm,
dt_t dt 
)

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.

Parameters
tmWake-up time
dtWake-up date

◆ rtc_update_time_sec()

void rtc_update_time_sec ( int  delta_sec)

Shift time by given amount of seconds.

Parameters
delta_secNumber of seconds

◆ rtc_wakeup_delay()

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.

◆ rtc_write()

void rtc_write ( tm_t tm,
dt_t dt 
)

Set date and time.

Parameters
tmTime to set
dtDate to set

◆ rtc_write_century()

void rtc_write_century ( uint8_t  cent)

Write century.

Parameters
centCentury (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).