Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2 | Rev 9 | ||
|---|---|---|---|
| Line 3... | Line 3... | ||
| 3 | * @file stm32f1xx_hal_wwdg.c |
3 | * @file stm32f1xx_hal_wwdg.c |
| 4 | * @author MCD Application Team |
4 | * @author MCD Application Team |
| 5 | * @brief WWDG HAL module driver. |
5 | * @brief WWDG HAL module driver. |
| 6 | * This file provides firmware functions to manage the following |
6 | * This file provides firmware functions to manage the following |
| 7 | * functionalities of the Window Watchdog (WWDG) peripheral: |
7 | * functionalities of the Window Watchdog (WWDG) peripheral: |
| 8 | * + Initialization and de-initialization functions |
8 | * + Initialization and Configuration functions |
| 9 | * + IO operation functions |
9 | * + IO operation functions |
| 10 | * + Peripheral State functions |
- | |
| 11 | @verbatim |
10 | @verbatim |
| 12 | ============================================================================== |
11 | ============================================================================== |
| 13 | ##### WWDG specific features ##### |
12 | ##### WWDG Specific features ##### |
| 14 | ============================================================================== |
13 | ============================================================================== |
| 15 | [..] |
14 | [..] |
| 16 | Once enabled the WWDG generates a system reset on expiry of a programmed |
15 | Once enabled the WWDG generates a system reset on expiry of a programmed |
| 17 | time period, unless the program refreshes the counter (downcounter) |
16 | time period, unless the program refreshes the counter (T[6;0] downcounter) |
| 18 | before reaching 0x3F value (i.e. a reset is generated when the counter |
17 | before reaching 0x3F value (i.e. a reset is generated when the counter |
| 19 | value rolls over from 0x40 to 0x3F). |
18 | value rolls down from 0x40 to 0x3F). |
| 20 | 19 | ||
| 21 | (+) An MCU reset is also generated if the counter value is refreshed |
20 | (+) An MCU reset is also generated if the counter value is refreshed |
| 22 | before the counter has reached the refresh window value. This |
21 | before the counter has reached the refresh window value. This |
| 23 | implies that the counter must be refreshed in a limited window. |
22 | implies that the counter must be refreshed in a limited window. |
| 24 | (+) Once enabled the WWDG cannot be disabled except by a system reset. |
23 | (+) Once enabled the WWDG cannot be disabled except by a system reset. |
| - | 24 | (+) If required by application, an Early Wakeup Interrupt can be triggered |
|
| - | 25 | in order to be warned before WWDG expiration. The Early Wakeup Interrupt |
|
| - | 26 | (EWI) can be used if specific safety operations or data logging must |
|
| - | 27 | be performed before the actual reset is generated. When the downcounter |
|
| - | 28 | reaches 0x40, interrupt occurs. This mechanism requires WWDG interrupt |
|
| - | 29 | line to be enabled in NVIC. Once enabled, EWI interrupt cannot be |
|
| - | 30 | disabled except by a system reset. |
|
| 25 | (+) WWDGRST flag in RCC_CSR register can be used to inform when a WWDG |
31 | (+) WWDGRST flag in RCC CSR register can be used to inform when a WWDG |
| 26 | reset occurs. |
32 | reset occurs. |
| 27 | (+) The WWDG counter input clock is derived from the APB clock divided |
33 | (+) The WWDG counter input clock is derived from the APB clock divided |
| 28 | by a programmable prescaler. |
34 | by a programmable prescaler. |
| 29 | (+) WWDG clock (Hz) = PCLK1 / (4096 * Prescaler) |
35 | (+) WWDG clock (Hz) = PCLK1 / (4096 * Prescaler) |
| 30 | (+) WWDG timeout (mS) = 1000 * Counter / WWDG clock |
36 | (+) WWDG timeout (mS) = 1000 * (T[5;0] + 1) / WWDG clock (Hz) |
| - | 37 | where T[5;0] are the lowest 6 bits of Counter. |
|
| 31 | (+) WWDG Counter refresh is allowed between the following limits : |
38 | (+) WWDG Counter refresh is allowed between the following limits : |
| 32 | (++) min time (mS) = 1000 * (Counter _ Window) / WWDG clock |
39 | (++) min time (mS) = 1000 * (Counter - Window) / WWDG clock |
| 33 | (++) max time (mS) = 1000 * (Counter _ 0x40) / WWDG clock |
40 | (++) max time (mS) = 1000 * (Counter - 0x40) / WWDG clock |
| 34 | - | ||
| 35 | (+) Min-max timeout value at 36 MHz(PCLK1): 910 us / 58.25 ms |
41 | (+) Typical values: |
| 36 | - | ||
| 37 | (+) The Early Wakeup Interrupt (EWI) can be used if specific safety |
- | |
| 38 | operations or data logging must be performed before the actual reset is |
42 | (++) Counter min (T[5;0] = 0x00) at 36MHz (PCLK1) with zero prescaler: |
| 39 | generated. When the downcounter reaches the value 0x40, an EWI interrupt |
- | |
| 40 | is generated and the corresponding interrupt service routine (ISR) can |
- | |
| 41 | be used to trigger specific actions (such as communications or data |
- | |
| 42 | logging), before resetting the device. |
43 | max timeout before reset: approximately 910µs |
| 43 | In some applications, the EWI interrupt can be used to manage a software |
- | |
| 44 | system check and/or system recovery/graceful degradation, without |
- | |
| 45 | generating a WWDG reset. In this case, the corresponding interrupt |
44 | (++) Counter max (T[5;0] = 0x3F) at 36MHz (PCLK1) with prescaler |
| 46 | service routine (ISR) should reload the WWDG counter to avoid the WWDG |
- | |
| 47 | reset, then trigger the required actions. |
45 | dividing by 8: |
| 48 | Note:When the EWI interrupt cannot be served, e.g. due to a system lock |
- | |
| 49 | in a higher priority task, the WWDG reset will eventually be generated. |
46 | max timeout before reset: approximately 58.25ms |
| 50 | - | ||
| 51 | (+) Debug mode : When the microcontroller enters debug mode (core halted), |
- | |
| 52 | the WWDG counter either continues to work normally or stops, depending |
- | |
| 53 | on DBG_WWDG_STOP configuration bit in DBG module, accessible through |
- | |
| 54 | __HAL_DBGMCU_FREEZE_WWDG() and __HAL_DBGMCU_UNFREEZE_WWDG() macros |
- | |
| 55 | 47 | ||
| 56 | ##### How to use this driver ##### |
48 | ##### How to use this driver ##### |
| 57 | ============================================================================== |
49 | ============================================================================== |
| 58 | [..] |
- | |
| 59 | (+) Enable WWDG APB1 clock using __HAL_RCC_WWDG_CLK_ENABLE(). |
- | |
| 60 | 50 | ||
| 61 | (+) Set the WWDG prescaler, refresh window, counter value and Early Wakeup |
- | |
| 62 | Interrupt mode using using HAL_WWDG_Init() function. |
- | |
| 63 | This enables WWDG peripheral and the downcounter starts downcounting |
- | |
| 64 | from given counter value. |
51 | *** Common driver usage *** |
| 65 | Init function can be called again to modify all watchdog parameters, |
- | |
| 66 | however if EWI mode has been set once, it can't be clear until next |
- | |
| 67 | reset. |
52 | =========================== |
| 68 | 53 | ||
| - | 54 | [..] |
|
| - | 55 | (+) Enable WWDG APB1 clock using __HAL_RCC_WWDG_CLK_ENABLE(). |
|
| - | 56 | (+) Configure the WWDG prescaler, refresh window value, counter value and early |
|
| - | 57 | interrupt status using HAL_WWDG_Init() function. This will automatically |
|
| - | 58 | enable WWDG and start its downcounter. Time reference can be taken from |
|
| - | 59 | function exit. Care must be taken to provide a counter value |
|
| - | 60 | greater than 0x40 to prevent generation of immediate reset. |
|
| - | 61 | (+) If the Early Wakeup Interrupt (EWI) feature is enabled, an interrupt is |
|
| - | 62 | generated when the counter reaches 0x40. When HAL_WWDG_IRQHandler is |
|
| - | 63 | triggered by the interrupt service routine, flag will be automatically |
|
| - | 64 | cleared and HAL_WWDG_WakeupCallback user callback will be executed. User |
|
| - | 65 | can add his own code by customization of callback HAL_WWDG_WakeupCallback. |
|
| 69 | (+) The application program must refresh the WWDG counter at regular |
66 | (+) Then the application program must refresh the WWDG counter at regular |
| 70 | intervals during normal operation to prevent an MCU reset using |
67 | intervals during normal operation to prevent an MCU reset, using |
| 71 | HAL_WWDG_Refresh() function. This operation must occur only when |
68 | HAL_WWDG_Refresh() function. This operation must occur only when |
| 72 | the counter is lower than the window value already programmed. |
69 | the counter is lower than the refresh window value already programmed. |
| 73 | 70 | ||
| - | 71 | *** Callback registration *** |
|
| - | 72 | ============================= |
|
| - | 73 | ||
| - | 74 | [..] |
|
| - | 75 | The compilation define USE_HAL_WWDG_REGISTER_CALLBACKS when set to 1 allows |
|
| - | 76 | the user to configure dynamically the driver callbacks. Use Functions |
|
| - | 77 | HAL_WWDG_RegisterCallback() to register a user callback. |
|
| - | 78 | ||
| - | 79 | (+) Function HAL_WWDG_RegisterCallback() allows to register following |
|
| - | 80 | callbacks: |
|
| - | 81 | (++) EwiCallback : callback for Early WakeUp Interrupt. |
|
| - | 82 | (++) MspInitCallback : WWDG MspInit. |
|
| 74 | (+) if Early Wakeup Interrupt mode is enable an interrupt is generated when |
83 | This function takes as parameters the HAL peripheral handle, the Callback ID |
| 75 | the counter reaches 0x40. User can add his own code in weak function |
84 | and a pointer to the user callback function. |
| - | 85 | ||
| - | 86 | (+) Use function HAL_WWDG_UnRegisterCallback() to reset a callback to |
|
| - | 87 | the default weak (surcharged) function. HAL_WWDG_UnRegisterCallback() |
|
| - | 88 | takes as parameters the HAL peripheral handle and the Callback ID. |
|
| - | 89 | This function allows to reset following callbacks: |
|
| - | 90 | (++) EwiCallback : callback for Early WakeUp Interrupt. |
|
| 76 | HAL_WWDG_EarlyWakeupCallback(). |
91 | (++) MspInitCallback : WWDG MspInit. |
| - | 92 | ||
| - | 93 | [..] |
|
| - | 94 | When calling HAL_WWDG_Init function, callbacks are reset to the |
|
| - | 95 | corresponding legacy weak (surcharged) functions: |
|
| - | 96 | HAL_WWDG_EarlyWakeupCallback() and HAL_WWDG_MspInit() only if they have |
|
| - | 97 | not been registered before. |
|
| - | 98 | ||
| - | 99 | [..] |
|
| - | 100 | When compilation define USE_HAL_WWDG_REGISTER_CALLBACKS is set to 0 or |
|
| - | 101 | not defined, the callback registering feature is not available |
|
| - | 102 | and weak (surcharged) callbacks are used. |
|
| 77 | 103 | ||
| 78 | *** WWDG HAL driver macros list *** |
104 | *** WWDG HAL driver macros list *** |
| 79 | ================================== |
105 | =================================== |
| 80 | [..] |
106 | [..] |
| 81 | Below the list of most used macros in WWDG HAL driver. |
107 | Below the list of available macros in WWDG HAL driver. |
| 82 | - | ||
| 83 | (+) __HAL_WWDG_GET_IT_SOURCE: Check the selected WWDG's interrupt source. |
108 | (+) __HAL_WWDG_ENABLE: Enable the WWDG peripheral |
| 84 | (+) __HAL_WWDG_GET_FLAG: Get the selected WWDG's flag status. |
109 | (+) __HAL_WWDG_GET_FLAG: Get the selected WWDG's flag status |
| 85 | (+) __HAL_WWDG_CLEAR_FLAG: Clear the WWDG's pending flags. |
110 | (+) __HAL_WWDG_CLEAR_FLAG: Clear the WWDG's pending flags |
| - | 111 | (+) __HAL_WWDG_ENABLE_IT: Enable the WWDG early wakeup interrupt |
|
| 86 | 112 | ||
| 87 | @endverbatim |
113 | @endverbatim |
| 88 | ****************************************************************************** |
114 | ****************************************************************************** |
| 89 | * @attention |
115 | * @attention |
| 90 | * |
116 | * |
| 91 | * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> |
117 | * <h2><center>© Copyright (c) 2016 STMicroelectronics. |
| 92 | * |
- | |
| 93 | * Redistribution and use in source and binary forms, with or without modification, |
- | |
| 94 | * are permitted provided that the following conditions are met: |
- | |
| 95 | * 1. Redistributions of source code must retain the above copyright notice, |
- | |
| 96 | * this list of conditions and the following disclaimer. |
- | |
| 97 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
- | |
| 98 | * this list of conditions and the following disclaimer in the documentation |
- | |
| 99 | * and/or other materials provided with the distribution. |
- | |
| 100 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
- | |
| 101 | * may be used to endorse or promote products derived from this software |
- | |
| 102 | * without specific prior written permission. |
118 | * All rights reserved.</center></h2> |
| 103 | * |
119 | * |
| 104 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
120 | * This software component is licensed by ST under BSD 3-Clause license, |
| 105 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
- | |
| 106 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
- | |
| 107 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
- | |
| 108 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
- | |
| 109 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
121 | * the "License"; You may not use this file except in compliance with the |
| 110 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
122 | * License. You may obtain a copy of the License at: |
| 111 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
- | |
| 112 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
- | |
| 113 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
123 | * opensource.org/licenses/BSD-3-Clause |
| 114 | * |
124 | * |
| 115 | ****************************************************************************** |
125 | ****************************************************************************** |
| 116 | */ |
126 | */ |
| 117 | 127 | ||
| 118 | /* Includes ------------------------------------------------------------------*/ |
128 | /* Includes ------------------------------------------------------------------*/ |
| Line 176... | Line 186... | ||
| 176 | assert_param(IS_WWDG_PRESCALER(hwwdg->Init.Prescaler)); |
186 | assert_param(IS_WWDG_PRESCALER(hwwdg->Init.Prescaler)); |
| 177 | assert_param(IS_WWDG_WINDOW(hwwdg->Init.Window)); |
187 | assert_param(IS_WWDG_WINDOW(hwwdg->Init.Window)); |
| 178 | assert_param(IS_WWDG_COUNTER(hwwdg->Init.Counter)); |
188 | assert_param(IS_WWDG_COUNTER(hwwdg->Init.Counter)); |
| 179 | assert_param(IS_WWDG_EWI_MODE(hwwdg->Init.EWIMode)); |
189 | assert_param(IS_WWDG_EWI_MODE(hwwdg->Init.EWIMode)); |
| 180 | 190 | ||
| - | 191 | #if (USE_HAL_WWDG_REGISTER_CALLBACKS == 1) |
|
| - | 192 | /* Reset Callback pointers */ |
|
| - | 193 | if (hwwdg->EwiCallback == NULL) |
|
| - | 194 | { |
|
| - | 195 | hwwdg->EwiCallback = HAL_WWDG_EarlyWakeupCallback; |
|
| - | 196 | } |
|
| - | 197 | ||
| - | 198 | if (hwwdg->MspInitCallback == NULL) |
|
| - | 199 | { |
|
| - | 200 | hwwdg->MspInitCallback = HAL_WWDG_MspInit; |
|
| - | 201 | } |
|
| - | 202 | ||
| - | 203 | /* Init the low level hardware */ |
|
| - | 204 | hwwdg->MspInitCallback(hwwdg); |
|
| - | 205 | #else |
|
| 181 | /* Init the low level hardware */ |
206 | /* Init the low level hardware */ |
| 182 | HAL_WWDG_MspInit(hwwdg); |
207 | HAL_WWDG_MspInit(hwwdg); |
| - | 208 | #endif /* USE_HAL_WWDG_REGISTER_CALLBACKS */ |
|
| 183 | 209 | ||
| 184 | /* Set WWDG Counter */ |
210 | /* Set WWDG Counter */ |
| 185 | WRITE_REG(hwwdg->Instance->CR, (WWDG_CR_WDGA | hwwdg->Init.Counter)); |
211 | WRITE_REG(hwwdg->Instance->CR, (WWDG_CR_WDGA | hwwdg->Init.Counter)); |
| 186 | 212 | ||
| 187 | /* Set WWDG Prescaler and Window */ |
213 | /* Set WWDG Prescaler and Window */ |
| Line 189... | Line 215... | ||
| 189 | 215 | ||
| 190 | /* Return function status */ |
216 | /* Return function status */ |
| 191 | return HAL_OK; |
217 | return HAL_OK; |
| 192 | } |
218 | } |
| 193 | 219 | ||
| - | 220 | ||
| 194 | /** |
221 | /** |
| 195 | * @brief Initialize the WWDG MSP. |
222 | * @brief Initialize the WWDG MSP. |
| 196 | * @param hwwdg pointer to a WWDG_HandleTypeDef structure that contains |
223 | * @param hwwdg pointer to a WWDG_HandleTypeDef structure that contains |
| 197 | * the configuration information for the specified WWDG module. |
224 | * the configuration information for the specified WWDG module. |
| 198 | * @note When rewriting this function in user file, mechanism may be added |
225 | * @note When rewriting this function in user file, mechanism may be added |
| Line 208... | Line 235... | ||
| 208 | /* NOTE: This function should not be modified, when the callback is needed, |
235 | /* NOTE: This function should not be modified, when the callback is needed, |
| 209 | the HAL_WWDG_MspInit could be implemented in the user file |
236 | the HAL_WWDG_MspInit could be implemented in the user file |
| 210 | */ |
237 | */ |
| 211 | } |
238 | } |
| 212 | 239 | ||
| - | 240 | ||
| - | 241 | #if (USE_HAL_WWDG_REGISTER_CALLBACKS == 1) |
|
| - | 242 | /** |
|
| - | 243 | * @brief Register a User WWDG Callback |
|
| - | 244 | * To be used instead of the weak (surcharged) predefined callback |
|
| - | 245 | * @param hwwdg WWDG handle |
|
| - | 246 | * @param CallbackID ID of the callback to be registered |
|
| - | 247 | * This parameter can be one of the following values: |
|
| - | 248 | * @arg @ref HAL_WWDG_EWI_CB_ID Early WakeUp Interrupt Callback ID |
|
| - | 249 | * @arg @ref HAL_WWDG_MSPINIT_CB_ID MspInit callback ID |
|
| - | 250 | * @param pCallback pointer to the Callback function |
|
| - | 251 | * @retval status |
|
| - | 252 | */ |
|
| - | 253 | HAL_StatusTypeDef HAL_WWDG_RegisterCallback(WWDG_HandleTypeDef *hwwdg, HAL_WWDG_CallbackIDTypeDef CallbackID, |
|
| - | 254 | pWWDG_CallbackTypeDef pCallback) |
|
| - | 255 | { |
|
| - | 256 | HAL_StatusTypeDef status = HAL_OK; |
|
| - | 257 | ||
| - | 258 | if (pCallback == NULL) |
|
| - | 259 | { |
|
| - | 260 | status = HAL_ERROR; |
|
| - | 261 | } |
|
| - | 262 | else |
|
| - | 263 | { |
|
| - | 264 | switch (CallbackID) |
|
| - | 265 | { |
|
| - | 266 | case HAL_WWDG_EWI_CB_ID: |
|
| - | 267 | hwwdg->EwiCallback = pCallback; |
|
| - | 268 | break; |
|
| - | 269 | ||
| - | 270 | case HAL_WWDG_MSPINIT_CB_ID: |
|
| - | 271 | hwwdg->MspInitCallback = pCallback; |
|
| - | 272 | break; |
|
| - | 273 | ||
| - | 274 | default: |
|
| - | 275 | status = HAL_ERROR; |
|
| - | 276 | break; |
|
| - | 277 | } |
|
| - | 278 | } |
|
| - | 279 | ||
| - | 280 | return status; |
|
| - | 281 | } |
|
| - | 282 | ||
| - | 283 | ||
| - | 284 | /** |
|
| - | 285 | * @brief Unregister a WWDG Callback |
|
| - | 286 | * WWDG Callback is redirected to the weak (surcharged) predefined callback |
|
| - | 287 | * @param hwwdg WWDG handle |
|
| - | 288 | * @param CallbackID ID of the callback to be registered |
|
| - | 289 | * This parameter can be one of the following values: |
|
| - | 290 | * @arg @ref HAL_WWDG_EWI_CB_ID Early WakeUp Interrupt Callback ID |
|
| - | 291 | * @arg @ref HAL_WWDG_MSPINIT_CB_ID MspInit callback ID |
|
| - | 292 | * @retval status |
|
| - | 293 | */ |
|
| - | 294 | HAL_StatusTypeDef HAL_WWDG_UnRegisterCallback(WWDG_HandleTypeDef *hwwdg, HAL_WWDG_CallbackIDTypeDef CallbackID) |
|
| - | 295 | { |
|
| - | 296 | HAL_StatusTypeDef status = HAL_OK; |
|
| - | 297 | ||
| - | 298 | switch (CallbackID) |
|
| - | 299 | { |
|
| - | 300 | case HAL_WWDG_EWI_CB_ID: |
|
| - | 301 | hwwdg->EwiCallback = HAL_WWDG_EarlyWakeupCallback; |
|
| - | 302 | break; |
|
| - | 303 | ||
| - | 304 | case HAL_WWDG_MSPINIT_CB_ID: |
|
| - | 305 | hwwdg->MspInitCallback = HAL_WWDG_MspInit; |
|
| - | 306 | break; |
|
| - | 307 | ||
| - | 308 | default: |
|
| - | 309 | status = HAL_ERROR; |
|
| - | 310 | break; |
|
| - | 311 | } |
|
| - | 312 | ||
| - | 313 | return status; |
|
| - | 314 | } |
|
| - | 315 | #endif /* USE_HAL_WWDG_REGISTER_CALLBACKS */ |
|
| - | 316 | ||
| 213 | /** |
317 | /** |
| 214 | * @} |
318 | * @} |
| 215 | */ |
319 | */ |
| 216 | 320 | ||
| 217 | /** @defgroup WWDG_Exported_Functions_Group2 IO operation functions |
321 | /** @defgroup WWDG_Exported_Functions_Group2 IO operation functions |
| 218 | * @brief IO operation functions |
322 | * @brief IO operation functions |
| 219 | * |
323 | * |
| 220 | @verbatim |
324 | @verbatim |
| 221 | ============================================================================== |
325 | ============================================================================== |
| 222 | ##### IO operation functions ##### |
326 | ##### IO operation functions ##### |
| 223 | ============================================================================== |
327 | ============================================================================== |
| 224 | [..] |
328 | [..] |
| Line 268... | Line 372... | ||
| 268 | if (__HAL_WWDG_GET_FLAG(hwwdg, WWDG_FLAG_EWIF) != RESET) |
372 | if (__HAL_WWDG_GET_FLAG(hwwdg, WWDG_FLAG_EWIF) != RESET) |
| 269 | { |
373 | { |
| 270 | /* Clear the WWDG Early Wakeup flag */ |
374 | /* Clear the WWDG Early Wakeup flag */ |
| 271 | __HAL_WWDG_CLEAR_FLAG(hwwdg, WWDG_FLAG_EWIF); |
375 | __HAL_WWDG_CLEAR_FLAG(hwwdg, WWDG_FLAG_EWIF); |
| 272 | 376 | ||
| - | 377 | #if (USE_HAL_WWDG_REGISTER_CALLBACKS == 1) |
|
| - | 378 | /* Early Wakeup registered callback */ |
|
| - | 379 | hwwdg->EwiCallback(hwwdg); |
|
| - | 380 | #else |
|
| 273 | /* Early Wakeup callback */ |
381 | /* Early Wakeup callback */ |
| 274 | HAL_WWDG_EarlyWakeupCallback(hwwdg); |
382 | HAL_WWDG_EarlyWakeupCallback(hwwdg); |
| - | 383 | #endif /* USE_HAL_WWDG_REGISTER_CALLBACKS */ |
|
| 275 | } |
384 | } |
| 276 | } |
385 | } |
| 277 | } |
386 | } |
| 278 | 387 | ||
| - | 388 | ||
| 279 | /** |
389 | /** |
| 280 | * @brief WWDG Early Wakeup callback. |
390 | * @brief WWDG Early Wakeup callback. |
| 281 | * @param hwwdg : pointer to a WWDG_HandleTypeDef structure that contains |
391 | * @param hwwdg pointer to a WWDG_HandleTypeDef structure that contains |
| 282 | * the configuration information for the specified WWDG module. |
392 | * the configuration information for the specified WWDG module. |
| 283 | * @retval None |
393 | * @retval None |
| 284 | */ |
394 | */ |
| 285 | __weak void HAL_WWDG_EarlyWakeupCallback(WWDG_HandleTypeDef *hwwdg) |
395 | __weak void HAL_WWDG_EarlyWakeupCallback(WWDG_HandleTypeDef *hwwdg) |
| 286 | { |
396 | { |