]> git.donarmstrong.com Git - qmk_firmware.git/blob - tool/mbed/mbed-sdk/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_pwr_ex.h
Squashed 'tmk_core/' changes from 7967731..b9e0ea0
[qmk_firmware.git] / tool / mbed / mbed-sdk / libraries / mbed / targets / cmsis / TARGET_STM / TARGET_STM32F3 / stm32f3xx_hal_pwr_ex.h
1 /**
2   ******************************************************************************
3   * @file    stm32f3xx_hal_pwr_ex.h
4   * @author  MCD Application Team
5   * @version V1.1.0
6   * @date    12-Sept-2014
7   * @brief   Header file of PWR HAL Extended 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 __STM32F3xx_HAL_PWR_EX_H
40 #define __STM32F3xx_HAL_PWR_EX_H
41
42 #ifdef __cplusplus
43  extern "C" {
44 #endif
45
46 /* Includes ------------------------------------------------------------------*/
47 #include "stm32f3xx_hal_def.h"
48
49 /** @addtogroup STM32F3xx_HAL_Driver
50   * @{
51   */
52
53 /** @addtogroup PWREx
54   * @{
55   */
56
57 /* Exported types ------------------------------------------------------------*/
58
59 /** @defgroup PWREx_Exported_Types PWR Extended Exported Types
60  *  @{
61  */
62 #if defined(STM32F302xE) || defined(STM32F303xE) || \
63     defined(STM32F302xC) || defined(STM32F303xC) || \
64     defined(STM32F303x8) || defined(STM32F334x8) || \
65     defined(STM32F301x8) || defined(STM32F302x8) || \
66     defined(STM32F373xC) 
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 #endif /* STM32F302xE || STM32F303xE || */
79        /* STM32F302xC || STM32F303xC || */
80        /* STM32F303x8 || STM32F334x8 || */
81        /* STM32F301x8 || STM32F302x8 || */
82        /* STM32F373xC                   */
83
84 /**
85   * @}
86   */
87
88 /* Exported constants --------------------------------------------------------*/
89 /** @defgroup PWREx_Exported_Constants PWR Extended Exported Constants
90   * @{
91   */
92
93 #if defined(STM32F302xE) || defined(STM32F303xE) || \
94     defined(STM32F302xC) || defined(STM32F303xC) || \
95     defined(STM32F303x8) || defined(STM32F334x8) || \
96     defined(STM32F301x8) || defined(STM32F302x8) || \
97     defined(STM32F373xC)
98     
99 /** @defgroup PWREx_PVD_detection_level PWR Extended PVD detection level
100   * @{
101   */
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))
114 /**
115   * @}
116   */
117
118 /** @defgroup PWREx_PVD_Mode PWR Extended PVD Mode
119   * @{
120   */
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 */
128
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))
133 /**
134   * @}
135   */
136
137 #define PWR_EXTI_LINE_PVD  ((uint32_t)0x00010000)  /*!< External interrupt line 16 Connected to the PVD EXTI Line */
138
139 #endif /* STM32F302xE || STM32F303xE || */
140        /* STM32F302xC || STM32F303xC || */
141        /* STM32F303x8 || STM32F334x8 || */
142        /* STM32F301x8 || STM32F302x8 || */
143        /* STM32F373xC                   */
144
145 #if defined(STM32F373xC) || defined(STM32F378xx)
146 /** @defgroup PWREx_SDADC_ANALOGx PWR Extended SDADC ANALOGx
147   * @{
148   */
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))
155 /**
156   * @}
157   */
158 #endif /* STM32F373xC || STM32F378xx */
159
160 /**
161   * @}
162   */
163
164 /* Exported macro ------------------------------------------------------------*/
165 /** @defgroup PWREx_Exported_Macros PWR Extended Exported Macros
166   * @{
167   */
168
169 #if defined(STM32F302xE) || defined(STM32F303xE) || \
170     defined(STM32F302xC) || defined(STM32F303xC) || \
171     defined(STM32F303x8) || defined(STM32F334x8) || \
172     defined(STM32F301x8) || defined(STM32F302x8) || \
173     defined(STM32F373xC)
174     
175 /**
176   * @brief Enable interrupt on PVD Exti Line 16.
177   * @retval None.
178   */
179 #define __HAL_PWR_PVD_EXTI_ENABLE_IT()      (EXTI->IMR |= (PWR_EXTI_LINE_PVD))
180
181 /**
182   * @brief Disable interrupt on PVD Exti Line 16.
183   * @retval None.
184   */
185 #define __HAL_PWR_PVD_EXTI_DISABLE_IT()     (EXTI->IMR &= ~(PWR_EXTI_LINE_PVD))
186
187 /**
188   * @brief Generate a Software interrupt on selected EXTI line.
189   * @retval None.
190   */
191 #define __HAL_PWR_PVD_EXTI_GENERATE_SWIT()  (EXTI->SWIER |= (PWR_EXTI_LINE_PVD))
192
193 /**
194   * @brief Enable event on PVD Exti Line 16.
195   * @retval None.
196   */
197 #define __HAL_PWR_PVD_EXTI_ENABLE_EVENT()   (EXTI->EMR |= (PWR_EXTI_LINE_PVD))
198
199 /**
200   * @brief Disable event on PVD Exti Line 16.
201   * @retval None.
202   */
203 #define __HAL_PWR_PVD_EXTI_DISABLE_EVENT()  (EXTI->EMR &= ~(PWR_EXTI_LINE_PVD))
204
205 /**
206   * @brief  PVD EXTI line configuration: clear falling edge trigger and set rising edge.
207   * @retval None.
208   */
209 #define __HAL_PWR_PVD_EXTI_CLEAR_EGDE_TRIGGER()   EXTI->FTSR &= ~(PWR_EXTI_LINE_PVD); \
210                                                   EXTI->RTSR &= ~(PWR_EXTI_LINE_PVD)
211
212 /**
213   * @brief  PVD EXTI line configuration: set falling edge trigger.
214   * @retval None.
215   */
216 #define __HAL_PWR_PVD_EXTI_SET_FALLING_EGDE_TRIGGER()  EXTI->FTSR |= (PWR_EXTI_LINE_PVD)
217
218 /**
219   * @brief  PVD EXTI line configuration: set rising edge trigger.
220   * @retval None.
221   */
222 #define __HAL_PWR_PVD_EXTI_SET_RISING_EDGE_TRIGGER()   EXTI->RTSR |= (PWR_EXTI_LINE_PVD)
223
224 /**
225   * @brief Check whether the specified PVD EXTI interrupt flag is set or not.
226   * @retval EXTI PVD Line Status.
227   */
228 #define __HAL_PWR_PVD_EXTI_GET_FLAG()       (EXTI->PR & (PWR_EXTI_LINE_PVD))
229
230 /**
231   * @brief Clear the PVD EXTI flag.
232   * @retval None.
233   */
234 #define __HAL_PWR_PVD_EXTI_CLEAR_FLAG()     (EXTI->PR = (PWR_EXTI_LINE_PVD))
235
236 #endif /* STM32F302xE || STM32F303xE || */
237        /* STM32F302xC || STM32F303xC || */
238        /* STM32F303x8 || STM32F334x8 || */
239        /* STM32F301x8 || STM32F302x8 || */
240        /* STM32F373xC                   */
241
242 /**
243   * @}
244   */
245
246 /* Exported functions --------------------------------------------------------*/
247
248 /** @addtogroup PWREx_Exported_Functions PWR Extended Exported Functions
249  *  @{
250  */
251
252 /** @addtogroup PWREx_Exported_Functions_Group1 Peripheral Extended Control Functions
253   * @{
254   */
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) || \
260     defined(STM32F373xC)
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 || */
270        /* STM32F373xC                   */
271
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 */
276
277 /**
278   * @}
279   */
280
281 /**
282   * @}
283   */
284
285 /**
286   * @}
287   */
288
289 /**
290   * @}
291   */
292
293 #ifdef __cplusplus
294 }
295 #endif
296
297 #endif /* __STM32F3xx_HAL_PWR_EX_H */
298
299 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/