STM32F2 Standard Peripheral bibliotheek  1.0
ST Microelectronics bibliotheek documentatie voor de STM32F2 Standard Peripheral Library
 All Data Structures Files Functions Variables Enumerations Enumerator Groups

RTC driver modules. More...

Modules

 RTC_Exported_Constants
 
 RTC_Private_Functions
 

Data Structures

struct  RTC_InitTypeDef
 RTC Init structures definition. More...
 
struct  RTC_TimeTypeDef
 RTC Time structure definition. More...
 
struct  RTC_DateTypeDef
 RTC Date structure definition. More...
 
struct  RTC_AlarmTypeDef
 RTC Alarm structure definition. More...
 

Macros

#define RTC_TR_RESERVED_MASK   ((uint32_t)0x007F7F7F)
 
#define RTC_DR_RESERVED_MASK   ((uint32_t)0x00FFFF3F)
 
#define RTC_INIT_MASK   ((uint32_t)0xFFFFFFFF)
 
#define RTC_RSF_MASK   ((uint32_t)0xFFFFFF5F)
 
#define RTC_FLAGS_MASK
 
#define INITMODE_TIMEOUT   ((uint32_t) 0x00010000)
 
#define SYNCHRO_TIMEOUT   ((uint32_t) 0x00008000)
 

Functions

ErrorStatus RTC_DeInit (void)
 Deinitializes the RTC registers to their default reset values. More...
 
ErrorStatus RTC_Init (RTC_InitTypeDef *RTC_InitStruct)
 Initializes the RTC registers according to the specified parameters in RTC_InitStruct. More...
 
void RTC_StructInit (RTC_InitTypeDef *RTC_InitStruct)
 Fills each RTC_InitStruct member with its default value. More...
 
void RTC_WriteProtectionCmd (FunctionalState NewState)
 Enables or disables the RTC registers write protection. More...
 
ErrorStatus RTC_EnterInitMode (void)
 Enters the RTC Initialization mode. More...
 
void RTC_ExitInitMode (void)
 Exits the RTC Initialization mode. More...
 
ErrorStatus RTC_WaitForSynchro (void)
 Waits until the RTC Time and Date registers (RTC_TR and RTC_DR) are synchronized with RTC APB clock. More...
 
ErrorStatus RTC_RefClockCmd (FunctionalState NewState)
 Enables or disables the RTC reference clock detection. More...
 
ErrorStatus RTC_SetTime (uint32_t RTC_Format, RTC_TimeTypeDef *RTC_TimeStruct)
 Set the RTC current time. More...
 
void RTC_TimeStructInit (RTC_TimeTypeDef *RTC_TimeStruct)
 Fills each RTC_TimeStruct member with its default value (Time = 00h:00min:00sec). More...
 
void RTC_GetTime (uint32_t RTC_Format, RTC_TimeTypeDef *RTC_TimeStruct)
 Get the RTC current Time. More...
 
ErrorStatus RTC_SetDate (uint32_t RTC_Format, RTC_DateTypeDef *RTC_DateStruct)
 Set the RTC current date. More...
 
void RTC_DateStructInit (RTC_DateTypeDef *RTC_DateStruct)
 Fills each RTC_DateStruct member with its default value (Monday, January 01 xx00). More...
 
void RTC_GetDate (uint32_t RTC_Format, RTC_DateTypeDef *RTC_DateStruct)
 Get the RTC current date. More...
 
void RTC_SetAlarm (uint32_t RTC_Format, uint32_t RTC_Alarm, RTC_AlarmTypeDef *RTC_AlarmStruct)
 Set the specified RTC Alarm. More...
 
void RTC_AlarmStructInit (RTC_AlarmTypeDef *RTC_AlarmStruct)
 Fills each RTC_AlarmStruct member with its default value (Time = 00h:00mn:00sec / Date = 1st day of the month/Mask = all fields are masked). More...
 
void RTC_GetAlarm (uint32_t RTC_Format, uint32_t RTC_Alarm, RTC_AlarmTypeDef *RTC_AlarmStruct)
 Get the RTC Alarm value and masks. More...
 
ErrorStatus RTC_AlarmCmd (uint32_t RTC_Alarm, FunctionalState NewState)
 Enables or disables the specified RTC Alarm. More...
 
void RTC_WakeUpClockConfig (uint32_t RTC_WakeUpClock)
 Configures the RTC Wakeup clock source. More...
 
void RTC_SetWakeUpCounter (uint32_t RTC_WakeUpCounter)
 Configures the RTC Wakeup counter. More...
 
uint32_t RTC_GetWakeUpCounter (void)
 Returns the RTC WakeUp timer counter value. More...
 
ErrorStatus RTC_WakeUpCmd (FunctionalState NewState)
 Enables or Disables the RTC WakeUp timer. More...
 
void RTC_DayLightSavingConfig (uint32_t RTC_DayLightSaving, uint32_t RTC_StoreOperation)
 Adds or substract one hour from the current time. More...
 
uint32_t RTC_GetStoreOperation (void)
 Returns the RTC Day Light Saving stored operation. More...
 
void RTC_OutputConfig (uint32_t RTC_Output, uint32_t RTC_OutputPolarity)
 Configures the RTC output source (AFO_ALARM). More...
 
ErrorStatus RTC_CoarseCalibConfig (uint32_t RTC_CalibSign, uint32_t Value)
 Configures the Coarse calibration parameters. More...
 
ErrorStatus RTC_CoarseCalibCmd (FunctionalState NewState)
 Enables or disables the Coarse calibration process. More...
 
void RTC_CalibOutputCmd (FunctionalState NewState)
 Enables or disables the RTC clock to be output through the relative pin. More...
 
void RTC_TimeStampCmd (uint32_t RTC_TimeStampEdge, FunctionalState NewState)
 Enables or Disables the RTC TimeStamp functionality with the specified time stamp pin stimulating edge. More...
 
void RTC_GetTimeStamp (uint32_t RTC_Format, RTC_TimeTypeDef *RTC_StampTimeStruct, RTC_DateTypeDef *RTC_StampDateStruct)
 Get the RTC TimeStamp value and masks. More...
 
void RTC_TamperTriggerConfig (uint32_t RTC_Tamper, uint32_t RTC_TamperTrigger)
 Configures the select Tamper pin edge. More...
 
void RTC_TamperCmd (uint32_t RTC_Tamper, FunctionalState NewState)
 Enables or Disables the Tamper detection. More...
 
void RTC_WriteBackupRegister (uint32_t RTC_BKP_DR, uint32_t Data)
 Writes a data in a specified RTC Backup data register. More...
 
uint32_t RTC_ReadBackupRegister (uint32_t RTC_BKP_DR)
 Reads data from the specified RTC Backup data Register. More...
 
void RTC_TamperPinSelection (uint32_t RTC_TamperPin)
 Selects the RTC Tamper Pin. More...
 
void RTC_TimeStampPinSelection (uint32_t RTC_TimeStampPin)
 Selects the RTC TimeStamp Pin. More...
 
void RTC_OutputTypeConfig (uint32_t RTC_OutputType)
 Configures the RTC Output Pin mode. More...
 
void RTC_ITConfig (uint32_t RTC_IT, FunctionalState NewState)
 Enables or disables the specified RTC interrupts. More...
 
FlagStatus RTC_GetFlagStatus (uint32_t RTC_FLAG)
 Checks whether the specified RTC flag is set or not. More...
 
void RTC_ClearFlag (uint32_t RTC_FLAG)
 Clears the RTC's pending flags. More...
 
ITStatus RTC_GetITStatus (uint32_t RTC_IT)
 Checks whether the specified RTC interrupt has occurred or not. More...
 
void RTC_ClearITPendingBit (uint32_t RTC_IT)
 Clears the RTC's interrupt pending bits. More...
 

Detailed Description

RTC driver modules.

Macro Definition Documentation

