2 ******************************************************************************
3 * @file stm32f3xx_hal_pwr_ex.h
4 * @author MCD Application Team
7 * @brief Header file of PWR HAL Extended module.
8 ******************************************************************************
11 * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
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.
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.
35 ******************************************************************************
38 /* Define to prevent recursive inclusion -------------------------------------*/
39 #ifndef __STM32F3xx_HAL_PWR_EX_H
40 #define __STM32F3xx_HAL_PWR_EX_H
46 /* Includes ------------------------------------------------------------------*/
47 #include "stm32f3xx_hal_def.h"
49 /** @addtogroup STM32F3xx_HAL_Driver
57 /* Exported types ------------------------------------------------------------*/
59 /** @defgroup PWREx_Exported_Types PWR Extended Exported Types
62 #if defined(STM32F302xE) || defined(STM32F303xE) || \
63 defined(STM32F302xC) || defined(STM32F303xC) || \
64 defined(STM32F303x8) || defined(STM32F334x8) || \
65 defined(STM32F301x8) || defined(STM32F302x8) || \
68 * @brief PWR PVD configuration structure definition
72 uint32_t PVDLevel; /*!< PVDLevel: Specifies the PVD detection level
73 This parameter can be a value of @ref PWREx_PVD_detection_level */
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 */
78 #endif /* STM32F302xE || STM32F303xE || */
79 /* STM32F302xC || STM32F303xC || */
80 /* STM32F303x8 || STM32F334x8 || */
81 /* STM32F301x8 || STM32F302x8 || */
88 /* Exported constants --------------------------------------------------------*/
89 /** @defgroup PWREx_Exported_Constants PWR Extended Exported Constants
93 #if defined(STM32F302xE) || defined(STM32F303xE) || \
94 defined(STM32F302xC) || defined(STM32F303xC) || \
95 defined(STM32F303x8) || defined(STM32F334x8) || \
96 defined(STM32F301x8) || defined(STM32F302x8) || \
99 /** @defgroup PWREx_PVD_detection_level PWR Extended PVD detection level
102 #define PWR_PVDLEVEL_0 PWR_CR_PLS_LEV0
103 #define PWR_PVDLEVEL_1 PWR_CR_PLS_LEV1
104 #define PWR_PVDLEVEL_2 PWR_CR_PLS_LEV2
105 #define PWR_PVDLEVEL_3 PWR_CR_PLS_LEV3
106 #define PWR_PVDLEVEL_4 PWR_CR_PLS_LEV4
107 #define PWR_PVDLEVEL_5 PWR_CR_PLS_LEV5
108 #define PWR_PVDLEVEL_6 PWR_CR_PLS_LEV6
109 #define PWR_PVDLEVEL_7 PWR_CR_PLS_LEV7
110 #define IS_PWR_PVD_LEVEL(LEVEL) (((LEVEL) == PWR_PVDLEVEL_0) || ((LEVEL) == PWR_PVDLEVEL_1)|| \
111 ((LEVEL) == PWR_PVDLEVEL_2) || ((LEVEL) == PWR_PVDLEVEL_3)|| \
112 ((LEVEL) == PWR_PVDLEVEL_4) || ((LEVEL) == PWR_PVDLEVEL_5)|| \
113 ((LEVEL) == PWR_PVDLEVEL_6) || ((LEVEL) == PWR_PVDLEVEL_7))
118 /** @defgroup PWREx_PVD_Mode PWR Extended PVD Mode
121 #define PWR_PVD_MODE_NORMAL ((uint32_t)0x00000000) /*!< basic mode is used */
122 #define PWR_PVD_MODE_IT_RISING ((uint32_t)0x00010001) /*!< External Interrupt Mode with Rising edge trigger detection */
123 #define PWR_PVD_MODE_IT_FALLING ((uint32_t)0x00010002) /*!< External Interrupt Mode with Falling edge trigger detection */
124 #define PWR_PVD_MODE_IT_RISING_FALLING ((uint32_t)0x00010003) /*!< External Interrupt Mode with Rising/Falling edge trigger detection */
125 #define PWR_PVD_MODE_EVENT_RISING ((uint32_t)0x00020001) /*!< Event Mode with Rising edge trigger detection */
126 #define PWR_PVD_MODE_EVENT_FALLING ((uint32_t)0x00020002) /*!< Event Mode with Falling edge trigger detection */
127 #define PWR_PVD_MODE_EVENT_RISING_FALLING ((uint32_t)0x00020003) /*!< Event Mode with Rising/Falling edge trigger detection */
129 #define IS_PWR_PVD_MODE(MODE) (((MODE) == PWR_PVD_MODE_IT_RISING)|| ((MODE) == PWR_PVD_MODE_IT_FALLING) || \
130 ((MODE) == PWR_PVD_MODE_IT_RISING_FALLING) || ((MODE) == PWR_PVD_MODE_EVENT_RISING) || \
131 ((MODE) == PWR_PVD_MODE_EVENT_FALLING) || ((MODE) == PWR_PVD_MODE_EVENT_RISING_FALLING) || \
132 ((MODE) == PWR_PVD_MODE_NORMAL))
137 #define PWR_EXTI_LINE_PVD ((uint32_t)0x00010000) /*!< External interrupt line 16 Connected to the PVD EXTI Line */
139 #endif /* STM32F302xE || STM32F303xE || */
140 /* STM32F302xC || STM32F303xC || */
141 /* STM32F303x8 || STM32F334x8 || */
142 /* STM32F301x8 || STM32F302x8 || */
145 #if defined(STM32F373xC) || defined(STM32F378xx)
146 /** @defgroup PWREx_SDADC_ANALOGx PWR Extended SDADC ANALOGx
149 #define PWR_SDADC_ANALOG1 ((uint32_t)PWR_CR_SDADC1EN)
150 #define PWR_SDADC_ANALOG2 ((uint32_t)PWR_CR_SDADC2EN)
151 #define PWR_SDADC_ANALOG3 ((uint32_t)PWR_CR_SDADC3EN)
152 #define IS_PWR_SDADC_ANALOG(SDADC) (((SDADC) == PWR_SDADC_ANALOG1) || \
153 ((SDADC) == PWR_SDADC_ANALOG2) || \
154 ((SDADC) == PWR_SDADC_ANALOG3))
158 #endif /* STM32F373xC || STM32F378xx */
164 /* Exported macro ------------------------------------------------------------*/
165 /** @defgroup PWREx_Exported_Macros PWR Extended Exported Macros
169 #if defined(STM32F302xE) || defined(STM32F303xE) || \
170 defined(STM32F302xC) || defined(STM32F303xC) || \
171 defined(STM32F303x8) || defined(STM32F334x8) || \
172 defined(STM32F301x8) || defined(STM32F302x8) || \
176 * @brief Enable interrupt on PVD Exti Line 16.
179 #define __HAL_PWR_PVD_EXTI_ENABLE_IT() (EXTI->IMR |= (PWR_EXTI_LINE_PVD))
182 * @brief Disable interrupt on PVD Exti Line 16.
185 #define __HAL_PWR_PVD_EXTI_DISABLE_IT() (EXTI->IMR &= ~(PWR_EXTI_LINE_PVD))
188 * @brief Generate a Software interrupt on selected EXTI line.
191 #define __HAL_PWR_PVD_EXTI_GENERATE_SWIT() (EXTI->SWIER |= (PWR_EXTI_LINE_PVD))
194 * @brief Enable event on PVD Exti Line 16.
197 #define __HAL_PWR_PVD_EXTI_ENABLE_EVENT() (EXTI->EMR |= (PWR_EXTI_LINE_PVD))
200 * @brief Disable event on PVD Exti Line 16.
203 #define __HAL_PWR_PVD_EXTI_DISABLE_EVENT() (EXTI->EMR &= ~(PWR_EXTI_LINE_PVD))
206 * @brief PVD EXTI line configuration: clear falling edge trigger and set rising edge.
209 #define __HAL_PWR_PVD_EXTI_CLEAR_EGDE_TRIGGER() EXTI->FTSR &= ~(PWR_EXTI_LINE_PVD); \
210 EXTI->RTSR &= ~(PWR_EXTI_LINE_PVD)
213 * @brief PVD EXTI line configuration: set falling edge trigger.
216 #define __HAL_PWR_PVD_EXTI_SET_FALLING_EGDE_TRIGGER() EXTI->FTSR |= (PWR_EXTI_LINE_PVD)
219 * @brief PVD EXTI line configuration: set rising edge trigger.
222 #define __HAL_PWR_PVD_EXTI_SET_RISING_EDGE_TRIGGER() EXTI->RTSR |= (PWR_EXTI_LINE_PVD)
225 * @brief Check whether the specified PVD EXTI interrupt flag is set or not.
226 * @retval EXTI PVD Line Status.
228 #define __HAL_PWR_PVD_EXTI_GET_FLAG() (EXTI->PR & (PWR_EXTI_LINE_PVD))
231 * @brief Clear the PVD EXTI flag.
234 #define __HAL_PWR_PVD_EXTI_CLEAR_FLAG() (EXTI->PR = (PWR_EXTI_LINE_PVD))
236 #endif /* STM32F302xE || STM32F303xE || */
237 /* STM32F302xC || STM32F303xC || */
238 /* STM32F303x8 || STM32F334x8 || */
239 /* STM32F301x8 || STM32F302x8 || */
246 /* Exported functions --------------------------------------------------------*/
248 /** @addtogroup PWREx_Exported_Functions PWR Extended Exported Functions
252 /** @addtogroup PWREx_Exported_Functions_Group1 Peripheral Extended Control Functions
255 /* Peripheral Extended control functions **************************************/
256 #if defined(STM32F302xE) || defined(STM32F303xE) || \
257 defined(STM32F302xC) || defined(STM32F303xC) || \
258 defined(STM32F303x8) || defined(STM32F334x8) || \
259 defined(STM32F301x8) || defined(STM32F302x8) || \
261 void HAL_PWR_PVDConfig(PWR_PVDTypeDef *sConfigPVD);
262 void HAL_PWR_EnablePVD(void);
263 void HAL_PWR_DisablePVD(void);
264 void HAL_PWR_PVD_IRQHandler(void);
265 void HAL_PWR_PVDCallback(void);
266 #endif /* STM32F302xE || STM32F303xE || */
267 /* STM32F302xC || STM32F303xC || */
268 /* STM32F303x8 || STM32F334x8 || */
269 /* STM32F301x8 || STM32F302x8 || */
272 #if defined(STM32F373xC) || defined(STM32F378xx)
273 void HAL_PWREx_EnableSDADCAnalog(uint32_t Analogx);
274 void HAL_PWREx_DisableSDADCAnalog(uint32_t Analogx);
275 #endif /* STM32F373xC || STM32F378xx */
297 #endif /* __STM32F3xx_HAL_PWR_EX_H */
299 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/