Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2 | Rev 9 | ||
---|---|---|---|
Line 4... | Line 4... | ||
4 | * @author MCD Application Team |
4 | * @author MCD Application Team |
5 | * @brief Header file of WWDG HAL module. |
5 | * @brief Header file of WWDG HAL module. |
6 | ****************************************************************************** |
6 | ****************************************************************************** |
7 | * @attention |
7 | * @attention |
8 | * |
8 | * |
9 | * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> |
9 | * <h2><center>© Copyright (c) 2016 STMicroelectronics. |
- | 10 | * All rights reserved.</center></h2> |
|
10 | * |
11 | * |
11 | * Redistribution and use in source and binary forms, with or without modification, |
12 | * This software component is licensed by ST under BSD 3-Clause license, |
12 | * are permitted provided that the following conditions are met: |
13 | * the "License"; You may not use this file except in compliance with the |
13 | * 1. Redistributions of source code must retain the above copyright notice, |
- | |
14 | * this list of conditions and the following disclaimer. |
- | |
15 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
- | |
16 | * this list of conditions and the following disclaimer in the documentation |
- | |
17 | * and/or other materials provided with the distribution. |
14 | * License. You may obtain a copy of the License at: |
18 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
- | |
19 | * may be used to endorse or promote products derived from this software |
15 | * opensource.org/licenses/BSD-3-Clause |
20 | * without specific prior written permission. |
- | |
21 | * |
- | |
22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
- | |
23 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
- | |
24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
- | |
25 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
- | |
26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
- | |
27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
- | |
28 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
- | |
29 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
- | |
30 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
- | |
31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
- | |
32 | * |
16 | * |
33 | ****************************************************************************** |
17 | ****************************************************************************** |
34 | */ |
18 | */ |
35 | 19 | ||
36 | /* Define to prevent recursive inclusion -------------------------------------*/ |
20 | /* Define to prevent recursive inclusion -------------------------------------*/ |
37 | #ifndef __STM32F1xx_HAL_WWDG_H |
21 | #ifndef STM32F1xx_HAL_WWDG_H |
38 | #define __STM32F1xx_HAL_WWDG_H |
22 | #define STM32F1xx_HAL_WWDG_H |
39 | 23 | ||
40 | #ifdef __cplusplus |
24 | #ifdef __cplusplus |
41 | extern "C" { |
25 | extern "C" { |
42 | #endif |
26 | #endif |
43 | 27 | ||
Line 51... | Line 35... | ||
51 | /** @addtogroup WWDG |
35 | /** @addtogroup WWDG |
52 | * @{ |
36 | * @{ |
53 | */ |
37 | */ |
54 | 38 | ||
55 | /* Exported types ------------------------------------------------------------*/ |
39 | /* Exported types ------------------------------------------------------------*/ |
- | 40 | ||
56 | /** @defgroup WWDG_Exported_Types WWDG Exported Types |
41 | /** @defgroup WWDG_Exported_Types WWDG Exported Types |
57 | * @{ |
42 | * @{ |
58 | */ |
43 | */ |
59 | 44 | ||
60 | /** |
45 | /** |
Line 69... | Line 54... | ||
69 | This parameter must be a number Min_Data = 0x40 and Max_Data = 0x7F */ |
54 | This parameter must be a number Min_Data = 0x40 and Max_Data = 0x7F */ |
70 | 55 | ||
71 | uint32_t Counter; /*!< Specifies the WWDG free-running downcounter value. |
56 | uint32_t Counter; /*!< Specifies the WWDG free-running downcounter value. |
72 | This parameter must be a number between Min_Data = 0x40 and Max_Data = 0x7F */ |
57 | This parameter must be a number between Min_Data = 0x40 and Max_Data = 0x7F */ |
73 | 58 | ||
74 | uint32_t EWIMode ; /*!< Specifies if WWDG Early Wakeup Interupt is enable or not. |
59 | uint32_t EWIMode ; /*!< Specifies if WWDG Early Wakeup Interrupt is enable or not. |
75 | This parameter can be a value of @ref WWDG_EWI_Mode */ |
60 | This parameter can be a value of @ref WWDG_EWI_Mode */ |
76 | 61 | ||
77 | } WWDG_InitTypeDef; |
62 | } WWDG_InitTypeDef; |
78 | 63 | ||
79 | /** |
64 | /** |
80 | * @brief WWDG handle Structure definition |
65 | * @brief WWDG handle Structure definition |
81 | */ |
66 | */ |
- | 67 | #if (USE_HAL_WWDG_REGISTER_CALLBACKS == 1) |
|
- | 68 | typedef struct __WWDG_HandleTypeDef |
|
- | 69 | #else |
|
82 | typedef struct |
70 | typedef struct |
- | 71 | #endif /* USE_HAL_WWDG_REGISTER_CALLBACKS */ |
|
83 | { |
72 | { |
84 | WWDG_TypeDef *Instance; /*!< Register base address */ |
73 | WWDG_TypeDef *Instance; /*!< Register base address */ |
- | 74 | ||
- | 75 | WWDG_InitTypeDef Init; /*!< WWDG required parameters */ |
|
85 | 76 | ||
- | 77 | #if (USE_HAL_WWDG_REGISTER_CALLBACKS == 1) |
|
86 | WWDG_InitTypeDef Init; /*!< WWDG required parameters */ |
78 | void (* EwiCallback)(struct __WWDG_HandleTypeDef *hwwdg); /*!< WWDG Early WakeUp Interrupt callback */ |
87 | 79 | ||
- | 80 | void (* MspInitCallback)(struct __WWDG_HandleTypeDef *hwwdg); /*!< WWDG Msp Init callback */ |
|
- | 81 | #endif /* USE_HAL_WWDG_REGISTER_CALLBACKS */ |
|
88 | } WWDG_HandleTypeDef; |
82 | } WWDG_HandleTypeDef; |
- | 83 | ||
- | 84 | #if (USE_HAL_WWDG_REGISTER_CALLBACKS == 1) |
|
- | 85 | /** |
|
- | 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 */ |
|
89 | /** |
100 | /** |
90 | * @} |
101 | * @} |
91 | */ |
102 | */ |
92 | 103 | ||
93 | /* Exported constants --------------------------------------------------------*/ |
104 | /* Exported constants --------------------------------------------------------*/ |
Line 114... | Line 125... | ||
114 | */ |
125 | */ |
115 | 126 | ||
116 | /** @defgroup WWDG_Prescaler WWDG Prescaler |
127 | /** @defgroup WWDG_Prescaler WWDG Prescaler |
117 | * @{ |
128 | * @{ |
118 | */ |
129 | */ |
119 | #define WWDG_PRESCALER_1 0x00000000U /*!< WWDG counter clock = (PCLK1/4096)/1 */ |
130 | #define WWDG_PRESCALER_1 0x00000000u /*!< WWDG counter clock = (PCLK1/4096)/1 */ |
120 | #define WWDG_PRESCALER_2 WWDG_CFR_WDGTB0 /*!< WWDG counter clock = (PCLK1/4096)/2 */ |
131 | #define WWDG_PRESCALER_2 WWDG_CFR_WDGTB_0 /*!< WWDG counter clock = (PCLK1/4096)/2 */ |
121 | #define WWDG_PRESCALER_4 WWDG_CFR_WDGTB1 /*!< WWDG counter clock = (PCLK1/4096)/4 */ |
132 | #define WWDG_PRESCALER_4 WWDG_CFR_WDGTB_1 /*!< WWDG counter clock = (PCLK1/4096)/4 */ |
122 | #define WWDG_PRESCALER_8 WWDG_CFR_WDGTB /*!< WWDG counter clock = (PCLK1/4096)/8 */ |
133 | #define WWDG_PRESCALER_8 (WWDG_CFR_WDGTB_1 | WWDG_CFR_WDGTB_0) /*!< WWDG counter clock = (PCLK1/4096)/8 */ |
123 | /** |
134 | /** |
124 | * @} |
135 | * @} |
125 | */ |
136 | */ |
126 | 137 | ||
127 | /** @defgroup WWDG_EWI_Mode WWDG Early Wakeup Interrupt Mode |
138 | /** @defgroup WWDG_EWI_Mode WWDG Early Wakeup Interrupt Mode |
128 | * @{ |
139 | * @{ |
129 | */ |
140 | */ |
130 | #define WWDG_EWI_DISABLE 0x00000000U /*!< EWI Disable */ |
141 | #define WWDG_EWI_DISABLE 0x00000000u /*!< EWI Disable */ |
131 | #define WWDG_EWI_ENABLE WWDG_CFR_EWI /*!< EWI Enable */ |
142 | #define WWDG_EWI_ENABLE WWDG_CFR_EWI /*!< EWI Enable */ |
132 | /** |
143 | /** |
133 | * @} |
144 | * @} |
134 | */ |
145 | */ |
135 | 146 | ||
Line 140... | Line 151... | ||
140 | /* Private macros ------------------------------------------------------------*/ |
151 | /* Private macros ------------------------------------------------------------*/ |
141 | 152 | ||
142 | /** @defgroup WWDG_Private_Macros WWDG Private Macros |
153 | /** @defgroup WWDG_Private_Macros WWDG Private Macros |
143 | * @{ |
154 | * @{ |
144 | */ |
155 | */ |
145 | #define IS_WWDG_PRESCALER(__PRESCALER__) (((__PRESCALER__) == WWDG_PRESCALER_1) || \ |
156 | #define IS_WWDG_PRESCALER(__PRESCALER__) (((__PRESCALER__) == WWDG_PRESCALER_1) || \ |
146 | ((__PRESCALER__) == WWDG_PRESCALER_2) || \ |
157 | ((__PRESCALER__) == WWDG_PRESCALER_2) || \ |
147 | ((__PRESCALER__) == WWDG_PRESCALER_4) || \ |
158 | ((__PRESCALER__) == WWDG_PRESCALER_4) || \ |
148 | ((__PRESCALER__) == WWDG_PRESCALER_8)) |
159 | ((__PRESCALER__) == WWDG_PRESCALER_8)) |
149 | 160 | ||
150 | #define IS_WWDG_WINDOW(__WINDOW__) (((__WINDOW__) >= WWDG_CFR_W_6) && ((__WINDOW__) <= WWDG_CFR_W)) |
161 | #define IS_WWDG_WINDOW(__WINDOW__) (((__WINDOW__) >= WWDG_CFR_W_6) && ((__WINDOW__) <= WWDG_CFR_W)) |
151 | 162 | ||
152 | #define IS_WWDG_COUNTER(__COUNTER__) (((__COUNTER__) >= WWDG_CR_T_6) && ((__COUNTER__) <= WWDG_CR_T)) |
163 | #define IS_WWDG_COUNTER(__COUNTER__) (((__COUNTER__) >= WWDG_CR_T_6) && ((__COUNTER__) <= WWDG_CR_T)) |
Line 163... | Line 174... | ||
163 | /** @defgroup WWDG_Exported_Macros WWDG Exported Macros |
174 | /** @defgroup WWDG_Exported_Macros WWDG Exported Macros |
164 | * @{ |
175 | * @{ |
165 | */ |
176 | */ |
166 | 177 | ||
167 | /** |
178 | /** |
168 | * @brief Enables the WWDG peripheral. |
179 | * @brief Enable the WWDG peripheral. |
169 | * @param __HANDLE__: WWDG handle |
180 | * @param __HANDLE__ WWDG handle |
170 | * @retval None |
181 | * @retval None |
171 | */ |
182 | */ |
172 | #define __HAL_WWDG_ENABLE(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CR, WWDG_CR_WDGA) |
183 | #define __HAL_WWDG_ENABLE(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CR, WWDG_CR_WDGA) |
173 | 184 | ||
174 | /** |
185 | /** |
175 | * @brief Enables the WWDG early wakeup interrupt. |
186 | * @brief Enable the WWDG early wakeup interrupt. |
176 | * @param __HANDLE__: WWDG handle |
187 | * @param __HANDLE__: WWDG handle |
177 | * @param __INTERRUPT__ specifies the interrupt to enable. |
188 | * @param __INTERRUPT__ specifies the interrupt to enable. |
178 | * This parameter can be one of the following values: |
189 | * This parameter can be one of the following values: |
179 | * @arg WWDG_IT_EWI: Early wakeup interrupt |
190 | * @arg WWDG_IT_EWI: Early wakeup interrupt |
180 | * @note Once enabled this interrupt cannot be disabled except by a system reset. |
191 | * @note Once enabled this interrupt cannot be disabled except by a system reset. |
181 | * @retval None |
192 | * @retval None |
182 | */ |
193 | */ |
183 | #define __HAL_WWDG_ENABLE_IT(__HANDLE__, __INTERRUPT__) SET_BIT((__HANDLE__)->Instance->CFR, (__INTERRUPT__)) |
194 | #define __HAL_WWDG_ENABLE_IT(__HANDLE__, __INTERRUPT__) SET_BIT((__HANDLE__)->Instance->CFR, (__INTERRUPT__)) |
184 | 195 | ||
185 | /** |
196 | /** |
186 | * @brief Checks whether the selected WWDG interrupt has occurred or not. |
197 | * @brief Check whether the selected WWDG interrupt has occurred or not. |
187 | * @param __HANDLE__ WWDG handle |
198 | * @param __HANDLE__ WWDG handle |
188 | * @param __INTERRUPT__ specifies the it to check. |
199 | * @param __INTERRUPT__ specifies the it to check. |
189 | * This parameter can be one of the following values: |
200 | * This parameter can be one of the following values: |
190 | * @arg WWDG_FLAG_EWIF: Early wakeup interrupt IT |
201 | * @arg WWDG_FLAG_EWIF: Early wakeup interrupt IT |
191 | * @retval The new state of WWDG_FLAG (SET or RESET). |
202 | * @retval The new state of WWDG_FLAG (SET or RESET). |
192 | */ |
203 | */ |
193 | #define __HAL_WWDG_GET_IT(__HANDLE__, __INTERRUPT__) __HAL_WWDG_GET_FLAG((__HANDLE__),(__INTERRUPT__)) |
204 | #define __HAL_WWDG_GET_IT(__HANDLE__, __INTERRUPT__) __HAL_WWDG_GET_FLAG((__HANDLE__),(__INTERRUPT__)) |
194 | 205 | ||
195 | /** @brief Clear the WWDG's interrupt pending bits |
206 | /** @brief Clear the WWDG interrupt pending bits. |
196 | * bits to clear the selected interrupt pending bits. |
207 | * bits to clear the selected interrupt pending bits. |
197 | * @param __HANDLE__: WWDG handle |
208 | * @param __HANDLE__ WWDG handle |
198 | * @param __INTERRUPT__: specifies the interrupt pending bit to clear. |
209 | * @param __INTERRUPT__ specifies the interrupt pending bit to clear. |
199 | * This parameter can be one of the following values: |
210 | * This parameter can be one of the following values: |
200 | * @arg WWDG_FLAG_EWIF: Early wakeup interrupt flag |
211 | * @arg WWDG_FLAG_EWIF: Early wakeup interrupt flag |
201 | */ |
212 | */ |
202 | #define __HAL_WWDG_CLEAR_IT(__HANDLE__, __INTERRUPT__) __HAL_WWDG_CLEAR_FLAG((__HANDLE__), (__INTERRUPT__)) |
213 | #define __HAL_WWDG_CLEAR_IT(__HANDLE__, __INTERRUPT__) __HAL_WWDG_CLEAR_FLAG((__HANDLE__), (__INTERRUPT__)) |
203 | 214 | ||
204 | /** |
215 | /** |
205 | * @brief Check whether the specified WWDG flag is set or not. |
216 | * @brief Check whether the specified WWDG flag is set or not. |
206 | * @param __HANDLE__ WWDG handle |
217 | * @param __HANDLE__ WWDG handle |
207 | * @param __FLAG__ specifies the flag to check. |
218 | * @param __FLAG__ specifies the flag to check. |
208 | * This parameter can be one of the following values: |
219 | * This parameter can be one of the following values: |
209 | * @arg WWDG_FLAG_EWIF: Early wakeup interrupt flag |
220 | * @arg WWDG_FLAG_EWIF: Early wakeup interrupt flag |
210 | * @retval The new state of WWDG_FLAG (SET or RESET). |
221 | * @retval The new state of WWDG_FLAG (SET or RESET). |
211 | */ |
222 | */ |
212 | #define __HAL_WWDG_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR & (__FLAG__)) == (__FLAG__)) |
223 | #define __HAL_WWDG_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR & (__FLAG__)) == (__FLAG__)) |
213 | 224 | ||
214 | /** |
225 | /** |
215 | * @brief Clears the WWDG's pending flags. |
226 | * @brief Clear the WWDG's pending flags. |
216 | * @param __HANDLE__: WWDG handle |
227 | * @param __HANDLE__ WWDG handle |
217 | * @param __FLAG__: specifies the flag to clear. |
228 | * @param __FLAG__ specifies the flag to clear. |
218 | * This parameter can be one of the following values: |
229 | * This parameter can be one of the following values: |
219 | * @arg WWDG_FLAG_EWIF: Early wakeup interrupt flag |
230 | * @arg WWDG_FLAG_EWIF: Early wakeup interrupt flag |
220 | * @retval None |
231 | * @retval None |
221 | */ |
232 | */ |
222 | #define __HAL_WWDG_CLEAR_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR) = ~(__FLAG__)) |
233 | #define __HAL_WWDG_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->SR = ~(__FLAG__)) |
223 | 234 | ||
224 | /** @brief Checks if the specified WWDG interrupt source is enabled or disabled. |
235 | /** @brief Check whether the specified WWDG interrupt source is enabled or not. |
225 | * @param __HANDLE__: WWDG Handle. |
236 | * @param __HANDLE__ WWDG Handle. |
226 | * @param __INTERRUPT__: specifies the WWDG interrupt source to check. |
237 | * @param __INTERRUPT__ specifies the WWDG interrupt source to check. |
227 | * This parameter can be one of the following values: |
238 | * This parameter can be one of the following values: |
228 | * @arg WWDG_IT_EWI: Early Wakeup Interrupt |
239 | * @arg WWDG_IT_EWI: Early Wakeup Interrupt |
229 | * @retval state of __INTERRUPT__ (TRUE or FALSE). |
240 | * @retval state of __INTERRUPT__ (TRUE or FALSE). |
230 | */ |
241 | */ |
231 | #define __HAL_WWDG_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CFR & (__INTERRUPT__)) == (__INTERRUPT__)) |
242 | #define __HAL_WWDG_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CFR\ |
- | 243 | & (__INTERRUPT__)) == (__INTERRUPT__)) |
|
232 | 244 | ||
233 | /** |
245 | /** |
234 | * @} |
246 | * @} |
235 | */ |
247 | */ |
236 | 248 | ||
237 | /* Exported functions --------------------------------------------------------*/ |
249 | /* Exported functions --------------------------------------------------------*/ |
- | 250 | ||
238 | /** @addtogroup WWDG_Exported_Functions |
251 | /** @addtogroup WWDG_Exported_Functions |
239 | * @{ |
252 | * @{ |
240 | */ |
253 | */ |
241 | 254 | ||
242 | /** @addtogroup WWDG_Exported_Functions_Group1 |
255 | /** @addtogroup WWDG_Exported_Functions_Group1 |
243 | * @{ |
256 | * @{ |
244 | */ |
257 | */ |
245 | /* Initialization/de-initialization functions **********************************/ |
258 | /* Initialization/de-initialization functions **********************************/ |
246 | HAL_StatusTypeDef HAL_WWDG_Init(WWDG_HandleTypeDef *hwwdg); |
259 | HAL_StatusTypeDef HAL_WWDG_Init(WWDG_HandleTypeDef *hwwdg); |
247 | void HAL_WWDG_MspInit(WWDG_HandleTypeDef *hwwdg); |
260 | void HAL_WWDG_MspInit(WWDG_HandleTypeDef *hwwdg); |
- | 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 | ||
248 | /** |
268 | /** |
249 | * @} |
269 | * @} |
250 | */ |
270 | */ |
251 | 271 | ||
252 | /** @addtogroup WWDG_Exported_Functions_Group2 |
272 | /** @addtogroup WWDG_Exported_Functions_Group2 |
Line 274... | Line 294... | ||
274 | 294 | ||
275 | #ifdef __cplusplus |
295 | #ifdef __cplusplus |
276 | } |
296 | } |
277 | #endif |
297 | #endif |
278 | 298 | ||
279 | #endif /* __STM32F1xx_HAL_WWDG_H */ |
299 | #endif /* STM32F1xx_HAL_WWDG_H */ |
280 | 300 | ||
281 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
301 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |