Mouse code for the MacroRat

Dependencies:   ITG3200 QEI

Committer:
sahilmgandhi
Date:
Sat Jun 03 00:22:44 2017 +0000
Revision:
46:b156ef445742
Parent:
18:6a4db94011d3
Final code for internal battlebot competition.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sahilmgandhi 18:6a4db94011d3 1 /**
sahilmgandhi 18:6a4db94011d3 2 ******************************************************************************
sahilmgandhi 18:6a4db94011d3 3 * @file stm32f2xx_hal_wwdg.c
sahilmgandhi 18:6a4db94011d3 4 * @author MCD Application Team
sahilmgandhi 18:6a4db94011d3 5 * @version V1.1.3
sahilmgandhi 18:6a4db94011d3 6 * @date 29-June-2016
sahilmgandhi 18:6a4db94011d3 7 * @brief WWDG HAL module driver.
sahilmgandhi 18:6a4db94011d3 8 * This file provides firmware functions to manage the following
sahilmgandhi 18:6a4db94011d3 9 * functionalities of the Window Watchdog (WWDG) peripheral:
sahilmgandhi 18:6a4db94011d3 10 * + Initialization and de-initialization functions
sahilmgandhi 18:6a4db94011d3 11 * + IO operation functions
sahilmgandhi 18:6a4db94011d3 12 * + Peripheral State functions
sahilmgandhi 18:6a4db94011d3 13 @verbatim
sahilmgandhi 18:6a4db94011d3 14 ==============================================================================
sahilmgandhi 18:6a4db94011d3 15 ##### WWDG specific features #####
sahilmgandhi 18:6a4db94011d3 16 ==============================================================================
sahilmgandhi 18:6a4db94011d3 17 [..]
sahilmgandhi 18:6a4db94011d3 18 Once enabled the WWDG generates a system reset on expiry of a programmed
sahilmgandhi 18:6a4db94011d3 19 time period, unless the program refreshes the counter (downcounter)
sahilmgandhi 18:6a4db94011d3 20 before reaching 0x3F value (i.e. a reset is generated when the counter
sahilmgandhi 18:6a4db94011d3 21 value rolls over from 0x40 to 0x3F).
sahilmgandhi 18:6a4db94011d3 22
sahilmgandhi 18:6a4db94011d3 23 (+) An MCU reset is also generated if the counter value is refreshed
sahilmgandhi 18:6a4db94011d3 24 before the counter has reached the refresh window value. This
sahilmgandhi 18:6a4db94011d3 25 implies that the counter must be refreshed in a limited window.
sahilmgandhi 18:6a4db94011d3 26 (+) Once enabled the WWDG cannot be disabled except by a system reset.
sahilmgandhi 18:6a4db94011d3 27 (+) WWDGRST flag in RCC_CSR register can be used to inform when a WWDG
sahilmgandhi 18:6a4db94011d3 28 reset occurs.
sahilmgandhi 18:6a4db94011d3 29 (+) The WWDG counter input clock is derived from the APB clock divided
sahilmgandhi 18:6a4db94011d3 30 by a programmable prescaler.
sahilmgandhi 18:6a4db94011d3 31 (+) WWDG clock (Hz) = PCLK1 / (4096 * Prescaler)
sahilmgandhi 18:6a4db94011d3 32 (+) WWDG timeout (mS) = 1000 * Counter / WWDG clock
sahilmgandhi 18:6a4db94011d3 33 (+) WWDG Counter refresh is allowed between the following limits :
sahilmgandhi 18:6a4db94011d3 34 (++) min time (mS) = 1000 * (Counter _ Window) / WWDG clock
sahilmgandhi 18:6a4db94011d3 35 (++) max time (mS) = 1000 * (Counter _ 0x40) / WWDG clock
sahilmgandhi 18:6a4db94011d3 36
sahilmgandhi 18:6a4db94011d3 37 (+) Min-max timeout value at 50 MHz(PCLK1): 81.9 us / 41.9 ms
sahilmgandhi 18:6a4db94011d3 38
sahilmgandhi 18:6a4db94011d3 39 (+) The Early Wakeup Interrupt (EWI) can be used if specific safety
sahilmgandhi 18:6a4db94011d3 40 operations or data logging must be performed before the actual reset is
sahilmgandhi 18:6a4db94011d3 41 generated. When the downcounter reaches the value 0x40, an EWI interrupt
sahilmgandhi 18:6a4db94011d3 42 is generated and the corresponding interrupt service routine (ISR) can
sahilmgandhi 18:6a4db94011d3 43 be used to trigger specific actions (such as communications or data
sahilmgandhi 18:6a4db94011d3 44 logging), before resetting the device.
sahilmgandhi 18:6a4db94011d3 45 In some applications, the EWI interrupt can be used to manage a software
sahilmgandhi 18:6a4db94011d3 46 system check and/or system recovery/graceful degradation, without
sahilmgandhi 18:6a4db94011d3 47 generating a WWDG reset. In this case, the corresponding interrupt
sahilmgandhi 18:6a4db94011d3 48 service routine (ISR) should reload the WWDG counter to avoid the WWDG
sahilmgandhi 18:6a4db94011d3 49 reset, then trigger the required actions.
sahilmgandhi 18:6a4db94011d3 50 Note:When the EWI interrupt cannot be served, e.g. due to a system lock
sahilmgandhi 18:6a4db94011d3 51 in a higher priority task, the WWDG reset will eventually be generated.
sahilmgandhi 18:6a4db94011d3 52
sahilmgandhi 18:6a4db94011d3 53 (+) Debug mode : When the microcontroller enters debug mode (core halted),
sahilmgandhi 18:6a4db94011d3 54 the WWDG counter either continues to work normally or stops, depending
sahilmgandhi 18:6a4db94011d3 55 on DBG_WWDG_STOP configuration bit in DBG module, accessible through
sahilmgandhi 18:6a4db94011d3 56 __HAL_DBGMCU_FREEZE_WWDG() and __HAL_DBGMCU_UNFREEZE_WWDG() macros
sahilmgandhi 18:6a4db94011d3 57
sahilmgandhi 18:6a4db94011d3 58 ##### How to use this driver #####
sahilmgandhi 18:6a4db94011d3 59 ==============================================================================
sahilmgandhi 18:6a4db94011d3 60 [..]
sahilmgandhi 18:6a4db94011d3 61 (+) Enable WWDG APB1 clock using __HAL_RCC_WWDG_CLK_ENABLE().
sahilmgandhi 18:6a4db94011d3 62
sahilmgandhi 18:6a4db94011d3 63 (+) Set the WWDG prescaler, refresh window, counter value and Early Wakeup
sahilmgandhi 18:6a4db94011d3 64 Interrupt mode using using HAL_WWDG_Init() function.
sahilmgandhi 18:6a4db94011d3 65 This enables WWDG peripheral and the downcounter starts downcounting
sahilmgandhi 18:6a4db94011d3 66 from given counter value.
sahilmgandhi 18:6a4db94011d3 67 Init function can be called again to modify all watchdog parameters,
sahilmgandhi 18:6a4db94011d3 68 however if EWI mode has been set once, it can't be clear until next
sahilmgandhi 18:6a4db94011d3 69 reset.
sahilmgandhi 18:6a4db94011d3 70
sahilmgandhi 18:6a4db94011d3 71 (+) The application program must refresh the WWDG counter at regular
sahilmgandhi 18:6a4db94011d3 72 intervals during normal operation to prevent an MCU reset using
sahilmgandhi 18:6a4db94011d3 73 HAL_WWDG_Refresh() function. This operation must occur only when
sahilmgandhi 18:6a4db94011d3 74 the counter is lower than the window value already programmed.
sahilmgandhi 18:6a4db94011d3 75
sahilmgandhi 18:6a4db94011d3 76 (+) if Early Wakeup Interrupt mode is enable an interrupt is generated when
sahilmgandhi 18:6a4db94011d3 77 the counter reaches 0x40. User can add his own code in weak function
sahilmgandhi 18:6a4db94011d3 78 HAL_WWDG_EarlyWakeupCallback().
sahilmgandhi 18:6a4db94011d3 79
sahilmgandhi 18:6a4db94011d3 80 *** WWDG HAL driver macros list ***
sahilmgandhi 18:6a4db94011d3 81 ==================================
sahilmgandhi 18:6a4db94011d3 82 [..]
sahilmgandhi 18:6a4db94011d3 83 Below the list of most used macros in WWDG HAL driver.
sahilmgandhi 18:6a4db94011d3 84
sahilmgandhi 18:6a4db94011d3 85 (+) __HAL_WWDG_GET_IT_SOURCE: Check the selected WWDG's interrupt source.
sahilmgandhi 18:6a4db94011d3 86 (+) __HAL_WWDG_GET_FLAG: Get the selected WWDG's flag status.
sahilmgandhi 18:6a4db94011d3 87 (+) __HAL_WWDG_CLEAR_FLAG: Clear the WWDG's pending flags.
sahilmgandhi 18:6a4db94011d3 88
sahilmgandhi 18:6a4db94011d3 89 @endverbatim
sahilmgandhi 18:6a4db94011d3 90 ******************************************************************************
sahilmgandhi 18:6a4db94011d3 91 * @attention
sahilmgandhi 18:6a4db94011d3 92 *
sahilmgandhi 18:6a4db94011d3 93 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
sahilmgandhi 18:6a4db94011d3 94 *
sahilmgandhi 18:6a4db94011d3 95 * Redistribution and use in source and binary forms, with or without modification,
sahilmgandhi 18:6a4db94011d3 96 * are permitted provided that the following conditions are met:
sahilmgandhi 18:6a4db94011d3 97 * 1. Redistributions of source code must retain the above copyright notice,
sahilmgandhi 18:6a4db94011d3 98 * this list of conditions and the following disclaimer.
sahilmgandhi 18:6a4db94011d3 99 * 2. Redistributions in binary form must reproduce the above copyright notice,
sahilmgandhi 18:6a4db94011d3 100 * this list of conditions and the following disclaimer in the documentation
sahilmgandhi 18:6a4db94011d3 101 * and/or other materials provided with the distribution.
sahilmgandhi 18:6a4db94011d3 102 * 3. Neither the name of STMicroelectronics nor the names of its contributors
sahilmgandhi 18:6a4db94011d3 103 * may be used to endorse or promote products derived from this software
sahilmgandhi 18:6a4db94011d3 104 * without specific prior written permission.
sahilmgandhi 18:6a4db94011d3 105 *
sahilmgandhi 18:6a4db94011d3 106 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
sahilmgandhi 18:6a4db94011d3 107 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
sahilmgandhi 18:6a4db94011d3 108 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
sahilmgandhi 18:6a4db94011d3 109 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
sahilmgandhi 18:6a4db94011d3 110 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
sahilmgandhi 18:6a4db94011d3 111 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
sahilmgandhi 18:6a4db94011d3 112 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
sahilmgandhi 18:6a4db94011d3 113 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
sahilmgandhi 18:6a4db94011d3 114 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
sahilmgandhi 18:6a4db94011d3 115 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
sahilmgandhi 18:6a4db94011d3 116 *
sahilmgandhi 18:6a4db94011d3 117 ******************************************************************************
sahilmgandhi 18:6a4db94011d3 118 */
sahilmgandhi 18:6a4db94011d3 119
sahilmgandhi 18:6a4db94011d3 120 /* Includes ------------------------------------------------------------------*/
sahilmgandhi 18:6a4db94011d3 121 #include "stm32f2xx_hal.h"
sahilmgandhi 18:6a4db94011d3 122
sahilmgandhi 18:6a4db94011d3 123 /** @addtogroup STM32F2xx_HAL_Driver
sahilmgandhi 18:6a4db94011d3 124 * @{
sahilmgandhi 18:6a4db94011d3 125 */
sahilmgandhi 18:6a4db94011d3 126
sahilmgandhi 18:6a4db94011d3 127 #ifdef HAL_WWDG_MODULE_ENABLED
sahilmgandhi 18:6a4db94011d3 128 /** @defgroup WWDG WWDG
sahilmgandhi 18:6a4db94011d3 129 * @brief WWDG HAL module driver.
sahilmgandhi 18:6a4db94011d3 130 * @{
sahilmgandhi 18:6a4db94011d3 131 */
sahilmgandhi 18:6a4db94011d3 132
sahilmgandhi 18:6a4db94011d3 133 /* Private typedef -----------------------------------------------------------*/
sahilmgandhi 18:6a4db94011d3 134 /* Private define ------------------------------------------------------------*/
sahilmgandhi 18:6a4db94011d3 135 /* Private macro -------------------------------------------------------------*/
sahilmgandhi 18:6a4db94011d3 136 /* Private variables ---------------------------------------------------------*/
sahilmgandhi 18:6a4db94011d3 137 /* Private function prototypes -----------------------------------------------*/
sahilmgandhi 18:6a4db94011d3 138 /* Exported functions --------------------------------------------------------*/
sahilmgandhi 18:6a4db94011d3 139
sahilmgandhi 18:6a4db94011d3 140 /** @defgroup WWDG_Exported_Functions WWDG Exported Functions
sahilmgandhi 18:6a4db94011d3 141 * @{
sahilmgandhi 18:6a4db94011d3 142 */
sahilmgandhi 18:6a4db94011d3 143
sahilmgandhi 18:6a4db94011d3 144 /** @defgroup WWDG_Exported_Functions_Group1 Initialization and Configuration functions
sahilmgandhi 18:6a4db94011d3 145 * @brief Initialization and Configuration functions.
sahilmgandhi 18:6a4db94011d3 146 *
sahilmgandhi 18:6a4db94011d3 147 @verbatim
sahilmgandhi 18:6a4db94011d3 148 ==============================================================================
sahilmgandhi 18:6a4db94011d3 149 ##### Initialization and Configuration functions #####
sahilmgandhi 18:6a4db94011d3 150 ==============================================================================
sahilmgandhi 18:6a4db94011d3 151 [..]
sahilmgandhi 18:6a4db94011d3 152 This section provides functions allowing to:
sahilmgandhi 18:6a4db94011d3 153 (+) Initialize and start the WWDG according to the specified parameters
sahilmgandhi 18:6a4db94011d3 154 in the WWDG_InitTypeDef of associated handle.
sahilmgandhi 18:6a4db94011d3 155 (+) Initialize the WWDG MSP.
sahilmgandhi 18:6a4db94011d3 156
sahilmgandhi 18:6a4db94011d3 157 @endverbatim
sahilmgandhi 18:6a4db94011d3 158 * @{
sahilmgandhi 18:6a4db94011d3 159 */
sahilmgandhi 18:6a4db94011d3 160
sahilmgandhi 18:6a4db94011d3 161 /**
sahilmgandhi 18:6a4db94011d3 162 * @brief Initialize the WWDG according to the specified.
sahilmgandhi 18:6a4db94011d3 163 * parameters in the WWDG_InitTypeDef of associated handle.
sahilmgandhi 18:6a4db94011d3 164 * @param hwwdg pointer to a WWDG_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 165 * the configuration information for the specified WWDG module.
sahilmgandhi 18:6a4db94011d3 166 * @retval HAL status
sahilmgandhi 18:6a4db94011d3 167 */
sahilmgandhi 18:6a4db94011d3 168 HAL_StatusTypeDef HAL_WWDG_Init(WWDG_HandleTypeDef *hwwdg)
sahilmgandhi 18:6a4db94011d3 169 {
sahilmgandhi 18:6a4db94011d3 170 /* Check the WWDG handle allocation */
sahilmgandhi 18:6a4db94011d3 171 if(hwwdg == NULL)
sahilmgandhi 18:6a4db94011d3 172 {
sahilmgandhi 18:6a4db94011d3 173 return HAL_ERROR;
sahilmgandhi 18:6a4db94011d3 174 }
sahilmgandhi 18:6a4db94011d3 175
sahilmgandhi 18:6a4db94011d3 176 /* Check the parameters */
sahilmgandhi 18:6a4db94011d3 177 assert_param(IS_WWDG_ALL_INSTANCE(hwwdg->Instance));
sahilmgandhi 18:6a4db94011d3 178 assert_param(IS_WWDG_PRESCALER(hwwdg->Init.Prescaler));
sahilmgandhi 18:6a4db94011d3 179 assert_param(IS_WWDG_WINDOW(hwwdg->Init.Window));
sahilmgandhi 18:6a4db94011d3 180 assert_param(IS_WWDG_COUNTER(hwwdg->Init.Counter));
sahilmgandhi 18:6a4db94011d3 181 assert_param(IS_WWDG_EWI_MODE(hwwdg->Init.EWIMode));
sahilmgandhi 18:6a4db94011d3 182
sahilmgandhi 18:6a4db94011d3 183 /* Init the low level hardware */
sahilmgandhi 18:6a4db94011d3 184 HAL_WWDG_MspInit(hwwdg);
sahilmgandhi 18:6a4db94011d3 185
sahilmgandhi 18:6a4db94011d3 186 /* Set WWDG Counter */
sahilmgandhi 18:6a4db94011d3 187 WRITE_REG(hwwdg->Instance->CR, (WWDG_CR_WDGA | hwwdg->Init.Counter));
sahilmgandhi 18:6a4db94011d3 188
sahilmgandhi 18:6a4db94011d3 189 /* Set WWDG Prescaler and Window */
sahilmgandhi 18:6a4db94011d3 190 WRITE_REG(hwwdg->Instance->CFR, (hwwdg->Init.EWIMode | hwwdg->Init.Prescaler | hwwdg->Init.Window));
sahilmgandhi 18:6a4db94011d3 191
sahilmgandhi 18:6a4db94011d3 192 /* Return function status */
sahilmgandhi 18:6a4db94011d3 193 return HAL_OK;
sahilmgandhi 18:6a4db94011d3 194 }
sahilmgandhi 18:6a4db94011d3 195
sahilmgandhi 18:6a4db94011d3 196 /**
sahilmgandhi 18:6a4db94011d3 197 * @brief Initialize the WWDG MSP.
sahilmgandhi 18:6a4db94011d3 198 * @param hwwdg pointer to a WWDG_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 199 * the configuration information for the specified WWDG module.
sahilmgandhi 18:6a4db94011d3 200 * @note When rewriting this function in user file, mechanism may be added
sahilmgandhi 18:6a4db94011d3 201 * to avoid multiple initialize when HAL_WWDG_Init function is called
sahilmgandhi 18:6a4db94011d3 202 * again to change parameters.
sahilmgandhi 18:6a4db94011d3 203 * @retval None
sahilmgandhi 18:6a4db94011d3 204 */
sahilmgandhi 18:6a4db94011d3 205 __weak void HAL_WWDG_MspInit(WWDG_HandleTypeDef *hwwdg)
sahilmgandhi 18:6a4db94011d3 206 {
sahilmgandhi 18:6a4db94011d3 207 /* Prevent unused argument(s) compilation warning */
sahilmgandhi 18:6a4db94011d3 208 UNUSED(hwwdg);
sahilmgandhi 18:6a4db94011d3 209
sahilmgandhi 18:6a4db94011d3 210 /* NOTE: This function should not be modified, when the callback is needed,
sahilmgandhi 18:6a4db94011d3 211 the HAL_WWDG_MspInit could be implemented in the user file
sahilmgandhi 18:6a4db94011d3 212 */
sahilmgandhi 18:6a4db94011d3 213 }
sahilmgandhi 18:6a4db94011d3 214
sahilmgandhi 18:6a4db94011d3 215 /**
sahilmgandhi 18:6a4db94011d3 216 * @}
sahilmgandhi 18:6a4db94011d3 217 */
sahilmgandhi 18:6a4db94011d3 218
sahilmgandhi 18:6a4db94011d3 219 /** @defgroup WWDG_Exported_Functions_Group2 IO operation functions
sahilmgandhi 18:6a4db94011d3 220 * @brief IO operation functions
sahilmgandhi 18:6a4db94011d3 221 *
sahilmgandhi 18:6a4db94011d3 222 @verbatim
sahilmgandhi 18:6a4db94011d3 223 ==============================================================================
sahilmgandhi 18:6a4db94011d3 224 ##### IO operation functions #####
sahilmgandhi 18:6a4db94011d3 225 ==============================================================================
sahilmgandhi 18:6a4db94011d3 226 [..]
sahilmgandhi 18:6a4db94011d3 227 This section provides functions allowing to:
sahilmgandhi 18:6a4db94011d3 228 (+) Refresh the WWDG.
sahilmgandhi 18:6a4db94011d3 229 (+) Handle WWDG interrupt request and associated function callback.
sahilmgandhi 18:6a4db94011d3 230
sahilmgandhi 18:6a4db94011d3 231 @endverbatim
sahilmgandhi 18:6a4db94011d3 232 * @{
sahilmgandhi 18:6a4db94011d3 233 */
sahilmgandhi 18:6a4db94011d3 234
sahilmgandhi 18:6a4db94011d3 235 /**
sahilmgandhi 18:6a4db94011d3 236 * @brief Refresh the WWDG.
sahilmgandhi 18:6a4db94011d3 237 * @param hwwdg pointer to a WWDG_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 238 * the configuration information for the specified WWDG module.
sahilmgandhi 18:6a4db94011d3 239 * @retval HAL status
sahilmgandhi 18:6a4db94011d3 240 */
sahilmgandhi 18:6a4db94011d3 241 HAL_StatusTypeDef HAL_WWDG_Refresh(WWDG_HandleTypeDef *hwwdg)
sahilmgandhi 18:6a4db94011d3 242 {
sahilmgandhi 18:6a4db94011d3 243 /* Write to WWDG CR the WWDG Counter value to refresh with */
sahilmgandhi 18:6a4db94011d3 244 WRITE_REG(hwwdg->Instance->CR, (hwwdg->Init.Counter));
sahilmgandhi 18:6a4db94011d3 245
sahilmgandhi 18:6a4db94011d3 246 /* Return function status */
sahilmgandhi 18:6a4db94011d3 247 return HAL_OK;
sahilmgandhi 18:6a4db94011d3 248 }
sahilmgandhi 18:6a4db94011d3 249
sahilmgandhi 18:6a4db94011d3 250 /**
sahilmgandhi 18:6a4db94011d3 251 * @brief Handle WWDG interrupt request.
sahilmgandhi 18:6a4db94011d3 252 * @note The Early Wakeup Interrupt (EWI) can be used if specific safety operations
sahilmgandhi 18:6a4db94011d3 253 * or data logging must be performed before the actual reset is generated.
sahilmgandhi 18:6a4db94011d3 254 * The EWI interrupt is enabled by calling HAL_WWDG_Init function with
sahilmgandhi 18:6a4db94011d3 255 * EWIMode set to WWDG_EWI_ENABLE.
sahilmgandhi 18:6a4db94011d3 256 * When the downcounter reaches the value 0x40, and EWI interrupt is
sahilmgandhi 18:6a4db94011d3 257 * generated and the corresponding Interrupt Service Routine (ISR) can
sahilmgandhi 18:6a4db94011d3 258 * be used to trigger specific actions (such as communications or data
sahilmgandhi 18:6a4db94011d3 259 * logging), before resetting the device.
sahilmgandhi 18:6a4db94011d3 260 * @param hwwdg pointer to a WWDG_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 261 * the configuration information for the specified WWDG module.
sahilmgandhi 18:6a4db94011d3 262 * @retval None
sahilmgandhi 18:6a4db94011d3 263 */
sahilmgandhi 18:6a4db94011d3 264 void HAL_WWDG_IRQHandler(WWDG_HandleTypeDef *hwwdg)
sahilmgandhi 18:6a4db94011d3 265 {
sahilmgandhi 18:6a4db94011d3 266 /* Check if Early Wakeup Interrupt is enable */
sahilmgandhi 18:6a4db94011d3 267 if(__HAL_WWDG_GET_IT_SOURCE(hwwdg, WWDG_IT_EWI) != RESET)
sahilmgandhi 18:6a4db94011d3 268 {
sahilmgandhi 18:6a4db94011d3 269 /* Check if WWDG Early Wakeup Interrupt occurred */
sahilmgandhi 18:6a4db94011d3 270 if(__HAL_WWDG_GET_FLAG(hwwdg, WWDG_FLAG_EWIF) != RESET)
sahilmgandhi 18:6a4db94011d3 271 {
sahilmgandhi 18:6a4db94011d3 272 /* Clear the WWDG Early Wakeup flag */
sahilmgandhi 18:6a4db94011d3 273 __HAL_WWDG_CLEAR_FLAG(hwwdg, WWDG_FLAG_EWIF);
sahilmgandhi 18:6a4db94011d3 274
sahilmgandhi 18:6a4db94011d3 275 /* Early Wakeup callback */
sahilmgandhi 18:6a4db94011d3 276 HAL_WWDG_EarlyWakeupCallback(hwwdg);
sahilmgandhi 18:6a4db94011d3 277 }
sahilmgandhi 18:6a4db94011d3 278 }
sahilmgandhi 18:6a4db94011d3 279 }
sahilmgandhi 18:6a4db94011d3 280
sahilmgandhi 18:6a4db94011d3 281 /**
sahilmgandhi 18:6a4db94011d3 282 * @brief WWDG Early Wakeup callback.
sahilmgandhi 18:6a4db94011d3 283 * @param hwwdg : pointer to a WWDG_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 284 * the configuration information for the specified WWDG module.
sahilmgandhi 18:6a4db94011d3 285 * @retval None
sahilmgandhi 18:6a4db94011d3 286 */
sahilmgandhi 18:6a4db94011d3 287 __weak void HAL_WWDG_EarlyWakeupCallback(WWDG_HandleTypeDef* hwwdg)
sahilmgandhi 18:6a4db94011d3 288 {
sahilmgandhi 18:6a4db94011d3 289 /* Prevent unused argument(s) compilation warning */
sahilmgandhi 18:6a4db94011d3 290 UNUSED(hwwdg);
sahilmgandhi 18:6a4db94011d3 291
sahilmgandhi 18:6a4db94011d3 292 /* NOTE: This function should not be modified, when the callback is needed,
sahilmgandhi 18:6a4db94011d3 293 the HAL_WWDG_EarlyWakeupCallback could be implemented in the user file
sahilmgandhi 18:6a4db94011d3 294 */
sahilmgandhi 18:6a4db94011d3 295 }
sahilmgandhi 18:6a4db94011d3 296
sahilmgandhi 18:6a4db94011d3 297 /**
sahilmgandhi 18:6a4db94011d3 298 * @}
sahilmgandhi 18:6a4db94011d3 299 */
sahilmgandhi 18:6a4db94011d3 300
sahilmgandhi 18:6a4db94011d3 301 /**
sahilmgandhi 18:6a4db94011d3 302 * @}
sahilmgandhi 18:6a4db94011d3 303 */
sahilmgandhi 18:6a4db94011d3 304
sahilmgandhi 18:6a4db94011d3 305 #endif /* HAL_WWDG_MODULE_ENABLED */
sahilmgandhi 18:6a4db94011d3 306 /**
sahilmgandhi 18:6a4db94011d3 307 * @}
sahilmgandhi 18:6a4db94011d3 308 */
sahilmgandhi 18:6a4db94011d3 309
sahilmgandhi 18:6a4db94011d3 310 /**
sahilmgandhi 18:6a4db94011d3 311 * @}
sahilmgandhi 18:6a4db94011d3 312 */
sahilmgandhi 18:6a4db94011d3 313
sahilmgandhi 18:6a4db94011d3 314 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/