#define RTC_FLAGS_MASK
Value:
((uint32_t)(RTC_FLAG_TSOVF | RTC_FLAG_TSF | RTC_FLAG_WUTF | \
RTC_FLAG_ALRBF | RTC_FLAG_ALRAF | RTC_FLAG_INITF | \
RTC_FLAG_RSF | RTC_FLAG_INITS | RTC_FLAG_WUTWF | \
RTC_FLAG_ALRBWF | RTC_FLAG_ALRAWF | RTC_FLAG_TAMP1F ))

Function Documentation

ErrorStatus RTC_AlarmCmd ( uint32_t  RTC_Alarm,
FunctionalState  NewState 
)

Enables or disables the specified RTC Alarm.

Parameters
RTC_Alarm,:specifies the alarm to be configured. This parameter can be any combination of the following values:
  • RTC_Alarm_A: to select Alarm A
  • RTC_Alarm_B: to select Alarm B
NewState,:new state of the specified alarm. This parameter can be: ENABLE or DISABLE.
Return values
AnErrorStatus enumeration value:
  • SUCCESS: RTC Alarm is enabled/disabled
  • ERROR: RTC Alarm is not enabled/disabled
void RTC_AlarmStructInit ( RTC_AlarmTypeDef RTC_AlarmStruct)

Fills each RTC_AlarmStruct member with its default value (Time = 00h:00mn:00sec / Date = 1st day of the month/Mask = all fields are masked).

Parameters
RTC_AlarmStruct,:pointer to a RTC_AlarmTypeDef structure which will be initialized.
Return values
None
void RTC_CalibOutputCmd ( FunctionalState  NewState)

Enables or disables the RTC clock to be output through the relative pin.

Parameters
NewState,:new state of the digital calibration Output. This parameter can be: ENABLE or DISABLE.
Return values
None
void RTC_ClearFlag ( uint32_t  RTC_FLAG)

Clears the RTC's pending flags.

Parameters
RTC_FLAG,:specifies the RTC flag to clear. This parameter can be any combination of the following values:
  • RTC_FLAG_TAMP1F: Tamper 1 event flag
  • RTC_FLAG_TSOVF: Time Stamp Overflow flag
  • RTC_FLAG_TSF: Time Stamp event flag
  • RTC_FLAG_WUTF: WakeUp Timer flag
  • RTC_FLAG_ALRBF: Alarm B flag
  • RTC_FLAG_ALRAF: Alarm A flag
  • RTC_FLAG_RSF: Registers Synchronized flag
Return values
None
void RTC_ClearITPendingBit ( uint32_t  RTC_IT)

Clears the RTC's interrupt pending bits.

Parameters
RTC_IT,:specifies the RTC interrupt pending bit to clear. This parameter can be any combination of the following values:
  • RTC_IT_TS: Time Stamp interrupt
  • RTC_IT_WUT: WakeUp Timer interrupt
  • RTC_IT_ALRB: Alarm B interrupt
  • RTC_IT_ALRA: Alarm A interrupt
  • RTC_IT_TAMP1: Tamper 1 event interrupt
Return values
None
ErrorStatus RTC_CoarseCalibCmd ( FunctionalState  NewState)

Enables or disables the Coarse calibration process.

Parameters
NewState,:new state of the Coarse calibration. This parameter can be: ENABLE or DISABLE.
Return values
AnErrorStatus enumeration value:
  • SUCCESS: RTC Coarse calibration are enabled/disabled
  • ERROR: RTC Coarse calibration are not enabled/disabled
ErrorStatus RTC_CoarseCalibConfig ( uint32_t  RTC_CalibSign,
uint32_t  Value 
)

Configures the Coarse calibration parameters.

Parameters
RTC_CalibSign,:specifies the sign of the coarse calibration value. This parameter can be one of the following values:
  • RTC_CalibSign_Positive: The value sign is positive
  • RTC_CalibSign_Negative: The value sign is negative
Value,:value of coarse calibration expressed in ppm (coded on 5 bits).
Note
This Calibration value should be between 0 and 63 when using negative sign with a 2-ppm step.
This Calibration value should be between 0 and 126 when using positive sign with a 4-ppm step.
Return values
AnErrorStatus enumeration value:
  • SUCCESS: RTC Coarse calibration are initialized
  • ERROR: RTC Coarse calibration are not initialized
void RTC_DateStructInit ( RTC_DateTypeDef RTC_DateStruct)

Fills each RTC_DateStruct member with its default value (Monday, January 01 xx00).

Parameters
RTC_DateStruct,:pointer to a RTC_DateTypeDef structure which will be initialized.
Return values
None
void RTC_DayLightSavingConfig ( uint32_t  RTC_DayLightSaving,
uint32_t  RTC_StoreOperation 
)

Adds or substract one hour from the current time.

Parameters
RTC_DayLightSaveOperation,:the value of hour adjustment. This parameter can be one of the following values:
  • RTC_DayLightSaving_SUB1H: Substract one hour (winter time)
  • RTC_DayLightSaving_ADD1H: Add one hour (summer time)
RTC_StoreOperation,:Specifies the value to be written in the BCK bit in CR register to store the operation. This parameter can be one of the following values:
  • RTC_StoreOperation_Reset: BCK Bit Reset
  • RTC_StoreOperation_Set: BCK Bit Set
Return values
None
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
AnErrorStatus enumeration value:
  • SUCCESS: RTC registers are deinitialized
  • ERROR: RTC registers are not deinitialized
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
AnErrorStatus enumeration value:
  • SUCCESS: RTC is in Init mode
  • ERROR: RTC is not in Init mode
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
void RTC_GetAlarm ( uint32_t  RTC_Format,
uint32_t  RTC_Alarm,
RTC_AlarmTypeDef RTC_AlarmStruct 
)

Get the RTC Alarm value and masks.

Parameters
RTC_Format,:specifies the format of the output parameters. This parameter can be one of the following values:
  • RTC_Format_BIN: Binary data format
  • RTC_Format_BCD: BCD data format
RTC_Alarm,:specifies the alarm to be read. This parameter can be one of the following values:
  • RTC_Alarm_A: to select Alarm A
  • RTC_Alarm_B: to select Alarm B
RTC_AlarmStruct,:pointer to a RTC_AlarmTypeDef structure that will contains the output alarm configuration values.
Return values
None
void RTC_GetDate ( uint32_t  RTC_Format,
RTC_DateTypeDef RTC_DateStruct 
)

Get the RTC current date.

Parameters
RTC_Format,:specifies the format of the returned parameters. This parameter can be one of the following values:
  • RTC_Format_BIN: Binary data format
  • RTC_Format_BCD: BCD data format
RTC_DateStruct,:pointer to a RTC_DateTypeDef structure that will contain the returned current date configuration.
Return values
None
FlagStatus RTC_GetFlagStatus ( uint32_t  RTC_FLAG)

Checks whether the specified RTC flag is set or not.

Parameters
RTC_FLAG,:specifies the flag to check. This parameter can be one of the following values:
  • RTC_FLAG_TAMP1F: Tamper 1 event flag
  • RTC_FLAG_TSOVF: Time Stamp OverFlow flag
  • RTC_FLAG_TSF: Time Stamp event flag
  • RTC_FLAG_WUTF: WakeUp Timer flag
  • RTC_FLAG_ALRBF: Alarm B flag
  • RTC_FLAG_ALRAF: Alarm A flag
  • RTC_FLAG_INITF: Initialization mode flag
  • RTC_FLAG_RSF: Registers Synchronized flag
  • RTC_FLAG_INITS: Registers Configured flag
  • RTC_FLAG_WUTWF: WakeUp Timer Write flag
  • RTC_FLAG_ALRBWF: Alarm B Write flag
  • RTC_FLAG_ALRAWF: Alarm A write flag
Return values
Thenew state of RTC_FLAG (SET or RESET).
ITStatus RTC_GetITStatus ( uint32_t  RTC_IT)

Checks whether the specified RTC interrupt has occurred or not.

