STM32F4xx HAL Documentation
Hardware Abstraction Layer for STM32F4 familiy
Loading...
Searching...
No Matches
stm32f4xx_hal_rtc_ex.c File Reference

Extended RTC HAL module driver. This file provides firmware functions to manage the following functionalities of the Real-Time Clock (RTC) Extended peripheral: More...

#include "stm32f4xx_hal.h"
Include dependency graph for stm32f4xx_hal_rtc_ex.c:

Go to the source code of this file.

Functions

HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp (RTC_HandleTypeDef *hrtc, uint32_t RTC_TimeStampEdge, uint32_t RTC_TimeStampPin)
 Sets Timestamp.
 
HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp_IT (RTC_HandleTypeDef *hrtc, uint32_t RTC_TimeStampEdge, uint32_t RTC_TimeStampPin)
 Sets Timestamp with Interrupt.
 
HAL_StatusTypeDef HAL_RTCEx_DeactivateTimeStamp (RTC_HandleTypeDef *hrtc)
 Deactivates Timestamp.
 
HAL_StatusTypeDef HAL_RTCEx_GetTimeStamp (RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTimeStamp, RTC_DateTypeDef *sTimeStampDate, uint32_t Format)
 Gets the RTC Timestamp value.
 
HAL_StatusTypeDef HAL_RTCEx_SetTamper (RTC_HandleTypeDef *hrtc, RTC_TamperTypeDef *sTamper)
 Sets Tamper.
 
HAL_StatusTypeDef HAL_RTCEx_SetTamper_IT (RTC_HandleTypeDef *hrtc, RTC_TamperTypeDef *sTamper)
 Sets Tamper with interrupt.
 
HAL_StatusTypeDef HAL_RTCEx_DeactivateTamper (RTC_HandleTypeDef *hrtc, uint32_t Tamper)
 Deactivates Tamper.
 
void HAL_RTCEx_TamperTimeStampIRQHandler (RTC_HandleTypeDef *hrtc)
 Handles Timestamp and Tamper interrupt request.
 
void HAL_RTCEx_TimeStampEventCallback (RTC_HandleTypeDef *hrtc)
 Timestamp callback.
 
void HAL_RTCEx_Tamper1EventCallback (RTC_HandleTypeDef *hrtc)
 Tamper 1 callback.
 
HAL_StatusTypeDef HAL_RTCEx_PollForTimeStampEvent (RTC_HandleTypeDef *hrtc, uint32_t Timeout)
 Handles Timestamp polling request.
 
HAL_StatusTypeDef HAL_RTCEx_PollForTamper1Event (RTC_HandleTypeDef *hrtc, uint32_t Timeout)
 Handles Tamper 1 Polling.
 
HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer (RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock)
 Sets wakeup timer.
 
HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer_IT (RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock)
 Sets wakeup timer with interrupt.
 
HAL_StatusTypeDef HAL_RTCEx_DeactivateWakeUpTimer (RTC_HandleTypeDef *hrtc)
 Deactivates wakeup timer counter.
 
uint32_t HAL_RTCEx_GetWakeUpTimer (RTC_HandleTypeDef *hrtc)
 Gets wakeup timer counter.
 
void HAL_RTCEx_WakeUpTimerIRQHandler (RTC_HandleTypeDef *hrtc)
 Handles Wakeup Timer interrupt request.
 
void HAL_RTCEx_WakeUpTimerEventCallback (RTC_HandleTypeDef *hrtc)
 Wakeup Timer callback.
 
HAL_StatusTypeDef HAL_RTCEx_PollForWakeUpTimerEvent (RTC_HandleTypeDef *hrtc, uint32_t Timeout)
 Handles Wakeup Timer Polling.
 
void HAL_RTCEx_BKUPWrite (RTC_HandleTypeDef *hrtc, uint32_t BackupRegister, uint32_t Data)
 Writes a data in a specified RTC Backup data register.
 
uint32_t HAL_RTCEx_BKUPRead (RTC_HandleTypeDef *hrtc, uint32_t BackupRegister)
 Reads data from the specified RTC Backup data Register.
 
HAL_StatusTypeDef HAL_RTCEx_SetCoarseCalib (RTC_HandleTypeDef *hrtc, uint32_t CalibSign, uint32_t Value)
 Sets the Coarse calibration parameters.
 
HAL_StatusTypeDef HAL_RTCEx_DeactivateCoarseCalib (RTC_HandleTypeDef *hrtc)
 Deactivates the Coarse calibration parameters.
 
HAL_StatusTypeDef HAL_RTCEx_SetSmoothCalib (RTC_HandleTypeDef *hrtc, uint32_t SmoothCalibPeriod, uint32_t SmoothCalibPlusPulses, uint32_t SmoothCalibMinusPulsesValue)
 Sets the Smooth calibration parameters.
 
HAL_StatusTypeDef HAL_RTCEx_SetSynchroShift (RTC_HandleTypeDef *hrtc, uint32_t ShiftAdd1S, uint32_t ShiftSubFS)
 Configures the Synchronization Shift Control Settings.
 
HAL_StatusTypeDef HAL_RTCEx_SetCalibrationOutPut (RTC_HandleTypeDef *hrtc, uint32_t CalibOutput)
 Configures the Calibration Pinout (RTC_CALIB) Selection (1Hz or 512Hz).
 
HAL_StatusTypeDef HAL_RTCEx_DeactivateCalibrationOutPut (RTC_HandleTypeDef *hrtc)
 Deactivates the Calibration Pinout (RTC_CALIB) Selection (1Hz or 512Hz).
 
HAL_StatusTypeDef HAL_RTCEx_SetRefClock (RTC_HandleTypeDef *hrtc)
 Enables the RTC reference clock detection.
 
HAL_StatusTypeDef HAL_RTCEx_DeactivateRefClock (RTC_HandleTypeDef *hrtc)
 Disable the RTC reference clock detection.
 
HAL_StatusTypeDef HAL_RTCEx_EnableBypassShadow (RTC_HandleTypeDef *hrtc)
 Enables the Bypass Shadow feature.
 
HAL_StatusTypeDef HAL_RTCEx_DisableBypassShadow (RTC_HandleTypeDef *hrtc)
 Disables the Bypass Shadow feature.
 
void HAL_RTCEx_AlarmBEventCallback (RTC_HandleTypeDef *hrtc)
 Alarm B callback.
 
HAL_StatusTypeDef HAL_RTCEx_PollForAlarmBEvent (RTC_HandleTypeDef *hrtc, uint32_t Timeout)
 Handles Alarm B Polling request.
 

Detailed Description

Extended RTC HAL module driver. This file provides firmware functions to manage the following functionalities of the Real-Time Clock (RTC) Extended peripheral:

Author
MCD Application Team
  • RTC Timestamp functions
  • RTC Tamper functions
  • RTC Wakeup functions
  • Extended Control functions
  • Extended RTC features functions
Attention

Copyright (c) 2016 STMicroelectronics. All rights reserved.

This software is licensed under terms that can be found in the LICENSE file in the root directory of this software component. If no LICENSE file comes with this software, it is provided AS-IS.

==============================================================================
                      ##### How to use this driver #####
==============================================================================
[..]
  (+) Enable the RTC domain access.
  (+) Configure the RTC Prescaler (Asynchronous and Synchronous) and RTC hour
      format using the HAL_RTC_Init() function.

*** RTC Wakeup configuration ***
================================
[..]
  (+) To configure the RTC Wakeup Clock source and Counter use the
      HAL_RTCEx_SetWakeUpTimer() function.
      You can also configure the RTC Wakeup timer in interrupt mode using the
      HAL_RTCEx_SetWakeUpTimer_IT() function.
  (+) To read the RTC Wakeup Counter register, use the HAL_RTCEx_GetWakeUpTimer()
      function.

