stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr.h
Go to the documentation of this file.
1 
20 /* Define to prevent recursive inclusion -------------------------------------*/
21 #ifndef __STM32F4xx_HAL_PWR_H
22 #define __STM32F4xx_HAL_PWR_H
23 
24 #ifdef __cplusplus
25  extern "C" {
26 #endif
27 
28 /* Includes ------------------------------------------------------------------*/
29 #include "stm32f4xx_hal_def.h"
30 
39 /* Exported types ------------------------------------------------------------*/
40 
48 typedef struct
49 {
50  uint32_t PVDLevel;
53  uint32_t Mode;
56 
61 /* Exported constants --------------------------------------------------------*/
69 #define PWR_WAKEUP_PIN1 0x00000100U
70 
77 #define PWR_PVDLEVEL_0 PWR_CR_PLS_LEV0
78 #define PWR_PVDLEVEL_1 PWR_CR_PLS_LEV1
79 #define PWR_PVDLEVEL_2 PWR_CR_PLS_LEV2
80 #define PWR_PVDLEVEL_3 PWR_CR_PLS_LEV3
81 #define PWR_PVDLEVEL_4 PWR_CR_PLS_LEV4
82 #define PWR_PVDLEVEL_5 PWR_CR_PLS_LEV5
83 #define PWR_PVDLEVEL_6 PWR_CR_PLS_LEV6
84 #define PWR_PVDLEVEL_7 PWR_CR_PLS_LEV7/* External input analog voltage
85  (Compare internally to VREFINT) */
86 
93 #define PWR_PVD_MODE_NORMAL 0x00000000U
94 #define PWR_PVD_MODE_IT_RISING 0x00010001U
95 #define PWR_PVD_MODE_IT_FALLING 0x00010002U
96 #define PWR_PVD_MODE_IT_RISING_FALLING 0x00010003U
97 #define PWR_PVD_MODE_EVENT_RISING 0x00020001U
98 #define PWR_PVD_MODE_EVENT_FALLING 0x00020002U
99 #define PWR_PVD_MODE_EVENT_RISING_FALLING 0x00020003U
108 #define PWR_MAINREGULATOR_ON 0x00000000U
109 #define PWR_LOWPOWERREGULATOR_ON PWR_CR_LPDS
110 
117 #define PWR_SLEEPENTRY_WFI ((uint8_t)0x01)
118 #define PWR_SLEEPENTRY_WFE ((uint8_t)0x02)
119 
126 #define PWR_STOPENTRY_WFI ((uint8_t)0x01)
127 #define PWR_STOPENTRY_WFE ((uint8_t)0x02)
128 
135 #define PWR_FLAG_WU PWR_CSR_WUF
136 #define PWR_FLAG_SB PWR_CSR_SBF
137 #define PWR_FLAG_PVDO PWR_CSR_PVDO
138 #define PWR_FLAG_BRR PWR_CSR_BRR
139 #define PWR_FLAG_VOSRDY PWR_CSR_VOSRDY
140 
148 /* Exported macro ------------------------------------------------------------*/
174 #define __HAL_PWR_GET_FLAG(__FLAG__) ((PWR->CSR & (__FLAG__)) == (__FLAG__))
175 
182 #define __HAL_PWR_CLEAR_FLAG(__FLAG__) (PWR->CR |= (__FLAG__) << 2U)
183 
188 #define __HAL_PWR_PVD_EXTI_ENABLE_IT() (EXTI->IMR |= (PWR_EXTI_LINE_PVD))
189 
194 #define __HAL_PWR_PVD_EXTI_DISABLE_IT() (EXTI->IMR &= ~(PWR_EXTI_LINE_PVD))
195 
200 #define __HAL_PWR_PVD_EXTI_ENABLE_EVENT() (EXTI->EMR |= (PWR_EXTI_LINE_PVD))
201 
206 #define __HAL_PWR_PVD_EXTI_DISABLE_EVENT() (EXTI->EMR &= ~(PWR_EXTI_LINE_PVD))
207 
212 #define __HAL_PWR_PVD_EXTI_ENABLE_RISING_EDGE() SET_BIT(EXTI->RTSR, PWR_EXTI_LINE_PVD)
213 
218 #define __HAL_PWR_PVD_EXTI_DISABLE_RISING_EDGE() CLEAR_BIT(EXTI->RTSR, PWR_EXTI_LINE_PVD)
219 
224 #define __HAL_PWR_PVD_EXTI_ENABLE_FALLING_EDGE() SET_BIT(EXTI->FTSR, PWR_EXTI_LINE_PVD)
225 
226 
231 #define __HAL_PWR_PVD_EXTI_DISABLE_FALLING_EDGE() CLEAR_BIT(EXTI->FTSR, PWR_EXTI_LINE_PVD)
232 
233 
238 #define __HAL_PWR_PVD_EXTI_ENABLE_RISING_FALLING_EDGE() do{__HAL_PWR_PVD_EXTI_ENABLE_RISING_EDGE();\
239  __HAL_PWR_PVD_EXTI_ENABLE_FALLING_EDGE();\
240  }while(0U)
241 
247 #define __HAL_PWR_PVD_EXTI_DISABLE_RISING_FALLING_EDGE() do{__HAL_PWR_PVD_EXTI_DISABLE_RISING_EDGE();\
248  __HAL_PWR_PVD_EXTI_DISABLE_FALLING_EDGE();\
249  }while(0U)
250 
255 #define __HAL_PWR_PVD_EXTI_GET_FLAG() (EXTI->PR & (PWR_EXTI_LINE_PVD))
256 
261 #define __HAL_PWR_PVD_EXTI_CLEAR_FLAG() (EXTI->PR = (PWR_EXTI_LINE_PVD))
262 
267 #define __HAL_PWR_PVD_EXTI_GENERATE_SWIT() (EXTI->SWIER |= (PWR_EXTI_LINE_PVD))
268 
273 /* Include PWR HAL Extension module */
274 #include "stm32f4xx_hal_pwr_ex.h"
275 
276 /* Exported functions --------------------------------------------------------*/
284 /* Initialization and de-initialization functions *****************************/
285 void HAL_PWR_DeInit(void);
286 void HAL_PWR_EnableBkUpAccess(void);
287 void HAL_PWR_DisableBkUpAccess(void);
295 /* Peripheral Control functions **********************************************/
296 /* PVD configuration */
297 void HAL_PWR_ConfigPVD(PWR_PVDTypeDef *sConfigPVD);
298 void HAL_PWR_EnablePVD(void);
299 void HAL_PWR_DisablePVD(void);
300 
301 /* WakeUp pins configuration */
302 void HAL_PWR_EnableWakeUpPin(uint32_t WakeUpPinx);
303 void HAL_PWR_DisableWakeUpPin(uint32_t WakeUpPinx);
304 
305 /* Low Power modes entry */
306 void HAL_PWR_EnterSTOPMode(uint32_t Regulator, uint8_t STOPEntry);
307 void HAL_PWR_EnterSLEEPMode(uint32_t Regulator, uint8_t SLEEPEntry);
308 void HAL_PWR_EnterSTANDBYMode(void);
309 
310 /* Power PVD IRQ Handler */
311 void HAL_PWR_PVD_IRQHandler(void);
312 void HAL_PWR_PVDCallback(void);
313 
314 /* Cortex System Control functions *******************************************/
315 void HAL_PWR_EnableSleepOnExit(void);
316 void HAL_PWR_DisableSleepOnExit(void);
317 void HAL_PWR_EnableSEVOnPend(void);
318 void HAL_PWR_DisableSEVOnPend(void);
327 /* Private types -------------------------------------------------------------*/
328 /* Private variables ---------------------------------------------------------*/
329 /* Private constants ---------------------------------------------------------*/
337 #define PWR_EXTI_LINE_PVD ((uint32_t)EXTI_IMR_MR16)
345 /* ------------- PWR registers bit address in the alias region ---------------*/
346 #define PWR_OFFSET (PWR_BASE - PERIPH_BASE)
347 #define PWR_CR_OFFSET 0x00U
348 #define PWR_CSR_OFFSET 0x04U
349 #define PWR_CR_OFFSET_BB (PWR_OFFSET + PWR_CR_OFFSET)
350 #define PWR_CSR_OFFSET_BB (PWR_OFFSET + PWR_CSR_OFFSET)
351 
358 /* --- CR Register ---*/
359 /* Alias word address of DBP bit */
360 #define DBP_BIT_NUMBER PWR_CR_DBP_Pos
361 #define CR_DBP_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32U) + (DBP_BIT_NUMBER * 4U))
362 
363 /* Alias word address of PVDE bit */
364 #define PVDE_BIT_NUMBER PWR_CR_PVDE_Pos
365 #define CR_PVDE_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32U) + (PVDE_BIT_NUMBER * 4U))
366 
367 /* Alias word address of VOS bit */
368 #define VOS_BIT_NUMBER PWR_CR_VOS_Pos
369 #define CR_VOS_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32U) + (VOS_BIT_NUMBER * 4U))
370 
377 /* --- CSR Register ---*/
378 /* Alias word address of EWUP bit */
379 #define EWUP_BIT_NUMBER PWR_CSR_EWUP_Pos
380 #define CSR_EWUP_BB (PERIPH_BB_BASE + (PWR_CSR_OFFSET_BB * 32U) + (EWUP_BIT_NUMBER * 4U))
381 
388 /* Private macros ------------------------------------------------------------*/
396 #define IS_PWR_PVD_LEVEL(LEVEL) (((LEVEL) == PWR_PVDLEVEL_0) || ((LEVEL) == PWR_PVDLEVEL_1)|| \
397  ((LEVEL) == PWR_PVDLEVEL_2) || ((LEVEL) == PWR_PVDLEVEL_3)|| \
398  ((LEVEL) == PWR_PVDLEVEL_4) || ((LEVEL) == PWR_PVDLEVEL_5)|| \
399  ((LEVEL) == PWR_PVDLEVEL_6) || ((LEVEL) == PWR_PVDLEVEL_7))
400 #define IS_PWR_PVD_MODE(MODE) (((MODE) == PWR_PVD_MODE_IT_RISING)|| ((MODE) == PWR_PVD_MODE_IT_FALLING) || \
401  ((MODE) == PWR_PVD_MODE_IT_RISING_FALLING) || ((MODE) == PWR_PVD_MODE_EVENT_RISING) || \
402  ((MODE) == PWR_PVD_MODE_EVENT_FALLING) || ((MODE) == PWR_PVD_MODE_EVENT_RISING_FALLING) || \
403  ((MODE) == PWR_PVD_MODE_NORMAL))
404 #define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_MAINREGULATOR_ON) || \
405  ((REGULATOR) == PWR_LOWPOWERREGULATOR_ON))
406 #define IS_PWR_SLEEP_ENTRY(ENTRY) (((ENTRY) == PWR_SLEEPENTRY_WFI) || ((ENTRY) == PWR_SLEEPENTRY_WFE))
407 #define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPENTRY_WFI) || ((ENTRY) == PWR_STOPENTRY_WFE))
408 
424 #ifdef __cplusplus
425 }
426 #endif
427 
428 
429 #endif /* __STM32F4xx_HAL_PWR_H */
430 
431 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
stm32f4xx_hal_pwr_ex.h
Header file of PWR HAL Extension module.
HAL_PWR_EnterSTOPMode
void HAL_PWR_EnterSTOPMode(uint32_t Regulator, uint8_t STOPEntry)
HAL_PWR_EnablePVD
void HAL_PWR_EnablePVD(void)
HAL_PWR_EnterSTANDBYMode
void HAL_PWR_EnterSTANDBYMode(void)
PWR_PVDTypeDef::PVDLevel
uint32_t PVDLevel
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr.h:50
PWR_PVDTypeDef
PWR PVD configuration structure definition.
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr.h:48
HAL_PWR_DisableBkUpAccess
void HAL_PWR_DisableBkUpAccess(void)
PWR_PVDTypeDef::Mode
uint32_t Mode
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr.h:53
HAL_PWR_DisableSEVOnPend
void HAL_PWR_DisableSEVOnPend(void)
HAL_PWR_PVDCallback
void HAL_PWR_PVDCallback(void)
HAL_PWR_EnableBkUpAccess
void HAL_PWR_EnableBkUpAccess(void)
stm32f4xx_hal_def.h
This file contains HAL common defines, enumeration, macros and structures definitions.
HAL_PWR_EnableSleepOnExit
void HAL_PWR_EnableSleepOnExit(void)
HAL_PWR_DisablePVD
void HAL_PWR_DisablePVD(void)
HAL_PWR_PVD_IRQHandler
void HAL_PWR_PVD_IRQHandler(void)
HAL_PWR_ConfigPVD
void HAL_PWR_ConfigPVD(PWR_PVDTypeDef *sConfigPVD)
HAL_PWR_DeInit
void HAL_PWR_DeInit(void)
HAL_PWR_DisableWakeUpPin
void HAL_PWR_DisableWakeUpPin(uint32_t WakeUpPinx)
HAL_PWR_EnableSEVOnPend
void HAL_PWR_EnableSEVOnPend(void)
HAL_PWR_EnterSLEEPMode
void HAL_PWR_EnterSLEEPMode(uint32_t Regulator, uint8_t SLEEPEntry)
HAL_PWR_DisableSleepOnExit
void HAL_PWR_DisableSleepOnExit(void)
HAL_PWR_EnableWakeUpPin
void HAL_PWR_EnableWakeUpPin(uint32_t WakeUpPinx)


picovoice_driver
Author(s):
autogenerated on Fri Apr 1 2022 02:14:52