mbed library sources

Dependents:   frdm_kl05z_gpio_test

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Fri Jun 27 07:30:09 2014 +0100
Revision:
242:7074e42da0b2
Parent:
133:d4dda5c437f0
Synchronized with git revision 124ef5e3add9e74a3221347a3fbeea7c8b3cf353

Full URL: https://github.com/mbedmicro/mbed/commit/124ef5e3add9e74a3221347a3fbeea7c8b3cf353/

[DISCO_F407VG] HAL update.

Who changed what in which revision?

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