| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455 | /**  ******************************************************************************  * @file    stm32f0xx_hal_pwr_ex.h  * @author  MCD Application Team  * @brief   Header file of PWR HAL Extension module.  ******************************************************************************  * @attention  *  * Copyright (c) 2016 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 __STM32F0xx_HAL_PWR_EX_H#define __STM32F0xx_HAL_PWR_EX_H#ifdef __cplusplus extern "C" {#endif/* Includes ------------------------------------------------------------------*/#include "stm32f0xx_hal_def.h"/** @addtogroup STM32F0xx_HAL_Driver  * @{  *//** @addtogroup PWREx  * @{  *//* Exported types ------------------------------------------------------------*/ /** @defgroup PWREx_Exported_Types PWREx Exported Types *  @{ */#if defined (STM32F031x6) || defined (STM32F042x6) || defined (STM32F051x8) || \    defined (STM32F071xB) || defined (STM32F072xB) || \    defined (STM32F091xC)/**  * @brief  PWR PVD configuration structure definition  */typedef struct{  uint32_t PVDLevel;   /*!< PVDLevel: Specifies the PVD detection level                            This parameter can be a value of @ref PWREx_PVD_detection_level */  uint32_t Mode;       /*!< Mode: Specifies the operating mode for the selected pins.                            This parameter can be a value of @ref PWREx_PVD_Mode */}PWR_PVDTypeDef;#endif /* defined (STM32F031x6) || defined (STM32F042x6) || defined (STM32F051x8) || */       /* defined (STM32F071xB) || defined (STM32F072xB) || */       /* defined (STM32F091xC) *//**  * @}  *//* Exported constants --------------------------------------------------------*//** @defgroup PWREx_Exported_Constants PWREx Exported Constants  * @{  *//** @defgroup PWREx_WakeUp_Pins PWREx Wakeup Pins  * @{  */#if defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || \    defined (STM32F091xC) || defined (STM32F098xx)#define PWR_WAKEUP_PIN1                     ((uint32_t)PWR_CSR_EWUP1)#define PWR_WAKEUP_PIN2                     ((uint32_t)PWR_CSR_EWUP2)#define PWR_WAKEUP_PIN3                     ((uint32_t)PWR_CSR_EWUP3)#define PWR_WAKEUP_PIN4                     ((uint32_t)PWR_CSR_EWUP4)#define PWR_WAKEUP_PIN5                     ((uint32_t)PWR_CSR_EWUP5)#define PWR_WAKEUP_PIN6                     ((uint32_t)PWR_CSR_EWUP6)#define PWR_WAKEUP_PIN7                     ((uint32_t)PWR_CSR_EWUP7)#define PWR_WAKEUP_PIN8                     ((uint32_t)PWR_CSR_EWUP8)#define IS_PWR_WAKEUP_PIN(PIN) (((PIN) == PWR_WAKEUP_PIN1) || \                                ((PIN) == PWR_WAKEUP_PIN2) || \                                ((PIN) == PWR_WAKEUP_PIN3) || \                                ((PIN) == PWR_WAKEUP_PIN4) || \                                ((PIN) == PWR_WAKEUP_PIN5) || \                                ((PIN) == PWR_WAKEUP_PIN6) || \                                ((PIN) == PWR_WAKEUP_PIN7) || \                                ((PIN) == PWR_WAKEUP_PIN8))#elif defined(STM32F030xC) || defined (STM32F070xB)#define PWR_WAKEUP_PIN1                     ((uint32_t)PWR_CSR_EWUP1)#define PWR_WAKEUP_PIN2                     ((uint32_t)PWR_CSR_EWUP2)#define PWR_WAKEUP_PIN4                     ((uint32_t)PWR_CSR_EWUP4)#define PWR_WAKEUP_PIN5                     ((uint32_t)PWR_CSR_EWUP5)#define PWR_WAKEUP_PIN6                     ((uint32_t)PWR_CSR_EWUP6)#define PWR_WAKEUP_PIN7                     ((uint32_t)PWR_CSR_EWUP7)#define IS_PWR_WAKEUP_PIN(PIN) (((PIN) == PWR_WAKEUP_PIN1) || \                                ((PIN) == PWR_WAKEUP_PIN2) || \                                ((PIN) == PWR_WAKEUP_PIN4) || \                                ((PIN) == PWR_WAKEUP_PIN5) || \                                ((PIN) == PWR_WAKEUP_PIN6) || \                                ((PIN) == PWR_WAKEUP_PIN7))#elif defined(STM32F042x6) || defined (STM32F048xx)#define PWR_WAKEUP_PIN1                     ((uint32_t)PWR_CSR_EWUP1)#define PWR_WAKEUP_PIN2                     ((uint32_t)PWR_CSR_EWUP2)#define PWR_WAKEUP_PIN4                     ((uint32_t)PWR_CSR_EWUP4)#define PWR_WAKEUP_PIN6                     ((uint32_t)PWR_CSR_EWUP6)#define PWR_WAKEUP_PIN7                     ((uint32_t)PWR_CSR_EWUP7)#define IS_PWR_WAKEUP_PIN(PIN) (((PIN) == PWR_WAKEUP_PIN1) || \                                ((PIN) == PWR_WAKEUP_PIN2) || \                                ((PIN) == PWR_WAKEUP_PIN4) || \                                ((PIN) == PWR_WAKEUP_PIN6) || \                                ((PIN) == PWR_WAKEUP_PIN7))#else#define PWR_WAKEUP_PIN1                     ((uint32_t)PWR_CSR_EWUP1)#define PWR_WAKEUP_PIN2                     ((uint32_t)PWR_CSR_EWUP2)#define IS_PWR_WAKEUP_PIN(PIN) (((PIN) == PWR_WAKEUP_PIN1) || \                                ((PIN) == PWR_WAKEUP_PIN2))#endif/**  * @}  *//** @defgroup PWREx_EXTI_Line PWREx EXTI Line  * @{  */#if defined (STM32F031x6) || defined (STM32F042x6) || defined (STM32F051x8) || \    defined (STM32F071xB) || defined (STM32F072xB) || \    defined (STM32F091xC)#define PWR_EXTI_LINE_PVD                   ((uint32_t)EXTI_IMR_MR16)  /*!< External interrupt line 16 Connected to the PVD EXTI Line */#endif /* defined (STM32F031x6) || defined (STM32F042x6) || defined (STM32F051x8) || */       /* defined (STM32F071xB) || defined (STM32F072xB) || */       /* defined (STM32F091xC) */      #if defined (STM32F042x6) || defined (STM32F048xx) || \    defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || \    defined (STM32F091xC) || defined (STM32F098xx)#define PWR_EXTI_LINE_VDDIO2                ((uint32_t)EXTI_IMR_MR31)  /*!< External interrupt line 31 Connected to the Vddio2 Monitor EXTI Line */#endif /* defined (STM32F042x6) || defined (STM32F048xx) ||\          defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || \          defined (STM32F091xC) || defined (STM32F098xx) ||*//**  * @}  */#if defined (STM32F031x6) || defined (STM32F042x6) || defined (STM32F051x8) || \    defined (STM32F071xB) || defined (STM32F072xB) || \    defined (STM32F091xC)/** @defgroup PWREx_PVD_detection_level PWREx PVD detection level  * @{  */#define PWR_PVDLEVEL_0                      PWR_CR_PLS_LEV0#define PWR_PVDLEVEL_1                      PWR_CR_PLS_LEV1#define PWR_PVDLEVEL_2                      PWR_CR_PLS_LEV2#define PWR_PVDLEVEL_3                      PWR_CR_PLS_LEV3#define PWR_PVDLEVEL_4                      PWR_CR_PLS_LEV4#define PWR_PVDLEVEL_5                      PWR_CR_PLS_LEV5#define PWR_PVDLEVEL_6                      PWR_CR_PLS_LEV6#define PWR_PVDLEVEL_7                      PWR_CR_PLS_LEV7#define IS_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))/**  * @}  *//** @defgroup PWREx_PVD_Mode PWREx PVD Mode  * @{  */#define PWR_PVD_MODE_NORMAL                 (0x00000000U)   /*!< basic mode is used */#define PWR_PVD_MODE_IT_RISING              (0x00010001U)   /*!< External Interrupt Mode with Rising edge trigger detection */#define PWR_PVD_MODE_IT_FALLING             (0x00010002U)   /*!< External Interrupt Mode with Falling edge trigger detection */#define PWR_PVD_MODE_IT_RISING_FALLING      (0x00010003U)   /*!< External Interrupt Mode with Rising/Falling edge trigger detection */#define PWR_PVD_MODE_EVENT_RISING           (0x00020001U)   /*!< Event Mode with Rising edge trigger detection */#define PWR_PVD_MODE_EVENT_FALLING          (0x00020002U)   /*!< Event Mode with Falling edge trigger detection */#define PWR_PVD_MODE_EVENT_RISING_FALLING   (0x00020003U)   /*!< Event Mode with Rising/Falling edge trigger detection */#define IS_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))/**  * @}  */#endif /* defined (STM32F031x6) || defined (STM32F042x6) || defined (STM32F051x8) || */       /* defined (STM32F071xB) || defined (STM32F072xB) || */       /* defined (STM32F091xC) *//** @defgroup PWREx_Flag PWREx Flag  * @{  */#if defined (STM32F031x6) || defined (STM32F042x6) || defined (STM32F051x8) || \    defined (STM32F071xB) || defined (STM32F072xB) || \    defined (STM32F091xC)#define PWR_FLAG_WU                         PWR_CSR_WUF#define PWR_FLAG_SB                         PWR_CSR_SBF#define PWR_FLAG_PVDO                       PWR_CSR_PVDO#define PWR_FLAG_VREFINTRDY                 PWR_CSR_VREFINTRDYF#elif defined (STM32F070x6) || defined (STM32F070xB) || defined (STM32F030xC)#define PWR_FLAG_WU                         PWR_CSR_WUF#define PWR_FLAG_SB                         PWR_CSR_SBF#define PWR_FLAG_VREFINTRDY                 PWR_CSR_VREFINTRDYF#else#define PWR_FLAG_WU                         PWR_CSR_WUF#define PWR_FLAG_SB                         PWR_CSR_SBF#endif /* defined (STM32F031x6) || defined (STM32F042x6) || defined (STM32F051x8) || */       /* defined (STM32F071xB) || defined (STM32F072xB) || */       /* defined (STM32F091xC) *//**  * @}  *//**  * @}  */   /* Exported macro ------------------------------------------------------------*//** @defgroup PWREx_Exported_Macros PWREx Exported Macros  * @{  */#if defined (STM32F031x6) || defined (STM32F042x6) || defined (STM32F051x8) || \    defined (STM32F071xB) || defined (STM32F072xB) || \    defined (STM32F091xC)/**  * @brief Enable interrupt on PVD Exti Line 16.  * @retval None.  */#define __HAL_PWR_PVD_EXTI_ENABLE_IT()      (EXTI->IMR |= (PWR_EXTI_LINE_PVD))/**  * @brief Disable interrupt on 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 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 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 Disable the PVD Extended Interrupt Rising & Falling Trigger.  * @retval None  */#define __HAL_PWR_PVD_EXTI_DISABLE_RISING_FALLING_EDGE()  __HAL_PWR_PVD_EXTI_DISABLE_RISING_EDGE();__HAL_PWR_PVD_EXTI_DISABLE_FALLING_EDGE();/**  * @brief  PVD EXTI line configuration: set falling edge trigger.  * @retval None.  */#define __HAL_PWR_PVD_EXTI_ENABLE_FALLING_EDGE()  EXTI->FTSR |= (PWR_EXTI_LINE_PVD)/**  * @brief  PVD EXTI line configuration: set rising edge trigger.  * @retval None.  */#define __HAL_PWR_PVD_EXTI_ENABLE_RISING_EDGE()   EXTI->RTSR |= (PWR_EXTI_LINE_PVD)/**  * @brief  Enable the PVD Extended Interrupt Rising & Falling Trigger.  * @retval None  */#define __HAL_PWR_PVD_EXTI_ENABLE_RISING_FALLING_EDGE()   __HAL_PWR_PVD_EXTI_ENABLE_RISING_EDGE();__HAL_PWR_PVD_EXTI_ENABLE_FALLING_EDGE();/**  * @brief Check 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 Generate a Software interrupt on selected EXTI line.  * @retval None.  */#define __HAL_PWR_PVD_EXTI_GENERATE_SWIT()  (EXTI->SWIER |= (PWR_EXTI_LINE_PVD))#endif /* defined (STM32F031x6) || defined (STM32F042x6) || defined (STM32F051x8) || */       /* defined (STM32F071xB) || defined (STM32F072xB) || */       /* defined (STM32F091xC) */#if defined (STM32F042x6) || defined (STM32F048xx) || \    defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || \    defined (STM32F091xC) || defined (STM32F098xx)/**  * @brief Enable interrupt on Vddio2 Monitor Exti Line 31.  * @retval None.  */#define __HAL_PWR_VDDIO2_EXTI_ENABLE_IT()             (EXTI->IMR |= (PWR_EXTI_LINE_VDDIO2))/**  * @brief Disable interrupt on Vddio2 Monitor Exti Line 31.  * @retval None.  */#define __HAL_PWR_VDDIO2_EXTI_DISABLE_IT()            (EXTI->IMR &= ~(PWR_EXTI_LINE_VDDIO2))/**  * @brief  Vddio2 Monitor EXTI line configuration: clear falling edge and rising edge trigger.  * @retval None.  */#define __HAL_PWR_VDDIO2_EXTI_DISABLE_FALLING_EDGE()                 \                        do{                                          \                            EXTI->FTSR &= ~(PWR_EXTI_LINE_VDDIO2);   \                            EXTI->RTSR &= ~(PWR_EXTI_LINE_VDDIO2);   \                          } while(0)                    /**  * @brief  Vddio2 Monitor EXTI line configuration: set falling edge trigger.  * @retval None.  */#define __HAL_PWR_VDDIO2_EXTI_ENABLE_FALLING_EDGE()  EXTI->FTSR |= (PWR_EXTI_LINE_VDDIO2)/**  * @brief Check whether the specified VDDIO2 monitor EXTI interrupt flag is set or not.  * @retval EXTI VDDIO2 Monitor Line Status.  */#define __HAL_PWR_VDDIO2_EXTI_GET_FLAG()              (EXTI->PR & (PWR_EXTI_LINE_VDDIO2))/**  * @brief Clear the VDDIO2 Monitor EXTI flag.  * @retval None.  */#define __HAL_PWR_VDDIO2_EXTI_CLEAR_FLAG()            (EXTI->PR = (PWR_EXTI_LINE_VDDIO2))/**  * @brief Generate a Software interrupt on selected EXTI line.  * @retval None.  */#define __HAL_PWR_VDDIO2_EXTI_GENERATE_SWIT()         (EXTI->SWIER |= (PWR_EXTI_LINE_VDDIO2))#endif /* defined (STM32F042x6) || defined (STM32F048xx) ||\          defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || \          defined (STM32F091xC) || defined (STM32F098xx) *//**  * @}  *//* Exported functions --------------------------------------------------------*//** @addtogroup PWREx_Exported_Functions PWREx Exported Functions *  @{ *//** @addtogroup PWREx_Exported_Functions_Group1  * @{  *//* I/O operation functions  ***************************************************/#if defined (STM32F031x6) || defined (STM32F042x6) || defined (STM32F051x8) || \    defined (STM32F071xB) || defined (STM32F072xB) || \    defined (STM32F091xC)void HAL_PWR_PVD_IRQHandler(void);void HAL_PWR_PVDCallback(void);#endif /* defined (STM32F031x6) || defined (STM32F042x6) || defined (STM32F051x8) || */       /* defined (STM32F071xB) || defined (STM32F072xB) || */       /* defined (STM32F091xC) */#if defined (STM32F042x6) || defined (STM32F048xx) || \    defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || \    defined (STM32F091xC) || defined (STM32F098xx)void HAL_PWREx_Vddio2Monitor_IRQHandler(void);void HAL_PWREx_Vddio2MonitorCallback(void);#endif /* defined (STM32F042x6) || defined (STM32F048xx) || \          defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || \          defined (STM32F091xC) || defined (STM32F098xx) *//* Peripheral Control functions  **********************************************/#if defined (STM32F031x6) || defined (STM32F042x6) || defined (STM32F051x8) || \    defined (STM32F071xB) || defined (STM32F072xB) || \    defined (STM32F091xC)void HAL_PWR_ConfigPVD(PWR_PVDTypeDef *sConfigPVD);void HAL_PWR_EnablePVD(void);void HAL_PWR_DisablePVD(void);#endif /* defined (STM32F031x6) || defined (STM32F042x6) || defined (STM32F051x8) || */       /* defined (STM32F071xB) || defined (STM32F072xB) || */       /* defined (STM32F091xC) */       #if defined (STM32F042x6) || defined (STM32F048xx) || \    defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || \    defined (STM32F091xC) || defined (STM32F098xx)void HAL_PWREx_EnableVddio2Monitor(void);void HAL_PWREx_DisableVddio2Monitor(void);#endif /* defined (STM32F042x6) || defined (STM32F048xx) || \          defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || \          defined (STM32F091xC) || defined (STM32F098xx) *//**  * @}  *//**  * @}  *//**  * @}  *//**  * @}  */#ifdef __cplusplus}#endif#endif /* __STM32F0xx_HAL_PWR_EX_H */
 |