Real-Time Clock Function Documentation

 

Sys_RTC_Config

void Sys_RTC_Config(uint32_t rtc_cfg, uint32_t rtc_ctrl)

 

Configure RTC block.

 

Location: rtc.h:49

 

Parameters

Direction Name Description

in

rtc_cfg

Select the RTC clock event and clock source; use RTC_CLOCK_*, and RTC_CLK_SRC_*

in

rtc_ctrl

RTC control register; use RTC_FORCE_CLOCK, RTC_[DISABLE | ENABLE]_CLOCK_EVENT, RTC_[DISABLE | ENABLE]_ALARM_EVENT, RTC_RESET, and RTC_[DISABLE | ENABLE]

 

 

Example Code for Sys_RTC_Config

    // Enable clock and alarm events and enable the RTC

    // Configure the RTC clock to trigger once a second

    // Use external 32kHz crystal as the clock

    Sys_RTC_Config(RTC_CLK_SRC_XTAL32K | RTC_CLOCK_1S, 

                   RTC_ENABLE_CLOCK_EVENT | RTC_ENABLE_ALARM_EVENT | RTC_ENABLE);

 

Sys_RTC_Count_Threshold

void Sys_RTC_Count_Threshold(uint32_t threshold)

 

Configure RTC Counter Threshold.

 

Location: rtc.h:63

 

Parameters

Direction Name Description

in

threshold

Compare value for the RTC counter; use RTC_COUNT_THRES_*

 

 

Example Code for Sys_RTC_Count_Threshold

    // Set the RTC counter threshold to 32767 (1 second, assuming an RTC clock

    // frequency of 32768 Hz)

    result = Sys_RTC_Count_Threshold(32767);

 

Sys_RTC_Value_Seconds

uint32_t Sys_RTC_Value_Seconds()

 

Read the current value of the RTC timer in seconds.

 

Location: rtc.h:73

 


Return


RTC timer current value in seconds

 

 

Example Code for Sys_RTC_Value_Seconds

    // Return the current value of the RTC counter, converted to seconds

    result = Sys_RTC_Value_Seconds();

 

Sys_RTC_Value

uint32_t Sys_RTC_Value()

 

Read the current value of the RTC timer.

 

Location: rtc.h:83

 


Return


RTC timer counter current value

 

 

Example Code for Sys_RTC_Value

    // Return the current value of the RTC counter

    result = Sys_RTC_Value();