STM32F103xB HAL User Manual
Functions
Initialization and de-initialization functions
RTC Exported Functions

Functions

ErrorStatus LL_RTC_DeInit (RTC_TypeDef *RTCx)
 De-Initializes the RTC registers to their default reset values.
ErrorStatus LL_RTC_Init (RTC_TypeDef *RTCx, LL_RTC_InitTypeDef *RTC_InitStruct)
 Initializes the RTC registers according to the specified parameters in RTC_InitStruct.
void LL_RTC_StructInit (LL_RTC_InitTypeDef *RTC_InitStruct)
 Set each LL_RTC_InitTypeDef field to default value.
ErrorStatus LL_RTC_TIME_Init (RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_TimeTypeDef *RTC_TimeStruct)
 Set the RTC current time.
void LL_RTC_TIME_StructInit (LL_RTC_TimeTypeDef *RTC_TimeStruct)
 Set each LL_RTC_TimeTypeDef field to default value (Time = 00h:00min:00sec).
ErrorStatus LL_RTC_ALARM_Init (RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_AlarmTypeDef *RTC_AlarmStruct)
 Set the RTC Alarm.
void LL_RTC_ALARM_StructInit (LL_RTC_AlarmTypeDef *RTC_AlarmStruct)
 Set each LL_RTC_AlarmTypeDef of ALARM field to default value (Time = 00h:00mn:00sec / Day = 1st day of the month/Mask = all fields are masked).
ErrorStatus LL_RTC_EnterInitMode (RTC_TypeDef *RTCx)
 Enters the RTC Initialization mode.
ErrorStatus LL_RTC_ExitInitMode (RTC_TypeDef *RTCx)
 Exit the RTC Initialization mode.
ErrorStatus LL_RTC_TIME_SetCounter (RTC_TypeDef *RTCx, uint32_t TimeCounter)
 Set the Time Counter.
ErrorStatus LL_RTC_ALARM_SetCounter (RTC_TypeDef *RTCx, uint32_t AlarmCounter)
 Set Alarm Counter.
ErrorStatus LL_RTC_WaitForSynchro (RTC_TypeDef *RTCx)
 Waits until the RTC registers are synchronized with RTC APB clock.

Function Documentation

ErrorStatus LL_RTC_ALARM_Init ( RTC_TypeDef *  RTCx,
uint32_t  RTC_Format,
LL_RTC_AlarmTypeDef RTC_AlarmStruct 
)

Set the RTC Alarm.

Parameters:
RTCxRTC Instance
RTC_FormatThis parameter can be one of the following values:
RTC_AlarmStructpointer to a LL_RTC_AlarmTypeDef structure that contains the alarm configuration parameters.
Note:
the user should call LL_RTC_ALARM_StructInit() or the structure of Alarm need to be initialized before Alarm init()
Return values:
AnErrorStatus enumeration value:
  • SUCCESS: ALARM registers are configured
  • ERROR: ALARM registers are not configured

Definition at line 297 of file stm32f1xx_ll_rtc.c.

References __LL_RTC_CONVERT_BCD2BIN, LL_RTC_AlarmTypeDef::AlarmTime, assert_param, LL_RTC_TimeTypeDef::Hours, IS_LL_RTC_FORMAT, IS_LL_RTC_HOUR24, IS_LL_RTC_MINUTES, IS_LL_RTC_SECONDS, LL_RTC_ALARM_Set(), LL_RTC_EnterInitMode(), LL_RTC_ExitInitMode(), LL_RTC_FORMAT_BIN, LL_RTC_TimeTypeDef::Minutes, and LL_RTC_TimeTypeDef::Seconds.

ErrorStatus LL_RTC_ALARM_SetCounter ( RTC_TypeDef *  RTCx,
uint32_t  AlarmCounter 
)

Set Alarm Counter.

Parameters:
RTCxRTC Instance
AlarmCounterthis value can be from 0 to 0xFFFFFFFF
Return values:
AnErrorStatus enumeration value:
  • SUCCESS: RTC exited from in Init mode
  • ERROR: Not applicable

Definition at line 467 of file stm32f1xx_ll_rtc.c.

References assert_param, LL_RTC_ALARM_Set(), LL_RTC_EnterInitMode(), and LL_RTC_ExitInitMode().

