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