STM32F439xx HAL User Manual
Functions
Time
RTC Exported Functions

Functions

__STATIC_INLINE void LL_RTC_TIME_SetFormat (RTC_TypeDef *RTCx, uint32_t TimeFormat)
 Set time format (AM/24-hour or PM notation)
__STATIC_INLINE uint32_t LL_RTC_TIME_GetFormat (RTC_TypeDef *RTCx)
 Get time format (AM or PM notation)
__STATIC_INLINE void LL_RTC_TIME_SetHour (RTC_TypeDef *RTCx, uint32_t Hours)
 Set Hours in BCD format.
__STATIC_INLINE uint32_t LL_RTC_TIME_GetHour (RTC_TypeDef *RTCx)
 Get Hours in BCD format.
__STATIC_INLINE void LL_RTC_TIME_SetMinute (RTC_TypeDef *RTCx, uint32_t Minutes)
 Set Minutes in BCD format.
__STATIC_INLINE uint32_t LL_RTC_TIME_GetMinute (RTC_TypeDef *RTCx)
 Get Minutes in BCD format.
__STATIC_INLINE void LL_RTC_TIME_SetSecond (RTC_TypeDef *RTCx, uint32_t Seconds)
 Set Seconds in BCD format.
__STATIC_INLINE uint32_t LL_RTC_TIME_GetSecond (RTC_TypeDef *RTCx)
 Get Seconds in BCD format.
__STATIC_INLINE void LL_RTC_TIME_Config (RTC_TypeDef *RTCx, uint32_t Format12_24, uint32_t Hours, uint32_t Minutes, uint32_t Seconds)
 Set time (hour, minute and second) in BCD format.
__STATIC_INLINE uint32_t LL_RTC_TIME_Get (RTC_TypeDef *RTCx)
 Get time (hour, minute and second) in BCD format.
__STATIC_INLINE void LL_RTC_TIME_EnableDayLightStore (RTC_TypeDef *RTCx)
 Memorize whether the daylight saving time change has been performed.
__STATIC_INLINE void LL_RTC_TIME_DisableDayLightStore (RTC_TypeDef *RTCx)
 Disable memorization whether the daylight saving time change has been performed.
__STATIC_INLINE uint32_t LL_RTC_TIME_IsDayLightStoreEnabled (RTC_TypeDef *RTCx)
 Check if RTC Day Light Saving stored operation has been enabled or not.
__STATIC_INLINE void LL_RTC_TIME_DecHour (RTC_TypeDef *RTCx)
 Subtract 1 hour (winter time change)
__STATIC_INLINE void LL_RTC_TIME_IncHour (RTC_TypeDef *RTCx)
 Add 1 hour (summer time change)
__STATIC_INLINE uint32_t LL_RTC_TIME_GetSubSecond (RTC_TypeDef *RTCx)
 Get Sub second value in the synchronous prescaler counter.
__STATIC_INLINE void LL_RTC_TIME_Synchronize (RTC_TypeDef *RTCx, uint32_t ShiftSecond, uint32_t Fraction)
 Synchronize to a remote clock with a high degree of precision.

Function Documentation

__STATIC_INLINE void LL_RTC_TIME_Config ( RTC_TypeDef *  RTCx,
uint32_t  Format12_24,
uint32_t  Hours,
uint32_t  Minutes,
uint32_t  Seconds 
)

Set time (hour, minute and second) in BCD format.

Note:
Bit is write-protected. LL_RTC_DisableWriteProtection function should be called before.
It can be written in initialization mode only (LL_RTC_EnableInitMode function)
TimeFormat and Hours should follow the same format
Reference Manual to LL API cross reference:
TR PM LL_RTC_TIME_Config
TR HT LL_RTC_TIME_Config
TR HU LL_RTC_TIME_Config
TR MNT LL_RTC_TIME_Config
TR MNU LL_RTC_TIME_Config
TR ST LL_RTC_TIME_Config
TR SU LL_RTC_TIME_Config
Parameters:
RTCxRTC Instance
Format12_24This parameter can be one of the following values:
HoursValue between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
MinutesValue between Min_Data=0x00 and Max_Data=0x59
SecondsValue between Min_Data=0x00 and Max_Data=0x59
Return values:
None

Definition at line 1316 of file stm32f4xx_ll_rtc.h.

Referenced by LL_RTC_TIME_Init().

__STATIC_INLINE void LL_RTC_TIME_DecHour ( RTC_TypeDef *  RTCx)

Subtract 1 hour (winter time change)

Note:
Bit is write-protected. LL_RTC_DisableWriteProtection function should be called before.
Reference Manual to LL API cross reference:
CR SUB1H LL_RTC_TIME_DecHour
Parameters:
RTCxRTC Instance
Return values:
None

Definition at line 1396 of file stm32f4xx_ll_rtc.h.

__STATIC_INLINE void LL_RTC_TIME_DisableDayLightStore ( RTC_TypeDef *  RTCx)

Disable memorization whether the daylight saving time change has been performed.

Note:
Bit is write-protected. LL_RTC_DisableWriteProtection function should be called before.
Reference Manual to LL API cross reference:
CR BKP LL_RTC_TIME_DisableDayLightStore
Parameters:
RTCxRTC Instance
Return values:
None

Definition at line 1373 of file stm32f4xx_ll_rtc.h.

__STATIC_INLINE void LL_RTC_TIME_EnableDayLightStore ( RTC_TypeDef *  RTCx)

Memorize whether the daylight saving time change has been performed.

Note:
Bit is write-protected. LL_RTC_DisableWriteProtection function should be called before.
Reference Manual to LL API cross reference:
CR BKP LL_RTC_TIME_EnableDayLightStore
Parameters:
RTCxRTC Instance
Return values:
None

Definition at line 1361 of file stm32f4xx_ll_rtc.h.

__STATIC_INLINE uint32_t LL_RTC_TIME_Get ( RTC_TypeDef *  RTCx)

Get time (hour, minute and second) in BCD format.

Note:
if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set before reading this bit
Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND are available to get independently each parameter.
Reference Manual to LL API cross reference:
TR HT LL_RTC_TIME_Get
TR HU LL_RTC_TIME_Get
TR MNT LL_RTC_TIME_Get
TR MNU LL_RTC_TIME_Get
TR ST LL_RTC_TIME_Get
TR SU LL_RTC_TIME_Get
Parameters:
RTCxRTC Instance
Return values:
Combinationof hours, minutes and seconds (Format: 0x00HHMMSS).

Definition at line 1344 of file stm32f4xx_ll_rtc.h.

References RTC_OFFSET_HOUR, and RTC_OFFSET_MINUTE.

__STATIC_INLINE uint32_t LL_RTC_TIME_GetFormat ( RTC_TypeDef *  RTCx)

Get time format (AM or PM notation)

Note:
if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set before reading this bit
Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
Reference Manual to LL API cross reference:
TR PM LL_RTC_TIME_GetFormat
Parameters:
RTCxRTC Instance
Return values:
Returnedvalue can be one of the following values:

Definition at line 1176 of file stm32f4xx_ll_rtc.h.

__STATIC_INLINE uint32_t LL_RTC_TIME_GetHour ( RTC_TypeDef *  RTCx)

Get Hours in BCD format.

Note:
if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set before reading this bit
Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert hour from BCD to Binary format
Reference Manual to LL API cross reference:
TR HT LL_RTC_TIME_GetHour
TR HU LL_RTC_TIME_GetHour
Parameters:
RTCxRTC Instance
Return values:
Valuebetween Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23

Definition at line 1211 of file stm32f4xx_ll_rtc.h.

__STATIC_INLINE uint32_t LL_RTC_TIME_GetMinute ( RTC_TypeDef *  RTCx)

Get Minutes in BCD format.

Note:
if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set before reading this bit
Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert minute from BCD to Binary format
Reference Manual to LL API cross reference:
TR MNT LL_RTC_TIME_GetMinute
TR MNU LL_RTC_TIME_GetMinute
Parameters:
RTCxRTC Instance
Return values:
Valuebetween Min_Data=0x00 and Max_Data=0x59

Definition at line 1249 of file stm32f4xx_ll_rtc.h.

__STATIC_INLINE uint32_t LL_RTC_TIME_GetSecond ( RTC_TypeDef *  RTCx)

Get Seconds in BCD format.

Note:
if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set before reading this bit
Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD to Binary format
Reference Manual to LL API cross reference:
TR ST LL_RTC_TIME_GetSecond
TR SU LL_RTC_TIME_GetSecond
Parameters:
RTCxRTC Instance
Return values:
Valuebetween Min_Data=0x00 and Max_Data=0x59

Definition at line 1287 of file stm32f4xx_ll_rtc.h.

__STATIC_INLINE uint32_t LL_RTC_TIME_GetSubSecond ( RTC_TypeDef *  RTCx)

Get Sub second value in the synchronous prescaler counter.

Note:
You can use both SubSeconds value and SecondFraction (PREDIV_S through LL_RTC_GetSynchPrescaler function) terms returned to convert Calendar SubSeconds value in second fraction ratio with time unit following generic formula: ==> Seconds fraction ratio * time_unit= [(SecondFraction-SubSeconds)/(SecondFraction+1)] * time_unit This conversion can be performed only if no shift operation is pending (ie. SHFP=0) when PREDIV_S >= SS.
Reference Manual to LL API cross reference:
SSR SS LL_RTC_TIME_GetSubSecond
Parameters:
RTCxRTC Instance
Return values:
Subsecond value (number between 0 and 65535)

Definition at line 1426 of file stm32f4xx_ll_rtc.h.

__STATIC_INLINE void LL_RTC_TIME_IncHour ( RTC_TypeDef *  RTCx)

Add 1 hour (summer time change)

Note:
Bit is write-protected. LL_RTC_DisableWriteProtection function should be called before.
Reference Manual to LL API cross reference:
CR ADD1H LL_RTC_TIME_IncHour
Parameters:
RTCxRTC Instance
Return values:
None

Definition at line 1408 of file stm32f4xx_ll_rtc.h.

__STATIC_INLINE uint32_t LL_RTC_TIME_IsDayLightStoreEnabled ( RTC_TypeDef *  RTCx)

Check if RTC Day Light Saving stored operation has been enabled or not.

Reference Manual to LL API cross reference:
CR BKP LL_RTC_TIME_IsDayLightStoreEnabled
Parameters:
RTCxRTC Instance
Return values:
Stateof bit (1 or 0).

Definition at line 1384 of file stm32f4xx_ll_rtc.h.

__STATIC_INLINE void LL_RTC_TIME_SetFormat ( RTC_TypeDef *  RTCx,
uint32_t  TimeFormat 
)

Set time format (AM/24-hour or PM notation)

Note:
Bit is write-protected. LL_RTC_DisableWriteProtection function should be called before.
It can be written in initialization mode only (LL_RTC_EnableInitMode function)
Reference Manual to LL API cross reference:
TR PM LL_RTC_TIME_SetFormat
Parameters:
RTCxRTC Instance
TimeFormatThis parameter can be one of the following values:
Return values:
None

Definition at line 1159 of file stm32f4xx_ll_rtc.h.

__STATIC_INLINE void LL_RTC_TIME_SetHour ( RTC_TypeDef *  RTCx,
uint32_t  Hours 
)

Set Hours in BCD format.

Note:
Bit is write-protected. LL_RTC_DisableWriteProtection function should be called before.
It can be written in initialization mode only (LL_RTC_EnableInitMode function)
helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert hour from binary to BCD format
Reference Manual to LL API cross reference:
TR HT LL_RTC_TIME_SetHour
TR HU LL_RTC_TIME_SetHour
Parameters:
RTCxRTC Instance
HoursValue between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
Return values:
None

Definition at line 1192 of file stm32f4xx_ll_rtc.h.

__STATIC_INLINE void LL_RTC_TIME_SetMinute ( RTC_TypeDef *  RTCx,
uint32_t  Minutes 
)

Set Minutes in BCD format.

Note:
Bit is write-protected. LL_RTC_DisableWriteProtection function should be called before.
It can be written in initialization mode only (LL_RTC_EnableInitMode function)
helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Minutes from binary to BCD format
Reference Manual to LL API cross reference:
TR MNT LL_RTC_TIME_SetMinute
TR MNU LL_RTC_TIME_SetMinute
Parameters:
RTCxRTC Instance
MinutesValue between Min_Data=0x00 and Max_Data=0x59
Return values:
None

Definition at line 1230 of file stm32f4xx_ll_rtc.h.

__STATIC_INLINE void LL_RTC_TIME_SetSecond ( RTC_TypeDef *  RTCx,
uint32_t  Seconds 
)

Set Seconds in BCD format.

Note:
Bit is write-protected. LL_RTC_DisableWriteProtection function should be called before.
It can be written in initialization mode only (LL_RTC_EnableInitMode function)
helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Seconds from binary to BCD format
Reference Manual to LL API cross reference:
TR ST LL_RTC_TIME_SetSecond
TR SU LL_RTC_TIME_SetSecond
Parameters:
RTCxRTC Instance
SecondsValue between Min_Data=0x00 and Max_Data=0x59
Return values:
None

Definition at line 1268 of file stm32f4xx_ll_rtc.h.

__STATIC_INLINE void LL_RTC_TIME_Synchronize ( RTC_TypeDef *  RTCx,
uint32_t  ShiftSecond,
uint32_t  Fraction 
)

Synchronize to a remote clock with a high degree of precision.

Note:
This operation effectively subtracts from (delays) or advance the clock of a fraction of a second.
Bit is write-protected. LL_RTC_DisableWriteProtection function should be called before.
When REFCKON is set, firmware must not write to Shift control register.
Reference Manual to LL API cross reference:
SHIFTR ADD1S LL_RTC_TIME_Synchronize
SHIFTR SUBFS LL_RTC_TIME_Synchronize
Parameters:
RTCxRTC Instance
ShiftSecondThis parameter can be one of the following values:
FractionNumber of Seconds Fractions (any value from 0 to 0x7FFF)
Return values:
None

Definition at line 1445 of file stm32f4xx_ll_rtc.h.