Go to most recent revision | Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 2 | mjames | 1 | /** |
| 2 | ****************************************************************************** |
||
| 3 | * @file stm32f1xx_hal_wwdg.h |
||
| 4 | * @author MCD Application Team |
||
| 5 | * @brief Header file of WWDG HAL module. |
||
| 6 | ****************************************************************************** |
||
| 7 | * @attention |
||
| 8 | * |
||
| 9 | * <h2><center>© Copyright (c) 2016 STMicroelectronics. |
||
| 10 | * All rights reserved.</center></h2> |
||
| 11 | * |
||
| 12 | * This software component is licensed by ST under BSD 3-Clause license, |
||
| 13 | * the "License"; You may not use this file except in compliance with the |
||
| 14 | * License. You may obtain a copy of the License at: |
||
| 15 | * opensource.org/licenses/BSD-3-Clause |
||
| 16 | * |
||
| 17 | ****************************************************************************** |
||
| 18 | */ |
||
| 19 | |||
| 20 | /* Define to prevent recursive inclusion -------------------------------------*/ |
||
| 21 | #ifndef STM32F1xx_HAL_WWDG_H |
||
| 22 | #define STM32F1xx_HAL_WWDG_H |
||
| 23 | |||
| 24 | #ifdef __cplusplus |
||
| 25 | extern "C" { |
||
| 26 | #endif |
||
| 27 | |||
| 28 | /* Includes ------------------------------------------------------------------*/ |
||
| 29 | #include "stm32f1xx_hal_def.h" |
||
| 30 | |||
| 31 | /** @addtogroup STM32F1xx_HAL_Driver |
||
| 32 | * @{ |
||
| 33 | */ |
||
| 34 | |||
| 35 | /** @addtogroup WWDG |
||
| 36 | * @{ |
||
| 37 | */ |
||
| 38 | |||
| 39 | /* Exported types ------------------------------------------------------------*/ |
||
| 40 | /** @defgroup WWDG_Exported_Types WWDG Exported Types |
||
| 41 | * @{ |
||
| 42 | */ |
||
| 43 | |||
| 44 | /** |
||
| 45 | * @brief WWDG Init structure definition |
||
| 46 | */ |
||
| 47 | typedef struct |
||
| 48 | { |
||
| 49 | uint32_t Prescaler; /*!< Specifies the prescaler value of the WWDG. |
||
| 50 | This parameter can be a value of @ref WWDG_Prescaler */ |
||
| 51 | |||
| 52 | uint32_t Window; /*!< Specifies the WWDG window value to be compared to the downcounter. |
||
| 53 | This parameter must be a number Min_Data = 0x40 and Max_Data = 0x7F */ |
||
| 54 | |||
| 55 | uint32_t Counter; /*!< Specifies the WWDG free-running downcounter value. |
||
| 56 | This parameter must be a number between Min_Data = 0x40 and Max_Data = 0x7F */ |
||
| 57 | |||
| 58 | uint32_t EWIMode ; /*!< Specifies if WWDG Early Wakeup Interupt is enable or not. |
||
| 59 | This parameter can be a value of @ref WWDG_EWI_Mode */ |
||
| 60 | |||
| 61 | } WWDG_InitTypeDef; |
||
| 62 | |||
| 63 | /** |
||
| 64 | * @brief WWDG handle Structure definition |
||
| 65 | */ |
||
| 66 | #if (USE_HAL_WWDG_REGISTER_CALLBACKS == 1) |
||
| 67 | typedef struct __WWDG_HandleTypeDef |
||
| 68 | #else |
||
| 69 | typedef struct |
||
| 70 | #endif |
||
| 71 | { |
||
| 72 | WWDG_TypeDef *Instance; /*!< Register base address */ |
||
| 73 | |||
| 74 | WWDG_InitTypeDef Init; /*!< WWDG required parameters */ |
||
| 75 | #if (USE_HAL_WWDG_REGISTER_CALLBACKS == 1) |
||
| 76 | void (* EwiCallback)(struct __WWDG_HandleTypeDef *hwwdg); /*!< WWDG Early WakeUp Interrupt callback */ |
||
| 77 | |||
| 78 | void (* MspInitCallback)(struct __WWDG_HandleTypeDef *hwwdg); /*!< WWDG Msp Init callback */ |
||
| 79 | #endif |
||
| 80 | } WWDG_HandleTypeDef; |
||
| 81 | |||
| 82 | #if (USE_HAL_WWDG_REGISTER_CALLBACKS == 1) |
||
| 83 | /** |
||
| 84 | * @brief HAL WWDG common Callback ID enumeration definition |
||
| 85 | */ |
||
| 86 | typedef enum |
||
| 87 | { |
||
| 88 | HAL_WWDG_EWI_CB_ID = 0x00u, /*!< WWDG EWI callback ID */ |
||
| 89 | HAL_WWDG_MSPINIT_CB_ID = 0x01u, /*!< WWDG MspInit callback ID */ |
||
| 90 | }HAL_WWDG_CallbackIDTypeDef; |
||
| 91 | |||
| 92 | /** |
||
| 93 | * @brief HAL WWDG Callback pointer definition |
||
| 94 | */ |
||
| 95 | typedef void (*pWWDG_CallbackTypeDef)(WWDG_HandleTypeDef * hppp); /*!< pointer to a WWDG common callback functions */ |
||
| 96 | |||
| 97 | #endif |
||
| 98 | /** |
||
| 99 | * @} |
||
| 100 | */ |
||
| 101 | |||
| 102 | /* Exported constants --------------------------------------------------------*/ |
||
| 103 | |||
| 104 | /** @defgroup WWDG_Exported_Constants WWDG Exported Constants |
||
| 105 | * @{ |
||
| 106 | */ |
||
| 107 | |||
| 108 | /** @defgroup WWDG_Interrupt_definition WWDG Interrupt definition |
||
| 109 | * @{ |
||
| 110 | */ |
||
| 111 | #define WWDG_IT_EWI WWDG_CFR_EWI /*!< Early wakeup interrupt */ |
||
| 112 | /** |
||
| 113 | * @} |
||
| 114 | */ |
||
| 115 | |||
| 116 | /** @defgroup WWDG_Flag_definition WWDG Flag definition |
||
| 117 | * @brief WWDG Flag definition |
||
| 118 | * @{ |
||
| 119 | */ |
||
| 120 | #define WWDG_FLAG_EWIF WWDG_SR_EWIF /*!< Early wakeup interrupt flag */ |
||
| 121 | /** |
||
| 122 | * @} |
||
| 123 | */ |
||
| 124 | |||
| 125 | /** @defgroup WWDG_Prescaler WWDG Prescaler |
||
| 126 | * @{ |
||
| 127 | */ |
||
| 128 | #define WWDG_PRESCALER_1 0x00000000U /*!< WWDG counter clock = (PCLK1/4096)/1 */ |
||
| 129 | #define WWDG_PRESCALER_2 WWDG_CFR_WDGTB0 /*!< WWDG counter clock = (PCLK1/4096)/2 */ |
||
| 130 | #define WWDG_PRESCALER_4 WWDG_CFR_WDGTB1 /*!< WWDG counter clock = (PCLK1/4096)/4 */ |
||
| 131 | #define WWDG_PRESCALER_8 WWDG_CFR_WDGTB /*!< WWDG counter clock = (PCLK1/4096)/8 */ |
||
| 132 | /** |
||
| 133 | * @} |
||
| 134 | */ |
||
| 135 | |||
| 136 | /** @defgroup WWDG_EWI_Mode WWDG Early Wakeup Interrupt Mode |
||
| 137 | * @{ |
||
| 138 | */ |
||
| 139 | #define WWDG_EWI_DISABLE 0x00000000U /*!< EWI Disable */ |
||
| 140 | #define WWDG_EWI_ENABLE WWDG_CFR_EWI /*!< EWI Enable */ |
||
| 141 | /** |
||
| 142 | * @} |
||
| 143 | */ |
||
| 144 | |||
| 145 | /** |
||
| 146 | * @} |
||
| 147 | */ |
||
| 148 | |||
| 149 | /* Private macros ------------------------------------------------------------*/ |
||
| 150 | |||
| 151 | /** @defgroup WWDG_Private_Macros WWDG Private Macros |
||
| 152 | * @{ |
||
| 153 | */ |
||
| 154 | #define IS_WWDG_PRESCALER(__PRESCALER__) (((__PRESCALER__) == WWDG_PRESCALER_1) || \ |
||
| 155 | ((__PRESCALER__) == WWDG_PRESCALER_2) || \ |
||
| 156 | ((__PRESCALER__) == WWDG_PRESCALER_4) || \ |
||
| 157 | ((__PRESCALER__) == WWDG_PRESCALER_8)) |
||
| 158 | |||
| 159 | #define IS_WWDG_WINDOW(__WINDOW__) (((__WINDOW__) >= WWDG_CFR_W_6) && ((__WINDOW__) <= WWDG_CFR_W)) |
||
| 160 | |||
| 161 | #define IS_WWDG_COUNTER(__COUNTER__) (((__COUNTER__) >= WWDG_CR_T_6) && ((__COUNTER__) <= WWDG_CR_T)) |
||
| 162 | |||
| 163 | #define IS_WWDG_EWI_MODE(__MODE__) (((__MODE__) == WWDG_EWI_ENABLE) || \ |
||
| 164 | ((__MODE__) == WWDG_EWI_DISABLE)) |
||
| 165 | /** |
||
| 166 | * @} |
||
| 167 | */ |
||
| 168 | |||
| 169 | |||
| 170 | /* Exported macros ------------------------------------------------------------*/ |
||
| 171 | |||
| 172 | /** @defgroup WWDG_Exported_Macros WWDG Exported Macros |
||
| 173 | * @{ |
||
| 174 | */ |
||
| 175 | |||
| 176 | /** |
||
| 177 | * @brief Enables the WWDG peripheral. |
||
| 178 | * @param __HANDLE__: WWDG handle |
||
| 179 | * @retval None |
||
| 180 | */ |
||
| 181 | #define __HAL_WWDG_ENABLE(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CR, WWDG_CR_WDGA) |
||
| 182 | |||
| 183 | /** |
||
| 184 | * @brief Enables the WWDG early wakeup interrupt. |
||
| 185 | * @param __HANDLE__: WWDG handle |
||
| 186 | * @param __INTERRUPT__ specifies the interrupt to enable. |
||
| 187 | * This parameter can be one of the following values: |
||
| 188 | * @arg WWDG_IT_EWI: Early wakeup interrupt |
||
| 189 | * @note Once enabled this interrupt cannot be disabled except by a system reset. |
||
| 190 | * @retval None |
||
| 191 | */ |
||
| 192 | #define __HAL_WWDG_ENABLE_IT(__HANDLE__, __INTERRUPT__) SET_BIT((__HANDLE__)->Instance->CFR, (__INTERRUPT__)) |
||
| 193 | |||
| 194 | /** |
||
| 195 | * @brief Checks whether the selected WWDG interrupt has occurred or not. |
||
| 196 | * @param __HANDLE__ WWDG handle |
||
| 197 | * @param __INTERRUPT__ specifies the it to check. |
||
| 198 | * This parameter can be one of the following values: |
||
| 199 | * @arg WWDG_FLAG_EWIF: Early wakeup interrupt IT |
||
| 200 | * @retval The new state of WWDG_FLAG (SET or RESET). |
||
| 201 | */ |
||
| 202 | #define __HAL_WWDG_GET_IT(__HANDLE__, __INTERRUPT__) __HAL_WWDG_GET_FLAG((__HANDLE__),(__INTERRUPT__)) |
||
| 203 | |||
| 204 | /** @brief Clear the WWDG's interrupt pending bits |
||
| 205 | * bits to clear the selected interrupt pending bits. |
||
| 206 | * @param __HANDLE__: WWDG handle |
||
| 207 | * @param __INTERRUPT__: specifies the interrupt pending bit to clear. |
||
| 208 | * This parameter can be one of the following values: |
||
| 209 | * @arg WWDG_FLAG_EWIF: Early wakeup interrupt flag |
||
| 210 | */ |
||
| 211 | #define __HAL_WWDG_CLEAR_IT(__HANDLE__, __INTERRUPT__) __HAL_WWDG_CLEAR_FLAG((__HANDLE__), (__INTERRUPT__)) |
||
| 212 | |||
| 213 | /** |
||
| 214 | * @brief Check whether the specified WWDG flag is set or not. |
||
| 215 | * @param __HANDLE__ WWDG handle |
||
| 216 | * @param __FLAG__ specifies the flag to check. |
||
| 217 | * This parameter can be one of the following values: |
||
| 218 | * @arg WWDG_FLAG_EWIF: Early wakeup interrupt flag |
||
| 219 | * @retval The new state of WWDG_FLAG (SET or RESET). |
||
| 220 | */ |
||
| 221 | #define __HAL_WWDG_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR & (__FLAG__)) == (__FLAG__)) |
||
| 222 | |||
| 223 | /** |
||
| 224 | * @brief Clears the WWDG's pending flags. |
||
| 225 | * @param __HANDLE__: WWDG handle |
||
| 226 | * @param __FLAG__: specifies the flag to clear. |
||
| 227 | * This parameter can be one of the following values: |
||
| 228 | * @arg WWDG_FLAG_EWIF: Early wakeup interrupt flag |
||
| 229 | * @retval None |
||
| 230 | */ |
||
| 231 | #define __HAL_WWDG_CLEAR_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR) = ~(__FLAG__)) |
||
| 232 | |||
| 233 | /** @brief Checks if the specified WWDG interrupt source is enabled or disabled. |
||
| 234 | * @param __HANDLE__: WWDG Handle. |
||
| 235 | * @param __INTERRUPT__: specifies the WWDG interrupt source to check. |
||
| 236 | * This parameter can be one of the following values: |
||
| 237 | * @arg WWDG_IT_EWI: Early Wakeup Interrupt |
||
| 238 | * @retval state of __INTERRUPT__ (TRUE or FALSE). |
||
| 239 | */ |
||
| 240 | #define __HAL_WWDG_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CFR & (__INTERRUPT__)) == (__INTERRUPT__)) |
||
| 241 | |||
| 242 | /** |
||
| 243 | * @} |
||
| 244 | */ |
||
| 245 | |||
| 246 | /* Exported functions --------------------------------------------------------*/ |
||
| 247 | /** @addtogroup WWDG_Exported_Functions |
||
| 248 | * @{ |
||
| 249 | */ |
||
| 250 | |||
| 251 | /** @addtogroup WWDG_Exported_Functions_Group1 |
||
| 252 | * @{ |
||
| 253 | */ |
||
| 254 | /* Initialization/de-initialization functions **********************************/ |
||
| 255 | HAL_StatusTypeDef HAL_WWDG_Init(WWDG_HandleTypeDef *hwwdg); |
||
| 256 | void HAL_WWDG_MspInit(WWDG_HandleTypeDef *hwwdg); |
||
| 257 | |||
| 258 | /* Callbacks Register/UnRegister functions ***********************************/ |
||
| 259 | #if (USE_HAL_WWDG_REGISTER_CALLBACKS == 1) |
||
| 260 | HAL_StatusTypeDef HAL_WWDG_RegisterCallback(WWDG_HandleTypeDef *hwwdg, HAL_WWDG_CallbackIDTypeDef CallbackID, pWWDG_CallbackTypeDef pCallback); |
||
| 261 | HAL_StatusTypeDef HAL_WWDG_UnRegisterCallback(WWDG_HandleTypeDef *hwwdg, HAL_WWDG_CallbackIDTypeDef CallbackID); |
||
| 262 | #endif |
||
| 263 | |||
| 264 | /** |
||
| 265 | * @} |
||
| 266 | */ |
||
| 267 | |||
| 268 | /** @addtogroup WWDG_Exported_Functions_Group2 |
||
| 269 | * @{ |
||
| 270 | */ |
||
| 271 | /* I/O operation functions ******************************************************/ |
||
| 272 | HAL_StatusTypeDef HAL_WWDG_Refresh(WWDG_HandleTypeDef *hwwdg); |
||
| 273 | void HAL_WWDG_IRQHandler(WWDG_HandleTypeDef *hwwdg); |
||
| 274 | void HAL_WWDG_EarlyWakeupCallback(WWDG_HandleTypeDef *hwwdg); |
||
| 275 | /** |
||
| 276 | * @} |
||
| 277 | */ |
||
| 278 | |||
| 279 | /** |
||
| 280 | * @} |
||
| 281 | */ |
||
| 282 | |||
| 283 | /** |
||
| 284 | * @} |
||
| 285 | */ |
||
| 286 | |||
| 287 | /** |
||
| 288 | * @} |
||
| 289 | */ |
||
| 290 | |||
| 291 | #ifdef __cplusplus |
||
| 292 | } |
||
| 293 | #endif |
||
| 294 | |||
| 295 | #endif /* STM32F1xx_HAL_WWDG_H */ |
||
| 296 | |||
| 297 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |