/** ****************************************************************************** * @file stm32f4xx_hal_pwr.h * @author MCD Application Team * @brief Header file of PWR HAL module. ****************************************************************************** * @attention * * Copyright (c) 2017 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that can be found in the LICENSE file in * the root directory of this software component. * If no LICENSE file comes with this software, it is provided AS-IS. ****************************************************************************** *//* ... *//* Define to prevent recursive inclusion -------------------------------------*/#ifndef__STM32F4xx_HAL_PWR_H#define__STM32F4xx_HAL_PWR_H#ifdef__cplusplusextern"C"{#endif/* Includes ------------------------------------------------------------------*/#include"stm32f4xx_hal_def.h"/** @addtogroup STM32F4xx_HAL_Driver * @{ *//* ... *//** @addtogroup PWR * @{ *//* ... */Includes/* Exported types ------------------------------------------------------------*//** @defgroup PWR_Exported_Types PWR Exported Types * @{ *//* ... *//** * @brief PWR PVD configuration structure definition *//* ... */typedefstruct{uint32_tPVDLevel;/*!< PVDLevel: Specifies the PVD detection level. This parameter can be a value of @ref PWR_PVD_detection_level *//* ... */uint32_tMode;/*!< Mode: Specifies the operating mode for the selected pins. This parameter can be a value of @ref PWR_PVD_Mode *//* ... */...}PWR_PVDTypeDef;/** * @} *//* ... */Exported types/* Exported constants --------------------------------------------------------*//** @defgroup PWR_Exported_Constants PWR Exported Constants * @{ *//* ... *//** @defgroup PWR_WakeUp_Pins PWR WakeUp Pins * @{ *//* ... */#definePWR_WAKEUP_PIN10x00000100U/** * @} *//* ... *//** @defgroup PWR_PVD_detection_level PWR PVD detection level * @{ *//* ... */#definePWR_PVDLEVEL_0PWR_CR_PLS_LEV0#definePWR_PVDLEVEL_1PWR_CR_PLS_LEV1#definePWR_PVDLEVEL_2PWR_CR_PLS_LEV2#definePWR_PVDLEVEL_3PWR_CR_PLS_LEV3#definePWR_PVDLEVEL_4PWR_CR_PLS_LEV4#definePWR_PVDLEVEL_5PWR_CR_PLS_LEV5#definePWR_PVDLEVEL_6PWR_CR_PLS_LEV6#definePWR_PVDLEVEL_7PWR_CR_PLS_LEV7/* External input analog voltage (Compare internally to VREFINT) *//* ... *//** * @} *//* ... *//** @defgroup PWR_PVD_Mode PWR PVD Mode * @{ *//* ... */#definePWR_PVD_MODE_NORMAL0x00000000U/*!< basic mode is used */#definePWR_PVD_MODE_IT_RISING0x00010001U/*!< External Interrupt Mode with Rising edge trigger detection */#definePWR_PVD_MODE_IT_FALLING0x00010002U/*!< External Interrupt Mode with Falling edge trigger detection */#definePWR_PVD_MODE_IT_RISING_FALLING0x00010003U/*!< External Interrupt Mode with Rising/Falling edge trigger detection */#definePWR_PVD_MODE_EVENT_RISING0x00020001U/*!< Event Mode with Rising edge trigger detection */#definePWR_PVD_MODE_EVENT_FALLING0x00020002U/*!< Event Mode with Falling edge trigger detection */#definePWR_PVD_MODE_EVENT_RISING_FALLING0x00020003U/*!< Event Mode with Rising/Falling edge trigger detection *//** * @} *//* ... *//** @defgroup PWR_Regulator_state_in_STOP_mode PWR Regulator state in SLEEP/STOP mode * @{ *//* ... */#definePWR_MAINREGULATOR_ON0x00000000U#definePWR_LOWPOWERREGULATOR_ONPWR_CR_LPDS/** * @} *//* ... *//** @defgroup PWR_SLEEP_mode_entry PWR SLEEP mode entry * @{ *//* ... */#definePWR_SLEEPENTRY_WFI((uint8_t)0x01)#definePWR_SLEEPENTRY_WFE((uint8_t)0x02)#definePWR_SLEEPENTRY_WFE_NO_EVT_CLEAR((uint8_t)0x03)/** * @} *//* ... *//** @defgroup PWR_STOP_mode_entry PWR STOP mode entry * @{ *//* ... */#definePWR_STOPENTRY_WFI((uint8_t)0x01)#definePWR_STOPENTRY_WFE((uint8_t)0x02)#definePWR_STOPENTRY_WFE_NO_EVT_CLEAR((uint8_t)0x03)/** * @} *//* ... *//** @defgroup PWR_Flag PWR Flag * @{ *//* ... */#definePWR_FLAG_WUPWR_CSR_WUF#definePWR_FLAG_SBPWR_CSR_SBF#definePWR_FLAG_PVDOPWR_CSR_PVDO#definePWR_FLAG_BRRPWR_CSR_BRR#definePWR_FLAG_VOSRDYPWR_CSR_VOSRDY/** * @} *//* ... *//** * @} *//* ... *//* Exported macro ------------------------------------------------------------*//** @defgroup PWR_Exported_Macro PWR Exported Macro * @{ *//* ... *//** @brief Check PWR flag is set or not. * @param __FLAG__ specifies the flag to check. * This parameter can be one of the following values: * @arg PWR_FLAG_WU: Wake Up flag. This flag indicates that a wakeup event * was received from the WKUP pin or from the RTC alarm (Alarm A * or Alarm B), RTC Tamper event, RTC TimeStamp event or RTC Wakeup. * An additional wakeup event is detected if the WKUP pin is enabled * (by setting the EWUP bit) when the WKUP pin level is already high. * @arg PWR_FLAG_SB: StandBy flag. This flag indicates that the system was * resumed from StandBy mode. * @arg PWR_FLAG_PVDO: PVD Output. This flag is valid only if PVD is enabled * by the HAL_PWR_EnablePVD() function. The PVD is stopped by Standby mode * For this reason, this bit is equal to 0 after Standby or reset * until the PVDE bit is set. * @arg PWR_FLAG_BRR: Backup regulator ready flag. This bit is not reset * when the device wakes up from Standby mode or by a system reset * or power reset. * @arg PWR_FLAG_VOSRDY: This flag indicates that the Regulator voltage * scaling output selection is ready. * @retval The new state of __FLAG__ (TRUE or FALSE). *//* ... */#define__HAL_PWR_GET_FLAG(__FLAG__)((PWR->CSR&(__FLAG__))==(__FLAG__))/** @brief Clear the PWR's pending flags. * @param __FLAG__ specifies the flag to clear. * This parameter can be one of the following values: * @arg PWR_FLAG_WU: Wake Up flag * @arg PWR_FLAG_SB: StandBy flag *//* ... */#define__HAL_PWR_CLEAR_FLAG(__FLAG__)(PWR->CR|=(__FLAG__)<<2U)/** * @brief Enable the PVD Exti Line 16. * @retval None. *//* ... */#define__HAL_PWR_PVD_EXTI_ENABLE_IT()(EXTI->IMR|=(PWR_EXTI_LINE_PVD))/** * @brief Disable the PVD EXTI Line 16. * @retval None. *//* ... */#define__HAL_PWR_PVD_EXTI_DISABLE_IT()(EXTI->IMR&=~(PWR_EXTI_LINE_PVD))/** * @brief Enable event on PVD Exti Line 16. * @retval None. *//* ... */#define__HAL_PWR_PVD_EXTI_ENABLE_EVENT()(EXTI->EMR|=(PWR_EXTI_LINE_PVD))/** * @brief Disable event on PVD Exti Line 16. * @retval None. *//* ... */#define__HAL_PWR_PVD_EXTI_DISABLE_EVENT()(EXTI->EMR&=~(PWR_EXTI_LINE_PVD))/** * @brief Enable the PVD Extended Interrupt Rising Trigger. * @retval None. *//* ... */#define__HAL_PWR_PVD_EXTI_ENABLE_RISING_EDGE()SET_BIT(EXTI->RTSR,PWR_EXTI_LINE_PVD)/** * @brief Disable the PVD Extended Interrupt Rising Trigger. * @retval None. *//* ... */#define__HAL_PWR_PVD_EXTI_DISABLE_RISING_EDGE()CLEAR_BIT(EXTI->RTSR,PWR_EXTI_LINE_PVD)/** * @brief Enable the PVD Extended Interrupt Falling Trigger. * @retval None. *//* ... */#define__HAL_PWR_PVD_EXTI_ENABLE_FALLING_EDGE()SET_BIT(EXTI->FTSR,PWR_EXTI_LINE_PVD)/** * @brief Disable the PVD Extended Interrupt Falling Trigger. * @retval None. *//* ... */#define__HAL_PWR_PVD_EXTI_DISABLE_FALLING_EDGE()CLEAR_BIT(EXTI->FTSR,PWR_EXTI_LINE_PVD)/** * @brief PVD EXTI line configuration: set rising & falling edge trigger. * @retval None. *//* ... */#define__HAL_PWR_PVD_EXTI_ENABLE_RISING_FALLING_EDGE()do{__HAL_PWR_PVD_EXTI_ENABLE_RISING_EDGE();\__HAL_PWR_PVD_EXTI_ENABLE_FALLING_EDGE();\...}while(0U).../** * @brief Disable the PVD Extended Interrupt Rising & Falling Trigger. * This parameter can be: * @retval None. *//* ... */#define__HAL_PWR_PVD_EXTI_DISABLE_RISING_FALLING_EDGE()do{__HAL_PWR_PVD_EXTI_DISABLE_RISING_EDGE();\__HAL_PWR_PVD_EXTI_DISABLE_FALLING_EDGE();\...}while(0U).../** * @brief checks whether the specified PVD Exti interrupt flag is set or not. * @retval EXTI PVD Line Status. *//* ... */#define__HAL_PWR_PVD_EXTI_GET_FLAG()(EXTI->PR&(PWR_EXTI_LINE_PVD))/** * @brief Clear the PVD Exti flag. * @retval None. *//* ... */#define__HAL_PWR_PVD_EXTI_CLEAR_FLAG()(EXTI->PR=(PWR_EXTI_LINE_PVD))/** * @brief Generates a Software interrupt on PVD EXTI line. * @retval None *//* ... */#define__HAL_PWR_PVD_EXTI_GENERATE_SWIT()(EXTI->SWIER|=(PWR_EXTI_LINE_PVD))44 defines/** * @} *//* ... *//* Include PWR HAL Extension module */#include"stm32f4xx_hal_pwr_ex.h"/* Exported functions --------------------------------------------------------*//** @addtogroup PWR_Exported_Functions PWR Exported Functions * @{ *//* ... *//** @addtogroup PWR_Exported_Functions_Group1 Initialization and de-initialization functions * @{ *//* ... *//* Initialization and de-initialization functions *****************************/voidHAL_PWR_DeInit(void);voidHAL_PWR_EnableBkUpAccess(void);voidHAL_PWR_DisableBkUpAccess(void);/** * @} *//* ... *//** @addtogroup PWR_Exported_Functions_Group2 Peripheral Control functions * @{ *//* ... *//* Peripheral Control functions **********************************************//* PVD configuration */voidHAL_PWR_ConfigPVD(PWR_PVDTypeDef*sConfigPVD);voidHAL_PWR_EnablePVD(void);voidHAL_PWR_DisablePVD(void);/* WakeUp pins configuration */voidHAL_PWR_EnableWakeUpPin(uint32_tWakeUpPinx);voidHAL_PWR_DisableWakeUpPin(uint32_tWakeUpPinx);/* Low Power modes entry */voidHAL_PWR_EnterSTOPMode(uint32_tRegulator,uint8_tSTOPEntry);voidHAL_PWR_EnterSLEEPMode(uint32_tRegulator,uint8_tSLEEPEntry);voidHAL_PWR_EnterSTANDBYMode(void);/* Power PVD IRQ Handler */voidHAL_PWR_PVD_IRQHandler(void);voidHAL_PWR_PVDCallback(void);/* Cortex System Control functions *******************************************/voidHAL_PWR_EnableSleepOnExit(void);voidHAL_PWR_DisableSleepOnExit(void);voidHAL_PWR_EnableSEVOnPend(void);voidHAL_PWR_DisableSEVOnPend(void);/** * @} *//* ... *//** * @} *//* ... */Exported functions/* Private types -------------------------------------------------------------*//* Private variables ---------------------------------------------------------*//* Private constants ---------------------------------------------------------*//** @defgroup PWR_Private_Constants PWR Private Constants * @{ *//* ... *//** @defgroup PWR_PVD_EXTI_Line PWR PVD EXTI Line * @{ *//* ... */#definePWR_EXTI_LINE_PVD((uint32_t)EXTI_IMR_MR16)/*!< External interrupt line 16 Connected to the PVD EXTI Line *//** * @} *//* ... *//** @defgroup PWR_register_alias_address PWR Register alias address * @{ *//* ... *//* ------------- PWR registers bit address in the alias region ---------------*/#definePWR_OFFSET(PWR_BASE-PERIPH_BASE)#definePWR_CR_OFFSET0x00U#definePWR_CSR_OFFSET0x04U#definePWR_CR_OFFSET_BB(PWR_OFFSET+PWR_CR_OFFSET)#definePWR_CSR_OFFSET_BB(PWR_OFFSET+PWR_CSR_OFFSET)/** * @} *//* ... *//** @defgroup PWR_CR_register_alias PWR CR Register alias address * @{ *//* ... *//* --- CR Register ---*//* Alias word address of DBP bit */#defineDBP_BIT_NUMBERPWR_CR_DBP_Pos#defineCR_DBP_BB(uint32_t)(PERIPH_BB_BASE+(PWR_CR_OFFSET_BB*32U)+(DBP_BIT_NUMBER*4U))/* Alias word address of PVDE bit */#definePVDE_BIT_NUMBERPWR_CR_PVDE_Pos#defineCR_PVDE_BB(uint32_t)(PERIPH_BB_BASE+(PWR_CR_OFFSET_BB*32U)+(PVDE_BIT_NUMBER*4U))/* Alias word address of VOS bit */#defineVOS_BIT_NUMBERPWR_CR_VOS_Pos#defineCR_VOS_BB(uint32_t)(PERIPH_BB_BASE+(PWR_CR_OFFSET_BB*32U)+(VOS_BIT_NUMBER*4U))/** * @} *//* ... *//** @defgroup PWR_CSR_register_alias PWR CSR Register alias address * @{ *//* ... *//* --- CSR Register ---*//* Alias word address of EWUP bit */#defineEWUP_BIT_NUMBERPWR_CSR_EWUP_Pos#defineCSR_EWUP_BB(PERIPH_BB_BASE+(PWR_CSR_OFFSET_BB*32U)+(EWUP_BIT_NUMBER*4U))/** * @} *//* ... *//** * @} *//* ... */------------- PWR registers bit address in the alias region/* Private macros ------------------------------------------------------------*//** @defgroup PWR_Private_Macros PWR Private Macros * @{ *//* ... *//** @defgroup PWR_IS_PWR_Definitions PWR Private macros to check input parameters * @{ *//* ... */#defineIS_PWR_PVD_LEVEL(LEVEL)(((LEVEL)==PWR_PVDLEVEL_0)||((LEVEL)==PWR_PVDLEVEL_1)||\((LEVEL)==PWR_PVDLEVEL_2)||((LEVEL)==PWR_PVDLEVEL_3)||\((LEVEL)==PWR_PVDLEVEL_4)||((LEVEL)==PWR_PVDLEVEL_5)||\((LEVEL)==PWR_PVDLEVEL_6)||((LEVEL)==PWR_PVDLEVEL_7))...#defineIS_PWR_PVD_MODE(MODE)(((MODE)==PWR_PVD_MODE_IT_RISING)||((MODE)==PWR_PVD_MODE_IT_FALLING)||\((MODE)==PWR_PVD_MODE_IT_RISING_FALLING)||((MODE)==PWR_PVD_MODE_EVENT_RISING)||\((MODE)==PWR_PVD_MODE_EVENT_FALLING)||((MODE)==PWR_PVD_MODE_EVENT_RISING_FALLING)||\((MODE)==PWR_PVD_MODE_NORMAL))...#defineIS_PWR_REGULATOR(REGULATOR)(((REGULATOR)==PWR_MAINREGULATOR_ON)||\((REGULATOR)==PWR_LOWPOWERREGULATOR_ON))...#defineIS_PWR_SLEEP_ENTRY(ENTRY)(((ENTRY)==PWR_SLEEPENTRY_WFI)||\((ENTRY)==PWR_SLEEPENTRY_WFE)||\((ENTRY)==PWR_SLEEPENTRY_WFE_NO_EVT_CLEAR))...#defineIS_PWR_STOP_ENTRY(ENTRY)(((ENTRY)==PWR_STOPENTRY_WFI)||\((ENTRY)==PWR_STOPENTRY_WFE)||\((ENTRY)==PWR_STOPENTRY_WFE_NO_EVT_CLEAR))...19 defines/** * @} *//* ... *//** * @} *//* ... *//** * @} *//* ... *//** * @} *//* ... */#ifdef__cplusplus}extern "C" { ... }#endif/* ... */#endif/* __STM32F4xx_HAL_PWR_H */
Details
Show: from
Types: Columns:
All items filtered out
All items filtered out
This file uses the notable symbols shown below. Click anywhere in the file to view more details.