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