Parameters
RTC_IT,:specifies the RTC interrupt source to check. This parameter can be one of the following values:
  • RTC_IT_TS: Time Stamp interrupt
  • RTC_IT_WUT: WakeUp Timer interrupt
  • RTC_IT_ALRB: Alarm B interrupt
  • RTC_IT_ALRA: Alarm A interrupt
  • RTC_IT_TAMP1: Tamper 1 event interrupt
Return values
Thenew state of RTC_IT (SET or RESET).
uint32_t RTC_GetStoreOperation ( void  )

Returns the RTC Day Light Saving stored operation.

Parameters
None
Return values
RTCDay Light Saving stored operation.
  • RTC_StoreOperation_Reset
  • RTC_StoreOperation_Set
void RTC_GetTime ( uint32_t  RTC_Format,
RTC_TimeTypeDef RTC_TimeStruct 
)

Get the RTC current Time.

Parameters
RTC_Format,:specifies the format of the returned parameters. This parameter can be one of the following values:
  • RTC_Format_BIN: Binary data format
  • RTC_Format_BCD: BCD data format
RTC_TimeStruct,:pointer to a RTC_TimeTypeDef structure that will contain the returned current time configuration.
Return values
None
void RTC_GetTimeStamp ( uint32_t  RTC_Format,
RTC_TimeTypeDef RTC_StampTimeStruct,
RTC_DateTypeDef RTC_StampDateStruct 
)

Get the RTC TimeStamp value and masks.

Parameters
RTC_Format,:specifies the format of the output parameters. This parameter can be one of the following values:
  • RTC_Format_BIN: Binary data format
  • RTC_Format_BCD: BCD data format
RTC_StampTimeStruct,:pointer to a RTC_TimeTypeDef structure that will contains the TimeStamp time values.
RTC_StampDateStruct,:pointer to a RTC_DateTypeDef structure that will contains the TimeStamp date values.
Return values
None
uint32_t RTC_GetWakeUpCounter ( void  )

Returns the RTC WakeUp timer counter value.

Parameters
None
Return values
TheRTC WakeUp Counter value.
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
AnErrorStatus enumeration value:
  • SUCCESS: RTC registers are initialized
  • ERROR: RTC registers are not initialized
void RTC_ITConfig ( uint32_t  RTC_IT,
FunctionalState  NewState 
)

Enables or disables the specified RTC interrupts.

Parameters
RTC_IT,:specifies the RTC interrupt sources to be enabled or disabled. This parameter can be any combination of the following values:
  • RTC_IT_TS: Time Stamp interrupt mask
  • RTC_IT_WUT: WakeUp Timer interrupt mask
  • RTC_IT_ALRB: Alarm B interrupt mask
  • RTC_IT_ALRA: Alarm A interrupt mask
  • RTC_IT_TAMP: Tamper event interrupt mask
NewState,:new state of the specified RTC interrupts. This parameter can be: ENABLE or DISABLE.
Return values
None
void RTC_OutputConfig ( uint32_t  RTC_Output,
uint32_t  RTC_OutputPolarity 
)

Configures the RTC output source (AFO_ALARM).

Parameters
RTC_Output,:Specifies which signal will be routed to the RTC output. This parameter can be one of the following values:
  • RTC_Output_Disable: No output selected
  • RTC_Output_AlarmA: signal of AlarmA mapped to output
  • RTC_Output_AlarmB: signal of AlarmB mapped to output
  • RTC_Output_WakeUp: signal of WakeUp mapped to output
RTC_OutputPolarity,:Specifies the polarity of the output signal. This parameter can be one of the following:
  • RTC_OutputPolarity_High: The output pin is high when the ALRAF/ALRBF/WUTF is high (depending on OSEL)
  • RTC_OutputPolarity_Low: The output pin is low when the ALRAF/ALRBF/WUTF is high (depending on OSEL)
Return values
None
void RTC_OutputTypeConfig ( uint32_t  RTC_OutputType)

Configures the RTC Output Pin mode.

Parameters
RTC_OutputType,:specifies the RTC Output (PC13) pin mode. This parameter can be one of the following values:
  • RTC_OutputType_OpenDrain: RTC Output (PC13) is configured in Open Drain mode.
  • RTC_OutputType_PushPull: RTC Output (PC13) is configured in Push Pull mode.
Return values
None
uint32_t RTC_ReadBackupRegister ( uint32_t  RTC_BKP_DR)

Reads data from the specified RTC Backup data Register.

Parameters
RTC_BKP_DR,:RTC Backup data Register number. This parameter can be: RTC_BKP_DRx where x can be from 0 to 19 to specify the register.
Return values
None
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
AnErrorStatus enumeration value:
  • SUCCESS: RTC reference clock detection is enabled
  • ERROR: RTC reference clock detection is disabled
void RTC_SetAlarm ( uint32_t  RTC_Format,
uint32_t  RTC_Alarm,
RTC_AlarmTypeDef RTC_AlarmStruct 
)

Set the specified RTC Alarm.

Note
The Alarm register can only be written when the corresponding Alarm is disabled (Use the RTC_AlarmCmd(DISABLE)).
Parameters
RTC_Format,:specifies the format of the returned parameters. This parameter can be one of the following values:
  • RTC_Format_BIN: Binary data format
  • RTC_Format_BCD: BCD data format
RTC_Alarm,:specifies the alarm to be configured. This parameter can be one of the following values:
  • RTC_Alarm_A: to select Alarm A
  • RTC_Alarm_B: to select Alarm B
RTC_AlarmStruct,:pointer to a RTC_AlarmTypeDef structure that contains the alarm configuration parameters.
Return values
None
ErrorStatus RTC_SetDate ( uint32_t  RTC_Format,
RTC_DateTypeDef RTC_DateStruct 
)

Set the RTC current date.

Parameters
RTC_Format,:specifies the format of the entered parameters. This parameter can be one of the following values:
  • RTC_Format_BIN: Binary data format
  • RTC_Format_BCD: BCD data format
RTC_DateStruct,:pointer to a RTC_DateTypeDef structure that contains the date configuration information for the RTC.
Return values
AnErrorStatus enumeration value:
  • SUCCESS: RTC Date register is configured
  • ERROR: RTC Date register is not configured
ErrorStatus RTC_SetTime ( uint32_t  RTC_Format,
RTC_TimeTypeDef RTC_TimeStruct 
)

Set the RTC current time.

Parameters
RTC_Format,:specifies the format of the entered parameters. This parameter can be one of the following values:
  • RTC_Format_BIN: Binary data format
  • RTC_Format_BCD: BCD data format
RTC_TimeStruct,:pointer to a RTC_TimeTypeDef structure that contains the time configuration information for the RTC.
Return values
AnErrorStatus enumeration value:
  • SUCCESS: RTC Time register is configured
  • ERROR: RTC Time register is not configured
void RTC_SetWakeUpCounter ( uint32_t  RTC_WakeUpCounter)

Configures the RTC Wakeup counter.

Note
The RTC WakeUp counter can only be written when the RTC WakeUp is disabled (Use the RTC_WakeUpCmd(DISABLE)).
Parameters
RTC_WakeUpCounter,:specifies the WakeUp counter. This parameter can be a value from 0x0000 to 0xFFFF.
Return values
None
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
void RTC_TamperCmd ( uint32_t  RTC_Tamper,
FunctionalState  NewState 
)

Enables or Disables the Tamper detection.

Parameters
RTC_Tamper,:Selected tamper pin. This parameter can be RTC_Tamper_1.
NewState,:new state of the tamper pin. This parameter can be: ENABLE or DISABLE.
Return values
None
void RTC_TamperPinSelection ( uint32_t  RTC_TamperPin)

Selects the RTC Tamper Pin.

Parameters
RTC_TamperPin,:specifies the RTC Tamper Pin. This parameter can be one of the following values:
  • RTC_TamperPin_PC13: PC13 is selected as RTC Tamper Pin.
  • RTC_TamperPin_PI8: PI8 is selected as RTC Tamper Pin.
