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.
Fork of TUKS-COURSE-TIMER by
RTC Time and Date functions
[RTC Exported Functions]
RTC Time and Date functions. More...
Functions | |
HAL_StatusTypeDef | HAL_RTC_SetTime (RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTime, uint32_t Format) |
Set RTC current time. | |
HAL_StatusTypeDef | HAL_RTC_GetTime (RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTime, uint32_t Format) |
Get RTC current time. | |
HAL_StatusTypeDef | HAL_RTC_SetDate (RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDate, uint32_t Format) |
Set RTC current date. | |
HAL_StatusTypeDef | HAL_RTC_GetDate (RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDate, uint32_t Format) |
Get RTC current date. |
Detailed Description
RTC Time and Date functions.
=============================================================================== ##### RTC Time and Date functions ##### =============================================================================== [..] This section provides functions allowing to configure Time and Date features
Function Documentation
HAL_StatusTypeDef HAL_RTC_GetDate | ( | RTC_HandleTypeDef * | hrtc, |
RTC_DateTypeDef * | sDate, | ||
uint32_t | Format | ||
) |
Get RTC current date.
- Parameters:
-
hrtc,: RTC handle 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.
- Return values:
-
HAL status
Definition at line 709 of file stm32l4xx_hal_rtc.c.
HAL_StatusTypeDef HAL_RTC_GetTime | ( | RTC_HandleTypeDef * | hrtc, |
RTC_TimeTypeDef * | sTime, | ||
uint32_t | Format | ||
) |
Get RTC current time.
- Parameters:
-
hrtc,: RTC handle sTime,: Pointer to Time structure with Hours, Minutes and Seconds fields returned with input format (BIN or BCD), also SubSeconds field returning the RTC_SSR register content and SecondFraction field the Synchronous pre-scaler factor to be used for second fraction ratio computation. 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:
-
HAL status
Definition at line 554 of file stm32l4xx_hal_rtc.c.
HAL_StatusTypeDef HAL_RTC_SetDate | ( | RTC_HandleTypeDef * | hrtc, |
RTC_DateTypeDef * | sDate, | ||
uint32_t | Format | ||
) |
Set RTC current date.
- Parameters:
-
hrtc,: RTC handle 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:
-
HAL status
Definition at line 598 of file stm32l4xx_hal_rtc.c.
HAL_StatusTypeDef HAL_RTC_SetTime | ( | RTC_HandleTypeDef * | hrtc, |
RTC_TimeTypeDef * | sTime, | ||
uint32_t | Format | ||
) |
Set RTC current time.
- Parameters:
-
hrtc,: RTC handle 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
- Return values:
-
HAL status
Definition at line 419 of file stm32l4xx_hal_rtc.c.
Generated on Tue Jul 12 2022 17:38:54 by
