Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Space_Invaders_Demo neopixels gpio_test_stm32f3_discovery gpio_test_systimer ... more
Initialization and Configuration functions
[RTC_Private_Functions]
Initialization and Configuration functions. More...
Functions | |
ErrorStatus | RTC_DeInit (void) |
Deinitializes the RTC registers to their default reset values. | |
ErrorStatus | RTC_Init (RTC_InitTypeDef *RTC_InitStruct) |
Initializes the RTC registers according to the specified parameters in RTC_InitStruct. | |
void | RTC_StructInit (RTC_InitTypeDef *RTC_InitStruct) |
Fills each RTC_InitStruct member with its default value. | |
void | RTC_WriteProtectionCmd (FunctionalState NewState) |
Enables or disables the RTC registers write protection. | |
ErrorStatus | RTC_EnterInitMode (void) |
Enters the RTC Initialization mode. | |
void | RTC_ExitInitMode (void) |
Exits the RTC Initialization mode. | |
ErrorStatus | RTC_WaitForSynchro (void) |
Waits until the RTC Time and Date registers (RTC_TR and RTC_DR) are synchronized with RTC APB clock. | |
ErrorStatus | RTC_RefClockCmd (FunctionalState NewState) |
Enables or disables the RTC reference clock detection. | |
void | RTC_BypassShadowCmd (FunctionalState NewState) |
Enables or Disables the Bypass Shadow feature. |
Detailed Description
Initialization and Configuration functions.
=============================================================================== ##### Initialization and Configuration functions ##### =============================================================================== [..] This section provide functions allowing to initialize and configure the RTC Prescaler (Synchronous and Asynchronous), RTC Hour format, disable RTC registers Write protection, enter and exit the RTC initialization mode, RTC registers synchronization check and reference clock detection enable. (#) The RTC Prescaler is programmed to generate the RTC 1Hz time base. It is split into 2 programmable prescalers to minimize power consumption. (++) A 7-bit asynchronous prescaler and A 13-bit synchronous prescaler. (++) When both prescalers are used, it is recommended to configure the asynchronous prescaler to a high value to minimize consumption. (#) All RTC registers are Write protected. Writing to the RTC registers is enabled by writing a key into the Write Protection register, RTC_WPR. (#) To Configure the RTC Calendar, user application should enter initialization mode. In this mode, the calendar counter is stopped and its value can be updated. When the initialization sequence is complete, the calendar restarts counting after 4 RTCCLK cycles. (#) To read the calendar through the shadow registers after Calendar initialization, calendar update or after wakeup from low power modes the software must first clear the RSF flag. The software must then wait until it is set again before reading the calendar, which means that the calendar registers have been correctly copied into the RTC_TR and RTC_DR shadow registers. The RTC_WaitForSynchro() function implements the above software sequence (RSF clear and RSF check).
Function Documentation
void RTC_BypassShadowCmd | ( | FunctionalState | NewState ) |
Enables or Disables the Bypass Shadow feature.
- Note:
- When the Bypass Shadow is enabled the calendar value are taken directly from the Calendar counter.
- Parameters:
-
NewState,: new state of the Bypass Shadow feature. This parameter can be: ENABLE or DISABLE.
- Return values:
-
None
Definition at line 672 of file stm32f30x_rtc.c.
ErrorStatus RTC_DeInit | ( | void | ) |
Deinitializes the RTC registers to their default reset values.
- Note:
- This function doesn't reset the RTC Clock source and RTC Backup Data registers.
- Parameters:
-
None
- Return values:
-
An ErrorStatus enumeration value: - SUCCESS: RTC registers are deinitialized
- ERROR: RTC registers are not deinitialized
Definition at line 328 of file stm32f30x_rtc.c.
ErrorStatus RTC_EnterInitMode | ( | void | ) |
Enters the RTC Initialization mode.
- Note:
- The RTC Initialization mode is write protected, use the RTC_WriteProtectionCmd(DISABLE) before calling this function.
- Parameters:
-
None
- Return values:
-
An ErrorStatus enumeration value: - SUCCESS: RTC is in Init mode
- ERROR: RTC is not in Init mode
Definition at line 506 of file stm32f30x_rtc.c.
void RTC_ExitInitMode | ( | void | ) |
Exits the RTC Initialization mode.
- Note:
- When the initialization sequence is complete, the calendar restarts counting after 4 RTCCLK cycles.
- The RTC Initialization mode is write protected, use the RTC_WriteProtectionCmd(DISABLE) before calling this function.
- Parameters:
-
None
- Return values:
-
None
Definition at line 551 of file stm32f30x_rtc.c.
ErrorStatus RTC_Init | ( | RTC_InitTypeDef * | RTC_InitStruct ) |
Initializes the RTC registers according to the specified parameters in RTC_InitStruct.
- Parameters:
-
RTC_InitStruct,: pointer to a RTC_InitTypeDef structure that contains the configuration information for the RTC peripheral.
- Note:
- The RTC Prescaler register is write protected and can be written in initialization mode only.
- Return values:
-
An ErrorStatus enumeration value: - SUCCESS: RTC registers are initialized
- ERROR: RTC registers are not initialized
Definition at line 411 of file stm32f30x_rtc.c.
ErrorStatus RTC_RefClockCmd | ( | FunctionalState | NewState ) |
Enables or disables the RTC reference clock detection.
- Parameters:
-
NewState,: new state of the RTC reference clock. This parameter can be: ENABLE or DISABLE.
- Return values:
-
An ErrorStatus enumeration value: - SUCCESS: RTC reference clock detection is enabled
- ERROR: RTC reference clock detection is disabled
Definition at line 624 of file stm32f30x_rtc.c.
void RTC_StructInit | ( | RTC_InitTypeDef * | RTC_InitStruct ) |
Fills each RTC_InitStruct member with its default value.
- Parameters:
-
RTC_InitStruct,: pointer to a RTC_InitTypeDef structure which will be initialized.
- Return values:
-
None
Definition at line 457 of file stm32f30x_rtc.c.
ErrorStatus RTC_WaitForSynchro | ( | void | ) |
Waits until the RTC Time and Date registers (RTC_TR and RTC_DR) are synchronized with RTC APB clock.
- Note:
- The RTC Resynchronization mode is write protected, use the RTC_WriteProtectionCmd(DISABLE) before calling this function.
- To read the calendar through the shadow registers after Calendar initialization, calendar update or after wakeup from low power modes the software must first clear the RSF flag. The software must then wait until it is set again before reading the calendar, which means that the calendar registers have been correctly copied into the RTC_TR and RTC_DR shadow registers.
- Parameters:
-
None
- Return values:
-
An ErrorStatus enumeration value: - SUCCESS: RTC registers are synchronised
- ERROR: RTC registers are not synchronised
Definition at line 573 of file stm32f30x_rtc.c.
void RTC_WriteProtectionCmd | ( | FunctionalState | NewState ) |
Enables or disables the RTC registers write protection.
- Note:
- All the RTC registers are write protected except for RTC_ISR[13:8], RTC_TAFCR and RTC_BKPxR.
- Writing a wrong key reactivates the write protection.
- The protection mechanism is not affected by system reset.
- Parameters:
-
NewState,: new state of the write protection. This parameter can be: ENABLE or DISABLE.
- Return values:
-
None
Definition at line 479 of file stm32f30x_rtc.c.
Generated on Tue Jul 12 2022 17:34:46 by