void LL_RTC_ALARM_StructInit ( LL_RTC_AlarmTypeDef RTC_AlarmStruct)

Set each LL_RTC_AlarmTypeDef of ALARM field to default value (Time = 00h:00mn:00sec / Day = 1st day of the month/Mask = all fields are masked).

Parameters:
RTC_AlarmStructpointer to a LL_RTC_AlarmTypeDef structure which will be initialized.
Return values:
None

Definition at line 350 of file stm32f1xx_ll_rtc.c.

References LL_RTC_AlarmTypeDef::AlarmTime, LL_RTC_TimeTypeDef::Hours, LL_RTC_TimeTypeDef::Minutes, and LL_RTC_TimeTypeDef::Seconds.

ErrorStatus LL_RTC_DeInit ( RTC_TypeDef *  RTCx)

De-Initializes the RTC registers to their default reset values.

Note:
This function doesn't reset the RTC Clock source and RTC Backup Data registers.
Parameters:
RTCxRTC Instance
Return values:
AnErrorStatus enumeration value:
  • SUCCESS: RTC registers are de-initialized
  • ERROR: RTC registers are not de-initialized

Definition at line 96 of file stm32f1xx_ll_rtc.c.

References assert_param, LL_RTC_ClearFlag_RS(), LL_RTC_DisableWriteProtection(), LL_RTC_EnableWriteProtection(), LL_RTC_EnterInitMode(), LL_RTC_ExitInitMode(), LL_RTC_WaitForSynchro(), and LL_RTC_WriteReg.

ErrorStatus LL_RTC_EnterInitMode ( RTC_TypeDef *  RTCx)

Enters the RTC Initialization mode.

Parameters:
RTCxRTC Instance
Return values:
AnErrorStatus enumeration value:
  • SUCCESS: RTC is in Init mode
  • ERROR: RTC is not in Init mode

Definition at line 365 of file stm32f1xx_ll_rtc.c.

References assert_param, LL_RTC_DisableWriteProtection(), LL_RTC_IsActiveFlag_RTOF(), LL_SYSTICK_IsActiveCounterFlag(), and RTC_INITMODE_TIMEOUT.

Referenced by LL_RTC_ALARM_Init(), LL_RTC_ALARM_SetCounter(), LL_RTC_DeInit(), LL_RTC_Init(), LL_RTC_TIME_Init(), and LL_RTC_TIME_SetCounter().

ErrorStatus LL_RTC_ExitInitMode ( RTC_TypeDef *  RTCx)

Exit the RTC Initialization mode.

Note:
When the initialization sequence is complete, the calendar restarts counting after 4 RTCCLK cycles.
Parameters:
RTCxRTC Instance
Return values:
AnErrorStatus enumeration value:
  • SUCCESS: RTC exited from in Init mode
  • ERROR: Not applicable

Definition at line 404 of file stm32f1xx_ll_rtc.c.

References assert_param, LL_RTC_EnableWriteProtection(), LL_RTC_IsActiveFlag_RTOF(), LL_SYSTICK_IsActiveCounterFlag(), and RTC_INITMODE_TIMEOUT.

Referenced by LL_RTC_ALARM_Init(), LL_RTC_ALARM_SetCounter(), LL_RTC_DeInit(), LL_RTC_Init(), LL_RTC_TIME_Init(), and LL_RTC_TIME_SetCounter().

ErrorStatus LL_RTC_Init ( RTC_TypeDef *  RTCx,
LL_RTC_InitTypeDef RTC_InitStruct 
)

Initializes the RTC registers according to the specified parameters in RTC_InitStruct.

Parameters:
RTCxRTC Instance
RTC_InitStructpointer to a LL_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.
the user should call LL_RTC_StructInit() or the structure of Prescaler need to be initialized before RTC init()
Return values:
AnErrorStatus enumeration value:
  • SUCCESS: RTC registers are initialized
  • ERROR: RTC registers are not initialized

Definition at line 157 of file stm32f1xx_ll_rtc.c.

