Functions | |
cy_en_rtc_status_t | Cy_RTC_Init (cy_stc_rtc_config_t const *config) |
Initializes the RTC driver. More... | |
cy_en_rtc_status_t | Cy_RTC_SetDateAndTime (cy_stc_rtc_config_t const *dateTime) |
Sets the time and date values into the RTC_TIME and RTC_DATE registers. More... | |
void | Cy_RTC_GetDateAndTime (cy_stc_rtc_config_t *dateTime) |
Gets the current RTC time and date. More... | |
cy_en_rtc_status_t | Cy_RTC_SetDateAndTimeDirect (uint32_t sec, uint32_t min, uint32_t hour, uint32_t date, uint32_t month, uint32_t year) |
Sets the time and date values into the RTC_TIME and RTC_DATE registers using direct time parameters. More... | |
cy_en_rtc_status_t | Cy_RTC_SetHoursFormat (cy_en_rtc_hours_format_t hoursFormat) |
Sets the 12/24-hour mode. More... | |
void | Cy_RTC_SelectFrequencyPrescaler (cy_en_rtc_clock_freq_t clkSel) |
Selects the RTC pre-scaler value and changes its clock frequency. More... | |
void | Cy_RTC_SelectClockSource (cy_en_rtc_clk_select_sources_t clkSel) |
cy_en_rtc_status_t | Cy_RTC_CalibrationControlEnable (uint8_t calib_val, cy_en_rtc_calib_sign_t calib_sign, cy_en_rtc_calib_sel_t calib_sel) |
This function writes calibration control register. More... | |
cy_en_rtc_status_t | Cy_RTC_CalibrationControlDisable (void) |
This function disables the calibration control. More... | |
cy_en_rtc_status_t Cy_RTC_Init | ( | cy_stc_rtc_config_t const * | config | ) |
Initializes the RTC driver.
*config | The pointer to the RTC configuration structure, see cy_stc_rtc_config_t. |
cy_en_rtc_status_t Cy_RTC_SetDateAndTime | ( | cy_stc_rtc_config_t const * | dateTime | ) |
Sets the time and date values into the RTC_TIME and RTC_DATE registers.
dateTime | The pointer to the RTC configuration structure, see cy_stc_rtc_config_t. |
void Cy_RTC_GetDateAndTime | ( | cy_stc_rtc_config_t * | dateTime | ) |
Gets the current RTC time and date.
The AHB RTC Time and Date register values are stored into the *dateTime structure.
dateTime | The RTC time and date structure. See Data Structures. |
cy_en_rtc_status_t Cy_RTC_SetDateAndTimeDirect | ( | uint32_t | sec, |
uint32_t | min, | ||
uint32_t | hour, | ||
uint32_t | date, | ||
uint32_t | month, | ||
uint32_t | year | ||
) |
Sets the time and date values into the RTC_TIME and RTC_DATE registers using direct time parameters.
sec | The second valid range is [0-59]. |
min | The minute valid range is [0-59]. |
hour | The hour valid range is [0-23]. This parameter should be presented in the 24-hour format. |
The function reads the current 12/24-hour mode, then converts the hour value properly as the mode.
date | The date valid range is [1-31], if the month of February is selected as the Month parameter, then the valid range is [0-29]. |
month | The month valid range is [1-12]. |
year | The year valid range is [0-99]. |
cy_en_rtc_status_t Cy_RTC_SetHoursFormat | ( | cy_en_rtc_hours_format_t | hoursFormat | ) |
Sets the 12/24-hour mode.
hoursFormat | The current hour format, see cy_en_rtc_hours_format_t. |
void Cy_RTC_SelectFrequencyPrescaler | ( | cy_en_rtc_clock_freq_t | clkSel | ) |
Selects the RTC pre-scaler value and changes its clock frequency.
If the external 32.768 kHz WCO is absent on the board, the RTC can be driven by a 32.768kHz square clock source or an external 50-Hz or 60-Hz sine-wave clock source, for example the wall AC frequency.
clkSel | clock frequency, see cy_en_rtc_clock_freq_t. |
In addition to generating the 32.768 kHz clock from external crystals, the WCO can be sourced by an external clock source (50 Hz or 60Hz), even the wall AC frequency as a timebase. The API helps select between the RTC sources:
If you want to use an external 50-Hz or 60-Hz sine-wave clock source to drive the RTC, the next procedure is required:
If you want to use the WCO after using an external 50-Hz or 60-Hz sine-wave clock source:
(1) - Refer to the device TRM to know how to configure the wco pins properly and which wco pin should be driven/floating.
void Cy_RTC_SelectClockSource | ( | cy_en_rtc_clk_select_sources_t | clkSel | ) |
clkSel | Source clock, see cy_en_rtc_clk_select_sources_t Selects the source clock for RTC. |
cy_en_rtc_status_t Cy_RTC_CalibrationControlEnable | ( | uint8_t | calib_val, |
cy_en_rtc_calib_sign_t | calib_sign, | ||
cy_en_rtc_calib_sel_t | calib_sel | ||
) |
This function writes calibration control register.
calib_val | Calibration value for absolute frequency (at a fixed temperature). Each step causes 128 ticks to be added or removed each hour. |
calib_sign | Remove or Add ticks, see cy_en_rtc_calib_sign_t |
calib_sel | Select calibration wave output signal, see cy_en_rtc_calib_sel_t |
cy_en_rtc_status_t Cy_RTC_CalibrationControlDisable | ( | void | ) |
This function disables the calibration control.