Return values
None
void RTC_TamperTriggerConfig ( uint32_t  RTC_Tamper,
uint32_t  RTC_TamperTrigger 
)

Configures the select Tamper pin edge.

Parameters
RTC_Tamper,:Selected tamper pin. This parameter can be RTC_Tamper_1.
RTC_TamperTrigger,:Specifies the trigger on the tamper pin that stimulates tamper event. This parameter can be one of the following values:
  • RTC_TamperTrigger_RisingEdge: Rising Edge of the tamper pin causes tamper event.
  • RTC_TamperTrigger_FallingEdge: Falling Edge of the tamper pin causes tamper event.
Return values
None
void RTC_TimeStampCmd ( uint32_t  RTC_TimeStampEdge,
FunctionalState  NewState 
)

Enables or Disables the RTC TimeStamp functionality with the specified time stamp pin stimulating edge.

Parameters
RTC_TimeStampEdge,:Specifies the pin edge on which the TimeStamp is activated. This parameter can be one of the following:
  • RTC_TimeStampEdge_Rising: the Time stamp event occurs on the rising edge of the related pin.
  • RTC_TimeStampEdge_Falling: the Time stamp event occurs on the falling edge of the related pin.
NewState,:new state of the TimeStamp. This parameter can be: ENABLE or DISABLE.
Return values
None
void RTC_TimeStampPinSelection ( uint32_t  RTC_TimeStampPin)

Selects the RTC TimeStamp Pin.

Parameters
RTC_TimeStampPin,:specifies the RTC TimeStamp Pin. This parameter can be one of the following values:
  • RTC_TimeStampPin_PC13: PC13 is selected as RTC TimeStamp Pin.
  • RTC_TimeStampPin_PI8: PI8 is selected as RTC TimeStamp Pin.
Return values
None
void RTC_TimeStructInit ( RTC_TimeTypeDef RTC_TimeStruct)

Fills each RTC_TimeStruct member with its default value (Time = 00h:00min:00sec).

Parameters
RTC_TimeStruct,:pointer to a RTC_TimeTypeDef structure which will be initialized.
Return values
None
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
AnErrorStatus enumeration value:
  • SUCCESS: RTC registers are synchronised
  • ERROR: RTC registers are not synchronised
void RTC_WakeUpClockConfig ( uint32_t  RTC_WakeUpClock)

Configures the RTC Wakeup clock source.

Note
The WakeUp Clock source can only be changed when the RTC WakeUp is disabled (Use the RTC_WakeUpCmd(DISABLE)).
Parameters
RTC_WakeUpClock,:Wakeup Clock source. This parameter can be one of the following values:
  • RTC_WakeUpClock_RTCCLK_Div16: RTC Wakeup Counter Clock = RTCCLK/16
  • RTC_WakeUpClock_RTCCLK_Div8: RTC Wakeup Counter Clock = RTCCLK/8
  • RTC_WakeUpClock_RTCCLK_Div4: RTC Wakeup Counter Clock = RTCCLK/4
  • RTC_WakeUpClock_RTCCLK_Div2: RTC Wakeup Counter Clock = RTCCLK/2
  • RTC_WakeUpClock_CK_SPRE_16bits: RTC Wakeup Counter Clock = CK_SPRE
  • RTC_WakeUpClock_CK_SPRE_17bits: RTC Wakeup Counter Clock = CK_SPRE
Return values
None
ErrorStatus RTC_WakeUpCmd ( FunctionalState  NewState)

Enables or Disables the RTC WakeUp timer.

Parameters
NewState,:new state of the WakeUp timer. This parameter can be: ENABLE or DISABLE.
Return values
None
void RTC_WriteBackupRegister ( uint32_t  RTC_BKP_DR,
uint32_t  Data 
)

Writes a data in a specified RTC Backup data register.

Parameters
RTC_BKP_DR,:RTC Backup data Register number. This parameter can be: RTC_BKP_DRx where x can be from 0 to 19 to specify the register.
Data,:Data to be written in the specified RTC Backup data register.
Return values
None
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