Mercurial > public > ostc4
comparison Common/Drivers/STM32F4xx_HAL_DRIVER_v120/Inc/stm32f4xx_hal_wwdg.h @ 38:5f11787b4f42
include in ostc4 repository
author | heinrichsweikamp |
---|---|
date | Sat, 28 Apr 2018 11:52:34 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
37:ccc45c0e1ea2 | 38:5f11787b4f42 |
---|---|
1 /** | |
2 ****************************************************************************** | |
3 * @file stm32f4xx_hal_wwdg.h | |
4 * @author MCD Application Team | |
5 * @version V1.2.0 | |
6 * @date 26-December-2014 | |
7 * @brief Header file of WWDG HAL module. | |
8 ****************************************************************************** | |
9 * @attention | |
10 * | |
11 * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> | |
12 * | |
13 * Redistribution and use in source and binary forms, with or without modification, | |
14 * are permitted provided that the following conditions are met: | |
15 * 1. Redistributions of source code must retain the above copyright notice, | |
16 * this list of conditions and the following disclaimer. | |
17 * 2. Redistributions in binary form must reproduce the above copyright notice, | |
18 * this list of conditions and the following disclaimer in the documentation | |
19 * and/or other materials provided with the distribution. | |
20 * 3. Neither the name of STMicroelectronics nor the names of its contributors | |
21 * may be used to endorse or promote products derived from this software | |
22 * without specific prior written permission. | |
23 * | |
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | |
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |
31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |
32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
34 * | |
35 ****************************************************************************** | |
36 */ | |
37 | |
38 /* Define to prevent recursive inclusion -------------------------------------*/ | |
39 #ifndef __STM32F4xx_HAL_WWDG_H | |
40 #define __STM32F4xx_HAL_WWDG_H | |
41 | |
42 #ifdef __cplusplus | |
43 extern "C" { | |
44 #endif | |
45 | |
46 /* Includes ------------------------------------------------------------------*/ | |
47 #include "stm32f4xx_hal_def.h" | |
48 | |
49 /** @addtogroup STM32F4xx_HAL_Driver | |
50 * @{ | |
51 */ | |
52 | |
53 /** @addtogroup WWDG | |
54 * @{ | |
55 */ | |
56 | |
57 /* Exported types ------------------------------------------------------------*/ | |
58 /** @defgroup WWDG_Exported_Types WWDG Exported Types | |
59 * @{ | |
60 */ | |
61 | |
62 /** | |
63 * @brief WWDG HAL State Structure definition | |
64 */ | |
65 typedef enum | |
66 { | |
67 HAL_WWDG_STATE_RESET = 0x00, /*!< WWDG not yet initialized or disabled */ | |
68 HAL_WWDG_STATE_READY = 0x01, /*!< WWDG initialized and ready for use */ | |
69 HAL_WWDG_STATE_BUSY = 0x02, /*!< WWDG internal process is ongoing */ | |
70 HAL_WWDG_STATE_TIMEOUT = 0x03, /*!< WWDG timeout state */ | |
71 HAL_WWDG_STATE_ERROR = 0x04 /*!< WWDG error state */ | |
72 }HAL_WWDG_StateTypeDef; | |
73 | |
74 /** | |
75 * @brief WWDG Init structure definition | |
76 */ | |
77 typedef struct | |
78 { | |
79 uint32_t Prescaler; /*!< Specifies the prescaler value of the WWDG. | |
80 This parameter can be a value of @ref WWDG_Prescaler */ | |
81 | |
82 uint32_t Window; /*!< Specifies the WWDG window value to be compared to the downcounter. | |
83 This parameter must be a number lower than Max_Data = 0x80 */ | |
84 | |
85 uint32_t Counter; /*!< Specifies the WWDG free-running downcounter value. | |
86 This parameter must be a number between Min_Data = 0x40 and Max_Data = 0x7F */ | |
87 | |
88 }WWDG_InitTypeDef; | |
89 | |
90 /** | |
91 * @brief WWDG handle Structure definition | |
92 */ | |
93 typedef struct | |
94 { | |
95 WWDG_TypeDef *Instance; /*!< Register base address */ | |
96 | |
97 WWDG_InitTypeDef Init; /*!< WWDG required parameters */ | |
98 | |
99 HAL_LockTypeDef Lock; /*!< WWDG locking object */ | |
100 | |
101 __IO HAL_WWDG_StateTypeDef State; /*!< WWDG communication state */ | |
102 | |
103 }WWDG_HandleTypeDef; | |
104 /** | |
105 * @} | |
106 */ | |
107 | |
108 /* Exported constants --------------------------------------------------------*/ | |
109 /** @defgroup WWDG_Exported_Constants WWDG Exported Constants | |
110 * @{ | |
111 */ | |
112 | |
113 /** @defgroup WWDG_Interrupt_definition WWDG Interrupt definition | |
114 * @{ | |
115 */ | |
116 #define WWDG_IT_EWI WWDG_CFR_EWI /*!< Early wakeup interrupt */ | |
117 /** | |
118 * @} | |
119 */ | |
120 | |
121 /** @defgroup WWDG_Flag_definition WWDG Flag definition | |
122 * @brief WWDG Flag definition | |
123 * @{ | |
124 */ | |
125 #define WWDG_FLAG_EWIF WWDG_SR_EWIF /*!< Early wakeup interrupt flag */ | |
126 /** | |
127 * @} | |
128 */ | |
129 | |
130 /** @defgroup WWDG_Prescaler WWDG Prescaler | |
131 * @{ | |
132 */ | |
133 #define WWDG_PRESCALER_1 ((uint32_t)0x00000000) /*!< WWDG counter clock = (PCLK1/4096)/1 */ | |
134 #define WWDG_PRESCALER_2 WWDG_CFR_WDGTB0 /*!< WWDG counter clock = (PCLK1/4096)/2 */ | |
135 #define WWDG_PRESCALER_4 WWDG_CFR_WDGTB1 /*!< WWDG counter clock = (PCLK1/4096)/4 */ | |
136 #define WWDG_PRESCALER_8 WWDG_CFR_WDGTB /*!< WWDG counter clock = (PCLK1/4096)/8 */ | |
137 /** | |
138 * @} | |
139 */ | |
140 | |
141 /** | |
142 * @} | |
143 */ | |
144 | |
145 /* Exported macro ------------------------------------------------------------*/ | |
146 /** @defgroup WWDG_Exported_Macros WWDG Exported Macros | |
147 * @{ | |
148 */ | |
149 | |
150 /** @brief Reset WWDG handle state | |
151 * @param __HANDLE__: WWDG handle | |
152 * @retval None | |
153 */ | |
154 #define __HAL_WWDG_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_WWDG_STATE_RESET) | |
155 | |
156 /** | |
157 * @brief Enables the WWDG peripheral. | |
158 * @param __HANDLE__: WWDG handle | |
159 * @retval None | |
160 */ | |
161 #define __HAL_WWDG_ENABLE(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CR, WWDG_CR_WDGA) | |
162 | |
163 /** | |
164 * @brief Disables the WWDG peripheral. | |
165 * @param __HANDLE__: WWDG handle | |
166 * @note WARNING: This is a dummy macro for HAL code alignment. | |
167 * Once enable, WWDG Peripheral cannot be disabled except by a system reset. | |
168 * @retval None | |
169 */ | |
170 #define __HAL_WWDG_DISABLE(__HANDLE__) /* dummy macro */ | |
171 | |
172 /** | |
173 * @brief Gets the selected WWDG's it status. | |
174 * @param __HANDLE__: WWDG handle | |
175 * @param __INTERRUPT__: specifies the it to check. | |
176 * This parameter can be one of the following values: | |
177 * @arg WWDG_FLAG_EWIF: Early wakeup interrupt IT | |
178 * @retval The new state of WWDG_FLAG (SET or RESET). | |
179 */ | |
180 #define __HAL_WWDG_GET_IT(__HANDLE__, __INTERRUPT__) __HAL_WWDG_GET_FLAG((__HANDLE__),(__INTERRUPT__)) | |
181 | |
182 /** @brief Clear the WWDG's interrupt pending bits | |
183 * bits to clear the selected interrupt pending bits. | |
184 * @param __HANDLE__: WWDG handle | |
185 * @param __INTERRUPT__: specifies the interrupt pending bit to clear. | |
186 * This parameter can be one of the following values: | |
187 * @arg WWDG_FLAG_EWIF: Early wakeup interrupt flag | |
188 */ | |
189 #define __HAL_WWDG_CLEAR_IT(__HANDLE__, __INTERRUPT__) __HAL_WWDG_CLEAR_FLAG((__HANDLE__), (__INTERRUPT__)) | |
190 | |
191 /** | |
192 * @brief Enables the WWDG early wakeup interrupt. | |
193 * @param __HANDLE__: WWDG handle | |
194 * @param __INTERRUPT__: specifies the interrupt to enable. | |
195 * This parameter can be one of the following values: | |
196 * @arg WWDG_IT_EWI: Early wakeup interrupt | |
197 * @note Once enabled this interrupt cannot be disabled except by a system reset. | |
198 * @retval None | |
199 */ | |
200 #define __HAL_WWDG_ENABLE_IT(__HANDLE__, __INTERRUPT__) SET_BIT((__HANDLE__)->Instance->CFR, (__INTERRUPT__)) | |
201 | |
202 /** | |
203 * @brief Disables the WWDG early wakeup interrupt. | |
204 * @param __HANDLE__: WWDG handle | |
205 * @param __INTERRUPT__: specifies the interrupt to disable. | |
206 * This parameter can be one of the following values: | |
207 * @arg WWDG_IT_EWI: Early wakeup interrupt | |
208 * @note WARNING: This is a dummy macro for HAL code alignment. | |
209 * Once enabled this interrupt cannot be disabled except by a system reset. | |
210 * @retval None | |
211 */ | |
212 #define __HAL_WWDG_DISABLE_IT(__HANDLE__, __INTERRUPT__) /* dummy macro */ | |
213 | |
214 /** | |
215 * @brief Gets the selected WWDG's flag status. | |
216 * @param __HANDLE__: WWDG handle | |
217 * @param __FLAG__: specifies the flag to check. | |
218 * This parameter can be one of the following values: | |
219 * @arg WWDG_FLAG_EWIF: Early wakeup interrupt flag | |
220 * @retval The new state of WWDG_FLAG (SET or RESET). | |
221 */ | |
222 #define __HAL_WWDG_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR & (__FLAG__)) == (__FLAG__)) | |
223 | |
224 /** | |
225 * @brief Clears the WWDG's pending flags. | |
226 * @param __HANDLE__: WWDG handle | |
227 * @param __FLAG__: specifies the flag to clear. | |
228 * This parameter can be one of the following values: | |
229 * @arg WWDG_FLAG_EWIF: Early wakeup interrupt flag | |
230 * @retval None | |
231 */ | |
232 #define __HAL_WWDG_CLEAR_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR) = ~(__FLAG__)) | |
233 | |
234 /** @brief Checks if the specified WWDG interrupt source is enabled or disabled. | |
235 * @param __HANDLE__: WWDG Handle. | |
236 * @param __INTERRUPT__: specifies the WWDG interrupt source to check. | |
237 * This parameter can be one of the following values: | |
238 * @arg WWDG_IT_EWI: Early Wakeup Interrupt | |
239 * @retval state of __INTERRUPT__ (TRUE or FALSE). | |
240 */ | |
241 #define __HAL_WWDG_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CFR & (__INTERRUPT__)) == (__INTERRUPT__)) | |
242 | |
243 /** | |
244 * @} | |
245 */ | |
246 | |
247 /* Exported functions --------------------------------------------------------*/ | |
248 /** @addtogroup WWDG_Exported_Functions | |
249 * @{ | |
250 */ | |
251 | |
252 /** @addtogroup WWDG_Exported_Functions_Group1 | |
253 * @{ | |
254 */ | |
255 /* Initialization/de-initialization functions **********************************/ | |
256 HAL_StatusTypeDef HAL_WWDG_Init(WWDG_HandleTypeDef *hwwdg); | |
257 HAL_StatusTypeDef HAL_WWDG_DeInit(WWDG_HandleTypeDef *hwwdg); | |
258 void HAL_WWDG_MspInit(WWDG_HandleTypeDef *hwwdg); | |
259 void HAL_WWDG_MspDeInit(WWDG_HandleTypeDef *hwwdg); | |
260 void HAL_WWDG_WakeupCallback(WWDG_HandleTypeDef* hwwdg); | |
261 /** | |
262 * @} | |
263 */ | |
264 | |
265 /** @addtogroup WWDG_Exported_Functions_Group2 | |
266 * @{ | |
267 */ | |
268 /* I/O operation functions ******************************************************/ | |
269 HAL_StatusTypeDef HAL_WWDG_Start(WWDG_HandleTypeDef *hwwdg); | |
270 HAL_StatusTypeDef HAL_WWDG_Start_IT(WWDG_HandleTypeDef *hwwdg); | |
271 HAL_StatusTypeDef HAL_WWDG_Refresh(WWDG_HandleTypeDef *hwwdg, uint32_t Counter); | |
272 void HAL_WWDG_IRQHandler(WWDG_HandleTypeDef *hwwdg); | |
273 /** | |
274 * @} | |
275 */ | |
276 | |
277 /** @addtogroup WWDG_Exported_Functions_Group3 | |
278 * @{ | |
279 */ | |
280 /* Peripheral State functions **************************************************/ | |
281 HAL_WWDG_StateTypeDef HAL_WWDG_GetState(WWDG_HandleTypeDef *hwwdg); | |
282 /** | |
283 * @} | |
284 */ | |
285 | |
286 /** | |
287 * @} | |
288 */ | |
289 | |
290 /* Private types -------------------------------------------------------------*/ | |
291 /* Private variables ---------------------------------------------------------*/ | |
292 /* Private constants ---------------------------------------------------------*/ | |
293 /** @defgroup WWDG_Private_Constants WWDG Private Constants | |
294 * @{ | |
295 */ | |
296 /** @defgroup WWDG_BitAddress_AliasRegion WWDG BitAddress | |
297 * @brief WWDG registers bit address in the alias region | |
298 * @{ | |
299 */ | |
300 | |
301 /* --- CFR Register ---*/ | |
302 /* Alias word address of EWI bit */ | |
303 #define WWDG_CFR_BASE (uint32_t)(WWDG_BASE + 0x04) | |
304 | |
305 /** | |
306 * @} | |
307 */ | |
308 | |
309 /** | |
310 * @} | |
311 */ | |
312 | |
313 /* Private macros ------------------------------------------------------------*/ | |
314 /** @defgroup WWDG_Private_Macros WWDG Private Macros | |
315 * @{ | |
316 */ | |
317 #define IS_WWDG_PRESCALER(__PRESCALER__) (((__PRESCALER__) == WWDG_PRESCALER_1) || \ | |
318 ((__PRESCALER__) == WWDG_PRESCALER_2) || \ | |
319 ((__PRESCALER__) == WWDG_PRESCALER_4) || \ | |
320 ((__PRESCALER__) == WWDG_PRESCALER_8)) | |
321 #define IS_WWDG_WINDOW(__WINDOW__) ((__WINDOW__) <= 0x7F) | |
322 #define IS_WWDG_COUNTER(__COUNTER__) (((__COUNTER__) >= 0x40) && ((__COUNTER__) <= 0x7F)) | |
323 /** | |
324 * @} | |
325 */ | |
326 | |
327 /* Private functions ---------------------------------------------------------*/ | |
328 /** @defgroup WWDG_Private_Functions WWDG Private Functions | |
329 * @{ | |
330 */ | |
331 | |
332 /** | |
333 * @} | |
334 */ | |
335 | |
336 /** | |
337 * @} | |
338 */ | |
339 | |
340 /** | |
341 * @} | |
342 */ | |
343 #ifdef __cplusplus | |
344 } | |
345 #endif | |
346 | |
347 #endif /* __STM32F4xx_HAL_WWDG_H */ | |
348 | |
349 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |