STM32L4xx_HAL_Driver  1.14.0
stm32l4xx_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...

Go to the source code of this file.

Functions

HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp (RTC_HandleTypeDef *hrtc, uint32_t TimeStampEdge, uint32_t RTC_TimeStampPin)
 Set TimeStamp. More...
 
HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp_IT (RTC_HandleTypeDef *hrtc, uint32_t TimeStampEdge, uint32_t RTC_TimeStampPin)
 Set TimeStamp with Interrupt. More...
 
HAL_StatusTypeDef HAL_RTCEx_DeactivateTimeStamp (RTC_HandleTypeDef *hrtc)
 Deactivate TimeStamp. More...
 
HAL_StatusTypeDef HAL_RTCEx_SetInternalTimeStamp (RTC_HandleTypeDef *hrtc)
 Set Internal TimeStamp. More...
 
HAL_StatusTypeDef HAL_RTCEx_DeactivateInternalTimeStamp (RTC_HandleTypeDef *hrtc)
 Deactivate Internal TimeStamp. More...
 
HAL_StatusTypeDef HAL_RTCEx_GetTimeStamp (RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTimeStamp, RTC_DateTypeDef *sTimeStampDate, uint32_t Format)
 Get the RTC TimeStamp value. More...
 
void HAL_RTCEx_TamperTimeStampIRQHandler (RTC_HandleTypeDef *hrtc)
 Handle TimeStamp interrupt request. More...
 
void HAL_RTCEx_TimeStampEventCallback (RTC_HandleTypeDef *hrtc)
 TimeStamp callback. More...
 
HAL_StatusTypeDef HAL_RTCEx_PollForTimeStampEvent (RTC_HandleTypeDef *hrtc, uint32_t Timeout)
 Handle TimeStamp polling request. More...
 
HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer (RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock)
 Set wake up timer. More...
 
HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer_IT (RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock, uint32_t WakeUpAutoClr) HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer_IT(RTC_HandleTypeDef *hrtc
 Set wake up timer with interrupt. More...
 
 assert_param (IS_RTC_WAKEUP_CLOCK(WakeUpClock))
 
 assert_param (IS_RTC_WAKEUP_COUNTER(WakeUpCounter))
 
 assert_param (WakeUpAutoClr<=WakeUpCounter)
 
 __HAL_LOCK (hrtc)
 
 __HAL_RTC_WRITEPROTECTION_DISABLE (hrtc)
 
 CLEAR_BIT (hrtc->Instance->CR, RTC_CR_WUTE)
 
 __HAL_RTC_WAKEUPTIMER_CLEAR_FLAG (hrtc, RTC_FLAG_WUTF)
 
 if (READ_BIT(hrtc->Instance->ICSR, RTC_ICSR_INITF)==0U)
 
 MODIFY_REG (hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)
 
 if (WakeUpAutoClr !=0u)
 
 __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_IT ()
 
 __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_RISING_EDGE ()
 
 __HAL_RTC_WAKEUPTIMER_ENABLE_IT (hrtc, RTC_IT_WUT)
 
 __HAL_RTC_WAKEUPTIMER_ENABLE (hrtc)
 
 __HAL_RTC_WRITEPROTECTION_ENABLE (hrtc)
 
 __HAL_UNLOCK (hrtc)
 
HAL_StatusTypeDef HAL_RTCEx_DeactivateWakeUpTimer (RTC_HandleTypeDef *hrtc)
 Deactivate wake up timer counter. More...
 
uint32_t HAL_RTCEx_GetWakeUpTimer (RTC_HandleTypeDef *hrtc)
 Get wake up timer counter. More...
 
void HAL_RTCEx_WakeUpTimerIRQHandler (RTC_HandleTypeDef *hrtc)
 Handle Wake Up Timer interrupt request. More...
 

Variables

HAL_StatusTypeDef uint32_t WakeUpCounter
 
HAL_StatusTypeDef uint32_t uint32_t WakeUpClock
 
hrtc State = HAL_RTC_STATE_BUSY
 
hrtc Instance WUTR = (uint32_t)(WakeUpCounter | (WakeUpAutoClr << RTC_WUTR_WUTOCLR_Pos))
 
 else
 
return HAL_OK
 

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 Time Stamp functions
  • RTC Tamper functions
  • RTC Wake-up functions
  • Extended Control functions
  • Extended RTC features functions
==============================================================================
                ##### 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 with interrupt mode
      using the HAL_RTCEx_SetWakeUpTimer_IT() function.
  (+) To read the RTC WakeUp Counter register, use the HAL_RTCEx_GetWakeUpTimer()
      function.

*** Outputs configuration ***
=============================
[..]  The RTC has 2 different outputs:
  (+) RTC_ALARM: this output is used to manage the RTC Alarm A, Alarm B
      and WaKeUp signals.
      To output the selected RTC signal, use the HAL_RTC_Init() function.
  (+) RTC_CALIB: this output is 512Hz signal or 1Hz.
      To enable the RTC_CALIB, use the HAL_RTCEx_SetCalibrationOutPut() function.
  (+) Two pins can be used as RTC_ALARM or RTC_CALIB (PC13, PB2) managed on
      the RTC_OR register.
  (+) When the RTC_CALIB or RTC_ALARM output is selected, the RTC_OUT pin is
      automatically configured in output alternate function.

*** Smooth digital Calibration configuration ***
================================================
[..]
  (+) Configure the RTC Original Digital Calibration Value and the corresponding
      calibration cycle period (32s,16s and 8s) using the HAL_RTCEx_SetSmoothCalib()
      function.

*** TimeStamp configuration ***
===============================
[..]
  (+) Enable the RTC TimeStamp using 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.

*** Internal TimeStamp configuration ***
===============================
[..]
  (+) Enable the RTC internal TimeStamp using the HAL_RTCEx_SetInternalTimeStamp() function.
      User has to check internal timestamp occurrence using __HAL_RTC_INTERNAL_TIMESTAMP_GET_FLAG.
  (+) To read the RTC TimeStamp Time and Date register, use the HAL_RTCEx_GetTimeStamp()
      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, NoErase, MaskFlag,  precharge or discharge and
       Pull-UP using the HAL_RTCEx_SetTamper() function. You can configure RTC Tamper
       with interrupt mode using HAL_RTCEx_SetTamper_IT() function.
   (+) The default configuration of the Tamper erases the backup registers. To avoid
       erase, enable the NoErase field on the RTC_TAMPCR register.
   (+) STM32L412xx and STM32L422xx only : With new RTC tamper configuration, you have to call HAL_RTC_Init() in order to
       perform TAMP base address offset calculation.
   (+) STM32L412xx and STM32L422xx only : If you don't intend to have tamper using RTC clock, you can bypass its initialization
       by setting ClockEnable inti field to RTC_CLOCK_DISABLE.
   (+) STM32L412xx and STM32L422xx only : Enable Internal tamper using HAL_RTCEx_SetInternalTamper. IT mode can be chosen using
       setting Interrupt field.

 *** 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.
   (+) STM32L412xx and STM32L422xx only : Before calling these functions you have to call HAL_RTC_Init() in order to
       perform TAMP base address offset calculation.
Attention

© Copyright (c) 2017 STMicroelectronics. All rights reserved.

This software component is licensed by ST under BSD 3-Clause license, the "License"; You may not use this file except in compliance with the License. You may obtain a copy of the License at: opensource.org/licenses/BSD-3-Clause

Definition in file stm32l4xx_hal_rtc_ex.c.