]> git.gir.st - tmk_keyboard.git/blob - tmk_core/tool/mbed/mbed-sdk/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32F0/stm32f0xx_hal_pwr_ex.h
Merge commit '4d116a04e94cf0d19317d5b44e4fa9f34a3e5594'
[tmk_keyboard.git] / tmk_core / tool / mbed / mbed-sdk / libraries / mbed / targets / cmsis / TARGET_STM / TARGET_STM32F0 / stm32f0xx_hal_pwr_ex.h
1 /**
2 ******************************************************************************
3 * @file stm32f0xx_hal_pwr_ex.h
4 * @author MCD Application Team
5 * @version V1.2.0
6 * @date 11-December-2014
7 * @brief Header file of PWR HAL Extension module.
8 ******************************************************************************
9 * @attention
10 *
11 * <h2><center>&copy; 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 __STM32F0xx_HAL_PWR_EX_H
40 #define __STM32F0xx_HAL_PWR_EX_H
41
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45
46 /* Includes ------------------------------------------------------------------*/
47 #include "stm32f0xx_hal_def.h"
48
49 /** @addtogroup STM32F0xx_HAL_Driver
50 * @{
51 */
52
53 /** @addtogroup PWREx
54 * @{
55 */
56
57 /* Exported types ------------------------------------------------------------*/
58
59 /** @defgroup PWREx_Exported_Types PWREx Exported Types
60 * @{
61 */
62
63 #if defined (STM32F031x6) || defined (STM32F042x6) || defined (STM32F051x8) || \
64 defined (STM32F071xB) || defined (STM32F072xB) || \
65 defined (STM32F091xC)
66
67 /**
68 * @brief PWR PVD configuration structure definition
69 */
70 typedef struct
71 {
72 uint32_t PVDLevel; /*!< PVDLevel: Specifies the PVD detection level
73 This parameter can be a value of @ref PWREx_PVD_detection_level */
74
75 uint32_t Mode; /*!< Mode: Specifies the operating mode for the selected pins.
76 This parameter can be a value of @ref PWREx_PVD_Mode */
77 }PWR_PVDTypeDef;
78
79 #endif /* defined (STM32F031x6) || defined (STM32F042x6) || defined (STM32F051x8) || */
80 /* defined (STM32F071xB) || defined (STM32F072xB) || */
81 /* defined (STM32F091xC) */
82 /**
83 * @}
84 */
85 /* Exported constants --------------------------------------------------------*/
86
87 /** @defgroup PWREx_Exported_Constants PWREx Exported Constants
88 * @{
89 */
90
91
92 /** @defgroup PWREx_WakeUp_Pins PWREx Wakeup Pins
93 * @{
94 */
95 #if defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || defined (STM32F070xB) || \
96 defined (STM32F091xC) || defined (STM32F098xx) || defined (STM32F030xC)
97 #define PWR_WAKEUP_PIN1 ((uint32_t)0x00)
98 #define PWR_WAKEUP_PIN2 ((uint32_t)0x01)
99 #define PWR_WAKEUP_PIN3 ((uint32_t)0x02)
100 #define PWR_WAKEUP_PIN4 ((uint32_t)0x03)
101 #define PWR_WAKEUP_PIN5 ((uint32_t)0x04)
102 #define PWR_WAKEUP_PIN6 ((uint32_t)0x05)
103 #define PWR_WAKEUP_PIN7 ((uint32_t)0x06)
104 #define PWR_WAKEUP_PIN8 ((uint32_t)0x07)
105
106 #define IS_PWR_WAKEUP_PIN(PIN) (((PIN) == PWR_WAKEUP_PIN1) || \
107 ((PIN) == PWR_WAKEUP_PIN2) || \
108 ((PIN) == PWR_WAKEUP_PIN3) || \
109 ((PIN) == PWR_WAKEUP_PIN4) || \
110 ((PIN) == PWR_WAKEUP_PIN5) || \
111 ((PIN) == PWR_WAKEUP_PIN6) || \
112 ((PIN) == PWR_WAKEUP_PIN7) || \
113 ((PIN) == PWR_WAKEUP_PIN8))
114 #else
115 #define PWR_WAKEUP_PIN1 ((uint32_t)0x00)
116 #define PWR_WAKEUP_PIN2 ((uint32_t)0x01)
117
118 #define IS_PWR_WAKEUP_PIN(PIN) (((PIN) == PWR_WAKEUP_PIN1) || \
119 ((PIN) == PWR_WAKEUP_PIN2))
120 #endif /* defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || defined (STM32F070xB) || */
121 /* defined (STM32F091xC) || defined (STM32F098xx) || defined (STM32F030xC) */
122 /**
123 * @}
124 */
125
126 /** @defgroup PWREx_EXTI_Line PWREx EXTI Line
127 * @{
128 */
129 #if defined (STM32F031x6) || defined (STM32F042x6) || defined (STM32F051x8) || \
130 defined (STM32F071xB) || defined (STM32F072xB) || \
131 defined (STM32F091xC)
132
133 #define PWR_EXTI_LINE_PVD ((uint32_t)0x00010000) /*!< External interrupt line 16 Connected to the PVD EXTI Line */
134
135 #endif /* defined (STM32F031x6) || defined (STM32F042x6) || defined (STM32F051x8) || */
136 /* defined (STM32F071xB) || defined (STM32F072xB) || */
137 /* defined (STM32F091xC) */
138
139 #if defined (STM32F042x6) || defined (STM32F048xx) || \
140 defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || \
141 defined (STM32F091xC) || defined (STM32F098xx)
142
143 #define PWR_EXTI_LINE_VDDIO2 ((uint32_t)0x80000000) /*!< External interrupt line 31 Connected to the Vddio2 Monitor EXTI Line */
144
145 #endif /* defined (STM32F042x6) || defined (STM32F048xx) ||\
146 defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || \
147 defined (STM32F091xC) || defined (STM32F098xx) ||*/
148 /**
149 * @}
150 */
151
152 #if defined (STM32F031x6) || defined (STM32F042x6) || defined (STM32F051x8) || \
153 defined (STM32F071xB) || defined (STM32F072xB) || \
154 defined (STM32F091xC)
155 /** @defgroup PWREx_PVD_detection_level PWREx PVD detection level
156 * @{
157 */
158 #define PWR_PVDLEVEL_0 PWR_CR_PLS_LEV0
159 #define PWR_PVDLEVEL_1 PWR_CR_PLS_LEV1
160 #define PWR_PVDLEVEL_2 PWR_CR_PLS_LEV2
161 #define PWR_PVDLEVEL_3 PWR_CR_PLS_LEV3
162 #define PWR_PVDLEVEL_4 PWR_CR_PLS_LEV4
163 #define PWR_PVDLEVEL_5 PWR_CR_PLS_LEV5
164 #define PWR_PVDLEVEL_6 PWR_CR_PLS_LEV6
165 #define PWR_PVDLEVEL_7 PWR_CR_PLS_LEV7
166 #define IS_PWR_PVD_LEVEL(LEVEL) (((LEVEL) == PWR_PVDLEVEL_0) || ((LEVEL) == PWR_PVDLEVEL_1)|| \
167 ((LEVEL) == PWR_PVDLEVEL_2) || ((LEVEL) == PWR_PVDLEVEL_3)|| \
168 ((LEVEL) == PWR_PVDLEVEL_4) || ((LEVEL) == PWR_PVDLEVEL_5)|| \
169 ((LEVEL) == PWR_PVDLEVEL_6) || ((LEVEL) == PWR_PVDLEVEL_7))
170 /**
171 * @}
172 */
173
174 /** @defgroup PWREx_PVD_Mode PWREx PVD Mode
175 * @{
176 */
177 #define PWR_PVD_MODE_NORMAL ((uint32_t)0x00000000) /*!< basic mode is used */
178 #define PWR_PVD_MODE_IT_RISING ((uint32_t)0x00010001) /*!< External Interrupt Mode with Rising edge trigger detection */
179 #define PWR_PVD_MODE_IT_FALLING ((uint32_t)0x00010002) /*!< External Interrupt Mode with Falling edge trigger detection */
180 #define PWR_PVD_MODE_IT_RISING_FALLING ((uint32_t)0x00010003) /*!< External Interrupt Mode with Rising/Falling edge trigger detection */
181 #define PWR_PVD_MODE_EVENT_RISING ((uint32_t)0x00020001) /*!< Event Mode with Rising edge trigger detection */
182 #define PWR_PVD_MODE_EVENT_FALLING ((uint32_t)0x00020002) /*!< Event Mode with Falling edge trigger detection */
183 #define PWR_PVD_MODE_EVENT_RISING_FALLING ((uint32_t)0x00020003) /*!< Event Mode with Rising/Falling edge trigger detection */
184
185 #define IS_PWR_PVD_MODE(MODE) (((MODE) == PWR_PVD_MODE_IT_RISING)|| ((MODE) == PWR_PVD_MODE_IT_FALLING) || \
186 ((MODE) == PWR_PVD_MODE_IT_RISING_FALLING) || ((MODE) == PWR_PVD_MODE_EVENT_RISING) || \
187 ((MODE) == PWR_PVD_MODE_EVENT_FALLING) || ((MODE) == PWR_PVD_MODE_EVENT_RISING_FALLING) || \
188 ((MODE) == PWR_PVD_MODE_NORMAL))
189 /**
190 * @}
191 */
192 #endif /* defined (STM32F031x6) || defined (STM32F042x6) || defined (STM32F051x8) || */
193 /* defined (STM32F071xB) || defined (STM32F072xB) || */
194 /* defined (STM32F091xC) */
195
196 /** @defgroup PWREx_Flag PWREx Flag
197 * @{
198 */
199 #if defined (STM32F031x6) || defined (STM32F042x6) || defined (STM32F051x8) || \
200 defined (STM32F071xB) || defined (STM32F072xB) || \
201 defined (STM32F091xC)
202
203 #define PWR_FLAG_WU PWR_CSR_WUF
204 #define PWR_FLAG_SB PWR_CSR_SBF
205 #define PWR_FLAG_PVDO PWR_CSR_PVDO
206 #define PWR_FLAG_VREFINTRDY PWR_CSR_VREFINTRDYF
207 #elif defined (STM32F070x6) || defined (STM32F070xB) || defined (STM32F030xC)
208 #define PWR_FLAG_WU PWR_CSR_WUF
209 #define PWR_FLAG_SB PWR_CSR_SBF
210 #define PWR_FLAG_VREFINTRDY PWR_CSR_VREFINTRDYF
211 #else
212 #define PWR_FLAG_WU PWR_CSR_WUF
213 #define PWR_FLAG_SB PWR_CSR_SBF
214
215 #endif /* defined (STM32F031x6) || defined (STM32F042x6) || defined (STM32F051x8) || */
216 /* defined (STM32F071xB) || defined (STM32F072xB) || */
217 /* defined (STM32F091xC) */
218 /**
219 * @}
220 */
221
222 /**
223 * @}
224 */
225
226 /* Exported macro ------------------------------------------------------------*/
227 /** @defgroup PWREx_Exported_Macros PWREx Exported Macros
228 * @{
229 */
230 #if defined (STM32F031x6) || defined (STM32F042x6) || defined (STM32F051x8) || \
231 defined (STM32F071xB) || defined (STM32F072xB) || \
232 defined (STM32F091xC)
233 /**
234 * @brief Enable interrupt on PVD Exti Line 16.
235 * @retval None.
236 */
237 #define __HAL_PWR_PVD_EXTI_ENABLE_IT() (EXTI->IMR |= (PWR_EXTI_LINE_PVD))
238
239 /**
240 * @brief Disable interrupt on PVD Exti Line 16.
241 * @retval None.
242 */
243 #define __HAL_PWR_PVD_EXTI_DISABLE_IT() (EXTI->IMR &= ~(PWR_EXTI_LINE_PVD))
244
245 /**
246 * @brief Enable event on PVD Exti Line 16.
247 * @retval None.
248 */
249 #define __HAL_PWR_PVD_EXTI_ENABLE_EVENT() (EXTI->EMR |= (PWR_EXTI_LINE_PVD))
250
251 /**
252 * @brief Disable event on PVD Exti Line 16.
253 * @retval None.
254 */
255 #define __HAL_PWR_PVD_EXTI_DISABLE_EVENT() (EXTI->EMR &= ~(PWR_EXTI_LINE_PVD))
256
257 /**
258 * @brief PVD EXTI line configuration: clear falling edge and rising edge trigger.
259 * @retval None.
260 */
261 #define __HAL_PWR_PVD_EXTI_CLEAR_EGDE_TRIGGER() EXTI->FTSR &= ~(PWR_EXTI_LINE_PVD); \
262 EXTI->RTSR &= ~(PWR_EXTI_LINE_PVD)
263
264 /**
265 * @brief PVD EXTI line configuration: set falling edge trigger.
266 * @retval None.
267 */
268 #define __HAL_PWR_PVD_EXTI_SET_FALLING_EGDE_TRIGGER() EXTI->FTSR |= (PWR_EXTI_LINE_PVD)
269
270 /**
271 * @brief PVD EXTI line configuration: set rising edge trigger.
272 * @retval None.
273 */
274 #define __HAL_PWR_PVD_EXTI_SET_RISING_EDGE_TRIGGER() EXTI->RTSR |= (PWR_EXTI_LINE_PVD)
275
276 /**
277 * @brief Check whether the specified PVD EXTI interrupt flag is set or not.
278 * @retval EXTI PVD Line Status.
279 */
280 #define __HAL_PWR_PVD_EXTI_GET_FLAG() (EXTI->PR & (PWR_EXTI_LINE_PVD))
281
282 /**
283 * @brief Clear the PVD EXTI flag.
284 * @retval None.
285 */
286 #define __HAL_PWR_PVD_EXTI_CLEAR_FLAG() (EXTI->PR = (PWR_EXTI_LINE_PVD))
287
288 /**
289 * @brief Generate a Software interrupt on selected EXTI line.
290 * @retval None.
291 */
292 #define __HAL_PWR_PVD_EXTI_GENERATE_SWIT() (EXTI->SWIER |= (PWR_EXTI_LINE_PVD))
293
294 #endif /* defined (STM32F031x6) || defined (STM32F042x6) || defined (STM32F051x8) || */
295 /* defined (STM32F071xB) || defined (STM32F072xB) || */
296 /* defined (STM32F091xC) */
297
298
299 #if defined (STM32F042x6) || defined (STM32F048xx) || \
300 defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || \
301 defined (STM32F091xC) || defined (STM32F098xx)
302 /**
303 * @brief Enable interrupt on Vddio2 Monitor Exti Line 31.
304 * @retval None.
305 */
306 #define __HAL_PWR_VDDIO2_EXTI_ENABLE_IT() (EXTI->IMR |= (PWR_EXTI_LINE_VDDIO2))
307
308 /**
309 * @brief Disable interrupt on Vddio2 Monitor Exti Line 31.
310 * @retval None.
311 */
312 #define __HAL_PWR_VDDIO2_EXTI_DISABLE_IT() (EXTI->IMR &= ~(PWR_EXTI_LINE_VDDIO2))
313
314 /**
315 * @brief Vddio2 Monitor EXTI line configuration: clear falling edge and rising edge trigger.
316 * @retval None.
317 */
318 #define __HAL_PWR_VDDIO2_EXTI_CLEAR_EGDE_TRIGGER() EXTI->FTSR &= ~(PWR_EXTI_LINE_VDDIO2); \
319 EXTI->RTSR &= ~(PWR_EXTI_LINE_VDDIO2)
320
321 /**
322 * @brief Vddio2 Monitor EXTI line configuration: set falling edge trigger.
323 * @retval None.
324 */
325 #define __HAL_PWR_VDDIO2_EXTI_SET_FALLING_EGDE_TRIGGER() EXTI->FTSR |= (PWR_EXTI_LINE_VDDIO2)
326
327 /**
328 * @brief Check whether the specified VDDIO2 monitor EXTI interrupt flag is set or not.
329 * @retval EXTI VDDIO2 Monitor Line Status.
330 */
331 #define __HAL_PWR_VDDIO2_EXTI_GET_FLAG() (EXTI->PR & (PWR_EXTI_LINE_VDDIO2))
332
333 /**
334 * @brief Clear the VDDIO2 Monitor EXTI flag.
335 * @retval None.
336 */
337 #define __HAL_PWR_VDDIO2_EXTI_CLEAR_FLAG() (EXTI->PR = (PWR_EXTI_LINE_VDDIO2))
338
339 /**
340 * @brief Generate a Software interrupt on selected EXTI line.
341 * @retval None.
342 */
343 #define __HAL_PWR_VDDIO2_EXTI_GENERATE_SWIT() (EXTI->SWIER |= (PWR_EXTI_LINE_VDDIO2))
344
345
346 #endif /* defined (STM32F042x6) || defined (STM32F048xx) ||\
347 defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || \
348 defined (STM32F091xC) || defined (STM32F098xx) */
349
350 /**
351 * @}
352 */
353
354 /* Exported functions --------------------------------------------------------*/
355
356 /** @addtogroup PWREx_Exported_Functions PWREx Exported Functions
357 * @{
358 */
359
360 /** @addtogroup PWREx_Exported_Functions_Group1
361 * @{
362 */
363 /* I/O operation functions ***************************************************/
364 #if defined (STM32F031x6) || defined (STM32F042x6) || defined (STM32F051x8) || \
365 defined (STM32F071xB) || defined (STM32F072xB) || \
366 defined (STM32F091xC)
367 void HAL_PWR_PVD_IRQHandler(void);
368 void HAL_PWR_PVDCallback(void);
369 #endif /* defined (STM32F031x6) || defined (STM32F042x6) || defined (STM32F051x8) || */
370 /* defined (STM32F071xB) || defined (STM32F072xB) || */
371 /* defined (STM32F091xC) */
372
373 #if defined (STM32F042x6) || defined (STM32F048xx) || \
374 defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || \
375 defined (STM32F091xC) || defined (STM32F098xx)
376 void HAL_PWR_Vddio2Monitor_IRQHandler(void);
377 void HAL_PWR_Vddio2MonitorCallback(void);
378 #endif /* defined (STM32F042x6) || defined (STM32F048xx) || \
379 defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || \
380 defined (STM32F091xC) || defined (STM32F098xx) */
381
382 /* Peripheral Control functions **********************************************/
383 #if defined (STM32F031x6) || defined (STM32F042x6) || defined (STM32F051x8) || \
384 defined (STM32F071xB) || defined (STM32F072xB) || \
385 defined (STM32F091xC)
386 void HAL_PWR_PVDConfig(PWR_PVDTypeDef *sConfigPVD);
387 void HAL_PWR_EnablePVD(void);
388 void HAL_PWR_DisablePVD(void);
389 #endif /* defined (STM32F031x6) || defined (STM32F042x6) || defined (STM32F051x8) || */
390 /* defined (STM32F071xB) || defined (STM32F072xB) || */
391 /* defined (STM32F091xC) */
392
393 #if defined (STM32F042x6) || defined (STM32F048xx) || \
394 defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || \
395 defined (STM32F091xC) || defined (STM32F098xx)
396 void HAL_PWR_EnableVddio2Monitor(void);
397 void HAL_PWR_DisableVddio2Monitor(void);
398 #endif /* defined (STM32F042x6) || defined (STM32F048xx) || \
399 defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || \
400 defined (STM32F091xC) || defined (STM32F098xx) */
401
402 /**
403 * @}
404 */
405
406 /**
407 * @}
408 */
409
410 /**
411 * @}
412 */
413
414 /**
415 * @}
416 */
417
418 #ifdef __cplusplus
419 }
420 #endif
421
422 #endif /* __STM32F0xx_HAL_PWR_EX_H */
423
424 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
425
Imprint / Impressum