Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
cubexHal.pdf
Скачиваний:
110
Добавлен:
10.02.2016
Размер:
16.16 Mб
Скачать

HAL RTC Extension Driver

UM1725

49 HAL RTC Extension Driver

49.1RTCEx Firmware driver registers structures

49.1.1RTC_TamperTypeDef

Data Fields

uint32_t Tamper

uint32_t PinSelection

uint32_t Trigger

uint32_t Filter

uint32_t SamplingFrequency

uint32_t PrechargeDuration

uint32_t TamperPullUp

uint32_t TimeStampOnTamperDetection

Field Documentation

uint32_t RTC_TamperTypeDef::Tamper

Specifies the Tamper Pin. This parameter can be a value of

RTCEx_Tamper_Pins_Definitions

uint32_t RTC_TamperTypeDef::PinSelection

Specifies the Tamper Pin. This parameter can be a value of

RTCEx_Tamper_Pins_Selection

uint32_t RTC_TamperTypeDef::Trigger

Specifies the Tamper Trigger. This parameter can be a value of

RTCEx_Tamper_Trigger_Definitions

uint32_t RTC_TamperTypeDef::Filter

Specifies the RTC Filter Tamper. This parameter can be a value of

RTCEx_Tamper_Filter_Definitions

uint32_t RTC_TamperTypeDef::SamplingFrequency

Specifies the sampling frequency. This parameter can be a value of

RTCEx_Tamper_Sampling_Frequencies_Definitions

uint32_t RTC_TamperTypeDef::PrechargeDuration

Specifies the Precharge Duration . This parameter can be a value of

RTCEx_Tamper_Pin_Precharge_Duration_Definitions

uint32_t RTC_TamperTypeDef::TamperPullUp

Specifies the Tamper PullUp . This parameter can be a value of

RTCEx_Tamper_Pull_UP_Definitions

uint32_t RTC_TamperTypeDef::TimeStampOnTamperDetection

Specifies the TimeStampOnTamperDetection. This parameter can be a value of

RTCEx_Tamper_TimeStampOnTamperDetection_Definitions

49.2RTCEx Firmware driver API description

49.2.1How to use this driver

634/900

DOCID025834 Rev 2

UM1725

HAL RTC Extension Driver

Enable the RTC domain access.

Configure the RTC Prescaler (Asynchronous and Synchronous) and RTC hour format using the HAL_RTC_Init() function.

RTC Wake-up configuration

To configure the RTC Wake-up Clock source and Counter use the

HAL_RTC_SetWakeUpTimer() function. You can also configure the RTC Wake-up timer in interrupt mode using the HAL_RTC_SetWakeUpTimer_IT() function.

To read the RTC Wake-up Counter register, use the HAL_RTC_GetWakeUpTimer() function.

TimeStamp configuration

Configure the RTC_AFx trigger and enable the RTC TimeStamp using the

HAL_RTC_SetTimeStamp() function. You can also configure the RTC TimeStamp with interrupt mode using the HAL_RTC_SetTimeStamp_IT() function.

To read the RTC TimeStamp Time and Date register, use the HAL_RTC_GetTimeStamp() function.

The TIMESTAMP alternate function can be mapped either to RTC_AF1 (PC13) or RTC_AF2 (PI8 or PA0 only for STM32F446xx devices) depending on the value of TSINSEL bit in RTC_TAFCR register. The corresponding pin is also selected by HAL_RTC_SetTimeStamp() or HAL_RTC_SetTimeStamp_IT() function.

Tamper configuration

Enable the RTC Tamper and configure the Tamper filter count, trigger Edge or Level according to the Tamper filter (if equal to 0 Edge else Level) value, sampling frequency, precharge or discharge and Pull-UP using the HAL_RTC_SetTamper() function. You can configure RTC Tamper in interrupt mode using HAL_RTC_SetTamper_IT() function.

The TAMPER1 alternate function can be mapped either to RTC_AF1 (PC13) or RTC_AF2 (PI8 or PA0 only for STM32F446xx devices) depending on the value of TAMP1INSEL bit in RTC_TAFCR register. The corresponding pin is also selected by HAL_RTC_SetTamper() or HAL_RTC_SetTamper_IT() function.

Backup Data Registers configuration

To write to the RTC Backup Data registers, use the HAL_RTC_BKUPWrite() function.

To read the RTC Backup Data registers, use the HAL_RTC_BKUPRead() function.

49.2.2RTC TimeStamp and Tamper functions

This section provides functions allowing to configure TimeStamp feature

This section contains the following APIs:

HAL_RTCEx_SetTimeStamp()

HAL_RTCEx_SetTimeStamp_IT()

HAL_RTCEx_DeactivateTimeStamp()

HAL_RTCEx_GetTimeStamp()

DOCID025834 Rev 2

635/900

HAL RTC Extension Driver

UM1725

HAL_RTCEx_SetTamper()

HAL_RTCEx_SetTamper_IT()

HAL_RTCEx_DeactivateTamper()

HAL_RTCEx_TamperTimeStampIRQHandler()

