...
The FreeRTOS BSP makes use of the STM32CubeH7 software component to provide a device driver for the STM32H7 RTC. The driver is configured (enabled / disabled) at the BSP build time, using the HAL_RTC_MODULE_ENABLED
configuration option, defined in the stm32h7xx_hal_conf.h
file.
1.2. FreeRTOS RTC C-Binding API
...
Function | Description | Comments |
HAL_StatusTypeDef HAL_RTC_Init(RTC_HandleTypeDef * hrtc)
|
| Initialize the RTC according to the specified parameters in hrtc | hrtc is a RTC handle, data structures describing initialization of RTC (see below); returns one of {HAL_OK, HAL_ERROR, HAL_BUSY, HAL_TIMEOUT}
|
HAL_StatusTypeDef HAL_RTC_DeInit(RTC_HandleTypeDef * hrtc)
|
| De-initialize the RTC peripheral | hrtc is a RTC handle; returns one of {HAL_OK, HAL_ERROR, HAL_BUSY, HAL_TIMEOUT}
|
HAL_StatusTypeDef HAL_RTC_GetDate(RTC_HandleTypeDef * hrtc, RTC_DateTypeDef * sDate, uint32_t Format)
|
| Get RTC current date | hrtc is a RTC handle; sDate is a pointer to Date structure; Format is a value of RTC_FORMAT_BIN or RTC_FORMAT_BCD ; returns one of {HAL_OK, HAL_ERROR, HAL_BUSY, HAL_TIMEOUT}
|
HAL_StatusTypeDef HAL_RTC_GetTime(RTC_HandleTypeDef * hrtc, RTC_TimeTypeDef * sTime, uint32_t Format)
|
| Get RTC current time | hrtc is a RTC handle; sTime is a pointer to Time structure; Format is a value of RTC_FORMAT_BIN or RTC_FORMAT_BCD ; returns one of {HAL_OK, HAL_ERROR, HAL_BUSY, HAL_TIMEOUT}
|
HAL_StatusTypeDef HAL_RTC_SetDate(RTC_HandleTypeDef * hrtc, RTC_DateTypeDef * sDate, uint32_t Format)
|
| Set RTC current date | hrtc is a RTC handle, data structures describing initialization of RTC (see below); returns one of {HAL_OK, HAL_ERROR, HAL_BUSY, HAL_TIMEOUT}
|
HAL_StatusTypeDef HAL_RTC_SetTime(RTC_HandleTypeDef * hrtc, RTC_TimeTypeDef * sTime, uint32_t Format)
|
| Get RTC current time | hrtc is a RTC handle; sTime is a pointer to Time structure; Format is a value of RTC_FORMAT_BIN or RTC_FORMAT_BCD ; returns one of {HAL_OK, HAL_ERROR, HAL_BUSY, HAL_TIMEOUT}
|
The RTC_HandleTypeDef
data structure used in the HAL_RTC_Init
interface has the following definition:
Code Block |
---|
typedef struct
{
RTC_TypeDef * Instance; /* Register base address */
RTC_InitTypeDef Init; /* RTC required parameters */
HAL_LockTypeDef Lock; /* RTC locking object */
__IO HAL_RTCStateTypeDef State; /* Time communication state */
} RTC_HandleTypeDef; |
The RTC_InitTypeDef
data structure used in RTC_HandleTypeDef
has the following definition:
...
Command | Description | Comments |
rtc_get_date
| Get the RTC time and date | |
rtc_set_date YYYY:MM:DD:hh:mm
| Set the RTC time and date | YYYY - year to be set; MM - month to be set; DD - date to be set; hh - hours to be set; mm - minutes to be set
|
3. Validating RTC Operation
...