fix LPC812 PWM
Fork of mbed-dev by
targets/cmsis/TARGET_STM/TARGET_STM32L0/stm32l0xx_hal_rtc_ex.c@129:2e517c56bcfb, 2016-05-16 (annotated)
- Committer:
- nameless129
- Date:
- Mon May 16 16:50:30 2016 +0000
- Revision:
- 129:2e517c56bcfb
- Parent:
- 113:b3775bf36a83
PWM Fix:Duty 0%??H???????????????
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bogdanm | 0:9b334a45a8ff | 1 | /** |
bogdanm | 0:9b334a45a8ff | 2 | ****************************************************************************** |
bogdanm | 0:9b334a45a8ff | 3 | * @file stm32l0xx_hal_rtc_ex.c |
bogdanm | 0:9b334a45a8ff | 4 | * @author MCD Application Team |
mbed_official | 113:b3775bf36a83 | 5 | * @version V1.5.0 |
mbed_official | 113:b3775bf36a83 | 6 | * @date 8-January-2016 |
bogdanm | 0:9b334a45a8ff | 7 | * @brief Extended RTC HAL module driver. |
bogdanm | 0:9b334a45a8ff | 8 | * |
bogdanm | 0:9b334a45a8ff | 9 | * This file provides firmware functions to manage the following |
bogdanm | 0:9b334a45a8ff | 10 | * functionalities of the Real Time Clock (RTC) Extended peripheral: |
bogdanm | 0:9b334a45a8ff | 11 | * + RTC Time Stamp functions |
bogdanm | 0:9b334a45a8ff | 12 | * + RTC Tamper functions |
bogdanm | 0:9b334a45a8ff | 13 | * + RTC Wake-up functions |
bogdanm | 0:9b334a45a8ff | 14 | * + Extended Control functions |
bogdanm | 0:9b334a45a8ff | 15 | * + Extended RTC features functions |
bogdanm | 0:9b334a45a8ff | 16 | * |
bogdanm | 0:9b334a45a8ff | 17 | @verbatim |
bogdanm | 0:9b334a45a8ff | 18 | ============================================================================== |
bogdanm | 0:9b334a45a8ff | 19 | ##### How to use this driver ##### |
bogdanm | 0:9b334a45a8ff | 20 | ============================================================================== |
bogdanm | 0:9b334a45a8ff | 21 | [..] |
bogdanm | 0:9b334a45a8ff | 22 | (+) Enable the RTC domain access. |
bogdanm | 0:9b334a45a8ff | 23 | (+) Configure the RTC Prescaler (Asynchronous and Synchronous) and RTC hour |
bogdanm | 0:9b334a45a8ff | 24 | format using the HAL_RTC_Init() function. |
bogdanm | 0:9b334a45a8ff | 25 | |
bogdanm | 0:9b334a45a8ff | 26 | *** RTC Wakeup configuration *** |
bogdanm | 0:9b334a45a8ff | 27 | ================================ |
bogdanm | 0:9b334a45a8ff | 28 | [..] |
bogdanm | 0:9b334a45a8ff | 29 | (+) To configure the RTC Wakeup Clock source and Counter use the HAL_RTCEx_SetWakeUpTimer() |
bogdanm | 0:9b334a45a8ff | 30 | function. You can also configure the RTC Wakeup timer with interrupt mode |
bogdanm | 0:9b334a45a8ff | 31 | using the HAL_RTCEx_SetWakeUpTimer_IT() function. |
bogdanm | 0:9b334a45a8ff | 32 | (+) To read the RTC WakeUp Counter register, use the HAL_RTCEx_GetWakeUpTimer() |
bogdanm | 0:9b334a45a8ff | 33 | function. |
bogdanm | 0:9b334a45a8ff | 34 | |
bogdanm | 0:9b334a45a8ff | 35 | *** Outputs configuration *** |
bogdanm | 0:9b334a45a8ff | 36 | ============================= |
bogdanm | 0:9b334a45a8ff | 37 | [..] The RTC has 2 different outputs: |
bogdanm | 0:9b334a45a8ff | 38 | (+) RTC_ALARM: this output is used to manage the RTC Alarm A, Alarm B |
bogdanm | 0:9b334a45a8ff | 39 | and WaKeUp signals. |
bogdanm | 0:9b334a45a8ff | 40 | To output the selected RTC signal, use the HAL_RTC_Init() function. |
bogdanm | 0:9b334a45a8ff | 41 | (+) RTC_CALIB: this output is 512Hz signal or 1Hz. |
bogdanm | 0:9b334a45a8ff | 42 | To enable the RTC_CALIB, use the HAL_RTCEx_SetCalibrationOutPut() function. |
mbed_official | 113:b3775bf36a83 | 43 | (+) Two pins can be used as RTC_ALARM or RTC_CALIB (PC13, PB14) for STM32L05x/6x/7x/8x |
mbed_official | 113:b3775bf36a83 | 44 | and (PA2, PB14) for STM32L03x/4x managed on the RTC_OR register. |
bogdanm | 0:9b334a45a8ff | 45 | (+) When the RTC_CALIB or RTC_ALARM output is selected, the RTC_OUT pin is |
bogdanm | 0:9b334a45a8ff | 46 | automatically configured in output alternate function. |
bogdanm | 0:9b334a45a8ff | 47 | |
bogdanm | 0:9b334a45a8ff | 48 | *** Smooth digital Calibration configuration *** |
bogdanm | 0:9b334a45a8ff | 49 | ================================================ |
bogdanm | 0:9b334a45a8ff | 50 | [..] |
bogdanm | 0:9b334a45a8ff | 51 | (+) Configure the RTC Original Digital Calibration Value and the corresponding |
bogdanm | 0:9b334a45a8ff | 52 | calibration cycle period (32s,16s and 8s) using the HAL_RTCEx_SetSmoothCalib() |
bogdanm | 0:9b334a45a8ff | 53 | function. |
bogdanm | 0:9b334a45a8ff | 54 | |
bogdanm | 0:9b334a45a8ff | 55 | *** TimeStamp configuration *** |
bogdanm | 0:9b334a45a8ff | 56 | =============================== |
bogdanm | 0:9b334a45a8ff | 57 | [..] |
mbed_official | 113:b3775bf36a83 | 58 | (+) Configure the RTC_AF trigger and enable the RTC TimeStamp using the |
mbed_official | 113:b3775bf36a83 | 59 | HAL_RTCEx_SetTimeStamp() function. You can also configure the RTC TimeStamp with |
mbed_official | 113:b3775bf36a83 | 60 | interrupt mode using the HAL_RTCEx_SetTimeStamp_IT() function. |
mbed_official | 113:b3775bf36a83 | 61 | (+) To read the RTC TimeStamp Time and Date register, use the HAL_RTCEx_GetTimeStamp() |
mbed_official | 113:b3775bf36a83 | 62 | function. |
bogdanm | 0:9b334a45a8ff | 63 | |
bogdanm | 0:9b334a45a8ff | 64 | *** Tamper configuration *** |
bogdanm | 0:9b334a45a8ff | 65 | ============================ |
bogdanm | 0:9b334a45a8ff | 66 | [..] |
mbed_official | 113:b3775bf36a83 | 67 | (+) Enable the RTC Tamper and configure the Tamper filter count, trigger Edge |
bogdanm | 0:9b334a45a8ff | 68 | or Level according to the Tamper filter (if equal to 0 Edge else Level) |
bogdanm | 0:9b334a45a8ff | 69 | value, sampling frequency, NoErase, MaskFlag, precharge or discharge and |
mbed_official | 113:b3775bf36a83 | 70 | Pull-UP using the HAL_RTCEx_SetTamper() function. You can configure RTC Tamper |
mbed_official | 113:b3775bf36a83 | 71 | with interrupt mode using HAL_RTCEx_SetTamper_IT() function. |
bogdanm | 0:9b334a45a8ff | 72 | (+) The default configuration of the Tamper erases the backup registers. To avoid |
bogdanm | 0:9b334a45a8ff | 73 | erase, enable the NoErase field on the RTC_TAMPCR register. |
bogdanm | 0:9b334a45a8ff | 74 | |
bogdanm | 0:9b334a45a8ff | 75 | *** Backup Data Registers configuration *** |
bogdanm | 0:9b334a45a8ff | 76 | =========================================== |
bogdanm | 0:9b334a45a8ff | 77 | [..] |
mbed_official | 113:b3775bf36a83 | 78 | (+) To write to the RTC Backup Data registers, use the HAL_RTCEx_BKUPWrite() |
bogdanm | 0:9b334a45a8ff | 79 | function. |
mbed_official | 113:b3775bf36a83 | 80 | (+) To read the RTC Backup Data registers, use the HAL_RTCEx_BKUPRead() |
mbed_official | 113:b3775bf36a83 | 81 | function. |
bogdanm | 0:9b334a45a8ff | 82 | |
bogdanm | 0:9b334a45a8ff | 83 | @endverbatim |
bogdanm | 0:9b334a45a8ff | 84 | ****************************************************************************** |
bogdanm | 0:9b334a45a8ff | 85 | * @attention |
bogdanm | 0:9b334a45a8ff | 86 | * |
mbed_official | 113:b3775bf36a83 | 87 | * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> |
bogdanm | 0:9b334a45a8ff | 88 | * |
bogdanm | 0:9b334a45a8ff | 89 | * Redistribution and use in source and binary forms, with or without modification, |
bogdanm | 0:9b334a45a8ff | 90 | * are permitted provided that the following conditions are met: |
bogdanm | 0:9b334a45a8ff | 91 | * 1. Redistributions of source code must retain the above copyright notice, |
bogdanm | 0:9b334a45a8ff | 92 | * this list of conditions and the following disclaimer. |
bogdanm | 0:9b334a45a8ff | 93 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
bogdanm | 0:9b334a45a8ff | 94 | * this list of conditions and the following disclaimer in the documentation |
bogdanm | 0:9b334a45a8ff | 95 | * and/or other materials provided with the distribution. |
bogdanm | 0:9b334a45a8ff | 96 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
bogdanm | 0:9b334a45a8ff | 97 | * may be used to endorse or promote products derived from this software |
bogdanm | 0:9b334a45a8ff | 98 | * without specific prior written permission. |
bogdanm | 0:9b334a45a8ff | 99 | * |
bogdanm | 0:9b334a45a8ff | 100 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
bogdanm | 0:9b334a45a8ff | 101 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
bogdanm | 0:9b334a45a8ff | 102 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
bogdanm | 0:9b334a45a8ff | 103 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
bogdanm | 0:9b334a45a8ff | 104 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
bogdanm | 0:9b334a45a8ff | 105 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
bogdanm | 0:9b334a45a8ff | 106 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
bogdanm | 0:9b334a45a8ff | 107 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
bogdanm | 0:9b334a45a8ff | 108 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
bogdanm | 0:9b334a45a8ff | 109 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
bogdanm | 0:9b334a45a8ff | 110 | * |
bogdanm | 0:9b334a45a8ff | 111 | ****************************************************************************** |
bogdanm | 0:9b334a45a8ff | 112 | */ |
bogdanm | 0:9b334a45a8ff | 113 | |
bogdanm | 0:9b334a45a8ff | 114 | /* Includes ------------------------------------------------------------------*/ |
bogdanm | 0:9b334a45a8ff | 115 | #include "stm32l0xx_hal.h" |
bogdanm | 0:9b334a45a8ff | 116 | |
bogdanm | 0:9b334a45a8ff | 117 | /** @addtogroup STM32L0xx_HAL_Driver |
bogdanm | 0:9b334a45a8ff | 118 | * @{ |
bogdanm | 0:9b334a45a8ff | 119 | */ |
bogdanm | 0:9b334a45a8ff | 120 | |
bogdanm | 0:9b334a45a8ff | 121 | /** @addtogroup RTCEx |
bogdanm | 0:9b334a45a8ff | 122 | * @brief RTC Extended HAL module driver |
bogdanm | 0:9b334a45a8ff | 123 | * @{ |
bogdanm | 0:9b334a45a8ff | 124 | */ |
bogdanm | 0:9b334a45a8ff | 125 | |
bogdanm | 0:9b334a45a8ff | 126 | #ifdef HAL_RTC_MODULE_ENABLED |
bogdanm | 0:9b334a45a8ff | 127 | |
bogdanm | 0:9b334a45a8ff | 128 | /* Private typedef -----------------------------------------------------------*/ |
bogdanm | 0:9b334a45a8ff | 129 | /* Private define ------------------------------------------------------------*/ |
bogdanm | 0:9b334a45a8ff | 130 | /* Private macro -------------------------------------------------------------*/ |
bogdanm | 0:9b334a45a8ff | 131 | /* Private variables ---------------------------------------------------------*/ |
bogdanm | 0:9b334a45a8ff | 132 | /* Private function prototypes -----------------------------------------------*/ |
bogdanm | 0:9b334a45a8ff | 133 | /* Exported functions --------------------------------------------------------*/ |
bogdanm | 0:9b334a45a8ff | 134 | |
bogdanm | 0:9b334a45a8ff | 135 | /** @addtogroup RTCEx_Exported_Functions |
bogdanm | 0:9b334a45a8ff | 136 | * @{ |
bogdanm | 0:9b334a45a8ff | 137 | */ |
bogdanm | 0:9b334a45a8ff | 138 | |
bogdanm | 0:9b334a45a8ff | 139 | |
bogdanm | 0:9b334a45a8ff | 140 | /** @addtogroup RTCEx_Exported_Functions_Group1 |
bogdanm | 0:9b334a45a8ff | 141 | * @brief RTC TimeStamp and Tamper functions |
bogdanm | 0:9b334a45a8ff | 142 | * |
bogdanm | 0:9b334a45a8ff | 143 | @verbatim |
bogdanm | 0:9b334a45a8ff | 144 | =============================================================================== |
bogdanm | 0:9b334a45a8ff | 145 | ##### RTC TimeStamp and Tamper functions ##### |
bogdanm | 0:9b334a45a8ff | 146 | =============================================================================== |
bogdanm | 0:9b334a45a8ff | 147 | |
mbed_official | 113:b3775bf36a83 | 148 | [..] This section provides functions allowing to configure TimeStamp feature |
bogdanm | 0:9b334a45a8ff | 149 | |
bogdanm | 0:9b334a45a8ff | 150 | @endverbatim |
bogdanm | 0:9b334a45a8ff | 151 | * @{ |
bogdanm | 0:9b334a45a8ff | 152 | */ |
bogdanm | 0:9b334a45a8ff | 153 | |
bogdanm | 0:9b334a45a8ff | 154 | /** |
mbed_official | 113:b3775bf36a83 | 155 | * @brief Set TimeStamp. |
bogdanm | 0:9b334a45a8ff | 156 | * @note This API must be called before enabling the TimeStamp feature. |
bogdanm | 0:9b334a45a8ff | 157 | * @param hrtc: RTC handle |
bogdanm | 0:9b334a45a8ff | 158 | * @param TimeStampEdge: Specifies the pin edge on which the TimeStamp is |
bogdanm | 0:9b334a45a8ff | 159 | * activated. |
bogdanm | 0:9b334a45a8ff | 160 | * This parameter can be one of the following values: |
bogdanm | 0:9b334a45a8ff | 161 | * @arg RTC_TIMESTAMPEDGE_RISING: the Time stamp event occurs on the |
bogdanm | 0:9b334a45a8ff | 162 | * rising edge of the related pin. |
bogdanm | 0:9b334a45a8ff | 163 | * @arg RTC_TIMESTAMPEDGE_FALLING: the Time stamp event occurs on the |
bogdanm | 0:9b334a45a8ff | 164 | * falling edge of the related pin. |
bogdanm | 0:9b334a45a8ff | 165 | * @param RTC_TimeStampPin: specifies the RTC TimeStamp Pin. |
bogdanm | 0:9b334a45a8ff | 166 | * This parameter can be one of the following values: |
mbed_official | 113:b3775bf36a83 | 167 | * @arg RTC_TIMESTAMPPIN_DEFAULT: PC13 is selected as RTC TimeStamp Pin on STM32L05x/6x/7x/8x |
mbed_official | 113:b3775bf36a83 | 168 | * and PA2 on STM32L03x/4x/2x/1x. |
bogdanm | 0:9b334a45a8ff | 169 | * @retval HAL status |
bogdanm | 0:9b334a45a8ff | 170 | */ |
bogdanm | 0:9b334a45a8ff | 171 | HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp(RTC_HandleTypeDef *hrtc, uint32_t TimeStampEdge, uint32_t RTC_TimeStampPin) |
bogdanm | 0:9b334a45a8ff | 172 | { |
bogdanm | 0:9b334a45a8ff | 173 | uint32_t tmpreg = 0; |
bogdanm | 0:9b334a45a8ff | 174 | |
bogdanm | 0:9b334a45a8ff | 175 | /* Check the parameters */ |
bogdanm | 0:9b334a45a8ff | 176 | assert_param(IS_TIMESTAMP_EDGE(TimeStampEdge)); |
bogdanm | 0:9b334a45a8ff | 177 | assert_param(IS_RTC_TIMESTAMP_PIN(RTC_TimeStampPin)); |
bogdanm | 0:9b334a45a8ff | 178 | |
bogdanm | 0:9b334a45a8ff | 179 | /* Process Locked */ |
bogdanm | 0:9b334a45a8ff | 180 | __HAL_LOCK(hrtc); |
bogdanm | 0:9b334a45a8ff | 181 | |
bogdanm | 0:9b334a45a8ff | 182 | hrtc->State = HAL_RTC_STATE_BUSY; |
bogdanm | 0:9b334a45a8ff | 183 | |
bogdanm | 0:9b334a45a8ff | 184 | /* Get the RTC_CR register and clear the bits to be configured */ |
bogdanm | 0:9b334a45a8ff | 185 | tmpreg = (uint32_t)(hrtc->Instance->CR & (uint32_t)~(RTC_CR_TSEDGE | RTC_CR_TSE)); |
bogdanm | 0:9b334a45a8ff | 186 | |
bogdanm | 0:9b334a45a8ff | 187 | tmpreg|= TimeStampEdge; |
bogdanm | 0:9b334a45a8ff | 188 | |
bogdanm | 0:9b334a45a8ff | 189 | /* Disable the write protection for RTC registers */ |
bogdanm | 0:9b334a45a8ff | 190 | __HAL_RTC_WRITEPROTECTION_DISABLE(hrtc); |
bogdanm | 0:9b334a45a8ff | 191 | |
bogdanm | 0:9b334a45a8ff | 192 | /* Configure the Time Stamp TSEDGE and Enable bits */ |
bogdanm | 0:9b334a45a8ff | 193 | hrtc->Instance->CR = (uint32_t)tmpreg; |
bogdanm | 0:9b334a45a8ff | 194 | |
bogdanm | 0:9b334a45a8ff | 195 | __HAL_RTC_TIMESTAMP_ENABLE(hrtc); |
bogdanm | 0:9b334a45a8ff | 196 | |
bogdanm | 0:9b334a45a8ff | 197 | /* Enable the write protection for RTC registers */ |
bogdanm | 0:9b334a45a8ff | 198 | __HAL_RTC_WRITEPROTECTION_ENABLE(hrtc); |
bogdanm | 0:9b334a45a8ff | 199 | |
bogdanm | 0:9b334a45a8ff | 200 | /* Change RTC state */ |
bogdanm | 0:9b334a45a8ff | 201 | hrtc->State = HAL_RTC_STATE_READY; |
bogdanm | 0:9b334a45a8ff | 202 | |
bogdanm | 0:9b334a45a8ff | 203 | /* Process Unlocked */ |
bogdanm | 0:9b334a45a8ff | 204 | __HAL_UNLOCK(hrtc); |
bogdanm | 0:9b334a45a8ff | 205 | |
bogdanm | 0:9b334a45a8ff | 206 | return HAL_OK; |
bogdanm | 0:9b334a45a8ff | 207 | } |
bogdanm | 0:9b334a45a8ff | 208 | |
bogdanm | 0:9b334a45a8ff | 209 | /** |
mbed_official | 113:b3775bf36a83 | 210 | * @brief Set TimeStamp with Interrupt. |
bogdanm | 0:9b334a45a8ff | 211 | * @param hrtc: RTC handle |
bogdanm | 0:9b334a45a8ff | 212 | * @note This API must be called before enabling the TimeStamp feature. |
bogdanm | 0:9b334a45a8ff | 213 | * @param TimeStampEdge: Specifies the pin edge on which the TimeStamp is |
bogdanm | 0:9b334a45a8ff | 214 | * activated. |
bogdanm | 0:9b334a45a8ff | 215 | * This parameter can be one of the following values: |
bogdanm | 0:9b334a45a8ff | 216 | * @arg RTC_TIMESTAMPEDGE_RISING: the Time stamp event occurs on the |
bogdanm | 0:9b334a45a8ff | 217 | * rising edge of the related pin. |
bogdanm | 0:9b334a45a8ff | 218 | * @arg RTC_TIMESTAMPEDGE_FALLING: the Time stamp event occurs on the |
bogdanm | 0:9b334a45a8ff | 219 | * falling edge of the related pin. |
bogdanm | 0:9b334a45a8ff | 220 | * @param RTC_TimeStampPin: Specifies the RTC TimeStamp Pin. |
bogdanm | 0:9b334a45a8ff | 221 | * This parameter can be one of the following values: |
mbed_official | 113:b3775bf36a83 | 222 | * @arg RTC_TIMESTAMPPIN_DEFAULT: PC13 is selected as RTC TimeStamp Pin on STM32L05x/6x/7x/8x |
mbed_official | 113:b3775bf36a83 | 223 | * and PA2 on STM32L03x/4x/2x/1x. |
bogdanm | 0:9b334a45a8ff | 224 | * @retval HAL status |
bogdanm | 0:9b334a45a8ff | 225 | */ |
bogdanm | 0:9b334a45a8ff | 226 | HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp_IT(RTC_HandleTypeDef *hrtc, uint32_t TimeStampEdge, uint32_t RTC_TimeStampPin) |
bogdanm | 0:9b334a45a8ff | 227 | { |
bogdanm | 0:9b334a45a8ff | 228 | uint32_t tmpreg = 0; |
bogdanm | 0:9b334a45a8ff | 229 | |
bogdanm | 0:9b334a45a8ff | 230 | /* Check the parameters */ |
bogdanm | 0:9b334a45a8ff | 231 | assert_param(IS_TIMESTAMP_EDGE(TimeStampEdge)); |
bogdanm | 0:9b334a45a8ff | 232 | assert_param(IS_RTC_TIMESTAMP_PIN(RTC_TimeStampPin)); |
bogdanm | 0:9b334a45a8ff | 233 | |
bogdanm | 0:9b334a45a8ff | 234 | /* Process Locked */ |
bogdanm | 0:9b334a45a8ff | 235 | __HAL_LOCK(hrtc); |
bogdanm | 0:9b334a45a8ff | 236 | |
bogdanm | 0:9b334a45a8ff | 237 | hrtc->State = HAL_RTC_STATE_BUSY; |
bogdanm | 0:9b334a45a8ff | 238 | |
bogdanm | 0:9b334a45a8ff | 239 | /* Get the RTC_CR register and clear the bits to be configured */ |
bogdanm | 0:9b334a45a8ff | 240 | tmpreg = (uint32_t)(hrtc->Instance->CR & (uint32_t)~(RTC_CR_TSEDGE | RTC_CR_TSE)); |
bogdanm | 0:9b334a45a8ff | 241 | |
bogdanm | 0:9b334a45a8ff | 242 | tmpreg |= TimeStampEdge; |
bogdanm | 0:9b334a45a8ff | 243 | |
bogdanm | 0:9b334a45a8ff | 244 | /* Disable the write protection for RTC registers */ |
bogdanm | 0:9b334a45a8ff | 245 | __HAL_RTC_WRITEPROTECTION_DISABLE(hrtc); |
bogdanm | 0:9b334a45a8ff | 246 | |
bogdanm | 0:9b334a45a8ff | 247 | /* Configure the Time Stamp TSEDGE and Enable bits */ |
bogdanm | 0:9b334a45a8ff | 248 | hrtc->Instance->CR = (uint32_t)tmpreg; |
bogdanm | 0:9b334a45a8ff | 249 | |
bogdanm | 0:9b334a45a8ff | 250 | __HAL_RTC_TIMESTAMP_ENABLE(hrtc); |
bogdanm | 0:9b334a45a8ff | 251 | |
bogdanm | 0:9b334a45a8ff | 252 | /* Enable IT timestamp */ |
bogdanm | 0:9b334a45a8ff | 253 | __HAL_RTC_TIMESTAMP_ENABLE_IT(hrtc,RTC_IT_TS); |
bogdanm | 0:9b334a45a8ff | 254 | |
bogdanm | 0:9b334a45a8ff | 255 | /* RTC timestamp Interrupt Configuration: EXTI configuration */ |
bogdanm | 0:9b334a45a8ff | 256 | __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_IT(); |
bogdanm | 0:9b334a45a8ff | 257 | |
bogdanm | 0:9b334a45a8ff | 258 | __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_RISING_EDGE(); |
bogdanm | 0:9b334a45a8ff | 259 | |
bogdanm | 0:9b334a45a8ff | 260 | /* Enable the write protection for RTC registers */ |
bogdanm | 0:9b334a45a8ff | 261 | __HAL_RTC_WRITEPROTECTION_ENABLE(hrtc); |
bogdanm | 0:9b334a45a8ff | 262 | |
bogdanm | 0:9b334a45a8ff | 263 | hrtc->State = HAL_RTC_STATE_READY; |
bogdanm | 0:9b334a45a8ff | 264 | |
bogdanm | 0:9b334a45a8ff | 265 | /* Process Unlocked */ |
bogdanm | 0:9b334a45a8ff | 266 | __HAL_UNLOCK(hrtc); |
bogdanm | 0:9b334a45a8ff | 267 | |
bogdanm | 0:9b334a45a8ff | 268 | return HAL_OK; |
bogdanm | 0:9b334a45a8ff | 269 | } |
bogdanm | 0:9b334a45a8ff | 270 | |
bogdanm | 0:9b334a45a8ff | 271 | /** |
mbed_official | 113:b3775bf36a83 | 272 | * @brief Deactivate TimeStamp. |
bogdanm | 0:9b334a45a8ff | 273 | * @param hrtc: RTC handle |
bogdanm | 0:9b334a45a8ff | 274 | * @retval HAL status |
bogdanm | 0:9b334a45a8ff | 275 | */ |
bogdanm | 0:9b334a45a8ff | 276 | HAL_StatusTypeDef HAL_RTCEx_DeactivateTimeStamp(RTC_HandleTypeDef *hrtc) |
bogdanm | 0:9b334a45a8ff | 277 | { |
bogdanm | 0:9b334a45a8ff | 278 | uint32_t tmpreg = 0; |
bogdanm | 0:9b334a45a8ff | 279 | |
bogdanm | 0:9b334a45a8ff | 280 | /* Process Locked */ |
bogdanm | 0:9b334a45a8ff | 281 | __HAL_LOCK(hrtc); |
bogdanm | 0:9b334a45a8ff | 282 | |
bogdanm | 0:9b334a45a8ff | 283 | hrtc->State = HAL_RTC_STATE_BUSY; |
bogdanm | 0:9b334a45a8ff | 284 | |
bogdanm | 0:9b334a45a8ff | 285 | /* Disable the write protection for RTC registers */ |
bogdanm | 0:9b334a45a8ff | 286 | __HAL_RTC_WRITEPROTECTION_DISABLE(hrtc); |
bogdanm | 0:9b334a45a8ff | 287 | |
bogdanm | 0:9b334a45a8ff | 288 | /* In case of interrupt mode is used, the interrupt source must disabled */ |
bogdanm | 0:9b334a45a8ff | 289 | __HAL_RTC_TIMESTAMP_DISABLE_IT(hrtc, RTC_IT_TS); |
bogdanm | 0:9b334a45a8ff | 290 | |
bogdanm | 0:9b334a45a8ff | 291 | /* Get the RTC_CR register and clear the bits to be configured */ |
bogdanm | 0:9b334a45a8ff | 292 | tmpreg = (uint32_t)(hrtc->Instance->CR & (uint32_t)~(RTC_CR_TSEDGE | RTC_CR_TSE)); |
bogdanm | 0:9b334a45a8ff | 293 | |
bogdanm | 0:9b334a45a8ff | 294 | /* Configure the Time Stamp TSEDGE and Enable bits */ |
bogdanm | 0:9b334a45a8ff | 295 | hrtc->Instance->CR = (uint32_t)tmpreg; |
bogdanm | 0:9b334a45a8ff | 296 | |
bogdanm | 0:9b334a45a8ff | 297 | /* Enable the write protection for RTC registers */ |
bogdanm | 0:9b334a45a8ff | 298 | __HAL_RTC_WRITEPROTECTION_ENABLE(hrtc); |
bogdanm | 0:9b334a45a8ff | 299 | |
bogdanm | 0:9b334a45a8ff | 300 | hrtc->State = HAL_RTC_STATE_READY; |
bogdanm | 0:9b334a45a8ff | 301 | |
bogdanm | 0:9b334a45a8ff | 302 | /* Process Unlocked */ |
bogdanm | 0:9b334a45a8ff | 303 | __HAL_UNLOCK(hrtc); |
bogdanm | 0:9b334a45a8ff | 304 | |
bogdanm | 0:9b334a45a8ff | 305 | return HAL_OK; |
bogdanm | 0:9b334a45a8ff | 306 | } |
bogdanm | 0:9b334a45a8ff | 307 | |
bogdanm | 0:9b334a45a8ff | 308 | /** |
mbed_official | 113:b3775bf36a83 | 309 | * @brief Get the RTC TimeStamp value. |
bogdanm | 0:9b334a45a8ff | 310 | * @param hrtc: RTC handle |
bogdanm | 0:9b334a45a8ff | 311 | |
bogdanm | 0:9b334a45a8ff | 312 | * @param sTimeStamp: Pointer to Time structure |
mbed_official | 113:b3775bf36a83 | 313 | * @param sTimeStampDate: Pointer to Date structure |
bogdanm | 0:9b334a45a8ff | 314 | * @param Format: specifies the format of the entered parameters. |
bogdanm | 0:9b334a45a8ff | 315 | * This parameter can be one of the following values: |
mbed_official | 113:b3775bf36a83 | 316 | * @arg RTC_FORMAT_BIN: Binary data format |
mbed_official | 113:b3775bf36a83 | 317 | * @arg RTC_FORMAT_BCD: BCD data format |
bogdanm | 0:9b334a45a8ff | 318 | * @retval HAL status |
bogdanm | 0:9b334a45a8ff | 319 | */ |
bogdanm | 0:9b334a45a8ff | 320 | HAL_StatusTypeDef HAL_RTCEx_GetTimeStamp(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef* sTimeStamp, RTC_DateTypeDef* sTimeStampDate, uint32_t Format) |
bogdanm | 0:9b334a45a8ff | 321 | { |
bogdanm | 0:9b334a45a8ff | 322 | uint32_t tmptime = 0, tmpdate = 0; |
bogdanm | 0:9b334a45a8ff | 323 | |
bogdanm | 0:9b334a45a8ff | 324 | /* Check the parameters */ |
bogdanm | 0:9b334a45a8ff | 325 | assert_param(IS_RTC_FORMAT(Format)); |
bogdanm | 0:9b334a45a8ff | 326 | |
bogdanm | 0:9b334a45a8ff | 327 | /* Get the TimeStamp time and date registers values */ |
bogdanm | 0:9b334a45a8ff | 328 | tmptime = (uint32_t)(hrtc->Instance->TSTR & RTC_TR_RESERVED_MASK); |
bogdanm | 0:9b334a45a8ff | 329 | tmpdate = (uint32_t)(hrtc->Instance->TSDR & RTC_DR_RESERVED_MASK); |
bogdanm | 0:9b334a45a8ff | 330 | |
bogdanm | 0:9b334a45a8ff | 331 | /* Fill the Time structure fields with the read parameters */ |
bogdanm | 0:9b334a45a8ff | 332 | sTimeStamp->Hours = (uint8_t)((tmptime & (RTC_TR_HT | RTC_TR_HU)) >> 16); |
bogdanm | 0:9b334a45a8ff | 333 | sTimeStamp->Minutes = (uint8_t)((tmptime & (RTC_TR_MNT | RTC_TR_MNU)) >> 8); |
bogdanm | 0:9b334a45a8ff | 334 | sTimeStamp->Seconds = (uint8_t)(tmptime & (RTC_TR_ST | RTC_TR_SU)); |
bogdanm | 0:9b334a45a8ff | 335 | sTimeStamp->TimeFormat = (uint8_t)((tmptime & (RTC_TR_PM)) >> 16); |
bogdanm | 0:9b334a45a8ff | 336 | sTimeStamp->SubSeconds = (uint32_t) hrtc->Instance->TSSSR; |
bogdanm | 0:9b334a45a8ff | 337 | |
bogdanm | 0:9b334a45a8ff | 338 | /* Fill the Date structure fields with the read parameters */ |
bogdanm | 0:9b334a45a8ff | 339 | sTimeStampDate->Year = 0; |
bogdanm | 0:9b334a45a8ff | 340 | sTimeStampDate->Month = (uint8_t)((tmpdate & (RTC_DR_MT | RTC_DR_MU)) >> 8); |
bogdanm | 0:9b334a45a8ff | 341 | sTimeStampDate->Date = (uint8_t)(tmpdate & (RTC_DR_DT | RTC_DR_DU)); |
bogdanm | 0:9b334a45a8ff | 342 | sTimeStampDate->WeekDay = (uint8_t)((tmpdate & (RTC_DR_WDU)) >> 13); |
bogdanm | 0:9b334a45a8ff | 343 | |
bogdanm | 0:9b334a45a8ff | 344 | /* Check the input parameters format */ |
bogdanm | 0:9b334a45a8ff | 345 | if(Format == RTC_FORMAT_BIN) |
bogdanm | 0:9b334a45a8ff | 346 | { |
bogdanm | 0:9b334a45a8ff | 347 | /* Convert the TimeStamp structure parameters to Binary format */ |
bogdanm | 0:9b334a45a8ff | 348 | sTimeStamp->Hours = (uint8_t)RTC_Bcd2ToByte(sTimeStamp->Hours); |
bogdanm | 0:9b334a45a8ff | 349 | sTimeStamp->Minutes = (uint8_t)RTC_Bcd2ToByte(sTimeStamp->Minutes); |
bogdanm | 0:9b334a45a8ff | 350 | sTimeStamp->Seconds = (uint8_t)RTC_Bcd2ToByte(sTimeStamp->Seconds); |
bogdanm | 0:9b334a45a8ff | 351 | |
bogdanm | 0:9b334a45a8ff | 352 | /* Convert the DateTimeStamp structure parameters to Binary format */ |
bogdanm | 0:9b334a45a8ff | 353 | sTimeStampDate->Month = (uint8_t)RTC_Bcd2ToByte(sTimeStampDate->Month); |
bogdanm | 0:9b334a45a8ff | 354 | sTimeStampDate->Date = (uint8_t)RTC_Bcd2ToByte(sTimeStampDate->Date); |
bogdanm | 0:9b334a45a8ff | 355 | sTimeStampDate->WeekDay = (uint8_t)RTC_Bcd2ToByte(sTimeStampDate->WeekDay); |
bogdanm | 0:9b334a45a8ff | 356 | } |
bogdanm | 0:9b334a45a8ff | 357 | |
bogdanm | 0:9b334a45a8ff | 358 | /* Clear the TIMESTAMP Flag */ |
bogdanm | 0:9b334a45a8ff | 359 | __HAL_RTC_TIMESTAMP_CLEAR_FLAG(hrtc, RTC_FLAG_TSF); |
bogdanm | 0:9b334a45a8ff | 360 | |
bogdanm | 0:9b334a45a8ff | 361 | return HAL_OK; |
bogdanm | 0:9b334a45a8ff | 362 | } |
bogdanm | 0:9b334a45a8ff | 363 | |
bogdanm | 0:9b334a45a8ff | 364 | /** |
mbed_official | 113:b3775bf36a83 | 365 | * @brief Set Tamper |
bogdanm | 0:9b334a45a8ff | 366 | * @note By calling this API we disable the tamper interrupt for all tampers. |
bogdanm | 0:9b334a45a8ff | 367 | * @param hrtc: RTC handle |
bogdanm | 0:9b334a45a8ff | 368 | * @param sTamper: Pointer to Tamper Structure. |
bogdanm | 0:9b334a45a8ff | 369 | * @retval HAL status |
bogdanm | 0:9b334a45a8ff | 370 | */ |
bogdanm | 0:9b334a45a8ff | 371 | HAL_StatusTypeDef HAL_RTCEx_SetTamper(RTC_HandleTypeDef *hrtc, RTC_TamperTypeDef* sTamper) |
bogdanm | 0:9b334a45a8ff | 372 | { |
bogdanm | 0:9b334a45a8ff | 373 | uint32_t tmpreg = 0; |
bogdanm | 0:9b334a45a8ff | 374 | |
bogdanm | 0:9b334a45a8ff | 375 | /* Check the parameters */ |
bogdanm | 0:9b334a45a8ff | 376 | assert_param( IS_RTC_TAMPER(sTamper->Tamper)); |
bogdanm | 0:9b334a45a8ff | 377 | assert_param( IS_RTC_TAMPER_TRIGGER(sTamper->Trigger)); |
bogdanm | 0:9b334a45a8ff | 378 | assert_param(IS_RTC_TAMPER_ERASE_MODE(sTamper->NoErase)); |
bogdanm | 0:9b334a45a8ff | 379 | assert_param(IS_RTC_TAMPER_MASKFLAG_STATE(sTamper->MaskFlag)); |
bogdanm | 0:9b334a45a8ff | 380 | assert_param(IS_RTC_TAMPER_FILTER(sTamper->Filter)); |
bogdanm | 0:9b334a45a8ff | 381 | assert_param(IS_RTC_TAMPER_SAMPLING_FREQ(sTamper->SamplingFrequency)); |
bogdanm | 0:9b334a45a8ff | 382 | assert_param(IS_RTC_TAMPER_PRECHARGE_DURATION(sTamper->PrechargeDuration)); |
bogdanm | 0:9b334a45a8ff | 383 | assert_param(IS_RTC_TAMPER_PULLUP_STATE(sTamper->TamperPullUp)); |
bogdanm | 0:9b334a45a8ff | 384 | assert_param(IS_RTC_TAMPER_TIMESTAMPONTAMPER_DETECTION(sTamper->TimeStampOnTamperDetection)); |
bogdanm | 0:9b334a45a8ff | 385 | |
bogdanm | 0:9b334a45a8ff | 386 | /* Process Locked */ |
bogdanm | 0:9b334a45a8ff | 387 | __HAL_LOCK(hrtc); |
bogdanm | 0:9b334a45a8ff | 388 | |
bogdanm | 0:9b334a45a8ff | 389 | hrtc->State = HAL_RTC_STATE_BUSY; |
bogdanm | 0:9b334a45a8ff | 390 | |
bogdanm | 0:9b334a45a8ff | 391 | /* Configure the tamper trigger */ |
bogdanm | 0:9b334a45a8ff | 392 | if(sTamper->Trigger != RTC_TAMPERTRIGGER_RISINGEDGE) |
bogdanm | 0:9b334a45a8ff | 393 | { |
bogdanm | 0:9b334a45a8ff | 394 | sTamper->Trigger = (uint32_t)(sTamper->Tamper << 1); |
bogdanm | 0:9b334a45a8ff | 395 | } |
bogdanm | 0:9b334a45a8ff | 396 | |
bogdanm | 0:9b334a45a8ff | 397 | if(sTamper->NoErase != RTC_TAMPER_ERASE_BACKUP_ENABLE) |
bogdanm | 0:9b334a45a8ff | 398 | { |
bogdanm | 0:9b334a45a8ff | 399 | sTamper->NoErase = 0; |
mbed_official | 113:b3775bf36a83 | 400 | #if defined (STM32L063xx) || defined (STM32L062xx) || defined (STM32L061xx) || \ |
mbed_official | 113:b3775bf36a83 | 401 | defined (STM32L053xx) || defined (STM32L052xx) || defined (STM32L051xx) ||\ |
mbed_official | 113:b3775bf36a83 | 402 | defined (STM32L083xx) || defined (STM32L082xx) || defined (STM32L081xx) || \ |
mbed_official | 113:b3775bf36a83 | 403 | defined (STM32L073xx) || defined (STM32L072xx) || defined (STM32L071xx) || \ |
mbed_official | 113:b3775bf36a83 | 404 | defined (STM32L031xx) || defined (STM32L041xx) |
mbed_official | 113:b3775bf36a83 | 405 | |
bogdanm | 0:9b334a45a8ff | 406 | if((sTamper->Tamper & RTC_TAMPER_1) != 0) |
bogdanm | 0:9b334a45a8ff | 407 | { |
bogdanm | 0:9b334a45a8ff | 408 | sTamper->NoErase |= RTC_TAMPCR_TAMP1NOERASE; |
bogdanm | 0:9b334a45a8ff | 409 | } |
mbed_official | 113:b3775bf36a83 | 410 | #endif /* (STM32L063xx) || (STM32L062xx) || (STM32L061xx) || |
mbed_official | 113:b3775bf36a83 | 411 | * (STM32L053xx) || (STM32L052xx) || (STM32L051xx) || |
mbed_official | 113:b3775bf36a83 | 412 | * (STM32L083xx) || (STM32L082xx) || (STM32L081xx) || |
mbed_official | 113:b3775bf36a83 | 413 | * (STM32L073xx) || (STM32L072xx) || (STM32L071xx) || |
mbed_official | 113:b3775bf36a83 | 414 | * (STM32L031xx) || (STM32L041xx) |
mbed_official | 113:b3775bf36a83 | 415 | */ |
mbed_official | 113:b3775bf36a83 | 416 | |
bogdanm | 0:9b334a45a8ff | 417 | if((sTamper->Tamper & RTC_TAMPER_2) != 0) |
bogdanm | 0:9b334a45a8ff | 418 | { |
bogdanm | 0:9b334a45a8ff | 419 | sTamper->NoErase |= RTC_TAMPCR_TAMP2NOERASE; |
bogdanm | 0:9b334a45a8ff | 420 | } |
bogdanm | 0:9b334a45a8ff | 421 | #if defined (STM32L083xx) || defined (STM32L082xx) || defined (STM32L081xx) || \ |
mbed_official | 113:b3775bf36a83 | 422 | defined (STM32L073xx) || defined (STM32L072xx) || defined (STM32L071xx) || \ |
mbed_official | 113:b3775bf36a83 | 423 | defined (STM32L031xx) || defined (STM32L041xx) || defined (STM32L011xx) || defined (STM32L021xx) |
bogdanm | 0:9b334a45a8ff | 424 | |
bogdanm | 0:9b334a45a8ff | 425 | if((sTamper->Tamper & RTC_TAMPER_3) != 0) |
bogdanm | 0:9b334a45a8ff | 426 | { |
bogdanm | 0:9b334a45a8ff | 427 | sTamper->NoErase |= RTC_TAMPCR_TAMP3NOERASE; |
bogdanm | 0:9b334a45a8ff | 428 | } |
bogdanm | 0:9b334a45a8ff | 429 | |
bogdanm | 0:9b334a45a8ff | 430 | #endif /* (STM32L083xx) || (STM32L082xx) || (STM32L081xx) || |
mbed_official | 113:b3775bf36a83 | 431 | * (STM32L073xx) || (STM32L072xx) || (STM32L071xx) || (STM32L031xx) || (STM32L041xx) || (STM32L011xx) || (STM32L021xx) |
mbed_official | 113:b3775bf36a83 | 432 | */ |
bogdanm | 0:9b334a45a8ff | 433 | } |
bogdanm | 0:9b334a45a8ff | 434 | |
bogdanm | 0:9b334a45a8ff | 435 | if(sTamper->MaskFlag != RTC_TAMPERMASK_FLAG_DISABLE) |
bogdanm | 0:9b334a45a8ff | 436 | { |
bogdanm | 0:9b334a45a8ff | 437 | sTamper->MaskFlag = 0; |
mbed_official | 113:b3775bf36a83 | 438 | |
mbed_official | 113:b3775bf36a83 | 439 | #if defined (STM32L063xx) || defined (STM32L062xx) || defined (STM32L061xx) || \ |
mbed_official | 113:b3775bf36a83 | 440 | defined (STM32L053xx) || defined (STM32L052xx) || defined (STM32L051xx) ||\ |
mbed_official | 113:b3775bf36a83 | 441 | defined (STM32L083xx) || defined (STM32L082xx) || defined (STM32L081xx) || \ |
mbed_official | 113:b3775bf36a83 | 442 | defined (STM32L073xx) || defined (STM32L072xx) || defined (STM32L071xx) || \ |
mbed_official | 113:b3775bf36a83 | 443 | defined (STM32L031xx) || defined (STM32L041xx) |
mbed_official | 113:b3775bf36a83 | 444 | |
bogdanm | 0:9b334a45a8ff | 445 | if((sTamper->Tamper & RTC_TAMPER_1) != 0) |
bogdanm | 0:9b334a45a8ff | 446 | { |
bogdanm | 0:9b334a45a8ff | 447 | sTamper->MaskFlag |= RTC_TAMPCR_TAMP1MF; |
bogdanm | 0:9b334a45a8ff | 448 | } |
mbed_official | 113:b3775bf36a83 | 449 | #endif /* (STM32L063xx) || (STM32L062xx) || (STM32L061xx) || |
mbed_official | 113:b3775bf36a83 | 450 | * (STM32L053xx) || (STM32L052xx) || (STM32L051xx) || |
mbed_official | 113:b3775bf36a83 | 451 | * (STM32L083xx) || (STM32L082xx) || (STM32L081xx) || |
mbed_official | 113:b3775bf36a83 | 452 | * (STM32L073xx) || (STM32L072xx) || (STM32L071xx) || |
mbed_official | 113:b3775bf36a83 | 453 | * (STM32L031xx) || (STM32L041xx) |
mbed_official | 113:b3775bf36a83 | 454 | */ |
mbed_official | 113:b3775bf36a83 | 455 | |
bogdanm | 0:9b334a45a8ff | 456 | if((sTamper->Tamper & RTC_TAMPER_2) != 0) |
bogdanm | 0:9b334a45a8ff | 457 | { |
bogdanm | 0:9b334a45a8ff | 458 | sTamper->MaskFlag |= RTC_TAMPCR_TAMP2MF; |
bogdanm | 0:9b334a45a8ff | 459 | } |
bogdanm | 0:9b334a45a8ff | 460 | #if defined (STM32L083xx) || defined (STM32L082xx) || defined (STM32L081xx) || \ |
mbed_official | 113:b3775bf36a83 | 461 | defined (STM32L073xx) || defined (STM32L072xx) || defined (STM32L071xx) || \ |
mbed_official | 113:b3775bf36a83 | 462 | defined (STM32L031xx) || defined (STM32L041xx) || defined (STM32L011xx) || defined (STM32L021xx) |
bogdanm | 0:9b334a45a8ff | 463 | |
bogdanm | 0:9b334a45a8ff | 464 | if((sTamper->Tamper & RTC_TAMPER_3) != 0) |
bogdanm | 0:9b334a45a8ff | 465 | { |
bogdanm | 0:9b334a45a8ff | 466 | sTamper->MaskFlag |= RTC_TAMPCR_TAMP3MF; |
bogdanm | 0:9b334a45a8ff | 467 | } |
mbed_official | 113:b3775bf36a83 | 468 | #endif /* (STM32L083xx) || (STM32L082xx) || (STM32L081xx) || |
mbed_official | 113:b3775bf36a83 | 469 | * (STM32L073xx) || (STM32L072xx) || (STM32L071xx) || (STM32L031xx) || (STM32L041xx)|| (STM32L011xx) || (STM32L021xx) |
mbed_official | 113:b3775bf36a83 | 470 | */ |
bogdanm | 0:9b334a45a8ff | 471 | } |
bogdanm | 0:9b334a45a8ff | 472 | |
bogdanm | 0:9b334a45a8ff | 473 | /* Configure the RTC_TAMPCR register */ |
bogdanm | 0:9b334a45a8ff | 474 | tmpreg = (uint32_t)((uint32_t)sTamper->Tamper | (uint32_t)sTamper->Trigger | (uint32_t)sTamper->NoErase |\ |
bogdanm | 0:9b334a45a8ff | 475 | (uint32_t)sTamper->MaskFlag | (uint32_t)sTamper->Filter | (uint32_t)sTamper->SamplingFrequency |\ |
bogdanm | 0:9b334a45a8ff | 476 | (uint32_t)sTamper->PrechargeDuration | (uint32_t)sTamper->TamperPullUp | (uint32_t)sTamper->TimeStampOnTamperDetection); |
bogdanm | 0:9b334a45a8ff | 477 | |
bogdanm | 0:9b334a45a8ff | 478 | #if defined (STM32L063xx) || defined (STM32L062xx) || defined (STM32L061xx) || \ |
bogdanm | 0:9b334a45a8ff | 479 | defined (STM32L053xx) || defined (STM32L052xx) || defined (STM32L051xx) |
bogdanm | 0:9b334a45a8ff | 480 | hrtc->Instance->TAMPCR &= ((uint32_t)~((uint32_t)sTamper->Tamper | (uint32_t)(sTamper->Tamper << 1) | RTC_TAMPCR_TAMPTS |\ |
bogdanm | 0:9b334a45a8ff | 481 | RTC_TAMPCR_TAMPFREQ | RTC_TAMPCR_TAMPFLT | RTC_TAMPCR_TAMPPRCH |\ |
bogdanm | 0:9b334a45a8ff | 482 | RTC_TAMPCR_TAMPPUDIS | RTC_TAMPCR_TAMPIE | RTC_TAMPCR_TAMP1IE |\ |
bogdanm | 0:9b334a45a8ff | 483 | RTC_TAMPCR_TAMP2IE | RTC_TAMPCR_TAMP1NOERASE | RTC_TAMPCR_TAMP2NOERASE|\ |
bogdanm | 0:9b334a45a8ff | 484 | RTC_TAMPCR_TAMP1MF | RTC_TAMPCR_TAMP2MF)); |
bogdanm | 0:9b334a45a8ff | 485 | |
mbed_official | 113:b3775bf36a83 | 486 | #elif defined (STM32L083xx) || defined (STM32L082xx) || defined (STM32L081xx) || \ |
mbed_official | 113:b3775bf36a83 | 487 | defined (STM32L073xx) || defined (STM32L072xx) || defined (STM32L071xx) || \ |
mbed_official | 113:b3775bf36a83 | 488 | defined (STM32L031xx) || defined (STM32L041xx) |
bogdanm | 0:9b334a45a8ff | 489 | hrtc->Instance->TAMPCR &= ((uint32_t)~((uint32_t)sTamper->Tamper | (uint32_t)(sTamper->Tamper << 1) | RTC_TAMPCR_TAMPTS |\ |
bogdanm | 0:9b334a45a8ff | 490 | RTC_TAMPCR_TAMPFREQ | RTC_TAMPCR_TAMPFLT | RTC_TAMPCR_TAMPPRCH |\ |
bogdanm | 0:9b334a45a8ff | 491 | RTC_TAMPCR_TAMPPUDIS | RTC_TAMPCR_TAMPIE | RTC_TAMPCR_TAMP1IE |\ |
bogdanm | 0:9b334a45a8ff | 492 | RTC_TAMPCR_TAMP2IE | RTC_TAMPCR_TAMP3IE | RTC_TAMPCR_TAMP1NOERASE |\ |
bogdanm | 0:9b334a45a8ff | 493 | RTC_TAMPCR_TAMP2NOERASE | RTC_TAMPCR_TAMP3NOERASE | RTC_TAMPCR_TAMP1MF |\ |
bogdanm | 0:9b334a45a8ff | 494 | RTC_TAMPCR_TAMP2MF | RTC_TAMPCR_TAMP3MF)); |
mbed_official | 113:b3775bf36a83 | 495 | |
mbed_official | 113:b3775bf36a83 | 496 | #elif defined (STM32L011xx) || defined (STM32L021xx) |
mbed_official | 113:b3775bf36a83 | 497 | hrtc->Instance->TAMPCR &= ((uint32_t)~((uint32_t)sTamper->Tamper | (uint32_t)(sTamper->Tamper << 1) | RTC_TAMPCR_TAMPTS |\ |
mbed_official | 113:b3775bf36a83 | 498 | RTC_TAMPCR_TAMPFREQ | RTC_TAMPCR_TAMPFLT | RTC_TAMPCR_TAMPPRCH |\ |
mbed_official | 113:b3775bf36a83 | 499 | RTC_TAMPCR_TAMPPUDIS | RTC_TAMPCR_TAMPIE |\ |
mbed_official | 113:b3775bf36a83 | 500 | RTC_TAMPCR_TAMP2IE | RTC_TAMPCR_TAMP3IE |\ |
mbed_official | 113:b3775bf36a83 | 501 | RTC_TAMPCR_TAMP2NOERASE | RTC_TAMPCR_TAMP3NOERASE |\ |
mbed_official | 113:b3775bf36a83 | 502 | RTC_TAMPCR_TAMP2MF | RTC_TAMPCR_TAMP3MF)); |
mbed_official | 113:b3775bf36a83 | 503 | |
mbed_official | 113:b3775bf36a83 | 504 | #endif /* (STM32L011xx) || (STM32L021xx) |
mbed_official | 113:b3775bf36a83 | 505 | */ |
mbed_official | 113:b3775bf36a83 | 506 | |
bogdanm | 0:9b334a45a8ff | 507 | hrtc->Instance->TAMPCR |= tmpreg; |
bogdanm | 0:9b334a45a8ff | 508 | |
bogdanm | 0:9b334a45a8ff | 509 | hrtc->State = HAL_RTC_STATE_READY; |
bogdanm | 0:9b334a45a8ff | 510 | |
bogdanm | 0:9b334a45a8ff | 511 | /* Process Unlocked */ |
bogdanm | 0:9b334a45a8ff | 512 | __HAL_UNLOCK(hrtc); |
bogdanm | 0:9b334a45a8ff | 513 | |
bogdanm | 0:9b334a45a8ff | 514 | return HAL_OK; |
bogdanm | 0:9b334a45a8ff | 515 | } |
bogdanm | 0:9b334a45a8ff | 516 | |
bogdanm | 0:9b334a45a8ff | 517 | /** |
mbed_official | 113:b3775bf36a83 | 518 | * @brief Set Tamper with interrupt. |
bogdanm | 0:9b334a45a8ff | 519 | * @note By calling this API we force the tamper interrupt for all tampers. |
bogdanm | 0:9b334a45a8ff | 520 | * @param hrtc: RTC handle |
bogdanm | 0:9b334a45a8ff | 521 | * @param sTamper: Pointer to RTC Tamper. |
bogdanm | 0:9b334a45a8ff | 522 | * @retval HAL status |
bogdanm | 0:9b334a45a8ff | 523 | */ |
bogdanm | 0:9b334a45a8ff | 524 | HAL_StatusTypeDef HAL_RTCEx_SetTamper_IT(RTC_HandleTypeDef *hrtc, RTC_TamperTypeDef* sTamper) |
bogdanm | 0:9b334a45a8ff | 525 | { |
bogdanm | 0:9b334a45a8ff | 526 | uint32_t tmpreg = 0; |
bogdanm | 0:9b334a45a8ff | 527 | |
bogdanm | 0:9b334a45a8ff | 528 | /* Check the parameters */ |
bogdanm | 0:9b334a45a8ff | 529 | assert_param( IS_RTC_TAMPER(sTamper->Tamper)); |
bogdanm | 0:9b334a45a8ff | 530 | assert_param(IS_RTC_TAMPER_INTERRUPT(sTamper->Interrupt)); |
bogdanm | 0:9b334a45a8ff | 531 | assert_param( IS_RTC_TAMPER_TRIGGER(sTamper->Trigger)); |
bogdanm | 0:9b334a45a8ff | 532 | assert_param(IS_RTC_TAMPER_ERASE_MODE(sTamper->NoErase)); |
bogdanm | 0:9b334a45a8ff | 533 | assert_param(IS_RTC_TAMPER_MASKFLAG_STATE(sTamper->MaskFlag)); |
bogdanm | 0:9b334a45a8ff | 534 | assert_param(IS_RTC_TAMPER_FILTER(sTamper->Filter)); |
bogdanm | 0:9b334a45a8ff | 535 | assert_param(IS_RTC_TAMPER_SAMPLING_FREQ(sTamper->SamplingFrequency)); |
bogdanm | 0:9b334a45a8ff | 536 | assert_param(IS_RTC_TAMPER_PRECHARGE_DURATION(sTamper->PrechargeDuration)); |
bogdanm | 0:9b334a45a8ff | 537 | assert_param(IS_RTC_TAMPER_PULLUP_STATE(sTamper->TamperPullUp)); |
bogdanm | 0:9b334a45a8ff | 538 | assert_param(IS_RTC_TAMPER_TIMESTAMPONTAMPER_DETECTION(sTamper->TimeStampOnTamperDetection)); |
bogdanm | 0:9b334a45a8ff | 539 | |
bogdanm | 0:9b334a45a8ff | 540 | /* Process Locked */ |
bogdanm | 0:9b334a45a8ff | 541 | __HAL_LOCK(hrtc); |
bogdanm | 0:9b334a45a8ff | 542 | |
bogdanm | 0:9b334a45a8ff | 543 | hrtc->State = HAL_RTC_STATE_BUSY; |
bogdanm | 0:9b334a45a8ff | 544 | |
bogdanm | 0:9b334a45a8ff | 545 | /* Configure the tamper trigger */ |
bogdanm | 0:9b334a45a8ff | 546 | if(sTamper->Trigger != RTC_TAMPERTRIGGER_RISINGEDGE) |
bogdanm | 0:9b334a45a8ff | 547 | { |
bogdanm | 0:9b334a45a8ff | 548 | sTamper->Trigger = (uint32_t)(sTamper->Tamper << 1); |
bogdanm | 0:9b334a45a8ff | 549 | } |
bogdanm | 0:9b334a45a8ff | 550 | |
bogdanm | 0:9b334a45a8ff | 551 | if(sTamper->NoErase != RTC_TAMPER_ERASE_BACKUP_ENABLE) |
bogdanm | 0:9b334a45a8ff | 552 | { |
bogdanm | 0:9b334a45a8ff | 553 | sTamper->NoErase = 0; |
mbed_official | 113:b3775bf36a83 | 554 | |
mbed_official | 113:b3775bf36a83 | 555 | #if defined (STM32L063xx) || defined (STM32L062xx) || defined (STM32L061xx) || \ |
mbed_official | 113:b3775bf36a83 | 556 | defined (STM32L053xx) || defined (STM32L052xx) || defined (STM32L051xx) ||\ |
mbed_official | 113:b3775bf36a83 | 557 | defined (STM32L083xx) || defined (STM32L082xx) || defined (STM32L081xx) || \ |
mbed_official | 113:b3775bf36a83 | 558 | defined (STM32L073xx) || defined (STM32L072xx) || defined (STM32L071xx) || \ |
mbed_official | 113:b3775bf36a83 | 559 | defined (STM32L031xx) || defined (STM32L041xx) |
mbed_official | 113:b3775bf36a83 | 560 | |
bogdanm | 0:9b334a45a8ff | 561 | if((sTamper->Tamper & RTC_TAMPER_1) != 0) |
bogdanm | 0:9b334a45a8ff | 562 | { |
bogdanm | 0:9b334a45a8ff | 563 | sTamper->NoErase |= RTC_TAMPCR_TAMP1NOERASE; |
bogdanm | 0:9b334a45a8ff | 564 | } |
mbed_official | 113:b3775bf36a83 | 565 | #endif /* (STM32L063xx) || (STM32L062xx) || (STM32L061xx) || |
mbed_official | 113:b3775bf36a83 | 566 | * (STM32L053xx) || (STM32L052xx) || (STM32L051xx) || |
mbed_official | 113:b3775bf36a83 | 567 | * (STM32L083xx) || (STM32L082xx) || (STM32L081xx) || |
mbed_official | 113:b3775bf36a83 | 568 | * (STM32L073xx) || (STM32L072xx) || (STM32L071xx) || |
mbed_official | 113:b3775bf36a83 | 569 | * (STM32L031xx) || (STM32L041xx) |
mbed_official | 113:b3775bf36a83 | 570 | */ |
mbed_official | 113:b3775bf36a83 | 571 | |
mbed_official | 113:b3775bf36a83 | 572 | |
bogdanm | 0:9b334a45a8ff | 573 | if((sTamper->Tamper & RTC_TAMPER_2) != 0) |
bogdanm | 0:9b334a45a8ff | 574 | { |
bogdanm | 0:9b334a45a8ff | 575 | sTamper->NoErase |= RTC_TAMPCR_TAMP2NOERASE; |
bogdanm | 0:9b334a45a8ff | 576 | } |
bogdanm | 0:9b334a45a8ff | 577 | #if defined (STM32L083xx) || defined (STM32L082xx) || defined (STM32L081xx) || \ |
mbed_official | 113:b3775bf36a83 | 578 | defined (STM32L073xx) || defined (STM32L072xx) || defined (STM32L071xx) || \ |
mbed_official | 113:b3775bf36a83 | 579 | defined (STM32L031xx) || defined (STM32L041xx) || defined (STM32L011xx) || defined (STM32L021xx) |
bogdanm | 0:9b334a45a8ff | 580 | |
bogdanm | 0:9b334a45a8ff | 581 | if((sTamper->Tamper & RTC_TAMPER_3) != 0) |
bogdanm | 0:9b334a45a8ff | 582 | { |
bogdanm | 0:9b334a45a8ff | 583 | sTamper->NoErase |= RTC_TAMPCR_TAMP3NOERASE; |
bogdanm | 0:9b334a45a8ff | 584 | } |
bogdanm | 0:9b334a45a8ff | 585 | #endif /* (STM32L083xx) || (STM32L082xx) || (STM32L081xx) || |
mbed_official | 113:b3775bf36a83 | 586 | * (STM32L073xx) || (STM32L072xx) || (STM32L071xx) || (STM32L031xx) || (STM32L041xx) || (STM32L011xx) || (STM32L021xx) |
mbed_official | 113:b3775bf36a83 | 587 | */ |
bogdanm | 0:9b334a45a8ff | 588 | } |
bogdanm | 0:9b334a45a8ff | 589 | |
bogdanm | 0:9b334a45a8ff | 590 | if(sTamper->MaskFlag != RTC_TAMPERMASK_FLAG_DISABLE) |
bogdanm | 0:9b334a45a8ff | 591 | { |
bogdanm | 0:9b334a45a8ff | 592 | sTamper->MaskFlag = 0; |
mbed_official | 113:b3775bf36a83 | 593 | |
mbed_official | 113:b3775bf36a83 | 594 | #if defined (STM32L063xx) || defined (STM32L062xx) || defined (STM32L061xx) || \ |
mbed_official | 113:b3775bf36a83 | 595 | defined (STM32L053xx) || defined (STM32L052xx) || defined (STM32L051xx) ||\ |
mbed_official | 113:b3775bf36a83 | 596 | defined (STM32L083xx) || defined (STM32L082xx) || defined (STM32L081xx) || \ |
mbed_official | 113:b3775bf36a83 | 597 | defined (STM32L073xx) || defined (STM32L072xx) || defined (STM32L071xx) || \ |
mbed_official | 113:b3775bf36a83 | 598 | defined (STM32L031xx) || defined (STM32L041xx) |
bogdanm | 0:9b334a45a8ff | 599 | if((sTamper->Tamper & RTC_TAMPER_1) != 0) |
bogdanm | 0:9b334a45a8ff | 600 | { |
bogdanm | 0:9b334a45a8ff | 601 | sTamper->MaskFlag |= RTC_TAMPCR_TAMP1MF; |
bogdanm | 0:9b334a45a8ff | 602 | } |
mbed_official | 113:b3775bf36a83 | 603 | #endif /* (STM32L063xx) || (STM32L062xx) || (STM32L061xx) || |
mbed_official | 113:b3775bf36a83 | 604 | * (STM32L053xx) || (STM32L052xx) || (STM32L051xx) || |
mbed_official | 113:b3775bf36a83 | 605 | * (STM32L083xx) || (STM32L082xx) || (STM32L081xx) || |
mbed_official | 113:b3775bf36a83 | 606 | * (STM32L073xx) || (STM32L072xx) || (STM32L071xx) || |
mbed_official | 113:b3775bf36a83 | 607 | * (STM32L031xx) || (STM32L041xx) |
mbed_official | 113:b3775bf36a83 | 608 | */ |
mbed_official | 113:b3775bf36a83 | 609 | |
bogdanm | 0:9b334a45a8ff | 610 | if((sTamper->Tamper & RTC_TAMPER_2) != 0) |
bogdanm | 0:9b334a45a8ff | 611 | { |
bogdanm | 0:9b334a45a8ff | 612 | sTamper->MaskFlag |= RTC_TAMPCR_TAMP2MF; |
bogdanm | 0:9b334a45a8ff | 613 | } |
bogdanm | 0:9b334a45a8ff | 614 | #if defined (STM32L083xx) || defined (STM32L082xx) || defined (STM32L081xx) || \ |
mbed_official | 113:b3775bf36a83 | 615 | defined (STM32L073xx) || defined (STM32L072xx) || defined (STM32L071xx) || \ |
mbed_official | 113:b3775bf36a83 | 616 | defined (STM32L031xx) || defined (STM32L041xx) || defined (STM32L011xx) || defined (STM32L021xx) |
bogdanm | 0:9b334a45a8ff | 617 | |
bogdanm | 0:9b334a45a8ff | 618 | if((sTamper->Tamper & RTC_TAMPER_3) != 0) |
bogdanm | 0:9b334a45a8ff | 619 | { |
bogdanm | 0:9b334a45a8ff | 620 | sTamper->MaskFlag |= RTC_TAMPCR_TAMP3MF; |
bogdanm | 0:9b334a45a8ff | 621 | } |
bogdanm | 0:9b334a45a8ff | 622 | #endif /* (STM32L083xx) || (STM32L082xx) || (STM32L081xx) || |
mbed_official | 113:b3775bf36a83 | 623 | * (STM32L073xx) || (STM32L072xx) || (STM32L071xx) || (STM32L031xx) || (STM32L041xx) || (STM32L011xx) || (STM32L021xx) |
mbed_official | 113:b3775bf36a83 | 624 | */ |
bogdanm | 0:9b334a45a8ff | 625 | } |
bogdanm | 0:9b334a45a8ff | 626 | |
bogdanm | 0:9b334a45a8ff | 627 | /* Configure the RTC_TAMPCR register */ |
bogdanm | 0:9b334a45a8ff | 628 | tmpreg = (uint32_t)((uint32_t)sTamper->Tamper | (uint32_t)sTamper->Interrupt | (uint32_t)sTamper->Trigger | (uint32_t)sTamper->NoErase |\ |
bogdanm | 0:9b334a45a8ff | 629 | (uint32_t)sTamper->MaskFlag | (uint32_t)sTamper->Filter | (uint32_t)sTamper->SamplingFrequency |\ |
bogdanm | 0:9b334a45a8ff | 630 | (uint32_t)sTamper->PrechargeDuration | (uint32_t)sTamper->TamperPullUp | (uint32_t)sTamper->TimeStampOnTamperDetection); |
bogdanm | 0:9b334a45a8ff | 631 | |
bogdanm | 0:9b334a45a8ff | 632 | #if defined (STM32L063xx) || defined (STM32L062xx) || defined (STM32L061xx) || \ |
bogdanm | 0:9b334a45a8ff | 633 | defined (STM32L053xx) || defined (STM32L052xx) || defined (STM32L051xx) |
bogdanm | 0:9b334a45a8ff | 634 | hrtc->Instance->TAMPCR &= (uint32_t)~((uint32_t)sTamper->Tamper | (uint32_t)(sTamper->Tamper << 1) | RTC_TAMPCR_TAMPTS |\ |
bogdanm | 0:9b334a45a8ff | 635 | RTC_TAMPCR_TAMPFREQ | RTC_TAMPCR_TAMPFLT | RTC_TAMPCR_TAMPPRCH |\ |
bogdanm | 0:9b334a45a8ff | 636 | RTC_TAMPCR_TAMPPUDIS | RTC_TAMPCR_TAMPIE | RTC_TAMPCR_TAMP1IE |\ |
bogdanm | 0:9b334a45a8ff | 637 | RTC_TAMPCR_TAMP2IE | RTC_TAMPCR_TAMP1NOERASE | RTC_TAMPCR_TAMP2NOERASE |\ |
bogdanm | 0:9b334a45a8ff | 638 | RTC_TAMPCR_TAMP1MF | RTC_TAMPCR_TAMP2MF); |
bogdanm | 0:9b334a45a8ff | 639 | |
mbed_official | 113:b3775bf36a83 | 640 | #elif defined (STM32L083xx) || defined (STM32L082xx) || defined (STM32L081xx) || \ |
mbed_official | 113:b3775bf36a83 | 641 | defined (STM32L073xx) || defined (STM32L072xx) || defined (STM32L071xx) || \ |
mbed_official | 113:b3775bf36a83 | 642 | defined (STM32L031xx) || defined (STM32L041xx) |
bogdanm | 0:9b334a45a8ff | 643 | hrtc->Instance->TAMPCR &= (uint32_t)~((uint32_t)sTamper->Tamper | (uint32_t)(sTamper->Tamper << 1) | RTC_TAMPCR_TAMPTS |\ |
bogdanm | 0:9b334a45a8ff | 644 | RTC_TAMPCR_TAMPFREQ | RTC_TAMPCR_TAMPFLT | RTC_TAMPCR_TAMPPRCH |\ |
bogdanm | 0:9b334a45a8ff | 645 | RTC_TAMPCR_TAMPPUDIS | RTC_TAMPCR_TAMPIE | RTC_TAMPCR_TAMP1IE |\ |
bogdanm | 0:9b334a45a8ff | 646 | RTC_TAMPCR_TAMP2IE | RTC_TAMPCR_TAMP3IE | RTC_TAMPCR_TAMP1NOERASE |\ |
bogdanm | 0:9b334a45a8ff | 647 | RTC_TAMPCR_TAMP2NOERASE | RTC_TAMPCR_TAMP3NOERASE | RTC_TAMPCR_TAMP1MF |\ |
bogdanm | 0:9b334a45a8ff | 648 | RTC_TAMPCR_TAMP2MF | RTC_TAMPCR_TAMP3MF); |
bogdanm | 0:9b334a45a8ff | 649 | |
mbed_official | 113:b3775bf36a83 | 650 | #elif defined (STM32L011xx) || defined (STM32L021xx) |
mbed_official | 113:b3775bf36a83 | 651 | hrtc->Instance->TAMPCR &= (uint32_t)~((uint32_t)sTamper->Tamper | (uint32_t)(sTamper->Tamper << 1) | RTC_TAMPCR_TAMPTS |\ |
mbed_official | 113:b3775bf36a83 | 652 | RTC_TAMPCR_TAMPFREQ | RTC_TAMPCR_TAMPFLT | RTC_TAMPCR_TAMPPRCH |\ |
mbed_official | 113:b3775bf36a83 | 653 | RTC_TAMPCR_TAMPPUDIS | RTC_TAMPCR_TAMPIE |\ |
mbed_official | 113:b3775bf36a83 | 654 | RTC_TAMPCR_TAMP2IE | RTC_TAMPCR_TAMP3IE |\ |
mbed_official | 113:b3775bf36a83 | 655 | RTC_TAMPCR_TAMP2NOERASE | RTC_TAMPCR_TAMP3NOERASE |\ |
mbed_official | 113:b3775bf36a83 | 656 | RTC_TAMPCR_TAMP2MF | RTC_TAMPCR_TAMP3MF); |
mbed_official | 113:b3775bf36a83 | 657 | |
mbed_official | 113:b3775bf36a83 | 658 | #endif /* (STM32L011xx) || (STM32L021xx) |
mbed_official | 113:b3775bf36a83 | 659 | */ |
bogdanm | 0:9b334a45a8ff | 660 | |
bogdanm | 0:9b334a45a8ff | 661 | hrtc->Instance->TAMPCR |= tmpreg; |
bogdanm | 0:9b334a45a8ff | 662 | |
bogdanm | 0:9b334a45a8ff | 663 | /* RTC Tamper Interrupt Configuration: EXTI configuration */ |
bogdanm | 0:9b334a45a8ff | 664 | __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_IT(); |
bogdanm | 0:9b334a45a8ff | 665 | |
bogdanm | 0:9b334a45a8ff | 666 | __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_RISING_EDGE(); |
bogdanm | 0:9b334a45a8ff | 667 | |
bogdanm | 0:9b334a45a8ff | 668 | hrtc->State = HAL_RTC_STATE_READY; |
bogdanm | 0:9b334a45a8ff | 669 | |
bogdanm | 0:9b334a45a8ff | 670 | /* Process Unlocked */ |
bogdanm | 0:9b334a45a8ff | 671 | __HAL_UNLOCK(hrtc); |
bogdanm | 0:9b334a45a8ff | 672 | |
bogdanm | 0:9b334a45a8ff | 673 | return HAL_OK; |
bogdanm | 0:9b334a45a8ff | 674 | } |
bogdanm | 0:9b334a45a8ff | 675 | |
bogdanm | 0:9b334a45a8ff | 676 | /** |
mbed_official | 113:b3775bf36a83 | 677 | * @brief Deactivate Tamper. |
bogdanm | 0:9b334a45a8ff | 678 | * @param hrtc: RTC handle |
bogdanm | 0:9b334a45a8ff | 679 | * @param Tamper: Selected tamper pin. |
mbed_official | 113:b3775bf36a83 | 680 | * This parameter can be RTC_Tamper_1 and/or RTC_TAMPER_2 for STM32L05x/6x. |
mbed_official | 113:b3775bf36a83 | 681 | * This parameter can be any combination of RTC_TAMPER_1, RTC_TAMPER_2 and RTC_TAMPER_3 for STM32L01x/2x/3x/7x/8x. |
bogdanm | 0:9b334a45a8ff | 682 | * @retval HAL status |
bogdanm | 0:9b334a45a8ff | 683 | */ |
bogdanm | 0:9b334a45a8ff | 684 | HAL_StatusTypeDef HAL_RTCEx_DeactivateTamper(RTC_HandleTypeDef *hrtc, uint32_t Tamper) |
bogdanm | 0:9b334a45a8ff | 685 | { |
bogdanm | 0:9b334a45a8ff | 686 | assert_param( IS_RTC_TAMPER(Tamper)); |
bogdanm | 0:9b334a45a8ff | 687 | |
bogdanm | 0:9b334a45a8ff | 688 | /* Process Locked */ |
bogdanm | 0:9b334a45a8ff | 689 | __HAL_LOCK(hrtc); |
bogdanm | 0:9b334a45a8ff | 690 | |
bogdanm | 0:9b334a45a8ff | 691 | hrtc->State = HAL_RTC_STATE_BUSY; |
bogdanm | 0:9b334a45a8ff | 692 | |
bogdanm | 0:9b334a45a8ff | 693 | /* Disable the selected Tamper pin */ |
bogdanm | 0:9b334a45a8ff | 694 | hrtc->Instance->TAMPCR &= ((uint32_t)~Tamper); |
mbed_official | 113:b3775bf36a83 | 695 | |
mbed_official | 113:b3775bf36a83 | 696 | #if defined (STM32L063xx) || defined (STM32L062xx) || defined (STM32L061xx) || \ |
mbed_official | 113:b3775bf36a83 | 697 | defined (STM32L053xx) || defined (STM32L052xx) || defined (STM32L051xx) ||\ |
mbed_official | 113:b3775bf36a83 | 698 | defined (STM32L083xx) || defined (STM32L082xx) || defined (STM32L081xx) || \ |
mbed_official | 113:b3775bf36a83 | 699 | defined (STM32L073xx) || defined (STM32L072xx) || defined (STM32L071xx) || \ |
mbed_official | 113:b3775bf36a83 | 700 | defined (STM32L031xx) || defined (STM32L041xx) |
bogdanm | 0:9b334a45a8ff | 701 | if ((Tamper & RTC_TAMPER_1) != 0) |
bogdanm | 0:9b334a45a8ff | 702 | { |
bogdanm | 0:9b334a45a8ff | 703 | /* Disable the Tamper1 interrupt */ |
bogdanm | 0:9b334a45a8ff | 704 | hrtc->Instance->TAMPCR &= ((uint32_t)~(RTC_IT_TAMP | RTC_IT_TAMP1)); |
bogdanm | 0:9b334a45a8ff | 705 | } |
mbed_official | 113:b3775bf36a83 | 706 | |
mbed_official | 113:b3775bf36a83 | 707 | #endif /* (STM32L063xx) || (STM32L062xx) || (STM32L061xx) || |
mbed_official | 113:b3775bf36a83 | 708 | * (STM32L053xx) || (STM32L052xx) || (STM32L051xx) || |
mbed_official | 113:b3775bf36a83 | 709 | * (STM32L083xx) || (STM32L082xx) || (STM32L081xx) || |
mbed_official | 113:b3775bf36a83 | 710 | * (STM32L073xx) || (STM32L072xx) || (STM32L071xx) || |
mbed_official | 113:b3775bf36a83 | 711 | * (STM32L031xx) || (STM32L041xx) |
mbed_official | 113:b3775bf36a83 | 712 | */ |
mbed_official | 113:b3775bf36a83 | 713 | |
bogdanm | 0:9b334a45a8ff | 714 | if ((Tamper & RTC_TAMPER_2) != 0) |
bogdanm | 0:9b334a45a8ff | 715 | { |
bogdanm | 0:9b334a45a8ff | 716 | /* Disable the Tamper2 interrupt */ |
bogdanm | 0:9b334a45a8ff | 717 | hrtc->Instance->TAMPCR &= ((uint32_t)~(RTC_IT_TAMP | RTC_IT_TAMP2)); |
bogdanm | 0:9b334a45a8ff | 718 | } |
bogdanm | 0:9b334a45a8ff | 719 | |
bogdanm | 0:9b334a45a8ff | 720 | #if defined (STM32L083xx) || defined (STM32L082xx) || defined (STM32L081xx) || \ |
mbed_official | 113:b3775bf36a83 | 721 | defined (STM32L073xx) || defined (STM32L072xx) || defined (STM32L071xx) || \ |
mbed_official | 113:b3775bf36a83 | 722 | defined (STM32L031xx) || defined (STM32L041xx) || defined (STM32L011xx) || defined (STM32L021xx) |
bogdanm | 0:9b334a45a8ff | 723 | |
bogdanm | 0:9b334a45a8ff | 724 | if ((Tamper & RTC_TAMPER_3) != 0) |
bogdanm | 0:9b334a45a8ff | 725 | { |
mbed_official | 113:b3775bf36a83 | 726 | /* Disable the Tamper3 interrupt */ |
bogdanm | 0:9b334a45a8ff | 727 | hrtc->Instance->TAMPCR &= ((uint32_t)~(RTC_IT_TAMP | RTC_IT_TAMP3)); |
bogdanm | 0:9b334a45a8ff | 728 | } |
bogdanm | 0:9b334a45a8ff | 729 | |
bogdanm | 0:9b334a45a8ff | 730 | #endif /* (STM32L083xx) || (STM32L082xx) || (STM32L081xx) || |
mbed_official | 113:b3775bf36a83 | 731 | * (STM32L073xx) || (STM32L072xx) || (STM32L071xx) || (STM32L031xx) || (STM32L041xx) || (STM32L011xx) || (STM32L021xx) |
bogdanm | 0:9b334a45a8ff | 732 | */ |
bogdanm | 0:9b334a45a8ff | 733 | |
bogdanm | 0:9b334a45a8ff | 734 | hrtc->State = HAL_RTC_STATE_READY; |
bogdanm | 0:9b334a45a8ff | 735 | |
bogdanm | 0:9b334a45a8ff | 736 | /* Process Unlocked */ |
bogdanm | 0:9b334a45a8ff | 737 | __HAL_UNLOCK(hrtc); |
bogdanm | 0:9b334a45a8ff | 738 | |
bogdanm | 0:9b334a45a8ff | 739 | return HAL_OK; |
bogdanm | 0:9b334a45a8ff | 740 | } |
bogdanm | 0:9b334a45a8ff | 741 | |
bogdanm | 0:9b334a45a8ff | 742 | /** |
mbed_official | 113:b3775bf36a83 | 743 | * @brief Handle TimeStamp interrupt request. |
bogdanm | 0:9b334a45a8ff | 744 | * @param hrtc: RTC handle |
bogdanm | 0:9b334a45a8ff | 745 | * @retval None |
bogdanm | 0:9b334a45a8ff | 746 | */ |
bogdanm | 0:9b334a45a8ff | 747 | void HAL_RTCEx_TamperTimeStampIRQHandler(RTC_HandleTypeDef *hrtc) |
mbed_official | 113:b3775bf36a83 | 748 | { |
mbed_official | 113:b3775bf36a83 | 749 | /* Get the TimeStamp interrupt source enable status */ |
mbed_official | 113:b3775bf36a83 | 750 | if(__HAL_RTC_TIMESTAMP_GET_IT_SOURCE(hrtc, RTC_IT_TS) != RESET) |
bogdanm | 0:9b334a45a8ff | 751 | { |
mbed_official | 113:b3775bf36a83 | 752 | /* Get the pending status of the TIMESTAMP Interrupt */ |
mbed_official | 113:b3775bf36a83 | 753 | if(__HAL_RTC_TIMESTAMP_GET_FLAG(hrtc, RTC_FLAG_TSF) != RESET) |
bogdanm | 0:9b334a45a8ff | 754 | { |
mbed_official | 113:b3775bf36a83 | 755 | /* TIMESTAMP callback */ |
bogdanm | 0:9b334a45a8ff | 756 | HAL_RTCEx_TimeStampEventCallback(hrtc); |
mbed_official | 113:b3775bf36a83 | 757 | |
bogdanm | 0:9b334a45a8ff | 758 | /* Clear the TIMESTAMP interrupt pending bit */ |
mbed_official | 113:b3775bf36a83 | 759 | __HAL_RTC_TIMESTAMP_CLEAR_FLAG(hrtc, RTC_FLAG_TSF); |
bogdanm | 0:9b334a45a8ff | 760 | } |
bogdanm | 0:9b334a45a8ff | 761 | } |
bogdanm | 0:9b334a45a8ff | 762 | |
mbed_official | 113:b3775bf36a83 | 763 | #if defined (STM32L063xx) || defined (STM32L062xx) || defined (STM32L061xx) || \ |
mbed_official | 113:b3775bf36a83 | 764 | defined (STM32L053xx) || defined (STM32L052xx) || defined (STM32L051xx) ||\ |
mbed_official | 113:b3775bf36a83 | 765 | defined (STM32L083xx) || defined (STM32L082xx) || defined (STM32L081xx) || \ |
mbed_official | 113:b3775bf36a83 | 766 | defined (STM32L073xx) || defined (STM32L072xx) || defined (STM32L071xx) || \ |
mbed_official | 113:b3775bf36a83 | 767 | defined (STM32L031xx) || defined (STM32L041xx) |
mbed_official | 113:b3775bf36a83 | 768 | |
mbed_official | 113:b3775bf36a83 | 769 | /* Get the Tamper1 interrupts source enable status */ |
mbed_official | 113:b3775bf36a83 | 770 | if(__HAL_RTC_TAMPER_GET_IT_SOURCE(hrtc, RTC_IT_TAMP | RTC_IT_TAMP1) != RESET) |
bogdanm | 0:9b334a45a8ff | 771 | { |
mbed_official | 113:b3775bf36a83 | 772 | /* Get the pending status of the Tamper1 Interrupt */ |
mbed_official | 113:b3775bf36a83 | 773 | if(__HAL_RTC_TAMPER_GET_FLAG(hrtc, RTC_FLAG_TAMP1F) != RESET) |
bogdanm | 0:9b334a45a8ff | 774 | { |
mbed_official | 113:b3775bf36a83 | 775 | /* Tamper1 callback */ |
bogdanm | 0:9b334a45a8ff | 776 | HAL_RTCEx_Tamper1EventCallback(hrtc); |
bogdanm | 0:9b334a45a8ff | 777 | |
mbed_official | 113:b3775bf36a83 | 778 | /* Clear the Tamper1 interrupt pending bit */ |
mbed_official | 113:b3775bf36a83 | 779 | __HAL_RTC_TAMPER_CLEAR_FLAG(hrtc, RTC_FLAG_TAMP1F); |
bogdanm | 0:9b334a45a8ff | 780 | } |
bogdanm | 0:9b334a45a8ff | 781 | } |
mbed_official | 113:b3775bf36a83 | 782 | #endif /* (STM32L063xx) || (STM32L062xx) || (STM32L061xx) || |
mbed_official | 113:b3775bf36a83 | 783 | * (STM32L053xx) || (STM32L052xx) || (STM32L051xx) || |
mbed_official | 113:b3775bf36a83 | 784 | * (STM32L083xx) || (STM32L082xx) || (STM32L081xx) || |
mbed_official | 113:b3775bf36a83 | 785 | * (STM32L073xx) || (STM32L072xx) || (STM32L071xx) || |
mbed_official | 113:b3775bf36a83 | 786 | * (STM32L031xx) || (STM32L041xx) |
mbed_official | 113:b3775bf36a83 | 787 | */ |
bogdanm | 0:9b334a45a8ff | 788 | |
mbed_official | 113:b3775bf36a83 | 789 | /* Get the Tamper2 interrupts source enable status */ |
mbed_official | 113:b3775bf36a83 | 790 | if(__HAL_RTC_TAMPER_GET_IT_SOURCE(hrtc, RTC_IT_TAMP | RTC_IT_TAMP2) != RESET) |
bogdanm | 0:9b334a45a8ff | 791 | { |
mbed_official | 113:b3775bf36a83 | 792 | /* Get the pending status of the Tamper2 Interrupt */ |
mbed_official | 113:b3775bf36a83 | 793 | if(__HAL_RTC_TAMPER_GET_FLAG(hrtc, RTC_FLAG_TAMP2F) != RESET) |
bogdanm | 0:9b334a45a8ff | 794 | { |
mbed_official | 113:b3775bf36a83 | 795 | /* Tamper2 callback */ |
bogdanm | 0:9b334a45a8ff | 796 | HAL_RTCEx_Tamper2EventCallback(hrtc); |
bogdanm | 0:9b334a45a8ff | 797 | |
mbed_official | 113:b3775bf36a83 | 798 | /* Clear the Tamper2 interrupt pending bit */ |
bogdanm | 0:9b334a45a8ff | 799 | __HAL_RTC_TAMPER_CLEAR_FLAG(hrtc, RTC_FLAG_TAMP2F); |
bogdanm | 0:9b334a45a8ff | 800 | } |
bogdanm | 0:9b334a45a8ff | 801 | } |
bogdanm | 0:9b334a45a8ff | 802 | |
bogdanm | 0:9b334a45a8ff | 803 | #if defined (STM32L083xx) || defined (STM32L082xx) || defined (STM32L081xx) || \ |
mbed_official | 113:b3775bf36a83 | 804 | defined (STM32L073xx) || defined (STM32L072xx) || defined (STM32L071xx) || \ |
mbed_official | 113:b3775bf36a83 | 805 | defined (STM32L031xx) || defined (STM32L041xx) || defined (STM32L011xx) || defined (STM32L021xx) |
bogdanm | 0:9b334a45a8ff | 806 | |
mbed_official | 113:b3775bf36a83 | 807 | /* Get the Tamper3 interrupts source enable status */ |
mbed_official | 113:b3775bf36a83 | 808 | if(__HAL_RTC_TAMPER_GET_IT_SOURCE(hrtc, RTC_IT_TAMP | RTC_IT_TAMP3) != RESET) |
bogdanm | 0:9b334a45a8ff | 809 | { |
mbed_official | 113:b3775bf36a83 | 810 | /* Get the pending status of the Tamper3 Interrupt */ |
mbed_official | 113:b3775bf36a83 | 811 | if(__HAL_RTC_TAMPER_GET_FLAG(hrtc, RTC_FLAG_TAMP3F) != RESET) |
bogdanm | 0:9b334a45a8ff | 812 | { |
mbed_official | 113:b3775bf36a83 | 813 | /* Tamper3 callback */ |
bogdanm | 0:9b334a45a8ff | 814 | HAL_RTCEx_Tamper3EventCallback(hrtc); |
bogdanm | 0:9b334a45a8ff | 815 | |
mbed_official | 113:b3775bf36a83 | 816 | /* Clear the Tamper3 interrupt pending bit */ |
bogdanm | 0:9b334a45a8ff | 817 | __HAL_RTC_TAMPER_CLEAR_FLAG(hrtc, RTC_FLAG_TAMP3F); |
bogdanm | 0:9b334a45a8ff | 818 | } |
bogdanm | 0:9b334a45a8ff | 819 | } |
bogdanm | 0:9b334a45a8ff | 820 | |
bogdanm | 0:9b334a45a8ff | 821 | #endif /* (STM32L083xx) || (STM32L082xx) || (STM32L081xx) || |
mbed_official | 113:b3775bf36a83 | 822 | * (STM32L073xx) || (STM32L072xx) || (STM32L071xx) || (STM32L031xx) || (STM32L041xx) || |
mbed_official | 113:b3775bf36a83 | 823 | * (STM32L011xx) || (STM32L021xx) |
mbed_official | 113:b3775bf36a83 | 824 | */ |
bogdanm | 0:9b334a45a8ff | 825 | |
bogdanm | 0:9b334a45a8ff | 826 | /* Clear the EXTI's Flag for RTC TimeStamp and Tamper */ |
bogdanm | 0:9b334a45a8ff | 827 | __HAL_RTC_TAMPER_TIMESTAMP_EXTI_CLEAR_FLAG(); |
bogdanm | 0:9b334a45a8ff | 828 | |
bogdanm | 0:9b334a45a8ff | 829 | /* Change RTC state */ |
bogdanm | 0:9b334a45a8ff | 830 | hrtc->State = HAL_RTC_STATE_READY; |
bogdanm | 0:9b334a45a8ff | 831 | } |
bogdanm | 0:9b334a45a8ff | 832 | |
bogdanm | 0:9b334a45a8ff | 833 | /** |
bogdanm | 0:9b334a45a8ff | 834 | * @brief TimeStamp callback. |
bogdanm | 0:9b334a45a8ff | 835 | * @param hrtc: RTC handle |
bogdanm | 0:9b334a45a8ff | 836 | * @retval None |
bogdanm | 0:9b334a45a8ff | 837 | */ |
bogdanm | 0:9b334a45a8ff | 838 | __weak void HAL_RTCEx_TimeStampEventCallback(RTC_HandleTypeDef *hrtc) |
bogdanm | 0:9b334a45a8ff | 839 | { |
mbed_official | 113:b3775bf36a83 | 840 | /* Prevent unused argument(s) compilation warning */ |
mbed_official | 113:b3775bf36a83 | 841 | UNUSED(hrtc); |
mbed_official | 113:b3775bf36a83 | 842 | |
mbed_official | 113:b3775bf36a83 | 843 | /* NOTE : This function should not be modified, when the callback is needed, |
bogdanm | 0:9b334a45a8ff | 844 | the HAL_RTCEx_TimeStampEventCallback could be implemented in the user file |
bogdanm | 0:9b334a45a8ff | 845 | */ |
bogdanm | 0:9b334a45a8ff | 846 | } |
bogdanm | 0:9b334a45a8ff | 847 | |
bogdanm | 0:9b334a45a8ff | 848 | /** |
bogdanm | 0:9b334a45a8ff | 849 | * @brief Tamper 1 callback. |
bogdanm | 0:9b334a45a8ff | 850 | * @param hrtc: RTC handle |
bogdanm | 0:9b334a45a8ff | 851 | * @retval None |
bogdanm | 0:9b334a45a8ff | 852 | */ |
bogdanm | 0:9b334a45a8ff | 853 | __weak void HAL_RTCEx_Tamper1EventCallback(RTC_HandleTypeDef *hrtc) |
bogdanm | 0:9b334a45a8ff | 854 | { |
mbed_official | 113:b3775bf36a83 | 855 | /* Prevent unused argument(s) compilation warning */ |
mbed_official | 113:b3775bf36a83 | 856 | UNUSED(hrtc); |
mbed_official | 113:b3775bf36a83 | 857 | |
mbed_official | 113:b3775bf36a83 | 858 | /* NOTE : This function should not be modified, when the callback is needed, |
bogdanm | 0:9b334a45a8ff | 859 | the HAL_RTCEx_Tamper1EventCallback could be implemented in the user file |
bogdanm | 0:9b334a45a8ff | 860 | */ |
bogdanm | 0:9b334a45a8ff | 861 | } |
bogdanm | 0:9b334a45a8ff | 862 | |
bogdanm | 0:9b334a45a8ff | 863 | /** |
bogdanm | 0:9b334a45a8ff | 864 | * @brief Tamper 2 callback. |
bogdanm | 0:9b334a45a8ff | 865 | * @param hrtc: RTC handle |
bogdanm | 0:9b334a45a8ff | 866 | * @retval None |
bogdanm | 0:9b334a45a8ff | 867 | */ |
bogdanm | 0:9b334a45a8ff | 868 | __weak void HAL_RTCEx_Tamper2EventCallback(RTC_HandleTypeDef *hrtc) |
bogdanm | 0:9b334a45a8ff | 869 | { |
mbed_official | 113:b3775bf36a83 | 870 | /* Prevent unused argument(s) compilation warning */ |
mbed_official | 113:b3775bf36a83 | 871 | UNUSED(hrtc); |
mbed_official | 113:b3775bf36a83 | 872 | |
mbed_official | 113:b3775bf36a83 | 873 | /* NOTE : This function should not be modified, when the callback is needed, |
bogdanm | 0:9b334a45a8ff | 874 | the HAL_RTCEx_Tamper2EventCallback could be implemented in the user file |
bogdanm | 0:9b334a45a8ff | 875 | */ |
bogdanm | 0:9b334a45a8ff | 876 | } |
bogdanm | 0:9b334a45a8ff | 877 | |
bogdanm | 0:9b334a45a8ff | 878 | |
bogdanm | 0:9b334a45a8ff | 879 | #if defined (STM32L083xx) || defined (STM32L082xx) || defined (STM32L081xx) || \ |
mbed_official | 113:b3775bf36a83 | 880 | defined (STM32L073xx) || defined (STM32L072xx) || defined (STM32L071xx) || \ |
mbed_official | 113:b3775bf36a83 | 881 | defined (STM32L031xx) || defined (STM32L041xx) || defined (STM32L011xx) || defined (STM32L021xx) |
bogdanm | 0:9b334a45a8ff | 882 | |
bogdanm | 0:9b334a45a8ff | 883 | /** |
bogdanm | 0:9b334a45a8ff | 884 | * @brief Tamper 3 callback. |
bogdanm | 0:9b334a45a8ff | 885 | * @param hrtc: RTC handle |
bogdanm | 0:9b334a45a8ff | 886 | * @retval None |
bogdanm | 0:9b334a45a8ff | 887 | */ |
bogdanm | 0:9b334a45a8ff | 888 | __weak void HAL_RTCEx_Tamper3EventCallback(RTC_HandleTypeDef *hrtc) |
bogdanm | 0:9b334a45a8ff | 889 | { |
mbed_official | 113:b3775bf36a83 | 890 | /* Prevent unused argument(s) compilation warning */ |
mbed_official | 113:b3775bf36a83 | 891 | UNUSED(hrtc); |
mbed_official | 113:b3775bf36a83 | 892 | |
mbed_official | 113:b3775bf36a83 | 893 | /* NOTE : This function should not be modified, when the callback is needed, |
bogdanm | 0:9b334a45a8ff | 894 | the HAL_RTCEx_Tamper3EventCallback could be implemented in the user file |
bogdanm | 0:9b334a45a8ff | 895 | */ |
bogdanm | 0:9b334a45a8ff | 896 | } |
bogdanm | 0:9b334a45a8ff | 897 | |
bogdanm | 0:9b334a45a8ff | 898 | #endif /* (STM32L083xx) || (STM32L082xx) || (STM32L081xx) || |
mbed_official | 113:b3775bf36a83 | 899 | * (STM32L073xx) || (STM32L072xx) || (STM32L071xx) || (STM32L031xx) || (STM32L041xx) || (STM32L011xx) || (STM32L021xx) |
bogdanm | 0:9b334a45a8ff | 900 | */ |
bogdanm | 0:9b334a45a8ff | 901 | |
bogdanm | 0:9b334a45a8ff | 902 | |
bogdanm | 0:9b334a45a8ff | 903 | /** |
mbed_official | 113:b3775bf36a83 | 904 | * @brief Handle TimeStamp polling request. |
bogdanm | 0:9b334a45a8ff | 905 | * @param hrtc: RTC handle |
bogdanm | 0:9b334a45a8ff | 906 | * @param Timeout: Timeout duration |
bogdanm | 0:9b334a45a8ff | 907 | * @retval HAL status |
bogdanm | 0:9b334a45a8ff | 908 | */ |
bogdanm | 0:9b334a45a8ff | 909 | HAL_StatusTypeDef HAL_RTCEx_PollForTimeStampEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout) |
bogdanm | 0:9b334a45a8ff | 910 | { |
bogdanm | 0:9b334a45a8ff | 911 | uint32_t tickstart = HAL_GetTick(); |
bogdanm | 0:9b334a45a8ff | 912 | |
bogdanm | 0:9b334a45a8ff | 913 | while(__HAL_RTC_TIMESTAMP_GET_FLAG(hrtc, RTC_FLAG_TSF) == RESET) |
bogdanm | 0:9b334a45a8ff | 914 | { |
bogdanm | 0:9b334a45a8ff | 915 | if(__HAL_RTC_TIMESTAMP_GET_FLAG(hrtc, RTC_FLAG_TSOVF) != RESET) |
bogdanm | 0:9b334a45a8ff | 916 | { |
bogdanm | 0:9b334a45a8ff | 917 | /* Clear the TIMESTAMP OverRun Flag */ |
bogdanm | 0:9b334a45a8ff | 918 | __HAL_RTC_TIMESTAMP_CLEAR_FLAG(hrtc, RTC_FLAG_TSOVF); |
bogdanm | 0:9b334a45a8ff | 919 | |
bogdanm | 0:9b334a45a8ff | 920 | /* Change TIMESTAMP state */ |
bogdanm | 0:9b334a45a8ff | 921 | hrtc->State = HAL_RTC_STATE_ERROR; |
bogdanm | 0:9b334a45a8ff | 922 | |
bogdanm | 0:9b334a45a8ff | 923 | return HAL_ERROR; |
bogdanm | 0:9b334a45a8ff | 924 | } |
bogdanm | 0:9b334a45a8ff | 925 | |
bogdanm | 0:9b334a45a8ff | 926 | if(Timeout != HAL_MAX_DELAY) |
bogdanm | 0:9b334a45a8ff | 927 | { |
bogdanm | 0:9b334a45a8ff | 928 | if((Timeout == 0)||((HAL_GetTick() - tickstart ) > Timeout)) |
bogdanm | 0:9b334a45a8ff | 929 | { |
bogdanm | 0:9b334a45a8ff | 930 | hrtc->State = HAL_RTC_STATE_TIMEOUT; |
bogdanm | 0:9b334a45a8ff | 931 | return HAL_TIMEOUT; |
bogdanm | 0:9b334a45a8ff | 932 | } |
bogdanm | 0:9b334a45a8ff | 933 | } |
bogdanm | 0:9b334a45a8ff | 934 | } |
bogdanm | 0:9b334a45a8ff | 935 | |
bogdanm | 0:9b334a45a8ff | 936 | /* Change RTC state */ |
bogdanm | 0:9b334a45a8ff | 937 | hrtc->State = HAL_RTC_STATE_READY; |
bogdanm | 0:9b334a45a8ff | 938 | |
bogdanm | 0:9b334a45a8ff | 939 | return HAL_OK; |
bogdanm | 0:9b334a45a8ff | 940 | } |
bogdanm | 0:9b334a45a8ff | 941 | |
mbed_official | 113:b3775bf36a83 | 942 | #if defined (STM32L063xx) || defined (STM32L062xx) || defined (STM32L061xx) || \ |
mbed_official | 113:b3775bf36a83 | 943 | defined (STM32L053xx) || defined (STM32L052xx) || defined (STM32L051xx) ||\ |
mbed_official | 113:b3775bf36a83 | 944 | defined (STM32L083xx) || defined (STM32L082xx) || defined (STM32L081xx) || \ |
mbed_official | 113:b3775bf36a83 | 945 | defined (STM32L073xx) || defined (STM32L072xx) || defined (STM32L071xx) || \ |
mbed_official | 113:b3775bf36a83 | 946 | defined (STM32L031xx) || defined (STM32L041xx) |
bogdanm | 0:9b334a45a8ff | 947 | /** |
mbed_official | 113:b3775bf36a83 | 948 | * @brief Handle Tamper 1 Polling. |
bogdanm | 0:9b334a45a8ff | 949 | * @param hrtc: RTC handle |
bogdanm | 0:9b334a45a8ff | 950 | * @param Timeout: Timeout duration |
bogdanm | 0:9b334a45a8ff | 951 | * @retval HAL status |
bogdanm | 0:9b334a45a8ff | 952 | */ |
bogdanm | 0:9b334a45a8ff | 953 | HAL_StatusTypeDef HAL_RTCEx_PollForTamper1Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout) |
bogdanm | 0:9b334a45a8ff | 954 | { |
bogdanm | 0:9b334a45a8ff | 955 | uint32_t tickstart = HAL_GetTick(); |
bogdanm | 0:9b334a45a8ff | 956 | |
bogdanm | 0:9b334a45a8ff | 957 | /* Get the status of the Interrupt */ |
bogdanm | 0:9b334a45a8ff | 958 | while(__HAL_RTC_TAMPER_GET_FLAG(hrtc, RTC_FLAG_TAMP1F)== RESET) |
bogdanm | 0:9b334a45a8ff | 959 | { |
bogdanm | 0:9b334a45a8ff | 960 | if(Timeout != HAL_MAX_DELAY) |
bogdanm | 0:9b334a45a8ff | 961 | { |
bogdanm | 0:9b334a45a8ff | 962 | if((Timeout == 0)||((HAL_GetTick() - tickstart ) > Timeout)) |
bogdanm | 0:9b334a45a8ff | 963 | { |
bogdanm | 0:9b334a45a8ff | 964 | hrtc->State = HAL_RTC_STATE_TIMEOUT; |
bogdanm | 0:9b334a45a8ff | 965 | return HAL_TIMEOUT; |
bogdanm | 0:9b334a45a8ff | 966 | } |
bogdanm | 0:9b334a45a8ff | 967 | } |
bogdanm | 0:9b334a45a8ff | 968 | } |
bogdanm | 0:9b334a45a8ff | 969 | |
bogdanm | 0:9b334a45a8ff | 970 | /* Clear the Tamper Flag */ |
bogdanm | 0:9b334a45a8ff | 971 | __HAL_RTC_TAMPER_CLEAR_FLAG(hrtc,RTC_FLAG_TAMP1F); |
bogdanm | 0:9b334a45a8ff | 972 | |
bogdanm | 0:9b334a45a8ff | 973 | /* Change RTC state */ |
bogdanm | 0:9b334a45a8ff | 974 | hrtc->State = HAL_RTC_STATE_READY; |
bogdanm | 0:9b334a45a8ff | 975 | |
bogdanm | 0:9b334a45a8ff | 976 | return HAL_OK; |
bogdanm | 0:9b334a45a8ff | 977 | } |
mbed_official | 113:b3775bf36a83 | 978 | #endif /* (STM32L063xx) || (STM32L062xx) || (STM32L061xx) || |
mbed_official | 113:b3775bf36a83 | 979 | * (STM32L053xx) || (STM32L052xx) || (STM32L051xx) || |
mbed_official | 113:b3775bf36a83 | 980 | * (STM32L083xx) || (STM32L082xx) || (STM32L081xx) || |
mbed_official | 113:b3775bf36a83 | 981 | * (STM32L073xx) || (STM32L072xx) || (STM32L071xx) || |
mbed_official | 113:b3775bf36a83 | 982 | * (STM32L031xx) || (STM32L041xx) |
mbed_official | 113:b3775bf36a83 | 983 | */ |
bogdanm | 0:9b334a45a8ff | 984 | |
bogdanm | 0:9b334a45a8ff | 985 | /** |
mbed_official | 113:b3775bf36a83 | 986 | * @brief Handle Tamper 2 Polling. |
bogdanm | 0:9b334a45a8ff | 987 | * @param hrtc: RTC handle |
bogdanm | 0:9b334a45a8ff | 988 | * @param Timeout: Timeout duration |
bogdanm | 0:9b334a45a8ff | 989 | * @retval HAL status |
bogdanm | 0:9b334a45a8ff | 990 | */ |
bogdanm | 0:9b334a45a8ff | 991 | HAL_StatusTypeDef HAL_RTCEx_PollForTamper2Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout) |
bogdanm | 0:9b334a45a8ff | 992 | { |
bogdanm | 0:9b334a45a8ff | 993 | uint32_t tickstart = HAL_GetTick(); |
bogdanm | 0:9b334a45a8ff | 994 | |
bogdanm | 0:9b334a45a8ff | 995 | /* Get the status of the Interrupt */ |
bogdanm | 0:9b334a45a8ff | 996 | while(__HAL_RTC_TAMPER_GET_FLAG(hrtc, RTC_FLAG_TAMP2F) == RESET) |
bogdanm | 0:9b334a45a8ff | 997 | { |
bogdanm | 0:9b334a45a8ff | 998 | if(Timeout != HAL_MAX_DELAY) |
bogdanm | 0:9b334a45a8ff | 999 | { |
bogdanm | 0:9b334a45a8ff | 1000 | if((Timeout == 0)||((HAL_GetTick() - tickstart ) > Timeout)) |
bogdanm | 0:9b334a45a8ff | 1001 | { |
bogdanm | 0:9b334a45a8ff | 1002 | hrtc->State = HAL_RTC_STATE_TIMEOUT; |
bogdanm | 0:9b334a45a8ff | 1003 | return HAL_TIMEOUT; |
bogdanm | 0:9b334a45a8ff | 1004 | } |
bogdanm | 0:9b334a45a8ff | 1005 | } |
bogdanm | 0:9b334a45a8ff | 1006 | } |
bogdanm | 0:9b334a45a8ff | 1007 | |
bogdanm | 0:9b334a45a8ff | 1008 | /* Clear the Tamper Flag */ |
bogdanm | 0:9b334a45a8ff | 1009 | __HAL_RTC_TAMPER_CLEAR_FLAG(hrtc,RTC_FLAG_TAMP2F); |
bogdanm | 0:9b334a45a8ff | 1010 | |
bogdanm | 0:9b334a45a8ff | 1011 | /* Change RTC state */ |
bogdanm | 0:9b334a45a8ff | 1012 | hrtc->State = HAL_RTC_STATE_READY; |
bogdanm | 0:9b334a45a8ff | 1013 | |
bogdanm | 0:9b334a45a8ff | 1014 | return HAL_OK; |
bogdanm | 0:9b334a45a8ff | 1015 | } |
bogdanm | 0:9b334a45a8ff | 1016 | |
bogdanm | 0:9b334a45a8ff | 1017 | |
bogdanm | 0:9b334a45a8ff | 1018 | #if defined (STM32L083xx) || defined (STM32L082xx) || defined (STM32L081xx) || \ |
mbed_official | 113:b3775bf36a83 | 1019 | defined (STM32L073xx) || defined (STM32L072xx) || defined (STM32L071xx) || \ |
mbed_official | 113:b3775bf36a83 | 1020 | defined (STM32L031xx) || defined (STM32L041xx) || defined (STM32L011xx) || defined (STM32L021xx) |
bogdanm | 0:9b334a45a8ff | 1021 | |
bogdanm | 0:9b334a45a8ff | 1022 | /** |
mbed_official | 113:b3775bf36a83 | 1023 | * @brief Handle Tamper 3 Polling. |
bogdanm | 0:9b334a45a8ff | 1024 | * @param hrtc: RTC handle |
bogdanm | 0:9b334a45a8ff | 1025 | * @param Timeout: Timeout duration |
bogdanm | 0:9b334a45a8ff | 1026 | * @retval HAL status |
bogdanm | 0:9b334a45a8ff | 1027 | */ |
bogdanm | 0:9b334a45a8ff | 1028 | HAL_StatusTypeDef HAL_RTCEx_PollForTamper3Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout) |
bogdanm | 0:9b334a45a8ff | 1029 | { |
bogdanm | 0:9b334a45a8ff | 1030 | uint32_t tickstart = HAL_GetTick(); |
bogdanm | 0:9b334a45a8ff | 1031 | |
bogdanm | 0:9b334a45a8ff | 1032 | /* Get the status of the Interrupt */ |
bogdanm | 0:9b334a45a8ff | 1033 | while(__HAL_RTC_TAMPER_GET_FLAG(hrtc,RTC_FLAG_TAMP3F) == RESET) |
bogdanm | 0:9b334a45a8ff | 1034 | { |
bogdanm | 0:9b334a45a8ff | 1035 | if(Timeout != HAL_MAX_DELAY) |
bogdanm | 0:9b334a45a8ff | 1036 | { |
bogdanm | 0:9b334a45a8ff | 1037 | if((Timeout == 0) || ((HAL_GetTick()-tickstart) > Timeout)) |
bogdanm | 0:9b334a45a8ff | 1038 | { |
bogdanm | 0:9b334a45a8ff | 1039 | hrtc->State = HAL_RTC_STATE_TIMEOUT; |
bogdanm | 0:9b334a45a8ff | 1040 | return HAL_TIMEOUT; |
bogdanm | 0:9b334a45a8ff | 1041 | } |
bogdanm | 0:9b334a45a8ff | 1042 | } |
bogdanm | 0:9b334a45a8ff | 1043 | } |
bogdanm | 0:9b334a45a8ff | 1044 | |
bogdanm | 0:9b334a45a8ff | 1045 | /* Clear the Tamper Flag */ |
bogdanm | 0:9b334a45a8ff | 1046 | __HAL_RTC_TAMPER_CLEAR_FLAG(hrtc,RTC_FLAG_TAMP3F); |
bogdanm | 0:9b334a45a8ff | 1047 | |
bogdanm | 0:9b334a45a8ff | 1048 | /* Change RTC state */ |
bogdanm | 0:9b334a45a8ff | 1049 | hrtc->State = HAL_RTC_STATE_READY; |
bogdanm | 0:9b334a45a8ff | 1050 | |
bogdanm | 0:9b334a45a8ff | 1051 | return HAL_OK; |
bogdanm | 0:9b334a45a8ff | 1052 | } |
bogdanm | 0:9b334a45a8ff | 1053 | #endif /* (STM32L083xx) || (STM32L082xx) || (STM32L081xx) || |
mbed_official | 113:b3775bf36a83 | 1054 | * (STM32L073xx) || (STM32L072xx) || (STM32L071xx) || (STM32L031xx) || (STM32L041xx) || (STM32L011xx) || (STM32L021xx) |
bogdanm | 0:9b334a45a8ff | 1055 | */ |
bogdanm | 0:9b334a45a8ff | 1056 | |
bogdanm | 0:9b334a45a8ff | 1057 | /** |
bogdanm | 0:9b334a45a8ff | 1058 | * @} |
bogdanm | 0:9b334a45a8ff | 1059 | */ |
bogdanm | 0:9b334a45a8ff | 1060 | |
bogdanm | 0:9b334a45a8ff | 1061 | /** @addtogroup RTCEx_Exported_Functions_Group2 |
bogdanm | 0:9b334a45a8ff | 1062 | * @brief RTC Wake-up functions |
bogdanm | 0:9b334a45a8ff | 1063 | * |
bogdanm | 0:9b334a45a8ff | 1064 | @verbatim |
bogdanm | 0:9b334a45a8ff | 1065 | =============================================================================== |
bogdanm | 0:9b334a45a8ff | 1066 | ##### RTC Wake-up functions ##### |
bogdanm | 0:9b334a45a8ff | 1067 | =============================================================================== |
mbed_official | 113:b3775bf36a83 | 1068 | |
mbed_official | 113:b3775bf36a83 | 1069 | [..] This section provides functions allowing to configure Wake-up feature |
bogdanm | 0:9b334a45a8ff | 1070 | |
bogdanm | 0:9b334a45a8ff | 1071 | @endverbatim |
bogdanm | 0:9b334a45a8ff | 1072 | * @{ |
bogdanm | 0:9b334a45a8ff | 1073 | */ |
bogdanm | 0:9b334a45a8ff | 1074 | |
bogdanm | 0:9b334a45a8ff | 1075 | /** |
mbed_official | 113:b3775bf36a83 | 1076 | * @brief Set wake up timer. |
bogdanm | 0:9b334a45a8ff | 1077 | * @param hrtc: RTC handle |
bogdanm | 0:9b334a45a8ff | 1078 | * @param WakeUpCounter: Wake up counter |
bogdanm | 0:9b334a45a8ff | 1079 | * @param WakeUpClock: Wake up clock |
bogdanm | 0:9b334a45a8ff | 1080 | * @retval HAL status |
bogdanm | 0:9b334a45a8ff | 1081 | */ |
bogdanm | 0:9b334a45a8ff | 1082 | HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock) |
bogdanm | 0:9b334a45a8ff | 1083 | { |
bogdanm | 0:9b334a45a8ff | 1084 | uint32_t tickstart = 0; |
bogdanm | 0:9b334a45a8ff | 1085 | |
bogdanm | 0:9b334a45a8ff | 1086 | /* Check the parameters */ |
bogdanm | 0:9b334a45a8ff | 1087 | assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock)); |
bogdanm | 0:9b334a45a8ff | 1088 | assert_param(IS_RTC_WAKEUP_COUNTER(WakeUpCounter)); |
bogdanm | 0:9b334a45a8ff | 1089 | |
bogdanm | 0:9b334a45a8ff | 1090 | /* Process Locked */ |
bogdanm | 0:9b334a45a8ff | 1091 | __HAL_LOCK(hrtc); |
bogdanm | 0:9b334a45a8ff | 1092 | |
bogdanm | 0:9b334a45a8ff | 1093 | hrtc->State = HAL_RTC_STATE_BUSY; |
bogdanm | 0:9b334a45a8ff | 1094 | |
bogdanm | 0:9b334a45a8ff | 1095 | /* Disable the write protection for RTC registers */ |
bogdanm | 0:9b334a45a8ff | 1096 | __HAL_RTC_WRITEPROTECTION_DISABLE(hrtc); |
mbed_official | 113:b3775bf36a83 | 1097 | |
mbed_official | 113:b3775bf36a83 | 1098 | /*Check RTC WUTWF flag is reset only when wake up timer enabled*/ |
mbed_official | 113:b3775bf36a83 | 1099 | if((hrtc->Instance->CR & RTC_CR_WUTE) != RESET){ |
mbed_official | 113:b3775bf36a83 | 1100 | tickstart = HAL_GetTick(); |
mbed_official | 113:b3775bf36a83 | 1101 | |
mbed_official | 113:b3775bf36a83 | 1102 | /* Wait till RTC WUTWF flag is reset and if Time out is reached exit */ |
mbed_official | 113:b3775bf36a83 | 1103 | while(__HAL_RTC_WAKEUPTIMER_GET_FLAG(hrtc, RTC_FLAG_WUTWF) == SET) |
mbed_official | 113:b3775bf36a83 | 1104 | { |
mbed_official | 113:b3775bf36a83 | 1105 | if((HAL_GetTick() - tickstart ) > RTC_TIMEOUT_VALUE) |
mbed_official | 113:b3775bf36a83 | 1106 | { |
mbed_official | 113:b3775bf36a83 | 1107 | /* Enable the write protection for RTC registers */ |
mbed_official | 113:b3775bf36a83 | 1108 | __HAL_RTC_WRITEPROTECTION_ENABLE(hrtc); |
mbed_official | 113:b3775bf36a83 | 1109 | |
mbed_official | 113:b3775bf36a83 | 1110 | hrtc->State = HAL_RTC_STATE_TIMEOUT; |
mbed_official | 113:b3775bf36a83 | 1111 | |
mbed_official | 113:b3775bf36a83 | 1112 | /* Process Unlocked */ |
mbed_official | 113:b3775bf36a83 | 1113 | __HAL_UNLOCK(hrtc); |
mbed_official | 113:b3775bf36a83 | 1114 | |
mbed_official | 113:b3775bf36a83 | 1115 | return HAL_TIMEOUT; |
mbed_official | 113:b3775bf36a83 | 1116 | } |
mbed_official | 113:b3775bf36a83 | 1117 | } |
mbed_official | 113:b3775bf36a83 | 1118 | } |
bogdanm | 0:9b334a45a8ff | 1119 | |
bogdanm | 0:9b334a45a8ff | 1120 | __HAL_RTC_WAKEUPTIMER_DISABLE(hrtc); |
bogdanm | 0:9b334a45a8ff | 1121 | |
bogdanm | 0:9b334a45a8ff | 1122 | tickstart = HAL_GetTick(); |
bogdanm | 0:9b334a45a8ff | 1123 | |
bogdanm | 0:9b334a45a8ff | 1124 | /* Wait till RTC WUTWF flag is set and if Time out is reached exit */ |
bogdanm | 0:9b334a45a8ff | 1125 | while(__HAL_RTC_WAKEUPTIMER_GET_FLAG(hrtc, RTC_FLAG_WUTWF) == RESET) |
bogdanm | 0:9b334a45a8ff | 1126 | { |
bogdanm | 0:9b334a45a8ff | 1127 | if((HAL_GetTick() - tickstart ) > RTC_TIMEOUT_VALUE) |
bogdanm | 0:9b334a45a8ff | 1128 | { |
bogdanm | 0:9b334a45a8ff | 1129 | /* Enable the write protection for RTC registers */ |
bogdanm | 0:9b334a45a8ff | 1130 | __HAL_RTC_WRITEPROTECTION_ENABLE(hrtc); |
bogdanm | 0:9b334a45a8ff | 1131 | |
bogdanm | 0:9b334a45a8ff | 1132 | hrtc->State = HAL_RTC_STATE_TIMEOUT; |
bogdanm | 0:9b334a45a8ff | 1133 | |
bogdanm | 0:9b334a45a8ff | 1134 | /* Process Unlocked */ |
bogdanm | 0:9b334a45a8ff | 1135 | __HAL_UNLOCK(hrtc); |
bogdanm | 0:9b334a45a8ff | 1136 | |
bogdanm | 0:9b334a45a8ff | 1137 | return HAL_TIMEOUT; |
bogdanm | 0:9b334a45a8ff | 1138 | } |
bogdanm | 0:9b334a45a8ff | 1139 | } |
bogdanm | 0:9b334a45a8ff | 1140 | |
bogdanm | 0:9b334a45a8ff | 1141 | /* Clear the Wakeup Timer clock source bits in CR register */ |
bogdanm | 0:9b334a45a8ff | 1142 | hrtc->Instance->CR &= (uint32_t)~RTC_CR_WUCKSEL; |
bogdanm | 0:9b334a45a8ff | 1143 | |
bogdanm | 0:9b334a45a8ff | 1144 | /* Configure the clock source */ |
bogdanm | 0:9b334a45a8ff | 1145 | hrtc->Instance->CR |= (uint32_t)WakeUpClock; |
bogdanm | 0:9b334a45a8ff | 1146 | |
bogdanm | 0:9b334a45a8ff | 1147 | /* Configure the Wakeup Timer counter */ |
bogdanm | 0:9b334a45a8ff | 1148 | hrtc->Instance->WUTR = (uint32_t)WakeUpCounter; |
bogdanm | 0:9b334a45a8ff | 1149 | |
bogdanm | 0:9b334a45a8ff | 1150 | /* Enable the Wakeup Timer */ |
bogdanm | 0:9b334a45a8ff | 1151 | __HAL_RTC_WAKEUPTIMER_ENABLE(hrtc); |
bogdanm | 0:9b334a45a8ff | 1152 | |
bogdanm | 0:9b334a45a8ff | 1153 | /* Enable the write protection for RTC registers */ |
bogdanm | 0:9b334a45a8ff | 1154 | __HAL_RTC_WRITEPROTECTION_ENABLE(hrtc); |
bogdanm | 0:9b334a45a8ff | 1155 | |
bogdanm | 0:9b334a45a8ff | 1156 | hrtc->State = HAL_RTC_STATE_READY; |
bogdanm | 0:9b334a45a8ff | 1157 | |
bogdanm | 0:9b334a45a8ff | 1158 | /* Process Unlocked */ |
bogdanm | 0:9b334a45a8ff | 1159 | __HAL_UNLOCK(hrtc); |
bogdanm | 0:9b334a45a8ff | 1160 | |
bogdanm | 0:9b334a45a8ff | 1161 | return HAL_OK; |
bogdanm | 0:9b334a45a8ff | 1162 | } |
bogdanm | 0:9b334a45a8ff | 1163 | |
bogdanm | 0:9b334a45a8ff | 1164 | /** |
mbed_official | 113:b3775bf36a83 | 1165 | * @brief Set wake up timer with interrupt. |
bogdanm | 0:9b334a45a8ff | 1166 | * @param hrtc: RTC handle |
bogdanm | 0:9b334a45a8ff | 1167 | * @param WakeUpCounter: Wake up counter |
bogdanm | 0:9b334a45a8ff | 1168 | * @param WakeUpClock: Wake up clock |
bogdanm | 0:9b334a45a8ff | 1169 | * @retval HAL status |
bogdanm | 0:9b334a45a8ff | 1170 | */ |
bogdanm | 0:9b334a45a8ff | 1171 | HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer_IT(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock) |
bogdanm | 0:9b334a45a8ff | 1172 | { |
bogdanm | 0:9b334a45a8ff | 1173 | uint32_t tickstart = 0; |
bogdanm | 0:9b334a45a8ff | 1174 | |
bogdanm | 0:9b334a45a8ff | 1175 | /* Check the parameters */ |
bogdanm | 0:9b334a45a8ff | 1176 | assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock)); |
bogdanm | 0:9b334a45a8ff | 1177 | assert_param(IS_RTC_WAKEUP_COUNTER(WakeUpCounter)); |
bogdanm | 0:9b334a45a8ff | 1178 | |
bogdanm | 0:9b334a45a8ff | 1179 | /* Process Locked */ |
bogdanm | 0:9b334a45a8ff | 1180 | __HAL_LOCK(hrtc); |
bogdanm | 0:9b334a45a8ff | 1181 | |
bogdanm | 0:9b334a45a8ff | 1182 | hrtc->State = HAL_RTC_STATE_BUSY; |
bogdanm | 0:9b334a45a8ff | 1183 | |
bogdanm | 0:9b334a45a8ff | 1184 | /* Disable the write protection for RTC registers */ |
bogdanm | 0:9b334a45a8ff | 1185 | __HAL_RTC_WRITEPROTECTION_DISABLE(hrtc); |
bogdanm | 0:9b334a45a8ff | 1186 | |
mbed_official | 113:b3775bf36a83 | 1187 | /*Check RTC WUTWF flag is reset only when wake up timer enabled*/ |
mbed_official | 113:b3775bf36a83 | 1188 | if((hrtc->Instance->CR & RTC_CR_WUTE) != RESET){ |
mbed_official | 113:b3775bf36a83 | 1189 | tickstart = HAL_GetTick(); |
mbed_official | 113:b3775bf36a83 | 1190 | |
mbed_official | 113:b3775bf36a83 | 1191 | /* Wait till RTC WUTWF flag is reset and if Time out is reached exit */ |
mbed_official | 113:b3775bf36a83 | 1192 | while(__HAL_RTC_WAKEUPTIMER_GET_FLAG(hrtc, RTC_FLAG_WUTWF) == SET) |
mbed_official | 113:b3775bf36a83 | 1193 | { |
mbed_official | 113:b3775bf36a83 | 1194 | if((HAL_GetTick() - tickstart ) > RTC_TIMEOUT_VALUE) |
mbed_official | 113:b3775bf36a83 | 1195 | { |
mbed_official | 113:b3775bf36a83 | 1196 | /* Enable the write protection for RTC registers */ |
mbed_official | 113:b3775bf36a83 | 1197 | __HAL_RTC_WRITEPROTECTION_ENABLE(hrtc); |
mbed_official | 113:b3775bf36a83 | 1198 | |
mbed_official | 113:b3775bf36a83 | 1199 | hrtc->State = HAL_RTC_STATE_TIMEOUT; |
mbed_official | 113:b3775bf36a83 | 1200 | |
mbed_official | 113:b3775bf36a83 | 1201 | /* Process Unlocked */ |
mbed_official | 113:b3775bf36a83 | 1202 | __HAL_UNLOCK(hrtc); |
mbed_official | 113:b3775bf36a83 | 1203 | |
mbed_official | 113:b3775bf36a83 | 1204 | return HAL_TIMEOUT; |
mbed_official | 113:b3775bf36a83 | 1205 | } |
mbed_official | 113:b3775bf36a83 | 1206 | } |
mbed_official | 113:b3775bf36a83 | 1207 | } |
mbed_official | 113:b3775bf36a83 | 1208 | |
bogdanm | 0:9b334a45a8ff | 1209 | __HAL_RTC_WAKEUPTIMER_DISABLE(hrtc); |
bogdanm | 0:9b334a45a8ff | 1210 | |
bogdanm | 0:9b334a45a8ff | 1211 | tickstart = HAL_GetTick(); |
bogdanm | 0:9b334a45a8ff | 1212 | |
bogdanm | 0:9b334a45a8ff | 1213 | /* Wait till RTC WUTWF flag is set and if Time out is reached exit */ |
bogdanm | 0:9b334a45a8ff | 1214 | while(__HAL_RTC_WAKEUPTIMER_GET_FLAG(hrtc, RTC_FLAG_WUTWF) == RESET) |
bogdanm | 0:9b334a45a8ff | 1215 | { |
bogdanm | 0:9b334a45a8ff | 1216 | if((HAL_GetTick() - tickstart ) > RTC_TIMEOUT_VALUE) |
bogdanm | 0:9b334a45a8ff | 1217 | { |
bogdanm | 0:9b334a45a8ff | 1218 | /* Enable the write protection for RTC registers */ |
bogdanm | 0:9b334a45a8ff | 1219 | __HAL_RTC_WRITEPROTECTION_ENABLE(hrtc); |
bogdanm | 0:9b334a45a8ff | 1220 | |
bogdanm | 0:9b334a45a8ff | 1221 | hrtc->State = HAL_RTC_STATE_TIMEOUT; |
bogdanm | 0:9b334a45a8ff | 1222 | |
bogdanm | 0:9b334a45a8ff | 1223 | /* Process Unlocked */ |
bogdanm | 0:9b334a45a8ff | 1224 | __HAL_UNLOCK(hrtc); |
bogdanm | 0:9b334a45a8ff | 1225 | |
bogdanm | 0:9b334a45a8ff | 1226 | return HAL_TIMEOUT; |
bogdanm | 0:9b334a45a8ff | 1227 | } |
bogdanm | 0:9b334a45a8ff | 1228 | } |
bogdanm | 0:9b334a45a8ff | 1229 | |
bogdanm | 0:9b334a45a8ff | 1230 | /* Configure the Wakeup Timer counter */ |
bogdanm | 0:9b334a45a8ff | 1231 | hrtc->Instance->WUTR = (uint32_t)WakeUpCounter; |
bogdanm | 0:9b334a45a8ff | 1232 | |
bogdanm | 0:9b334a45a8ff | 1233 | /* Clear the Wakeup Timer clock source bits in CR register */ |
bogdanm | 0:9b334a45a8ff | 1234 | hrtc->Instance->CR &= (uint32_t)~RTC_CR_WUCKSEL; |
bogdanm | 0:9b334a45a8ff | 1235 | |
bogdanm | 0:9b334a45a8ff | 1236 | /* Configure the clock source */ |
bogdanm | 0:9b334a45a8ff | 1237 | hrtc->Instance->CR |= (uint32_t)WakeUpClock; |
bogdanm | 0:9b334a45a8ff | 1238 | |
bogdanm | 0:9b334a45a8ff | 1239 | /* RTC WakeUpTimer Interrupt Configuration: EXTI configuration */ |
bogdanm | 0:9b334a45a8ff | 1240 | __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_IT(); |
bogdanm | 0:9b334a45a8ff | 1241 | |
bogdanm | 0:9b334a45a8ff | 1242 | __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_RISING_EDGE(); |
bogdanm | 0:9b334a45a8ff | 1243 | |
bogdanm | 0:9b334a45a8ff | 1244 | /* Configure the Interrupt in the RTC_CR register */ |
bogdanm | 0:9b334a45a8ff | 1245 | __HAL_RTC_WAKEUPTIMER_ENABLE_IT(hrtc,RTC_IT_WUT); |
bogdanm | 0:9b334a45a8ff | 1246 | |
bogdanm | 0:9b334a45a8ff | 1247 | /* Enable the Wakeup Timer */ |
bogdanm | 0:9b334a45a8ff | 1248 | __HAL_RTC_WAKEUPTIMER_ENABLE(hrtc); |
bogdanm | 0:9b334a45a8ff | 1249 | |
bogdanm | 0:9b334a45a8ff | 1250 | /* Enable the write protection for RTC registers */ |
bogdanm | 0:9b334a45a8ff | 1251 | __HAL_RTC_WRITEPROTECTION_ENABLE(hrtc); |
bogdanm | 0:9b334a45a8ff | 1252 | |
bogdanm | 0:9b334a45a8ff | 1253 | hrtc->State = HAL_RTC_STATE_READY; |
bogdanm | 0:9b334a45a8ff | 1254 | |
bogdanm | 0:9b334a45a8ff | 1255 | /* Process Unlocked */ |
bogdanm | 0:9b334a45a8ff | 1256 | __HAL_UNLOCK(hrtc); |
bogdanm | 0:9b334a45a8ff | 1257 | |
bogdanm | 0:9b334a45a8ff | 1258 | return HAL_OK; |
bogdanm | 0:9b334a45a8ff | 1259 | } |
bogdanm | 0:9b334a45a8ff | 1260 | |
bogdanm | 0:9b334a45a8ff | 1261 | /** |
mbed_official | 113:b3775bf36a83 | 1262 | * @brief Deactivate wake up timer counter. |
bogdanm | 0:9b334a45a8ff | 1263 | * @param hrtc: RTC handle |
bogdanm | 0:9b334a45a8ff | 1264 | * @retval HAL status |
bogdanm | 0:9b334a45a8ff | 1265 | */ |
bogdanm | 0:9b334a45a8ff | 1266 | uint32_t HAL_RTCEx_DeactivateWakeUpTimer(RTC_HandleTypeDef *hrtc) |
bogdanm | 0:9b334a45a8ff | 1267 | { |
bogdanm | 0:9b334a45a8ff | 1268 | uint32_t tickstart = 0; |
bogdanm | 0:9b334a45a8ff | 1269 | |
bogdanm | 0:9b334a45a8ff | 1270 | /* Process Locked */ |
bogdanm | 0:9b334a45a8ff | 1271 | __HAL_LOCK(hrtc); |
bogdanm | 0:9b334a45a8ff | 1272 | |
bogdanm | 0:9b334a45a8ff | 1273 | hrtc->State = HAL_RTC_STATE_BUSY; |
bogdanm | 0:9b334a45a8ff | 1274 | |
bogdanm | 0:9b334a45a8ff | 1275 | /* Disable the write protection for RTC registers */ |
bogdanm | 0:9b334a45a8ff | 1276 | __HAL_RTC_WRITEPROTECTION_DISABLE(hrtc); |
bogdanm | 0:9b334a45a8ff | 1277 | |
bogdanm | 0:9b334a45a8ff | 1278 | /* Disable the Wakeup Timer */ |
bogdanm | 0:9b334a45a8ff | 1279 | __HAL_RTC_WAKEUPTIMER_DISABLE(hrtc); |
bogdanm | 0:9b334a45a8ff | 1280 | |
bogdanm | 0:9b334a45a8ff | 1281 | /* In case of interrupt mode is used, the interrupt source must disabled */ |
bogdanm | 0:9b334a45a8ff | 1282 | __HAL_RTC_WAKEUPTIMER_DISABLE_IT(hrtc,RTC_IT_WUT); |
bogdanm | 0:9b334a45a8ff | 1283 | |
bogdanm | 0:9b334a45a8ff | 1284 | tickstart = HAL_GetTick(); |
bogdanm | 0:9b334a45a8ff | 1285 | /* Wait till RTC WUTWF flag is set and if Time out is reached exit */ |
bogdanm | 0:9b334a45a8ff | 1286 | while(__HAL_RTC_WAKEUPTIMER_GET_FLAG(hrtc, RTC_FLAG_WUTWF) == RESET) |
bogdanm | 0:9b334a45a8ff | 1287 | { |
bogdanm | 0:9b334a45a8ff | 1288 | if((HAL_GetTick() - tickstart ) > RTC_TIMEOUT_VALUE) |
bogdanm | 0:9b334a45a8ff | 1289 | { |
bogdanm | 0:9b334a45a8ff | 1290 | /* Enable the write protection for RTC registers */ |
bogdanm | 0:9b334a45a8ff | 1291 | __HAL_RTC_WRITEPROTECTION_ENABLE(hrtc); |
bogdanm | 0:9b334a45a8ff | 1292 | |
bogdanm | 0:9b334a45a8ff | 1293 | hrtc->State = HAL_RTC_STATE_TIMEOUT; |
bogdanm | 0:9b334a45a8ff | 1294 | |
bogdanm | 0:9b334a45a8ff | 1295 | /* Process Unlocked */ |
bogdanm | 0:9b334a45a8ff | 1296 | __HAL_UNLOCK(hrtc); |
bogdanm | 0:9b334a45a8ff | 1297 | |
bogdanm | 0:9b334a45a8ff | 1298 | return HAL_TIMEOUT; |
bogdanm | 0:9b334a45a8ff | 1299 | } |
bogdanm | 0:9b334a45a8ff | 1300 | } |
bogdanm | 0:9b334a45a8ff | 1301 | |
bogdanm | 0:9b334a45a8ff | 1302 | /* Enable the write protection for RTC registers */ |
bogdanm | 0:9b334a45a8ff | 1303 | __HAL_RTC_WRITEPROTECTION_ENABLE(hrtc); |
bogdanm | 0:9b334a45a8ff | 1304 | |
bogdanm | 0:9b334a45a8ff | 1305 | hrtc->State = HAL_RTC_STATE_READY; |
bogdanm | 0:9b334a45a8ff | 1306 | |
bogdanm | 0:9b334a45a8ff | 1307 | /* Process Unlocked */ |
bogdanm | 0:9b334a45a8ff | 1308 | __HAL_UNLOCK(hrtc); |
bogdanm | 0:9b334a45a8ff | 1309 | |
bogdanm | 0:9b334a45a8ff | 1310 | return HAL_OK; |
bogdanm | 0:9b334a45a8ff | 1311 | } |
bogdanm | 0:9b334a45a8ff | 1312 | |
bogdanm | 0:9b334a45a8ff | 1313 | /** |
mbed_official | 113:b3775bf36a83 | 1314 | * @brief Get wake up timer counter. |
bogdanm | 0:9b334a45a8ff | 1315 | * @param hrtc: RTC handle |
bogdanm | 0:9b334a45a8ff | 1316 | * @retval Counter value |
bogdanm | 0:9b334a45a8ff | 1317 | */ |
bogdanm | 0:9b334a45a8ff | 1318 | uint32_t HAL_RTCEx_GetWakeUpTimer(RTC_HandleTypeDef *hrtc) |
bogdanm | 0:9b334a45a8ff | 1319 | { |
bogdanm | 0:9b334a45a8ff | 1320 | /* Get the counter value */ |
bogdanm | 0:9b334a45a8ff | 1321 | return ((uint32_t)(hrtc->Instance->WUTR & RTC_WUTR_WUT)); |
bogdanm | 0:9b334a45a8ff | 1322 | } |
bogdanm | 0:9b334a45a8ff | 1323 | |
bogdanm | 0:9b334a45a8ff | 1324 | /** |
mbed_official | 113:b3775bf36a83 | 1325 | * @brief Handle Wake Up Timer interrupt request. |
bogdanm | 0:9b334a45a8ff | 1326 | * @param hrtc: RTC handle |
bogdanm | 0:9b334a45a8ff | 1327 | * @retval None |
bogdanm | 0:9b334a45a8ff | 1328 | */ |
bogdanm | 0:9b334a45a8ff | 1329 | void HAL_RTCEx_WakeUpTimerIRQHandler(RTC_HandleTypeDef *hrtc) |
bogdanm | 0:9b334a45a8ff | 1330 | { |
mbed_official | 113:b3775bf36a83 | 1331 | /* Get the pending status of the WAKEUPTIMER Interrupt */ |
mbed_official | 113:b3775bf36a83 | 1332 | if(__HAL_RTC_WAKEUPTIMER_GET_FLAG(hrtc, RTC_FLAG_WUTF) != RESET) |
bogdanm | 0:9b334a45a8ff | 1333 | { |
bogdanm | 0:9b334a45a8ff | 1334 | /* WAKEUPTIMER callback */ |
bogdanm | 0:9b334a45a8ff | 1335 | HAL_RTCEx_WakeUpTimerEventCallback(hrtc); |
bogdanm | 0:9b334a45a8ff | 1336 | |
bogdanm | 0:9b334a45a8ff | 1337 | /* Clear the WAKEUPTIMER interrupt pending bit */ |
bogdanm | 0:9b334a45a8ff | 1338 | __HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(hrtc, RTC_FLAG_WUTF); |
bogdanm | 0:9b334a45a8ff | 1339 | } |
mbed_official | 113:b3775bf36a83 | 1340 | |
bogdanm | 0:9b334a45a8ff | 1341 | |
bogdanm | 0:9b334a45a8ff | 1342 | /* Clear the EXTI's line Flag for RTC WakeUpTimer */ |
bogdanm | 0:9b334a45a8ff | 1343 | __HAL_RTC_WAKEUPTIMER_EXTI_CLEAR_FLAG(); |
bogdanm | 0:9b334a45a8ff | 1344 | |
bogdanm | 0:9b334a45a8ff | 1345 | /* Change RTC state */ |
bogdanm | 0:9b334a45a8ff | 1346 | hrtc->State = HAL_RTC_STATE_READY; |
bogdanm | 0:9b334a45a8ff | 1347 | } |
bogdanm | 0:9b334a45a8ff | 1348 | |
bogdanm | 0:9b334a45a8ff | 1349 | /** |
bogdanm | 0:9b334a45a8ff | 1350 | * @brief Wake Up Timer callback. |
bogdanm | 0:9b334a45a8ff | 1351 | * @param hrtc: RTC handle |
bogdanm | 0:9b334a45a8ff | 1352 | * @retval None |
bogdanm | 0:9b334a45a8ff | 1353 | */ |
bogdanm | 0:9b334a45a8ff | 1354 | __weak void HAL_RTCEx_WakeUpTimerEventCallback(RTC_HandleTypeDef *hrtc) |
bogdanm | 0:9b334a45a8ff | 1355 | { |
mbed_official | 113:b3775bf36a83 | 1356 | /* Prevent unused argument(s) compilation warning */ |
mbed_official | 113:b3775bf36a83 | 1357 | UNUSED(hrtc); |
mbed_official | 113:b3775bf36a83 | 1358 | |
mbed_official | 113:b3775bf36a83 | 1359 | /* NOTE : This function should not be modified, when the callback is needed, |
bogdanm | 0:9b334a45a8ff | 1360 | the HAL_RTCEx_WakeUpTimerEventCallback could be implemented in the user file |
bogdanm | 0:9b334a45a8ff | 1361 | */ |
bogdanm | 0:9b334a45a8ff | 1362 | } |
bogdanm | 0:9b334a45a8ff | 1363 | |
bogdanm | 0:9b334a45a8ff | 1364 | |
bogdanm | 0:9b334a45a8ff | 1365 | /** |
mbed_official | 113:b3775bf36a83 | 1366 | * @brief Handle Wake Up Timer Polling. |
bogdanm | 0:9b334a45a8ff | 1367 | * @param hrtc: RTC handle |
bogdanm | 0:9b334a45a8ff | 1368 | * @param Timeout: Timeout duration |
bogdanm | 0:9b334a45a8ff | 1369 | * @retval HAL status |
bogdanm | 0:9b334a45a8ff | 1370 | */ |
bogdanm | 0:9b334a45a8ff | 1371 | HAL_StatusTypeDef HAL_RTCEx_PollForWakeUpTimerEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout) |
bogdanm | 0:9b334a45a8ff | 1372 | { |
bogdanm | 0:9b334a45a8ff | 1373 | uint32_t tickstart = HAL_GetTick(); |
bogdanm | 0:9b334a45a8ff | 1374 | |
bogdanm | 0:9b334a45a8ff | 1375 | while(__HAL_RTC_WAKEUPTIMER_GET_FLAG(hrtc, RTC_FLAG_WUTF) == RESET) |
bogdanm | 0:9b334a45a8ff | 1376 | { |
bogdanm | 0:9b334a45a8ff | 1377 | if(Timeout != HAL_MAX_DELAY) |
bogdanm | 0:9b334a45a8ff | 1378 | { |
bogdanm | 0:9b334a45a8ff | 1379 | if((Timeout == 0)||((HAL_GetTick() - tickstart ) > Timeout)) |
bogdanm | 0:9b334a45a8ff | 1380 | { |
bogdanm | 0:9b334a45a8ff | 1381 | hrtc->State = HAL_RTC_STATE_TIMEOUT; |
bogdanm | 0:9b334a45a8ff | 1382 | |
bogdanm | 0:9b334a45a8ff | 1383 | return HAL_TIMEOUT; |
bogdanm | 0:9b334a45a8ff | 1384 | } |
bogdanm | 0:9b334a45a8ff | 1385 | } |
bogdanm | 0:9b334a45a8ff | 1386 | } |
bogdanm | 0:9b334a45a8ff | 1387 | |
bogdanm | 0:9b334a45a8ff | 1388 | /* Clear the WAKEUPTIMER Flag */ |
bogdanm | 0:9b334a45a8ff | 1389 | __HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(hrtc, RTC_FLAG_WUTF); |
bogdanm | 0:9b334a45a8ff | 1390 | |
bogdanm | 0:9b334a45a8ff | 1391 | /* Change RTC state */ |
bogdanm | 0:9b334a45a8ff | 1392 | hrtc->State = HAL_RTC_STATE_READY; |
bogdanm | 0:9b334a45a8ff | 1393 | |
bogdanm | 0:9b334a45a8ff | 1394 | return HAL_OK; |
bogdanm | 0:9b334a45a8ff | 1395 | } |
bogdanm | 0:9b334a45a8ff | 1396 | |
bogdanm | 0:9b334a45a8ff | 1397 | /** |
bogdanm | 0:9b334a45a8ff | 1398 | * @} |
bogdanm | 0:9b334a45a8ff | 1399 | */ |
bogdanm | 0:9b334a45a8ff | 1400 | |
bogdanm | 0:9b334a45a8ff | 1401 | |
bogdanm | 0:9b334a45a8ff | 1402 | /** @addtogroup RTCEx_Exported_Functions_Group3 |
bogdanm | 0:9b334a45a8ff | 1403 | * @brief Extended Peripheral Control functions |
bogdanm | 0:9b334a45a8ff | 1404 | * |
bogdanm | 0:9b334a45a8ff | 1405 | @verbatim |
bogdanm | 0:9b334a45a8ff | 1406 | =============================================================================== |
bogdanm | 0:9b334a45a8ff | 1407 | ##### Extended Peripheral Control functions ##### |
bogdanm | 0:9b334a45a8ff | 1408 | =============================================================================== |
bogdanm | 0:9b334a45a8ff | 1409 | [..] |
bogdanm | 0:9b334a45a8ff | 1410 | This subsection provides functions allowing to |
mbed_official | 113:b3775bf36a83 | 1411 | (+) Write a data in a specified RTC Backup data register |
bogdanm | 0:9b334a45a8ff | 1412 | (+) Read a data in a specified RTC Backup data register |
mbed_official | 113:b3775bf36a83 | 1413 | (+) Set the Coarse calibration parameters. |
mbed_official | 113:b3775bf36a83 | 1414 | (+) Deactivate the Coarse calibration parameters |
mbed_official | 113:b3775bf36a83 | 1415 | (+) Set the Smooth calibration parameters. |
mbed_official | 113:b3775bf36a83 | 1416 | (+) Configure the Synchronization Shift Control Settings. |
mbed_official | 113:b3775bf36a83 | 1417 | (+) Configure the Calibration Pinout (RTC_CALIB) Selection (1Hz or 512Hz). |
mbed_official | 113:b3775bf36a83 | 1418 | (+) Deactivate the Calibration Pinout (RTC_CALIB) Selection (1Hz or 512Hz). |
mbed_official | 113:b3775bf36a83 | 1419 | (+) Enable the RTC reference clock detection. |
bogdanm | 0:9b334a45a8ff | 1420 | (+) Disable the RTC reference clock detection. |
mbed_official | 113:b3775bf36a83 | 1421 | (+) Enable the Bypass Shadow feature. |
mbed_official | 113:b3775bf36a83 | 1422 | (+) Disable the Bypass Shadow feature. |
bogdanm | 0:9b334a45a8ff | 1423 | |
bogdanm | 0:9b334a45a8ff | 1424 | @endverbatim |
bogdanm | 0:9b334a45a8ff | 1425 | * @{ |
bogdanm | 0:9b334a45a8ff | 1426 | */ |
bogdanm | 0:9b334a45a8ff | 1427 | |
bogdanm | 0:9b334a45a8ff | 1428 | /** |
mbed_official | 113:b3775bf36a83 | 1429 | * @brief Write a data in a specified RTC Backup data register. |
bogdanm | 0:9b334a45a8ff | 1430 | * @param hrtc: RTC handle |
bogdanm | 0:9b334a45a8ff | 1431 | * @param BackupRegister: RTC Backup data Register number. |
bogdanm | 0:9b334a45a8ff | 1432 | * This parameter can be: RTC_BKP_DRx where x can be from 0 to 19 to |
bogdanm | 0:9b334a45a8ff | 1433 | * specify the register. |
bogdanm | 0:9b334a45a8ff | 1434 | * @param Data: Data to be written in the specified RTC Backup data register. |
bogdanm | 0:9b334a45a8ff | 1435 | * @retval None |
bogdanm | 0:9b334a45a8ff | 1436 | */ |
bogdanm | 0:9b334a45a8ff | 1437 | void HAL_RTCEx_BKUPWrite(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister, uint32_t Data) |
bogdanm | 0:9b334a45a8ff | 1438 | { |
bogdanm | 0:9b334a45a8ff | 1439 | uint32_t tmp = 0; |
bogdanm | 0:9b334a45a8ff | 1440 | |
bogdanm | 0:9b334a45a8ff | 1441 | /* Check the parameters */ |
bogdanm | 0:9b334a45a8ff | 1442 | assert_param(IS_RTC_BKP(BackupRegister)); |
bogdanm | 0:9b334a45a8ff | 1443 | |
bogdanm | 0:9b334a45a8ff | 1444 | tmp = (uint32_t)&(hrtc->Instance->BKP0R); |
bogdanm | 0:9b334a45a8ff | 1445 | tmp += (BackupRegister * 4); |
bogdanm | 0:9b334a45a8ff | 1446 | |
bogdanm | 0:9b334a45a8ff | 1447 | /* Write the specified register */ |
bogdanm | 0:9b334a45a8ff | 1448 | *(__IO uint32_t *)tmp = (uint32_t)Data; |
bogdanm | 0:9b334a45a8ff | 1449 | } |
bogdanm | 0:9b334a45a8ff | 1450 | |
bogdanm | 0:9b334a45a8ff | 1451 | /** |
bogdanm | 0:9b334a45a8ff | 1452 | * @brief Reads data from the specified RTC Backup data Register. |
bogdanm | 0:9b334a45a8ff | 1453 | * @param hrtc: RTC handle |
bogdanm | 0:9b334a45a8ff | 1454 | * @param BackupRegister: RTC Backup data Register number. |
bogdanm | 0:9b334a45a8ff | 1455 | * This parameter can be: RTC_BKP_DRx where x can be from 0 to 19 to |
bogdanm | 0:9b334a45a8ff | 1456 | * specify the register. |
bogdanm | 0:9b334a45a8ff | 1457 | * @retval Read value |
bogdanm | 0:9b334a45a8ff | 1458 | */ |
bogdanm | 0:9b334a45a8ff | 1459 | uint32_t HAL_RTCEx_BKUPRead(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister) |
bogdanm | 0:9b334a45a8ff | 1460 | { |
bogdanm | 0:9b334a45a8ff | 1461 | uint32_t tmp = 0; |
bogdanm | 0:9b334a45a8ff | 1462 | |
bogdanm | 0:9b334a45a8ff | 1463 | /* Check the parameters */ |
bogdanm | 0:9b334a45a8ff | 1464 | assert_param(IS_RTC_BKP(BackupRegister)); |
bogdanm | 0:9b334a45a8ff | 1465 | |
bogdanm | 0:9b334a45a8ff | 1466 | tmp = (uint32_t)&(hrtc->Instance->BKP0R); |
bogdanm | 0:9b334a45a8ff | 1467 | tmp += (BackupRegister * 4); |
bogdanm | 0:9b334a45a8ff | 1468 | |
bogdanm | 0:9b334a45a8ff | 1469 | /* Read the specified register */ |
bogdanm | 0:9b334a45a8ff | 1470 | return (*(__IO uint32_t *)tmp); |
bogdanm | 0:9b334a45a8ff | 1471 | } |
bogdanm | 0:9b334a45a8ff | 1472 | |
bogdanm | 0:9b334a45a8ff | 1473 | /** |
mbed_official | 113:b3775bf36a83 | 1474 | * @brief Set the Smooth calibration parameters. |
bogdanm | 0:9b334a45a8ff | 1475 | * @param hrtc: RTC handle |
bogdanm | 0:9b334a45a8ff | 1476 | * @param SmoothCalibPeriod: Select the Smooth Calibration Period. |
bogdanm | 0:9b334a45a8ff | 1477 | * This parameter can be can be one of the following values : |
mbed_official | 113:b3775bf36a83 | 1478 | * @arg RTC_SMOOTHCALIB_PERIOD_32SEC: The smooth calibration period is 32s. |
mbed_official | 113:b3775bf36a83 | 1479 | * @arg RTC_SMOOTHCALIB_PERIOD_16SEC: The smooth calibration period is 16s. |
mbed_official | 113:b3775bf36a83 | 1480 | * @arg RTC_SMOOTHCALIB_PERIOD_8SEC: The smooth calibration period is 8s. |
bogdanm | 0:9b334a45a8ff | 1481 | * @param SmoothCalibPlusPulses: Select to Set or reset the CALP bit. |
bogdanm | 0:9b334a45a8ff | 1482 | * This parameter can be one of the following values: |
mbed_official | 113:b3775bf36a83 | 1483 | * @arg RTC_SMOOTHCALIB_PLUSPULSES_SET: Add one RTCCLK pulse every 2*11 pulses. |
bogdanm | 0:9b334a45a8ff | 1484 | * @arg RTC_SMOOTHCALIB_PLUSPULSES_RESET: No RTCCLK pulses are added. |
bogdanm | 0:9b334a45a8ff | 1485 | * @param SmoothCalibMinusPulsesValue: Select the value of CALM[8:0] bits. |
bogdanm | 0:9b334a45a8ff | 1486 | * This parameter can be one any value from 0 to 0x000001FF. |
bogdanm | 0:9b334a45a8ff | 1487 | * @note To deactivate the smooth calibration, the field SmoothCalibPlusPulses |
bogdanm | 0:9b334a45a8ff | 1488 | * must be equal to SMOOTHCALIB_PLUSPULSES_RESET and the field |
bogdanm | 0:9b334a45a8ff | 1489 | * SmoothCalibMinusPulsesValue mut be equal to 0. |
bogdanm | 0:9b334a45a8ff | 1490 | * @retval HAL status |
bogdanm | 0:9b334a45a8ff | 1491 | */ |
bogdanm | 0:9b334a45a8ff | 1492 | HAL_StatusTypeDef HAL_RTCEx_SetSmoothCalib(RTC_HandleTypeDef* hrtc, uint32_t SmoothCalibPeriod, uint32_t SmoothCalibPlusPulses, uint32_t SmoothCalibMinusPulsesValue) |
bogdanm | 0:9b334a45a8ff | 1493 | { |
bogdanm | 0:9b334a45a8ff | 1494 | uint32_t tickstart = 0; |
bogdanm | 0:9b334a45a8ff | 1495 | |
bogdanm | 0:9b334a45a8ff | 1496 | /* Check the parameters */ |
bogdanm | 0:9b334a45a8ff | 1497 | assert_param(IS_RTC_SMOOTH_CALIB_PERIOD(SmoothCalibPeriod)); |
bogdanm | 0:9b334a45a8ff | 1498 | assert_param(IS_RTC_SMOOTH_CALIB_PLUS(SmoothCalibPlusPulses)); |
bogdanm | 0:9b334a45a8ff | 1499 | assert_param(IS_RTC_SMOOTH_CALIB_MINUS(SmoothCalibMinusPulsesValue)); |
bogdanm | 0:9b334a45a8ff | 1500 | |
bogdanm | 0:9b334a45a8ff | 1501 | /* Process Locked */ |
bogdanm | 0:9b334a45a8ff | 1502 | __HAL_LOCK(hrtc); |
bogdanm | 0:9b334a45a8ff | 1503 | |
bogdanm | 0:9b334a45a8ff | 1504 | hrtc->State = HAL_RTC_STATE_BUSY; |
bogdanm | 0:9b334a45a8ff | 1505 | |
bogdanm | 0:9b334a45a8ff | 1506 | /* Disable the write protection for RTC registers */ |
bogdanm | 0:9b334a45a8ff | 1507 | __HAL_RTC_WRITEPROTECTION_DISABLE(hrtc); |
bogdanm | 0:9b334a45a8ff | 1508 | |
bogdanm | 0:9b334a45a8ff | 1509 | /* check if a calibration is pending*/ |
bogdanm | 0:9b334a45a8ff | 1510 | if((hrtc->Instance->ISR & RTC_ISR_RECALPF) != RESET) |
bogdanm | 0:9b334a45a8ff | 1511 | { |
bogdanm | 0:9b334a45a8ff | 1512 | tickstart = HAL_GetTick(); |
bogdanm | 0:9b334a45a8ff | 1513 | |
bogdanm | 0:9b334a45a8ff | 1514 | /* check if a calibration is pending*/ |
bogdanm | 0:9b334a45a8ff | 1515 | while((hrtc->Instance->ISR & RTC_ISR_RECALPF) != RESET) |
bogdanm | 0:9b334a45a8ff | 1516 | { |
bogdanm | 0:9b334a45a8ff | 1517 | if((HAL_GetTick() - tickstart ) > RTC_TIMEOUT_VALUE) |
bogdanm | 0:9b334a45a8ff | 1518 | { |
bogdanm | 0:9b334a45a8ff | 1519 | /* Enable the write protection for RTC registers */ |
bogdanm | 0:9b334a45a8ff | 1520 | __HAL_RTC_WRITEPROTECTION_ENABLE(hrtc); |
bogdanm | 0:9b334a45a8ff | 1521 | |
bogdanm | 0:9b334a45a8ff | 1522 | /* Change RTC state */ |
bogdanm | 0:9b334a45a8ff | 1523 | hrtc->State = HAL_RTC_STATE_TIMEOUT; |
bogdanm | 0:9b334a45a8ff | 1524 | |
bogdanm | 0:9b334a45a8ff | 1525 | /* Process Unlocked */ |
bogdanm | 0:9b334a45a8ff | 1526 | __HAL_UNLOCK(hrtc); |
bogdanm | 0:9b334a45a8ff | 1527 | |
bogdanm | 0:9b334a45a8ff | 1528 | return HAL_TIMEOUT; |
bogdanm | 0:9b334a45a8ff | 1529 | } |
bogdanm | 0:9b334a45a8ff | 1530 | } |
bogdanm | 0:9b334a45a8ff | 1531 | } |
bogdanm | 0:9b334a45a8ff | 1532 | |
bogdanm | 0:9b334a45a8ff | 1533 | /* Configure the Smooth calibration settings */ |
bogdanm | 0:9b334a45a8ff | 1534 | hrtc->Instance->CALR = (uint32_t)((uint32_t)SmoothCalibPeriod | (uint32_t)SmoothCalibPlusPulses | (uint32_t)SmoothCalibMinusPulsesValue); |
bogdanm | 0:9b334a45a8ff | 1535 | |
bogdanm | 0:9b334a45a8ff | 1536 | /* Enable the write protection for RTC registers */ |
bogdanm | 0:9b334a45a8ff | 1537 | __HAL_RTC_WRITEPROTECTION_ENABLE(hrtc); |
bogdanm | 0:9b334a45a8ff | 1538 | |
bogdanm | 0:9b334a45a8ff | 1539 | /* Change RTC state */ |
bogdanm | 0:9b334a45a8ff | 1540 | hrtc->State = HAL_RTC_STATE_READY; |
bogdanm | 0:9b334a45a8ff | 1541 | |
bogdanm | 0:9b334a45a8ff | 1542 | /* Process Unlocked */ |
bogdanm | 0:9b334a45a8ff | 1543 | __HAL_UNLOCK(hrtc); |
bogdanm | 0:9b334a45a8ff | 1544 | |
bogdanm | 0:9b334a45a8ff | 1545 | return HAL_OK; |
bogdanm | 0:9b334a45a8ff | 1546 | } |
bogdanm | 0:9b334a45a8ff | 1547 | |
bogdanm | 0:9b334a45a8ff | 1548 | /** |
mbed_official | 113:b3775bf36a83 | 1549 | * @brief Configure the Synchronization Shift Control Settings. |
bogdanm | 0:9b334a45a8ff | 1550 | * @note When REFCKON is set, firmware must not write to Shift control register. |
bogdanm | 0:9b334a45a8ff | 1551 | * @param hrtc: RTC handle |
bogdanm | 0:9b334a45a8ff | 1552 | * @param ShiftAdd1S: Select to add or not 1 second to the time calendar. |
bogdanm | 0:9b334a45a8ff | 1553 | * This parameter can be one of the following values : |
bogdanm | 0:9b334a45a8ff | 1554 | * @arg RTC_SHIFTADD1S_SET: Add one second to the clock calendar. |
bogdanm | 0:9b334a45a8ff | 1555 | * @arg RTC_SHIFTADD1S_RESET: No effect. |
bogdanm | 0:9b334a45a8ff | 1556 | * @param ShiftSubFS: Select the number of Second Fractions to substitute. |
bogdanm | 0:9b334a45a8ff | 1557 | * This parameter can be one any value from 0 to 0x7FFF. |
bogdanm | 0:9b334a45a8ff | 1558 | * @retval HAL status |
bogdanm | 0:9b334a45a8ff | 1559 | */ |
bogdanm | 0:9b334a45a8ff | 1560 | HAL_StatusTypeDef HAL_RTCEx_SetSynchroShift(RTC_HandleTypeDef* hrtc, uint32_t ShiftAdd1S, uint32_t ShiftSubFS) |
bogdanm | 0:9b334a45a8ff | 1561 | { |
bogdanm | 0:9b334a45a8ff | 1562 | uint32_t tickstart = 0; |
bogdanm | 0:9b334a45a8ff | 1563 | |
bogdanm | 0:9b334a45a8ff | 1564 | /* Check the parameters */ |
bogdanm | 0:9b334a45a8ff | 1565 | assert_param(IS_RTC_SHIFT_ADD1S(ShiftAdd1S)); |
bogdanm | 0:9b334a45a8ff | 1566 | assert_param(IS_RTC_SHIFT_SUBFS(ShiftSubFS)); |
bogdanm | 0:9b334a45a8ff | 1567 | |
bogdanm | 0:9b334a45a8ff | 1568 | /* Process Locked */ |
bogdanm | 0:9b334a45a8ff | 1569 | __HAL_LOCK(hrtc); |
bogdanm | 0:9b334a45a8ff | 1570 | |
bogdanm | 0:9b334a45a8ff | 1571 | hrtc->State = HAL_RTC_STATE_BUSY; |
bogdanm | 0:9b334a45a8ff | 1572 | |
bogdanm | 0:9b334a45a8ff | 1573 | /* Disable the write protection for RTC registers */ |
bogdanm | 0:9b334a45a8ff | 1574 | __HAL_RTC_WRITEPROTECTION_DISABLE(hrtc); |
bogdanm | 0:9b334a45a8ff | 1575 | |
bogdanm | 0:9b334a45a8ff | 1576 | tickstart = HAL_GetTick(); |
bogdanm | 0:9b334a45a8ff | 1577 | |
bogdanm | 0:9b334a45a8ff | 1578 | /* Wait until the shift is completed*/ |
bogdanm | 0:9b334a45a8ff | 1579 | while((hrtc->Instance->ISR & RTC_ISR_SHPF) != RESET) |
bogdanm | 0:9b334a45a8ff | 1580 | { |
bogdanm | 0:9b334a45a8ff | 1581 | if((HAL_GetTick() - tickstart ) > RTC_TIMEOUT_VALUE) |
bogdanm | 0:9b334a45a8ff | 1582 | { |
bogdanm | 0:9b334a45a8ff | 1583 | /* Enable the write protection for RTC registers */ |
bogdanm | 0:9b334a45a8ff | 1584 | __HAL_RTC_WRITEPROTECTION_ENABLE(hrtc); |
bogdanm | 0:9b334a45a8ff | 1585 | |
bogdanm | 0:9b334a45a8ff | 1586 | hrtc->State = HAL_RTC_STATE_TIMEOUT; |
bogdanm | 0:9b334a45a8ff | 1587 | |
bogdanm | 0:9b334a45a8ff | 1588 | /* Process Unlocked */ |
bogdanm | 0:9b334a45a8ff | 1589 | __HAL_UNLOCK(hrtc); |
bogdanm | 0:9b334a45a8ff | 1590 | |
bogdanm | 0:9b334a45a8ff | 1591 | return HAL_TIMEOUT; |
bogdanm | 0:9b334a45a8ff | 1592 | } |
bogdanm | 0:9b334a45a8ff | 1593 | } |
bogdanm | 0:9b334a45a8ff | 1594 | |
bogdanm | 0:9b334a45a8ff | 1595 | /* Check if the reference clock detection is disabled */ |
bogdanm | 0:9b334a45a8ff | 1596 | if((hrtc->Instance->CR & RTC_CR_REFCKON) == RESET) |
bogdanm | 0:9b334a45a8ff | 1597 | { |
bogdanm | 0:9b334a45a8ff | 1598 | /* Configure the Shift settings */ |
bogdanm | 0:9b334a45a8ff | 1599 | hrtc->Instance->SHIFTR = (uint32_t)(uint32_t)(ShiftSubFS) | (uint32_t)(ShiftAdd1S); |
bogdanm | 0:9b334a45a8ff | 1600 | |
bogdanm | 0:9b334a45a8ff | 1601 | /* If RTC_CR_BYPSHAD bit = 0, wait for synchro else this check is not needed */ |
bogdanm | 0:9b334a45a8ff | 1602 | if((hrtc->Instance->CR & RTC_CR_BYPSHAD) == RESET) |
bogdanm | 0:9b334a45a8ff | 1603 | { |
bogdanm | 0:9b334a45a8ff | 1604 | if(HAL_RTC_WaitForSynchro(hrtc) != HAL_OK) |
bogdanm | 0:9b334a45a8ff | 1605 | { |
bogdanm | 0:9b334a45a8ff | 1606 | /* Enable the write protection for RTC registers */ |
bogdanm | 0:9b334a45a8ff | 1607 | __HAL_RTC_WRITEPROTECTION_ENABLE(hrtc); |
bogdanm | 0:9b334a45a8ff | 1608 | |
bogdanm | 0:9b334a45a8ff | 1609 | hrtc->State = HAL_RTC_STATE_ERROR; |
bogdanm | 0:9b334a45a8ff | 1610 | |
bogdanm | 0:9b334a45a8ff | 1611 | /* Process Unlocked */ |
bogdanm | 0:9b334a45a8ff | 1612 | __HAL_UNLOCK(hrtc); |
bogdanm | 0:9b334a45a8ff | 1613 | |
bogdanm | 0:9b334a45a8ff | 1614 | return HAL_ERROR; |
bogdanm | 0:9b334a45a8ff | 1615 | } |
bogdanm | 0:9b334a45a8ff | 1616 | } |
bogdanm | 0:9b334a45a8ff | 1617 | } |
bogdanm | 0:9b334a45a8ff | 1618 | else |
bogdanm | 0:9b334a45a8ff | 1619 | { |
bogdanm | 0:9b334a45a8ff | 1620 | /* Enable the write protection for RTC registers */ |
bogdanm | 0:9b334a45a8ff | 1621 | __HAL_RTC_WRITEPROTECTION_ENABLE(hrtc); |
bogdanm | 0:9b334a45a8ff | 1622 | |
bogdanm | 0:9b334a45a8ff | 1623 | /* Change RTC state */ |
bogdanm | 0:9b334a45a8ff | 1624 | hrtc->State = HAL_RTC_STATE_ERROR; |
bogdanm | 0:9b334a45a8ff | 1625 | |
bogdanm | 0:9b334a45a8ff | 1626 | /* Process Unlocked */ |
bogdanm | 0:9b334a45a8ff | 1627 | __HAL_UNLOCK(hrtc); |
bogdanm | 0:9b334a45a8ff | 1628 | |
bogdanm | 0:9b334a45a8ff | 1629 | return HAL_ERROR; |
bogdanm | 0:9b334a45a8ff | 1630 | } |
bogdanm | 0:9b334a45a8ff | 1631 | |
bogdanm | 0:9b334a45a8ff | 1632 | /* Enable the write protection for RTC registers */ |
bogdanm | 0:9b334a45a8ff | 1633 | __HAL_RTC_WRITEPROTECTION_ENABLE(hrtc); |
bogdanm | 0:9b334a45a8ff | 1634 | |
bogdanm | 0:9b334a45a8ff | 1635 | /* Change RTC state */ |
bogdanm | 0:9b334a45a8ff | 1636 | hrtc->State = HAL_RTC_STATE_READY; |
bogdanm | 0:9b334a45a8ff | 1637 | |
bogdanm | 0:9b334a45a8ff | 1638 | /* Process Unlocked */ |
bogdanm | 0:9b334a45a8ff | 1639 | __HAL_UNLOCK(hrtc); |
bogdanm | 0:9b334a45a8ff | 1640 | |
bogdanm | 0:9b334a45a8ff | 1641 | return HAL_OK; |
bogdanm | 0:9b334a45a8ff | 1642 | } |
bogdanm | 0:9b334a45a8ff | 1643 | |
bogdanm | 0:9b334a45a8ff | 1644 | /** |
mbed_official | 113:b3775bf36a83 | 1645 | * @brief Configure the Calibration Pinout (RTC_CALIB) Selection (1Hz or 512Hz). |
bogdanm | 0:9b334a45a8ff | 1646 | * @param hrtc: RTC handle |
bogdanm | 0:9b334a45a8ff | 1647 | * @param CalibOutput : Select the Calibration output Selection . |
bogdanm | 0:9b334a45a8ff | 1648 | * This parameter can be one of the following values: |
bogdanm | 0:9b334a45a8ff | 1649 | * @arg RTC_CALIBOUTPUT_512HZ: A signal has a regular waveform at 512Hz. |
bogdanm | 0:9b334a45a8ff | 1650 | * @arg RTC_CALIBOUTPUT_1HZ: A signal has a regular waveform at 1Hz. |
bogdanm | 0:9b334a45a8ff | 1651 | * @retval HAL status |
bogdanm | 0:9b334a45a8ff | 1652 | */ |
bogdanm | 0:9b334a45a8ff | 1653 | HAL_StatusTypeDef HAL_RTCEx_SetCalibrationOutPut(RTC_HandleTypeDef* hrtc, uint32_t CalibOutput) |
bogdanm | 0:9b334a45a8ff | 1654 | { |
bogdanm | 0:9b334a45a8ff | 1655 | /* Check the parameters */ |
bogdanm | 0:9b334a45a8ff | 1656 | assert_param(IS_RTC_CALIB_OUTPUT(CalibOutput)); |
bogdanm | 0:9b334a45a8ff | 1657 | |
bogdanm | 0:9b334a45a8ff | 1658 | /* Process Locked */ |
bogdanm | 0:9b334a45a8ff | 1659 | __HAL_LOCK(hrtc); |
bogdanm | 0:9b334a45a8ff | 1660 | |
bogdanm | 0:9b334a45a8ff | 1661 | hrtc->State = HAL_RTC_STATE_BUSY; |
bogdanm | 0:9b334a45a8ff | 1662 | |
bogdanm | 0:9b334a45a8ff | 1663 | /* Disable the write protection for RTC registers */ |
bogdanm | 0:9b334a45a8ff | 1664 | __HAL_RTC_WRITEPROTECTION_DISABLE(hrtc); |
bogdanm | 0:9b334a45a8ff | 1665 | |
bogdanm | 0:9b334a45a8ff | 1666 | /* Clear flags before config */ |
bogdanm | 0:9b334a45a8ff | 1667 | hrtc->Instance->CR &= (uint32_t)~RTC_CR_COSEL; |
bogdanm | 0:9b334a45a8ff | 1668 | |
bogdanm | 0:9b334a45a8ff | 1669 | /* Configure the RTC_CR register */ |
bogdanm | 0:9b334a45a8ff | 1670 | hrtc->Instance->CR |= (uint32_t)CalibOutput; |
bogdanm | 0:9b334a45a8ff | 1671 | |
bogdanm | 0:9b334a45a8ff | 1672 | __HAL_RTC_CALIBRATION_OUTPUT_ENABLE(hrtc); |
bogdanm | 0:9b334a45a8ff | 1673 | |
bogdanm | 0:9b334a45a8ff | 1674 | /* Enable the write protection for RTC registers */ |
bogdanm | 0:9b334a45a8ff | 1675 | __HAL_RTC_WRITEPROTECTION_ENABLE(hrtc); |
bogdanm | 0:9b334a45a8ff | 1676 | |
bogdanm | 0:9b334a45a8ff | 1677 | /* Change RTC state */ |
bogdanm | 0:9b334a45a8ff | 1678 | hrtc->State = HAL_RTC_STATE_READY; |
bogdanm | 0:9b334a45a8ff | 1679 | |
bogdanm | 0:9b334a45a8ff | 1680 | /* Process Unlocked */ |
bogdanm | 0:9b334a45a8ff | 1681 | __HAL_UNLOCK(hrtc); |
bogdanm | 0:9b334a45a8ff | 1682 | |
bogdanm | 0:9b334a45a8ff | 1683 | return HAL_OK; |
bogdanm | 0:9b334a45a8ff | 1684 | } |
bogdanm | 0:9b334a45a8ff | 1685 | |
bogdanm | 0:9b334a45a8ff | 1686 | /** |
mbed_official | 113:b3775bf36a83 | 1687 | * @brief Deactivate the Calibration Pinout (RTC_CALIB) Selection (1Hz or 512Hz). |
bogdanm | 0:9b334a45a8ff | 1688 | * @param hrtc: RTC handle |
bogdanm | 0:9b334a45a8ff | 1689 | * @retval HAL status |
bogdanm | 0:9b334a45a8ff | 1690 | */ |
bogdanm | 0:9b334a45a8ff | 1691 | HAL_StatusTypeDef HAL_RTCEx_DeactivateCalibrationOutPut(RTC_HandleTypeDef* hrtc) |
bogdanm | 0:9b334a45a8ff | 1692 | { |
bogdanm | 0:9b334a45a8ff | 1693 | /* Process Locked */ |
bogdanm | 0:9b334a45a8ff | 1694 | __HAL_LOCK(hrtc); |
bogdanm | 0:9b334a45a8ff | 1695 | |
bogdanm | 0:9b334a45a8ff | 1696 | hrtc->State = HAL_RTC_STATE_BUSY; |
bogdanm | 0:9b334a45a8ff | 1697 | |
bogdanm | 0:9b334a45a8ff | 1698 | /* Disable the write protection for RTC registers */ |
bogdanm | 0:9b334a45a8ff | 1699 | __HAL_RTC_WRITEPROTECTION_DISABLE(hrtc); |
bogdanm | 0:9b334a45a8ff | 1700 | |
bogdanm | 0:9b334a45a8ff | 1701 | __HAL_RTC_CALIBRATION_OUTPUT_DISABLE(hrtc); |
bogdanm | 0:9b334a45a8ff | 1702 | |
bogdanm | 0:9b334a45a8ff | 1703 | /* Enable the write protection for RTC registers */ |
bogdanm | 0:9b334a45a8ff | 1704 | __HAL_RTC_WRITEPROTECTION_ENABLE(hrtc); |
bogdanm | 0:9b334a45a8ff | 1705 | |
bogdanm | 0:9b334a45a8ff | 1706 | /* Change RTC state */ |
bogdanm | 0:9b334a45a8ff | 1707 | hrtc->State = HAL_RTC_STATE_READY; |
bogdanm | 0:9b334a45a8ff | 1708 | |
bogdanm | 0:9b334a45a8ff | 1709 | /* Process Unlocked */ |
bogdanm | 0:9b334a45a8ff | 1710 | __HAL_UNLOCK(hrtc); |
bogdanm | 0:9b334a45a8ff | 1711 | |
bogdanm | 0:9b334a45a8ff | 1712 | return HAL_OK; |
bogdanm | 0:9b334a45a8ff | 1713 | } |
bogdanm | 0:9b334a45a8ff | 1714 | |
bogdanm | 0:9b334a45a8ff | 1715 | /** |
mbed_official | 113:b3775bf36a83 | 1716 | * @brief Enable the RTC reference clock detection. |
bogdanm | 0:9b334a45a8ff | 1717 | * @param hrtc: RTC handle |
bogdanm | 0:9b334a45a8ff | 1718 | * @retval HAL status |
bogdanm | 0:9b334a45a8ff | 1719 | */ |
bogdanm | 0:9b334a45a8ff | 1720 | HAL_StatusTypeDef HAL_RTCEx_SetRefClock(RTC_HandleTypeDef* hrtc) |
bogdanm | 0:9b334a45a8ff | 1721 | { |
bogdanm | 0:9b334a45a8ff | 1722 | /* Process Locked */ |
bogdanm | 0:9b334a45a8ff | 1723 | __HAL_LOCK(hrtc); |
bogdanm | 0:9b334a45a8ff | 1724 | |
bogdanm | 0:9b334a45a8ff | 1725 | hrtc->State = HAL_RTC_STATE_BUSY; |
bogdanm | 0:9b334a45a8ff | 1726 | |
bogdanm | 0:9b334a45a8ff | 1727 | /* Disable the write protection for RTC registers */ |
bogdanm | 0:9b334a45a8ff | 1728 | __HAL_RTC_WRITEPROTECTION_DISABLE(hrtc); |
bogdanm | 0:9b334a45a8ff | 1729 | |
bogdanm | 0:9b334a45a8ff | 1730 | /* Set Initialization mode */ |
bogdanm | 0:9b334a45a8ff | 1731 | if(RTC_EnterInitMode(hrtc) != HAL_OK) |
bogdanm | 0:9b334a45a8ff | 1732 | { |
bogdanm | 0:9b334a45a8ff | 1733 | /* Enable the write protection for RTC registers */ |
bogdanm | 0:9b334a45a8ff | 1734 | __HAL_RTC_WRITEPROTECTION_ENABLE(hrtc); |
bogdanm | 0:9b334a45a8ff | 1735 | |
bogdanm | 0:9b334a45a8ff | 1736 | /* Set RTC state*/ |
bogdanm | 0:9b334a45a8ff | 1737 | hrtc->State = HAL_RTC_STATE_ERROR; |
bogdanm | 0:9b334a45a8ff | 1738 | |
bogdanm | 0:9b334a45a8ff | 1739 | /* Process Unlocked */ |
bogdanm | 0:9b334a45a8ff | 1740 | __HAL_UNLOCK(hrtc); |
bogdanm | 0:9b334a45a8ff | 1741 | |
bogdanm | 0:9b334a45a8ff | 1742 | return HAL_ERROR; |
bogdanm | 0:9b334a45a8ff | 1743 | } |
bogdanm | 0:9b334a45a8ff | 1744 | else |
bogdanm | 0:9b334a45a8ff | 1745 | { |
bogdanm | 0:9b334a45a8ff | 1746 | __HAL_RTC_CLOCKREF_DETECTION_ENABLE(hrtc); |
bogdanm | 0:9b334a45a8ff | 1747 | |
bogdanm | 0:9b334a45a8ff | 1748 | /* Exit Initialization mode */ |
bogdanm | 0:9b334a45a8ff | 1749 | hrtc->Instance->ISR &= (uint32_t)~RTC_ISR_INIT; |
bogdanm | 0:9b334a45a8ff | 1750 | } |
bogdanm | 0:9b334a45a8ff | 1751 | |
bogdanm | 0:9b334a45a8ff | 1752 | /* Enable the write protection for RTC registers */ |
bogdanm | 0:9b334a45a8ff | 1753 | __HAL_RTC_WRITEPROTECTION_ENABLE(hrtc); |
bogdanm | 0:9b334a45a8ff | 1754 | |
bogdanm | 0:9b334a45a8ff | 1755 | /* Change RTC state */ |
bogdanm | 0:9b334a45a8ff | 1756 | hrtc->State = HAL_RTC_STATE_READY; |
bogdanm | 0:9b334a45a8ff | 1757 | |
bogdanm | 0:9b334a45a8ff | 1758 | /* Process Unlocked */ |
bogdanm | 0:9b334a45a8ff | 1759 | __HAL_UNLOCK(hrtc); |
bogdanm | 0:9b334a45a8ff | 1760 | |
bogdanm | 0:9b334a45a8ff | 1761 | return HAL_OK; |
bogdanm | 0:9b334a45a8ff | 1762 | } |
bogdanm | 0:9b334a45a8ff | 1763 | |
bogdanm | 0:9b334a45a8ff | 1764 | /** |
bogdanm | 0:9b334a45a8ff | 1765 | * @brief Disable the RTC reference clock detection. |
bogdanm | 0:9b334a45a8ff | 1766 | * @param hrtc: RTC handle |
bogdanm | 0:9b334a45a8ff | 1767 | * @retval HAL status |
bogdanm | 0:9b334a45a8ff | 1768 | */ |
bogdanm | 0:9b334a45a8ff | 1769 | HAL_StatusTypeDef HAL_RTCEx_DeactivateRefClock(RTC_HandleTypeDef* hrtc) |
bogdanm | 0:9b334a45a8ff | 1770 | { |
bogdanm | 0:9b334a45a8ff | 1771 | /* Process Locked */ |
bogdanm | 0:9b334a45a8ff | 1772 | __HAL_LOCK(hrtc); |
bogdanm | 0:9b334a45a8ff | 1773 | |
bogdanm | 0:9b334a45a8ff | 1774 | hrtc->State = HAL_RTC_STATE_BUSY; |
bogdanm | 0:9b334a45a8ff | 1775 | |
bogdanm | 0:9b334a45a8ff | 1776 | /* Disable the write protection for RTC registers */ |
bogdanm | 0:9b334a45a8ff | 1777 | __HAL_RTC_WRITEPROTECTION_DISABLE(hrtc); |
bogdanm | 0:9b334a45a8ff | 1778 | |
bogdanm | 0:9b334a45a8ff | 1779 | /* Set Initialization mode */ |
bogdanm | 0:9b334a45a8ff | 1780 | if(RTC_EnterInitMode(hrtc) != HAL_OK) |
bogdanm | 0:9b334a45a8ff | 1781 | { |
bogdanm | 0:9b334a45a8ff | 1782 | /* Enable the write protection for RTC registers */ |
bogdanm | 0:9b334a45a8ff | 1783 | __HAL_RTC_WRITEPROTECTION_ENABLE(hrtc); |
bogdanm | 0:9b334a45a8ff | 1784 | |
bogdanm | 0:9b334a45a8ff | 1785 | /* Set RTC state*/ |
bogdanm | 0:9b334a45a8ff | 1786 | hrtc->State = HAL_RTC_STATE_ERROR; |
bogdanm | 0:9b334a45a8ff | 1787 | |
bogdanm | 0:9b334a45a8ff | 1788 | /* Process Unlocked */ |
bogdanm | 0:9b334a45a8ff | 1789 | __HAL_UNLOCK(hrtc); |
bogdanm | 0:9b334a45a8ff | 1790 | |
bogdanm | 0:9b334a45a8ff | 1791 | return HAL_ERROR; |
bogdanm | 0:9b334a45a8ff | 1792 | } |
bogdanm | 0:9b334a45a8ff | 1793 | else |
bogdanm | 0:9b334a45a8ff | 1794 | { |
bogdanm | 0:9b334a45a8ff | 1795 | __HAL_RTC_CLOCKREF_DETECTION_DISABLE(hrtc); |
bogdanm | 0:9b334a45a8ff | 1796 | |
bogdanm | 0:9b334a45a8ff | 1797 | /* Exit Initialization mode */ |
bogdanm | 0:9b334a45a8ff | 1798 | hrtc->Instance->ISR &= (uint32_t)~RTC_ISR_INIT; |
bogdanm | 0:9b334a45a8ff | 1799 | } |
bogdanm | 0:9b334a45a8ff | 1800 | |
bogdanm | 0:9b334a45a8ff | 1801 | /* Enable the write protection for RTC registers */ |
bogdanm | 0:9b334a45a8ff | 1802 | __HAL_RTC_WRITEPROTECTION_ENABLE(hrtc); |
bogdanm | 0:9b334a45a8ff | 1803 | |
bogdanm | 0:9b334a45a8ff | 1804 | /* Change RTC state */ |
bogdanm | 0:9b334a45a8ff | 1805 | hrtc->State = HAL_RTC_STATE_READY; |
bogdanm | 0:9b334a45a8ff | 1806 | |
bogdanm | 0:9b334a45a8ff | 1807 | /* Process Unlocked */ |
bogdanm | 0:9b334a45a8ff | 1808 | __HAL_UNLOCK(hrtc); |
bogdanm | 0:9b334a45a8ff | 1809 | |
bogdanm | 0:9b334a45a8ff | 1810 | return HAL_OK; |
bogdanm | 0:9b334a45a8ff | 1811 | } |
bogdanm | 0:9b334a45a8ff | 1812 | |
bogdanm | 0:9b334a45a8ff | 1813 | /** |
mbed_official | 113:b3775bf36a83 | 1814 | * @brief Enable the Bypass Shadow feature. |
bogdanm | 0:9b334a45a8ff | 1815 | * @param hrtc: RTC handle |
bogdanm | 0:9b334a45a8ff | 1816 | * @note When the Bypass Shadow is enabled the calendar value are taken |
bogdanm | 0:9b334a45a8ff | 1817 | * directly from the Calendar counter. |
bogdanm | 0:9b334a45a8ff | 1818 | * @retval HAL status |
bogdanm | 0:9b334a45a8ff | 1819 | */ |
bogdanm | 0:9b334a45a8ff | 1820 | HAL_StatusTypeDef HAL_RTCEx_EnableBypassShadow(RTC_HandleTypeDef* hrtc) |
bogdanm | 0:9b334a45a8ff | 1821 | { |
bogdanm | 0:9b334a45a8ff | 1822 | /* Process Locked */ |
bogdanm | 0:9b334a45a8ff | 1823 | __HAL_LOCK(hrtc); |
bogdanm | 0:9b334a45a8ff | 1824 | |
bogdanm | 0:9b334a45a8ff | 1825 | hrtc->State = HAL_RTC_STATE_BUSY; |
bogdanm | 0:9b334a45a8ff | 1826 | |
bogdanm | 0:9b334a45a8ff | 1827 | /* Disable the write protection for RTC registers */ |
bogdanm | 0:9b334a45a8ff | 1828 | __HAL_RTC_WRITEPROTECTION_DISABLE(hrtc); |
bogdanm | 0:9b334a45a8ff | 1829 | |
bogdanm | 0:9b334a45a8ff | 1830 | /* Set the BYPSHAD bit */ |
bogdanm | 0:9b334a45a8ff | 1831 | hrtc->Instance->CR |= (uint8_t)RTC_CR_BYPSHAD; |
bogdanm | 0:9b334a45a8ff | 1832 | |
bogdanm | 0:9b334a45a8ff | 1833 | /* Enable the write protection for RTC registers */ |
bogdanm | 0:9b334a45a8ff | 1834 | __HAL_RTC_WRITEPROTECTION_ENABLE(hrtc); |
bogdanm | 0:9b334a45a8ff | 1835 | |
bogdanm | 0:9b334a45a8ff | 1836 | /* Change RTC state */ |
bogdanm | 0:9b334a45a8ff | 1837 | hrtc->State = HAL_RTC_STATE_READY; |
bogdanm | 0:9b334a45a8ff | 1838 | |
bogdanm | 0:9b334a45a8ff | 1839 | /* Process Unlocked */ |
bogdanm | 0:9b334a45a8ff | 1840 | __HAL_UNLOCK(hrtc); |
bogdanm | 0:9b334a45a8ff | 1841 | |
bogdanm | 0:9b334a45a8ff | 1842 | return HAL_OK; |
bogdanm | 0:9b334a45a8ff | 1843 | } |
bogdanm | 0:9b334a45a8ff | 1844 | |
bogdanm | 0:9b334a45a8ff | 1845 | /** |
mbed_official | 113:b3775bf36a83 | 1846 | * @brief Disable the Bypass Shadow feature. |
bogdanm | 0:9b334a45a8ff | 1847 | * @param hrtc: RTC handle |
bogdanm | 0:9b334a45a8ff | 1848 | * @note When the Bypass Shadow is enabled the calendar value are taken |
bogdanm | 0:9b334a45a8ff | 1849 | * directly from the Calendar counter. |
bogdanm | 0:9b334a45a8ff | 1850 | * @retval HAL status |
bogdanm | 0:9b334a45a8ff | 1851 | */ |
bogdanm | 0:9b334a45a8ff | 1852 | HAL_StatusTypeDef HAL_RTCEx_DisableBypassShadow(RTC_HandleTypeDef* hrtc) |
bogdanm | 0:9b334a45a8ff | 1853 | { |
bogdanm | 0:9b334a45a8ff | 1854 | /* Process Locked */ |
bogdanm | 0:9b334a45a8ff | 1855 | __HAL_LOCK(hrtc); |
bogdanm | 0:9b334a45a8ff | 1856 | |
bogdanm | 0:9b334a45a8ff | 1857 | hrtc->State = HAL_RTC_STATE_BUSY; |
bogdanm | 0:9b334a45a8ff | 1858 | |
bogdanm | 0:9b334a45a8ff | 1859 | /* Disable the write protection for RTC registers */ |
bogdanm | 0:9b334a45a8ff | 1860 | __HAL_RTC_WRITEPROTECTION_DISABLE(hrtc); |
bogdanm | 0:9b334a45a8ff | 1861 | |
bogdanm | 0:9b334a45a8ff | 1862 | /* Reset the BYPSHAD bit */ |
bogdanm | 0:9b334a45a8ff | 1863 | hrtc->Instance->CR &= ((uint8_t)~RTC_CR_BYPSHAD); |
bogdanm | 0:9b334a45a8ff | 1864 | |
bogdanm | 0:9b334a45a8ff | 1865 | /* Enable the write protection for RTC registers */ |
bogdanm | 0:9b334a45a8ff | 1866 | __HAL_RTC_WRITEPROTECTION_ENABLE(hrtc); |
bogdanm | 0:9b334a45a8ff | 1867 | |
bogdanm | 0:9b334a45a8ff | 1868 | /* Change RTC state */ |
bogdanm | 0:9b334a45a8ff | 1869 | hrtc->State = HAL_RTC_STATE_READY; |
bogdanm | 0:9b334a45a8ff | 1870 | |
bogdanm | 0:9b334a45a8ff | 1871 | /* Process Unlocked */ |
bogdanm | 0:9b334a45a8ff | 1872 | __HAL_UNLOCK(hrtc); |
bogdanm | 0:9b334a45a8ff | 1873 | |
bogdanm | 0:9b334a45a8ff | 1874 | return HAL_OK; |
bogdanm | 0:9b334a45a8ff | 1875 | } |
bogdanm | 0:9b334a45a8ff | 1876 | |
bogdanm | 0:9b334a45a8ff | 1877 | /** |
bogdanm | 0:9b334a45a8ff | 1878 | * @} |
bogdanm | 0:9b334a45a8ff | 1879 | */ |
bogdanm | 0:9b334a45a8ff | 1880 | |
bogdanm | 0:9b334a45a8ff | 1881 | /** @addtogroup RTCEx_Exported_Functions_Group4 |
bogdanm | 0:9b334a45a8ff | 1882 | * @brief Extended features functions |
bogdanm | 0:9b334a45a8ff | 1883 | * |
bogdanm | 0:9b334a45a8ff | 1884 | @verbatim |
bogdanm | 0:9b334a45a8ff | 1885 | =============================================================================== |
bogdanm | 0:9b334a45a8ff | 1886 | ##### Extended features functions ##### |
bogdanm | 0:9b334a45a8ff | 1887 | =============================================================================== |
bogdanm | 0:9b334a45a8ff | 1888 | [..] This section provides functions allowing to: |
bogdanm | 0:9b334a45a8ff | 1889 | (+) RTC Alram B callback |
bogdanm | 0:9b334a45a8ff | 1890 | (+) RTC Poll for Alarm B request |
bogdanm | 0:9b334a45a8ff | 1891 | |
bogdanm | 0:9b334a45a8ff | 1892 | @endverbatim |
bogdanm | 0:9b334a45a8ff | 1893 | * @{ |
bogdanm | 0:9b334a45a8ff | 1894 | */ |
bogdanm | 0:9b334a45a8ff | 1895 | |
bogdanm | 0:9b334a45a8ff | 1896 | /** |
bogdanm | 0:9b334a45a8ff | 1897 | * @brief Alarm B callback. |
bogdanm | 0:9b334a45a8ff | 1898 | * @param hrtc: RTC handle |
bogdanm | 0:9b334a45a8ff | 1899 | * @retval None |
bogdanm | 0:9b334a45a8ff | 1900 | */ |
bogdanm | 0:9b334a45a8ff | 1901 | __weak void HAL_RTCEx_AlarmBEventCallback(RTC_HandleTypeDef *hrtc) |
bogdanm | 0:9b334a45a8ff | 1902 | { |
mbed_official | 113:b3775bf36a83 | 1903 | /* Prevent unused argument(s) compilation warning */ |
mbed_official | 113:b3775bf36a83 | 1904 | UNUSED(hrtc); |
mbed_official | 113:b3775bf36a83 | 1905 | |
mbed_official | 113:b3775bf36a83 | 1906 | /* NOTE : This function should not be modified, when the callback is needed, |
mbed_official | 113:b3775bf36a83 | 1907 | the HAL_RTCEx_AlarmBEventCallback could be implemented in the user file |
bogdanm | 0:9b334a45a8ff | 1908 | */ |
bogdanm | 0:9b334a45a8ff | 1909 | } |
bogdanm | 0:9b334a45a8ff | 1910 | |
bogdanm | 0:9b334a45a8ff | 1911 | /** |
mbed_official | 113:b3775bf36a83 | 1912 | * @brief Handle Alarm B Polling request. |
bogdanm | 0:9b334a45a8ff | 1913 | * @param hrtc: RTC handle |
bogdanm | 0:9b334a45a8ff | 1914 | * @param Timeout: Timeout duration |
bogdanm | 0:9b334a45a8ff | 1915 | * @retval HAL status |
bogdanm | 0:9b334a45a8ff | 1916 | */ |
bogdanm | 0:9b334a45a8ff | 1917 | HAL_StatusTypeDef HAL_RTCEx_PollForAlarmBEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout) |
bogdanm | 0:9b334a45a8ff | 1918 | { |
bogdanm | 0:9b334a45a8ff | 1919 | uint32_t tickstart = HAL_GetTick(); |
bogdanm | 0:9b334a45a8ff | 1920 | |
bogdanm | 0:9b334a45a8ff | 1921 | while(__HAL_RTC_ALARM_GET_FLAG(hrtc, RTC_FLAG_ALRBF) == RESET) |
bogdanm | 0:9b334a45a8ff | 1922 | { |
bogdanm | 0:9b334a45a8ff | 1923 | if(Timeout != HAL_MAX_DELAY) |
bogdanm | 0:9b334a45a8ff | 1924 | { |
bogdanm | 0:9b334a45a8ff | 1925 | if((Timeout == 0)||((HAL_GetTick() - tickstart ) > Timeout)) |
bogdanm | 0:9b334a45a8ff | 1926 | { |
bogdanm | 0:9b334a45a8ff | 1927 | hrtc->State = HAL_RTC_STATE_TIMEOUT; |
bogdanm | 0:9b334a45a8ff | 1928 | return HAL_TIMEOUT; |
bogdanm | 0:9b334a45a8ff | 1929 | } |
bogdanm | 0:9b334a45a8ff | 1930 | } |
bogdanm | 0:9b334a45a8ff | 1931 | } |
bogdanm | 0:9b334a45a8ff | 1932 | |
bogdanm | 0:9b334a45a8ff | 1933 | /* Clear the Alarm Flag */ |
bogdanm | 0:9b334a45a8ff | 1934 | __HAL_RTC_ALARM_CLEAR_FLAG(hrtc, RTC_FLAG_ALRBF); |
bogdanm | 0:9b334a45a8ff | 1935 | |
bogdanm | 0:9b334a45a8ff | 1936 | /* Change RTC state */ |
bogdanm | 0:9b334a45a8ff | 1937 | hrtc->State = HAL_RTC_STATE_READY; |
bogdanm | 0:9b334a45a8ff | 1938 | |
bogdanm | 0:9b334a45a8ff | 1939 | return HAL_OK; |
bogdanm | 0:9b334a45a8ff | 1940 | } |
bogdanm | 0:9b334a45a8ff | 1941 | |
bogdanm | 0:9b334a45a8ff | 1942 | /** |
bogdanm | 0:9b334a45a8ff | 1943 | * @} |
bogdanm | 0:9b334a45a8ff | 1944 | */ |
bogdanm | 0:9b334a45a8ff | 1945 | |
bogdanm | 0:9b334a45a8ff | 1946 | /** |
bogdanm | 0:9b334a45a8ff | 1947 | * @} |
bogdanm | 0:9b334a45a8ff | 1948 | */ |
mbed_official | 113:b3775bf36a83 | 1949 | |
bogdanm | 0:9b334a45a8ff | 1950 | #endif /* HAL_RTC_MODULE_ENABLED */ |
bogdanm | 0:9b334a45a8ff | 1951 | /** |
bogdanm | 0:9b334a45a8ff | 1952 | * @} |
bogdanm | 0:9b334a45a8ff | 1953 | */ |
bogdanm | 0:9b334a45a8ff | 1954 | |
mbed_official | 113:b3775bf36a83 | 1955 | |
bogdanm | 0:9b334a45a8ff | 1956 | /** |
bogdanm | 0:9b334a45a8ff | 1957 | * @} |
bogdanm | 0:9b334a45a8ff | 1958 | */ |
bogdanm | 0:9b334a45a8ff | 1959 | |
bogdanm | 0:9b334a45a8ff | 1960 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
bogdanm | 0:9b334a45a8ff | 1961 |