HAL_RTCEx_TimeStampEventCallback()

HAL_RTCEx_Tamper1EventCallback()

HAL_RTCEx_Tamper2EventCallback()

HAL_RTCEx_PollForTimeStampEvent()

HAL_RTCEx_PollForTamper1Event()

HAL_RTCEx_PollForTamper2Event()

49.2.3RTC Wake-up functions

This section provides functions allowing to configure Wake-up feature

This section contains the following APIs:

HAL_RTCEx_SetWakeUpTimer()

HAL_RTCEx_SetWakeUpTimer_IT()

HAL_RTCEx_DeactivateWakeUpTimer()

HAL_RTCEx_GetWakeUpTimer()

HAL_RTCEx_WakeUpTimerIRQHandler()

HAL_RTCEx_WakeUpTimerEventCallback()

HAL_RTCEx_PollForWakeUpTimerEvent()

49.2.4Extension Peripheral Control functions

This subsection provides functions allowing to

Write a data in a specified RTC Backup data register

Read a data in a specified RTC Backup data register

Set the Coarse calibration parameters.

Deactivate the Coarse calibration parameters

Set the Smooth calibration parameters.

Configure the Synchronization Shift Control Settings.

Configure the Calibration Pinout (RTC_CALIB) Selection (1Hz or 512Hz).

Deactivate the Calibration Pinout (RTC_CALIB) Selection (1Hz or 512Hz).

Enable the RTC reference clock detection.

Disable the RTC reference clock detection.

Enable the Bypass Shadow feature.

Disable the Bypass Shadow feature.

This section contains the following APIs:

HAL_RTCEx_BKUPWrite()

HAL_RTCEx_BKUPRead()

HAL_RTCEx_SetCoarseCalib()

HAL_RTCEx_DeactivateCoarseCalib()

HAL_RTCEx_SetSmoothCalib()

HAL_RTCEx_SetSynchroShift()

HAL_RTCEx_SetCalibrationOutPut()

HAL_RTCEx_DeactivateCalibrationOutPut()

HAL_RTCEx_SetRefClock()

HAL_RTCEx_DeactivateRefClock()

HAL_RTCEx_EnableBypassShadow()

HAL_RTCEx_DisableBypassShadow()

636/900

DOCID025834 Rev 2

UM1725

HAL RTC Extension Driver

49.2.5Extended features functions

This section provides functions allowing to:

RTC Alarm B callback

RTC Poll for Alarm B request

This section contains the following APIs:

HAL_RTCEx_AlarmBEventCallback()

HAL_RTCEx_PollForAlarmBEvent()

49.2.6HAL_RTCEx_SetTimeStamp

Function Name

HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp

 

(RTC_HandleTypeDef * hrtc, uint32_t TimeStampEdge,

 

uint32_t RTC_TimeStampPin)

Function Description

Sets TimeStamp.

Parameters

 

hrtc: pointer to a RTC_HandleTypeDef structure that

 

 

contains the configuration information for RTC.

 

TimeStampEdge: Specifies the pin edge on which the

 

 

TimeStamp is activated. This parameter can be one of the

 

 

following values: RTC_TIMESTAMPEDGE_RISING: the Time

 

 

stamp event occurs on the rising edge of the related

 

 

pin.RTC_TIMESTAMPEDGE_FALLING: the Time stamp

 

 

event occurs on the falling edge of the related pin.

 

RTC_TimeStampPin: specifies the RTC TimeStamp Pin.

 

 

This parameter can be one of the following values:

 

 

RTC_TIMESTAMPPIN_PC13: PC13 is selected as RTC

 

 

TimeStamp Pin.RTC_TIMESTAMPPIN_PI8: PI8 is selected

 

 

as RTC TimeStamp Pin. (not applicable in the case of

 

 

STM32F446xx devices)RTC_TIMESTAMPPIN_PA0: PA0 is

 

 

selected as RTC TimeStamp Pin only for STM32F446xx

 

 

devices

Return values

 

HAL status

Notes

This API must be called before enabling the TimeStamp

 

 

feature.

49.2.7HAL_RTCEx_SetTimeStamp_IT

Function Name

HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp_IT

 

 

(RTC_HandleTypeDef * hrtc, uint32_t TimeStampEdge,

 

 

uint32_t RTC_TimeStampPin)

 

Function Description

Sets TimeStamp with Interrupt.

 

Parameters

hrtc: pointer to a RTC_HandleTypeDef structure that

 

 

contains the configuration information for RTC.

 

 

TimeStampEdge: Specifies the pin edge on which the

 

TimeStamp is activated. This parameter can be one of the

 

following values: RTC_TIMESTAMPEDGE_RISING: the Time

 

stamp event occurs on the rising edge of the related

 

 

pin.RTC_TIMESTAMPEDGE_FALLING: the Time stamp

 

event occurs on the falling edge of the related pin.

 

 

RTC_TimeStampPin: Specifies the RTC TimeStamp Pin.

 

This parameter can be one of the following values:

 

 

DOCID025834 Rev 2

637/900

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]