mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Committer:
<>
Date:
Wed Jan 04 16:58:05 2017 +0000
Revision:
154:37f96f9d4de2
Parent:
149:156823d33999
Child:
165:e614a9f1c9e2
This updates the lib to the mbed lib v133

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 144:ef7eb2e8f9f7 1 /**
<> 144:ef7eb2e8f9f7 2 ******************************************************************************
<> 144:ef7eb2e8f9f7 3 * @file stm32f1xx_hal_iwdg.c
<> 144:ef7eb2e8f9f7 4 * @author MCD Application Team
<> 154:37f96f9d4de2 5 * @version V1.0.5
<> 154:37f96f9d4de2 6 * @date 06-December-2016
<> 144:ef7eb2e8f9f7 7 * @brief IWDG HAL module driver.
<> 144:ef7eb2e8f9f7 8 * This file provides firmware functions to manage the following
<> 144:ef7eb2e8f9f7 9 * functionalities of the Independent Watchdog (IWDG) peripheral:
<> 144:ef7eb2e8f9f7 10 * + Initialization and Configuration functions
<> 144:ef7eb2e8f9f7 11 * + IO operation functions
<> 144:ef7eb2e8f9f7 12 * + Peripheral State functions
<> 144:ef7eb2e8f9f7 13 @verbatim
<> 144:ef7eb2e8f9f7 14 ================================================================================
<> 144:ef7eb2e8f9f7 15 ##### IWDG specific features #####
<> 144:ef7eb2e8f9f7 16 ================================================================================
<> 144:ef7eb2e8f9f7 17 [..]
<> 144:ef7eb2e8f9f7 18 (+) The IWDG can be started by either software or hardware (configurable
<> 144:ef7eb2e8f9f7 19 through option byte).
<> 144:ef7eb2e8f9f7 20 (+) The IWDG is clocked by its own dedicated Low-Speed clock (LSI) and
<> 144:ef7eb2e8f9f7 21 thus stays active even if the main clock fails.
<> 144:ef7eb2e8f9f7 22 (+) Once the IWDG is started, the LSI is forced ON and cannot be disabled
<> 144:ef7eb2e8f9f7 23 (LSI cannot be disabled too), and the counter starts counting down from
<> 144:ef7eb2e8f9f7 24 the reset value of 0xFFF. When it reaches the end of count value (0x000)
<> 144:ef7eb2e8f9f7 25 a system reset is generated.
<> 144:ef7eb2e8f9f7 26 (+) The IWDG counter should be refreshed at regular intervals, otherwise the
<> 144:ef7eb2e8f9f7 27 watchdog generates an MCU reset when the counter reaches 0.
<> 144:ef7eb2e8f9f7 28 (+) The IWDG is implemented in the VDD voltage domain that is still functional
<> 144:ef7eb2e8f9f7 29 in STOP and STANDBY mode (IWDG reset can wake-up from STANDBY).
<> 144:ef7eb2e8f9f7 30 (+) IWDGRST flag in RCC_CSR register can be used to inform when an IWDG
<> 144:ef7eb2e8f9f7 31 reset occurs.
<> 144:ef7eb2e8f9f7 32
<> 144:ef7eb2e8f9f7 33 (+) Min-max timeout value at 40KHz (LSI): 0.1us / 26.2s .
<> 144:ef7eb2e8f9f7 34 The IWDG timeout may vary due to LSI frequency dispersion. STM32F1xx
<> 144:ef7eb2e8f9f7 35 devices provide the capability to measure the LSI frequency (LSI clock
<> 144:ef7eb2e8f9f7 36 connected internally to TIM5 CH4 input capture). The measured value
<> 144:ef7eb2e8f9f7 37 can be used to have an IWDG timeout with an acceptable accuracy.
<> 144:ef7eb2e8f9f7 38 For more information, please refer to the STM32F1xx Reference manual.
<> 144:ef7eb2e8f9f7 39 Note: LSI Calibration is only available on: High density, XL-density and Connectivity line devices.
<> 144:ef7eb2e8f9f7 40
<> 144:ef7eb2e8f9f7 41 ##### How to use this driver #####
<> 144:ef7eb2e8f9f7 42 ==============================================================================
<> 144:ef7eb2e8f9f7 43 [..]
<> 144:ef7eb2e8f9f7 44 (+) Use IWDG using HAL_IWDG_Init() function to :
<> 144:ef7eb2e8f9f7 45 (++) Enable write access to IWDG_PR, IWDG_RLR.
<> 144:ef7eb2e8f9f7 46 (++) Configure the IWDG prescaler, counter reload value.
<> 144:ef7eb2e8f9f7 47 This reload value will be loaded in the IWDG counter each time the counter
<> 144:ef7eb2e8f9f7 48 is reloaded, then the IWDG will start counting down from this value.
<> 144:ef7eb2e8f9f7 49 (+) Use IWDG using HAL_IWDG_Start() function to :
<> 144:ef7eb2e8f9f7 50 (++) Reload IWDG counter with value defined in the IWDG_RLR register.
<> 144:ef7eb2e8f9f7 51 (++) Start the IWDG, when the IWDG is used in software mode (no need
<> 144:ef7eb2e8f9f7 52 to enable the LSI, it will be enabled by hardware).
<> 144:ef7eb2e8f9f7 53 (+) Then the application program must refresh the IWDG counter at regular
<> 144:ef7eb2e8f9f7 54 intervals during normal operation to prevent an MCU reset, using
<> 144:ef7eb2e8f9f7 55 HAL_IWDG_Refresh() function.
<> 144:ef7eb2e8f9f7 56
<> 144:ef7eb2e8f9f7 57 *** IWDG HAL driver macros list ***
<> 144:ef7eb2e8f9f7 58 ====================================
<> 144:ef7eb2e8f9f7 59 [..]
<> 144:ef7eb2e8f9f7 60 Below the list of most used macros in IWDG HAL driver.
<> 144:ef7eb2e8f9f7 61
<> 144:ef7eb2e8f9f7 62 (+) __HAL_IWDG_START: Enable the IWDG peripheral
<> 144:ef7eb2e8f9f7 63 (+) __HAL_IWDG_RELOAD_COUNTER: Reloads IWDG counter with value defined in the reload register
<> 144:ef7eb2e8f9f7 64 (+) __HAL_IWDG_GET_FLAG: Get the selected IWDG's flag status
<> 144:ef7eb2e8f9f7 65
<> 144:ef7eb2e8f9f7 66 @endverbatim
<> 144:ef7eb2e8f9f7 67 ******************************************************************************
<> 144:ef7eb2e8f9f7 68 * @attention
<> 144:ef7eb2e8f9f7 69 *
<> 144:ef7eb2e8f9f7 70 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
<> 144:ef7eb2e8f9f7 71 *
<> 144:ef7eb2e8f9f7 72 * Redistribution and use in source and binary forms, with or without modification,
<> 144:ef7eb2e8f9f7 73 * are permitted provided that the following conditions are met:
<> 144:ef7eb2e8f9f7 74 * 1. Redistributions of source code must retain the above copyright notice,
<> 144:ef7eb2e8f9f7 75 * this list of conditions and the following disclaimer.
<> 144:ef7eb2e8f9f7 76 * 2. Redistributions in binary form must reproduce the above copyright notice,
<> 144:ef7eb2e8f9f7 77 * this list of conditions and the following disclaimer in the documentation
<> 144:ef7eb2e8f9f7 78 * and/or other materials provided with the distribution.
<> 144:ef7eb2e8f9f7 79 * 3. Neither the name of STMicroelectronics nor the names of its contributors
<> 144:ef7eb2e8f9f7 80 * may be used to endorse or promote products derived from this software
<> 144:ef7eb2e8f9f7 81 * without specific prior written permission.
<> 144:ef7eb2e8f9f7 82 *
<> 144:ef7eb2e8f9f7 83 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
<> 144:ef7eb2e8f9f7 84 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
<> 144:ef7eb2e8f9f7 85 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
<> 144:ef7eb2e8f9f7 86 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
<> 144:ef7eb2e8f9f7 87 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
<> 144:ef7eb2e8f9f7 88 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
<> 144:ef7eb2e8f9f7 89 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
<> 144:ef7eb2e8f9f7 90 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
<> 144:ef7eb2e8f9f7 91 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
<> 144:ef7eb2e8f9f7 92 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<> 144:ef7eb2e8f9f7 93 *
<> 144:ef7eb2e8f9f7 94 ******************************************************************************
<> 144:ef7eb2e8f9f7 95 */
<> 144:ef7eb2e8f9f7 96
<> 144:ef7eb2e8f9f7 97 /* Includes ------------------------------------------------------------------*/
<> 144:ef7eb2e8f9f7 98 #include "stm32f1xx_hal.h"
<> 144:ef7eb2e8f9f7 99
<> 144:ef7eb2e8f9f7 100 /** @addtogroup STM32F1xx_HAL_Driver
<> 144:ef7eb2e8f9f7 101 * @{
<> 144:ef7eb2e8f9f7 102 */
<> 144:ef7eb2e8f9f7 103
<> 144:ef7eb2e8f9f7 104 /** @defgroup IWDG IWDG
<> 144:ef7eb2e8f9f7 105 * @brief IWDG HAL module driver.
<> 144:ef7eb2e8f9f7 106 * @{
<> 144:ef7eb2e8f9f7 107 */
<> 144:ef7eb2e8f9f7 108
<> 144:ef7eb2e8f9f7 109 #ifdef HAL_IWDG_MODULE_ENABLED
<> 144:ef7eb2e8f9f7 110
<> 144:ef7eb2e8f9f7 111 /* Private typedef -----------------------------------------------------------*/
<> 144:ef7eb2e8f9f7 112 /* Private define ------------------------------------------------------------*/
<> 144:ef7eb2e8f9f7 113
<> 144:ef7eb2e8f9f7 114 /** @defgroup IWDG_Private_Constants IWDG Private Constants
<> 144:ef7eb2e8f9f7 115 * @{
<> 144:ef7eb2e8f9f7 116 */
<> 144:ef7eb2e8f9f7 117
<> 144:ef7eb2e8f9f7 118 #define IWDG_DEFAULT_TIMEOUT (uint32_t)1000
<> 144:ef7eb2e8f9f7 119
<> 144:ef7eb2e8f9f7 120 /**
<> 144:ef7eb2e8f9f7 121 * @}
<> 144:ef7eb2e8f9f7 122 */
<> 144:ef7eb2e8f9f7 123
<> 144:ef7eb2e8f9f7 124 /* Private macro -------------------------------------------------------------*/
<> 144:ef7eb2e8f9f7 125 /* Private variables ---------------------------------------------------------*/
<> 144:ef7eb2e8f9f7 126 /* Private function prototypes -----------------------------------------------*/
<> 144:ef7eb2e8f9f7 127 /* Private functions ---------------------------------------------------------*/
<> 144:ef7eb2e8f9f7 128
<> 144:ef7eb2e8f9f7 129 /** @defgroup IWDG_Exported_Functions IWDG Exported Functions
<> 144:ef7eb2e8f9f7 130 * @{
<> 144:ef7eb2e8f9f7 131 */
<> 144:ef7eb2e8f9f7 132
<> 144:ef7eb2e8f9f7 133 /** @defgroup IWDG_Exported_Functions_Group1 Initialization and de-initialization functions
<> 144:ef7eb2e8f9f7 134 * @brief Initialization and Configuration functions.
<> 144:ef7eb2e8f9f7 135 *
<> 144:ef7eb2e8f9f7 136 @verbatim
<> 144:ef7eb2e8f9f7 137 ===============================================================================
<> 144:ef7eb2e8f9f7 138 ##### Initialization and de-initialization functions #####
<> 144:ef7eb2e8f9f7 139 ===============================================================================
<> 144:ef7eb2e8f9f7 140 [..] This section provides functions allowing to:
<> 144:ef7eb2e8f9f7 141 (+) Initialize the IWDG according to the specified parameters
<> 144:ef7eb2e8f9f7 142 in the IWDG_InitTypeDef and create the associated handle
<> 144:ef7eb2e8f9f7 143 (+) Initialize the IWDG MSP
<> 144:ef7eb2e8f9f7 144 (+) DeInitialize IWDG MSP
<> 144:ef7eb2e8f9f7 145
<> 144:ef7eb2e8f9f7 146 @endverbatim
<> 144:ef7eb2e8f9f7 147 * @{
<> 144:ef7eb2e8f9f7 148 */
<> 144:ef7eb2e8f9f7 149
<> 144:ef7eb2e8f9f7 150 /**
<> 144:ef7eb2e8f9f7 151 * @brief Initializes the IWDG according to the specified
<> 144:ef7eb2e8f9f7 152 * parameters in the IWDG_InitTypeDef and creates the associated handle.
<> 144:ef7eb2e8f9f7 153 * @param hiwdg: pointer to a IWDG_HandleTypeDef structure that contains
<> 144:ef7eb2e8f9f7 154 * the configuration information for the specified IWDG module.
<> 144:ef7eb2e8f9f7 155 * @retval HAL status
<> 144:ef7eb2e8f9f7 156 */
<> 144:ef7eb2e8f9f7 157 HAL_StatusTypeDef HAL_IWDG_Init(IWDG_HandleTypeDef *hiwdg)
<> 144:ef7eb2e8f9f7 158 {
<> 144:ef7eb2e8f9f7 159 /* Check the IWDG handle allocation */
<> 144:ef7eb2e8f9f7 160 if(hiwdg == NULL)
<> 144:ef7eb2e8f9f7 161 {
<> 144:ef7eb2e8f9f7 162 return HAL_ERROR;
<> 144:ef7eb2e8f9f7 163 }
<> 144:ef7eb2e8f9f7 164
<> 144:ef7eb2e8f9f7 165 /* Check the parameters */
<> 144:ef7eb2e8f9f7 166 assert_param(IS_IWDG_ALL_INSTANCE(hiwdg->Instance));
<> 144:ef7eb2e8f9f7 167 assert_param(IS_IWDG_PRESCALER(hiwdg->Init.Prescaler));
<> 144:ef7eb2e8f9f7 168 assert_param(IS_IWDG_RELOAD(hiwdg->Init.Reload));
<> 144:ef7eb2e8f9f7 169
<> 144:ef7eb2e8f9f7 170 /* Check pending flag, if previous update not done, return error */
<> 144:ef7eb2e8f9f7 171 if((__HAL_IWDG_GET_FLAG(hiwdg, IWDG_FLAG_PVU) != RESET)
<> 144:ef7eb2e8f9f7 172 &&(__HAL_IWDG_GET_FLAG(hiwdg, IWDG_FLAG_RVU) != RESET))
<> 144:ef7eb2e8f9f7 173 {
<> 144:ef7eb2e8f9f7 174 return HAL_ERROR;
<> 144:ef7eb2e8f9f7 175 }
<> 144:ef7eb2e8f9f7 176
<> 144:ef7eb2e8f9f7 177 if(hiwdg->State == HAL_IWDG_STATE_RESET)
<> 144:ef7eb2e8f9f7 178 {
<> 144:ef7eb2e8f9f7 179 /* Allocate lock resource and initialize it */
<> 144:ef7eb2e8f9f7 180 hiwdg->Lock = HAL_UNLOCKED;
<> 144:ef7eb2e8f9f7 181
<> 144:ef7eb2e8f9f7 182 /* Init the low level hardware */
<> 144:ef7eb2e8f9f7 183 HAL_IWDG_MspInit(hiwdg);
<> 144:ef7eb2e8f9f7 184 }
<> 144:ef7eb2e8f9f7 185
<> 144:ef7eb2e8f9f7 186 /* Change IWDG peripheral state */
<> 144:ef7eb2e8f9f7 187 hiwdg->State = HAL_IWDG_STATE_BUSY;
<> 144:ef7eb2e8f9f7 188
<> 144:ef7eb2e8f9f7 189 /* Enable write access to IWDG_PR and IWDG_RLR registers */
<> 144:ef7eb2e8f9f7 190 IWDG_ENABLE_WRITE_ACCESS(hiwdg);
<> 144:ef7eb2e8f9f7 191
<> 144:ef7eb2e8f9f7 192 /* Write to IWDG registers the IWDG_Prescaler & IWDG_Reload values to work with */
<> 144:ef7eb2e8f9f7 193 MODIFY_REG(hiwdg->Instance->PR, IWDG_PR_PR, hiwdg->Init.Prescaler);
<> 144:ef7eb2e8f9f7 194 MODIFY_REG(hiwdg->Instance->RLR, IWDG_RLR_RL, hiwdg->Init.Reload);
<> 144:ef7eb2e8f9f7 195
<> 144:ef7eb2e8f9f7 196 /* Change IWDG peripheral state */
<> 144:ef7eb2e8f9f7 197 hiwdg->State = HAL_IWDG_STATE_READY;
<> 144:ef7eb2e8f9f7 198
<> 144:ef7eb2e8f9f7 199 /* Return function status */
<> 144:ef7eb2e8f9f7 200 return HAL_OK;
<> 144:ef7eb2e8f9f7 201 }
<> 144:ef7eb2e8f9f7 202
<> 144:ef7eb2e8f9f7 203 /**
<> 144:ef7eb2e8f9f7 204 * @brief Initializes the IWDG MSP.
<> 144:ef7eb2e8f9f7 205 * @param hiwdg: pointer to a IWDG_HandleTypeDef structure that contains
<> 144:ef7eb2e8f9f7 206 * the configuration information for the specified IWDG module.
<> 144:ef7eb2e8f9f7 207 * @retval None
<> 144:ef7eb2e8f9f7 208 */
<> 144:ef7eb2e8f9f7 209 __weak void HAL_IWDG_MspInit(IWDG_HandleTypeDef *hiwdg)
<> 144:ef7eb2e8f9f7 210 {
<> 144:ef7eb2e8f9f7 211 /* Prevent unused argument(s) compilation warning */
<> 144:ef7eb2e8f9f7 212 UNUSED(hiwdg);
<> 144:ef7eb2e8f9f7 213 /* NOTE : This function Should not be modified, when the callback is needed,
<> 144:ef7eb2e8f9f7 214 the HAL_IWDG_MspInit could be implemented in the user file
<> 144:ef7eb2e8f9f7 215 */
<> 144:ef7eb2e8f9f7 216 }
<> 144:ef7eb2e8f9f7 217
<> 144:ef7eb2e8f9f7 218 /**
<> 144:ef7eb2e8f9f7 219 * @}
<> 144:ef7eb2e8f9f7 220 */
<> 144:ef7eb2e8f9f7 221
<> 144:ef7eb2e8f9f7 222 /** @defgroup IWDG_Exported_Functions_Group2 IO operation functions
<> 144:ef7eb2e8f9f7 223 * @brief IO operation functions
<> 144:ef7eb2e8f9f7 224 *
<> 144:ef7eb2e8f9f7 225 @verbatim
<> 144:ef7eb2e8f9f7 226 ===============================================================================
<> 144:ef7eb2e8f9f7 227 ##### IO operation functions #####
<> 144:ef7eb2e8f9f7 228 ===============================================================================
<> 144:ef7eb2e8f9f7 229 [..] This section provides functions allowing to:
<> 144:ef7eb2e8f9f7 230 (+) Start the IWDG.
<> 144:ef7eb2e8f9f7 231 (+) Refresh the IWDG.
<> 144:ef7eb2e8f9f7 232
<> 144:ef7eb2e8f9f7 233 @endverbatim
<> 144:ef7eb2e8f9f7 234 * @{
<> 144:ef7eb2e8f9f7 235 */
<> 144:ef7eb2e8f9f7 236
<> 144:ef7eb2e8f9f7 237 /**
<> 144:ef7eb2e8f9f7 238 * @brief Starts the IWDG.
<> 144:ef7eb2e8f9f7 239 * @param hiwdg: pointer to a IWDG_HandleTypeDef structure that contains
<> 144:ef7eb2e8f9f7 240 * the configuration information for the specified IWDG module.
<> 144:ef7eb2e8f9f7 241 * @retval HAL status
<> 144:ef7eb2e8f9f7 242 */
<> 144:ef7eb2e8f9f7 243 HAL_StatusTypeDef HAL_IWDG_Start(IWDG_HandleTypeDef *hiwdg)
<> 144:ef7eb2e8f9f7 244 {
<> 144:ef7eb2e8f9f7 245 /* Process Locked */
<> 144:ef7eb2e8f9f7 246 __HAL_LOCK(hiwdg);
<> 144:ef7eb2e8f9f7 247
<> 144:ef7eb2e8f9f7 248 /* Change IWDG peripheral state */
<> 144:ef7eb2e8f9f7 249 hiwdg->State = HAL_IWDG_STATE_BUSY;
<> 144:ef7eb2e8f9f7 250
<> 144:ef7eb2e8f9f7 251 /* Start the IWDG peripheral */
<> 144:ef7eb2e8f9f7 252 __HAL_IWDG_START(hiwdg);
<> 144:ef7eb2e8f9f7 253
<> 144:ef7eb2e8f9f7 254 /* Reload IWDG counter with value defined in the RLR register */
<> 144:ef7eb2e8f9f7 255 __HAL_IWDG_RELOAD_COUNTER(hiwdg);
<> 144:ef7eb2e8f9f7 256
<> 144:ef7eb2e8f9f7 257 /* Change IWDG peripheral state */
<> 144:ef7eb2e8f9f7 258 hiwdg->State = HAL_IWDG_STATE_READY;
<> 144:ef7eb2e8f9f7 259
<> 144:ef7eb2e8f9f7 260 /* Process Unlocked */
<> 144:ef7eb2e8f9f7 261 __HAL_UNLOCK(hiwdg);
<> 144:ef7eb2e8f9f7 262
<> 144:ef7eb2e8f9f7 263 /* Return function status */
<> 144:ef7eb2e8f9f7 264 return HAL_OK;
<> 144:ef7eb2e8f9f7 265 }
<> 144:ef7eb2e8f9f7 266
<> 144:ef7eb2e8f9f7 267 /**
<> 144:ef7eb2e8f9f7 268 * @brief Refreshes the IWDG.
<> 144:ef7eb2e8f9f7 269 * @param hiwdg: pointer to a IWDG_HandleTypeDef structure that contains
<> 144:ef7eb2e8f9f7 270 * the configuration information for the specified IWDG module.
<> 144:ef7eb2e8f9f7 271 * @retval HAL status
<> 144:ef7eb2e8f9f7 272 */
<> 144:ef7eb2e8f9f7 273 HAL_StatusTypeDef HAL_IWDG_Refresh(IWDG_HandleTypeDef *hiwdg)
<> 144:ef7eb2e8f9f7 274 {
<> 144:ef7eb2e8f9f7 275 uint32_t tickstart = 0;
<> 144:ef7eb2e8f9f7 276
<> 144:ef7eb2e8f9f7 277 /* Process Locked */
<> 144:ef7eb2e8f9f7 278 __HAL_LOCK(hiwdg);
<> 144:ef7eb2e8f9f7 279
<> 144:ef7eb2e8f9f7 280 /* Change IWDG peripheral state */
<> 144:ef7eb2e8f9f7 281 hiwdg->State = HAL_IWDG_STATE_BUSY;
<> 144:ef7eb2e8f9f7 282
<> 144:ef7eb2e8f9f7 283 tickstart = HAL_GetTick();
<> 144:ef7eb2e8f9f7 284
<> 144:ef7eb2e8f9f7 285 /* Wait until RVU flag is RESET */
<> 144:ef7eb2e8f9f7 286 while(__HAL_IWDG_GET_FLAG(hiwdg, IWDG_FLAG_RVU) != RESET)
<> 144:ef7eb2e8f9f7 287 {
<> 144:ef7eb2e8f9f7 288 if((HAL_GetTick() - tickstart ) > IWDG_DEFAULT_TIMEOUT)
<> 144:ef7eb2e8f9f7 289 {
<> 144:ef7eb2e8f9f7 290 /* Set IWDG state */
<> 144:ef7eb2e8f9f7 291 hiwdg->State = HAL_IWDG_STATE_TIMEOUT;
<> 144:ef7eb2e8f9f7 292
<> 144:ef7eb2e8f9f7 293 /* Process unlocked */
<> 144:ef7eb2e8f9f7 294 __HAL_UNLOCK(hiwdg);
<> 144:ef7eb2e8f9f7 295
<> 144:ef7eb2e8f9f7 296 return HAL_TIMEOUT;
<> 144:ef7eb2e8f9f7 297 }
<> 144:ef7eb2e8f9f7 298 }
<> 144:ef7eb2e8f9f7 299
<> 144:ef7eb2e8f9f7 300 /* Reload IWDG counter with value defined in the reload register */
<> 144:ef7eb2e8f9f7 301 __HAL_IWDG_RELOAD_COUNTER(hiwdg);
<> 144:ef7eb2e8f9f7 302
<> 144:ef7eb2e8f9f7 303 /* Change IWDG peripheral state */
<> 144:ef7eb2e8f9f7 304 hiwdg->State = HAL_IWDG_STATE_READY;
<> 144:ef7eb2e8f9f7 305
<> 144:ef7eb2e8f9f7 306 /* Process Unlocked */
<> 144:ef7eb2e8f9f7 307 __HAL_UNLOCK(hiwdg);
<> 144:ef7eb2e8f9f7 308
<> 144:ef7eb2e8f9f7 309 /* Return function status */
<> 144:ef7eb2e8f9f7 310 return HAL_OK;
<> 144:ef7eb2e8f9f7 311 }
<> 144:ef7eb2e8f9f7 312
<> 144:ef7eb2e8f9f7 313 /**
<> 144:ef7eb2e8f9f7 314 * @}
<> 144:ef7eb2e8f9f7 315 */
<> 144:ef7eb2e8f9f7 316
<> 144:ef7eb2e8f9f7 317 /** @defgroup IWDG_Exported_Functions_Group3 Peripheral State functions
<> 144:ef7eb2e8f9f7 318 * @brief Peripheral State functions.
<> 144:ef7eb2e8f9f7 319 *
<> 144:ef7eb2e8f9f7 320 @verbatim
<> 144:ef7eb2e8f9f7 321 ===============================================================================
<> 144:ef7eb2e8f9f7 322 ##### Peripheral State functions #####
<> 144:ef7eb2e8f9f7 323 ===============================================================================
<> 144:ef7eb2e8f9f7 324 [..]
<> 144:ef7eb2e8f9f7 325 This subsection permits to get in run-time the status of the peripheral
<> 144:ef7eb2e8f9f7 326 and the data flow.
<> 144:ef7eb2e8f9f7 327
<> 144:ef7eb2e8f9f7 328 @endverbatim
<> 144:ef7eb2e8f9f7 329 * @{
<> 144:ef7eb2e8f9f7 330 */
<> 144:ef7eb2e8f9f7 331
<> 144:ef7eb2e8f9f7 332 /**
<> 144:ef7eb2e8f9f7 333 * @brief Returns the IWDG state.
<> 144:ef7eb2e8f9f7 334 * @param hiwdg: pointer to a IWDG_HandleTypeDef structure that contains
<> 144:ef7eb2e8f9f7 335 * the configuration information for the specified IWDG module.
<> 144:ef7eb2e8f9f7 336 * @retval HAL state
<> 144:ef7eb2e8f9f7 337 */
<> 144:ef7eb2e8f9f7 338 HAL_IWDG_StateTypeDef HAL_IWDG_GetState(IWDG_HandleTypeDef *hiwdg)
<> 144:ef7eb2e8f9f7 339 {
<> 144:ef7eb2e8f9f7 340 return hiwdg->State;
<> 144:ef7eb2e8f9f7 341 }
<> 144:ef7eb2e8f9f7 342
<> 144:ef7eb2e8f9f7 343 /**
<> 144:ef7eb2e8f9f7 344 * @}
<> 144:ef7eb2e8f9f7 345 */
<> 144:ef7eb2e8f9f7 346
<> 144:ef7eb2e8f9f7 347 /**
<> 144:ef7eb2e8f9f7 348 * @}
<> 144:ef7eb2e8f9f7 349 */
<> 144:ef7eb2e8f9f7 350
<> 144:ef7eb2e8f9f7 351 #endif /* HAL_IWDG_MODULE_ENABLED */
<> 144:ef7eb2e8f9f7 352 /**
<> 144:ef7eb2e8f9f7 353 * @}
<> 144:ef7eb2e8f9f7 354 */
<> 144:ef7eb2e8f9f7 355
<> 144:ef7eb2e8f9f7 356 /**
<> 144:ef7eb2e8f9f7 357 * @}
<> 144:ef7eb2e8f9f7 358 */
<> 144:ef7eb2e8f9f7 359
<> 144:ef7eb2e8f9f7 360 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/