*** Timestamp configuration ***
===============================
[..]
  (+) To configure the RTC Timestamp use the HAL_RTCEx_SetTimeStamp() function.
      You can also configure the RTC Timestamp with interrupt mode using the
      HAL_RTCEx_SetTimeStamp_IT() function.
  (+) To read the RTC Timestamp Time and Date register, use the
      HAL_RTCEx_GetTimeStamp() function.
  (+) The Timestamp alternate function can be mapped either to RTC_AF1 (PC13)
      or RTC_AF2 (PI8) depending on the value of TSINSEL bit in RTC_TAFCR
      register.
      For STM32F446xx devices RTC_AF2 corresponds to pin PA0 and not to pin PI8.
      The corresponding pin is also selected by HAL_RTCEx_SetTimeStamp()
      or HAL_RTCEx_SetTimeStamp_IT() functions.

*** Tamper configuration ***
============================
[..]
  (+) To Enable the RTC Tamper and configure the Tamper filter count, trigger
      Edge or Level according to the Tamper filter value (if equal to 0 Edge
      else Level), sampling frequency, precharge or discharge and Pull-UP use
      the HAL_RTCEx_SetTamper() function.
      You can configure RTC Tamper in interrupt mode using HAL_RTCEx_SetTamper_IT()
      function.
  (+) The TAMPER1 alternate function can be mapped either to RTC_AF1 (PC13)
      or RTC_AF2 (PI8) depending on the value of TAMP1INSEL bit in RTC_TAFCR
      register.
      The corresponding pin is also selected by HAL_RTCEx_SetTamper()
      or HAL_RTCEx_SetTamper_IT() functions.
  (+) The TAMPER2 alternate function is mapped to RTC_AF2 (PI8).
      For STM32F446xx devices RTC_AF2 corresponds to pin PA0 and not to pin PI8.

*** Backup Data Registers configuration ***
===========================================
[..]
  (+) To write to the RTC Backup Data registers, use the HAL_RTCEx_BKUPWrite()
      function.
  (+) To read the RTC Backup Data registers, use the HAL_RTCEx_BKUPRead()
      function.

*** Coarse Digital Calibration configuration ***
================================================
[..]
  (+) The Coarse Digital Calibration can be used to compensate crystal inaccuracy
      by setting the DCS bit in RTC_CALIBR register.
  (+) When positive calibration is enabled (DCS = ‘0’), 2 asynchronous prescaler
      clock cycles are added every minute during 2xDC minutes.
      This causes the calendar to be updated sooner, thereby adjusting the
      effective RTC frequency to be a bit higher.
  (+) When negative calibration is enabled (DCS = ‘1’), 1 asynchronous prescaler
      clock cycle is removed every minute during 2xDC minutes.
      This causes the calendar to be updated later, thereby adjusting the
      effective RTC frequency to be a bit lower.
  (+) DC is configured through bits DC[4:0] of RTC_CALIBR register. This number
      ranges from 0 to 31 corresponding to a time interval (2xDC) ranging from
      0 to 62.
  (+) In order to measure the clock deviation, a 512 Hz clock is output for
      calibration.
  (+) The RTC Coarse Digital Calibration value and sign can be calibrated using
      the HAL_RTCEx_SetCoarseCalib() function.

*** Smooth Digital Calibration configuration ***
================================================
[..]
  (+) RTC frequency can be digitally calibrated with a resolution of about
      0.954 ppm with a range from -487.1 ppm to +488.5 ppm.
      The correction of the frequency is performed using a series of small
      adjustments (adding and/or subtracting individual RTCCLK pulses).
  (+) The smooth digital calibration is performed during a cycle of about 2^20
      RTCCLK pulses (or 32 seconds) when the input frequency is 32,768 Hz.
      This cycle is maintained by a 20-bit counter clocked by RTCCLK.
  (+) The smooth calibration register (RTC_CALR) specifies the number of RTCCLK
      clock cycles to be masked during the 32-second cycle.
  (+) The RTC Smooth Digital Calibration value and the corresponding calibration
      cycle period (32s, 16s, or 8s) can be calibrated using the
      HAL_RTCEx_SetSmoothCalib() function.

Definition in file stm32f4xx_hal_rtc_ex.c.