RTC Time and Date functions.
More...
RTC Time and Date functions.
===============================================================================
##### RTC Time and Date functions #####
===============================================================================
[..] This section provides functions allowing to configure Time and Date features
◆ HAL_RTC_GetDate()
Gets RTC current date.
- Parameters
-
hrtc | pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC. |
sDate | Pointer to Date structure |
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
|
- Note
- You must call HAL_RTC_GetDate() after HAL_RTC_GetTime() to unlock the values in the higher-order calendar shadow registers to ensure consistency between the time and date values. Reading RTC current time locks the values in calendar shadow registers until current date is read to ensure consistency between the time and date values.
- Return values
-
Definition at line 946 of file stm32f4xx_hal_rtc.c.
◆ HAL_RTC_GetTime()
Gets RTC current time.
- Parameters
-
hrtc | pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC. |
sTime | Pointer to Time structure |
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
|
- Note
- You can use SubSeconds and SecondFraction (sTime structure fields returned) to convert SubSeconds value in second fraction ratio with time unit following generic formula: Second 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
-
You must call HAL_RTC_GetDate() after HAL_RTC_GetTime() to unlock the values in the higher-order calendar shadow registers to ensure consistency between the time and date values. Reading RTC current time locks the values in calendar shadow registers until current date is read to ensure consistency between the time and date values.
- Return values
-
Definition at line 812 of file stm32f4xx_hal_rtc.c.
◆ HAL_RTC_SetDate()
Sets RTC current date.
- Parameters
-
hrtc | pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC. |
sDate | Pointer to date structure |
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
|
- Return values
-
Definition at line 857 of file stm32f4xx_hal_rtc.c.
◆ HAL_RTC_SetTime()
Sets RTC current time.
- Parameters
-
hrtc | pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC. |
sTime | Pointer to Time structure |
- Note
- DayLightSaving and StoreOperation interfaces are deprecated. To manage Daylight Saving Time, please use HAL_RTC_DST_xxx functions.
- Parameters
-
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
|
- Return values
-
Definition at line 698 of file stm32f4xx_hal_rtc.c.