References assert_param, LL_RTC_InitTypeDef::AsynchPrescaler, IS_LL_RTC_ASYNCH_PREDIV, IS_LL_RTC_CALIB_OUTPUT, LL_RTC_CALIB_OUTPUT_NONE, LL_RTC_ClearFlag_ALR(), LL_RTC_ClearFlag_OW(), LL_RTC_ClearFlag_SEC(), LL_RTC_EnterInitMode(), LL_RTC_ExitInitMode(), LL_RTC_SetAsynchPrescaler(), LL_RTC_SetOutputSource(), LL_RTC_TAMPER_Disable(), LL_RTC_WaitForSynchro(), and LL_RTC_InitTypeDef::OutPutSource.

void LL_RTC_StructInit ( LL_RTC_InitTypeDef RTC_InitStruct)

Set each LL_RTC_InitTypeDef field to default value.

Parameters:
RTC_InitStructpointer to a LL_RTC_InitTypeDef structure which will be initialized.
Return values:
None

Definition at line 201 of file stm32f1xx_ll_rtc.c.

References LL_RTC_InitTypeDef::AsynchPrescaler, LL_RTC_CALIB_OUTPUT_NONE, LL_RTC_InitTypeDef::OutPutSource, and RTC_ASYNCH_PRESC_DEFAULT.

ErrorStatus LL_RTC_TIME_Init ( RTC_TypeDef *  RTCx,
uint32_t  RTC_Format,
LL_RTC_TimeTypeDef RTC_TimeStruct 
)

Set the RTC current time.

Parameters:
RTCxRTC Instance
RTC_FormatThis parameter can be one of the following values:
RTC_TimeStructpointer to a RTC_TimeTypeDef structure that contains the time configuration information for the RTC.
Note:
The user should call LL_RTC_TIME_StructInit() or the structure of time need to be initialized before time init()
Return values:
AnErrorStatus enumeration value:
  • SUCCESS: RTC Time register is configured
  • ERROR: RTC Time register is not configured

Definition at line 222 of file stm32f1xx_ll_rtc.c.

References __LL_RTC_CONVERT_BCD2BIN, assert_param, LL_RTC_TimeTypeDef::Hours, IS_LL_RTC_FORMAT, IS_LL_RTC_HOUR24, IS_LL_RTC_MINUTES, IS_LL_RTC_SECONDS, LL_RTC_EnterInitMode(), LL_RTC_ExitInitMode(), LL_RTC_FORMAT_BIN, LL_RTC_TIME_Set(), LL_RTC_TimeTypeDef::Minutes, and LL_RTC_TimeTypeDef::Seconds.

ErrorStatus LL_RTC_TIME_SetCounter ( RTC_TypeDef *  RTCx,
uint32_t  TimeCounter 
)

Set the Time Counter.

Parameters:
RTCxRTC Instance
TimeCounterthis value can be from 0 to 0xFFFFFFFF
Return values:
AnErrorStatus enumeration value:
  • SUCCESS: RTC Counter register configured
  • ERROR: Not applicable

Definition at line 441 of file stm32f1xx_ll_rtc.c.

References assert_param, LL_RTC_EnterInitMode(), LL_RTC_ExitInitMode(), and LL_RTC_TIME_Set().

void LL_RTC_TIME_StructInit ( LL_RTC_TimeTypeDef RTC_TimeStruct)

Set each LL_RTC_TimeTypeDef field to default value (Time = 00h:00min:00sec).

Parameters:
RTC_TimeStructpointer to a LL_RTC_TimeTypeDef structure which will be initialized.
Return values:
None

Definition at line 275 of file stm32f1xx_ll_rtc.c.

References LL_RTC_TimeTypeDef::Hours, LL_RTC_TimeTypeDef::Minutes, and LL_RTC_TimeTypeDef::Seconds.

ErrorStatus LL_RTC_WaitForSynchro ( RTC_TypeDef *  RTCx)

Waits until the RTC registers are synchronized with RTC APB clock.

Note:
The RTC Resynchronization mode is write protected, use the LL_RTC_DisableWriteProtection before calling this function.
Parameters:
RTCxRTC Instance
Return values:
AnErrorStatus enumeration value:
  • SUCCESS: RTC registers are synchronised
  • ERROR: RTC registers are not synchronised

Definition at line 494 of file stm32f1xx_ll_rtc.c.

References assert_param, LL_RTC_ClearFlag_RS(), LL_RTC_IsActiveFlag_RS(), LL_SYSTICK_IsActiveCounterFlag(), and RTC_SYNCHRO_TIMEOUT.

Referenced by LL_RTC_DeInit(), and LL_RTC_Init().