Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2 | Rev 18 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | /** |
1 | /** |
2 | ****************************************************************************** |
2 | ****************************************************************************** |
3 | * @file stm32f1xx_hal_pwr.h |
3 | * @file stm32f1xx_hal_pwr.h |
4 | * @author MCD Application Team |
4 | * @author MCD Application Team |
5 | * @brief Header file of PWR HAL module. |
5 | * @brief Header file of PWR HAL module. |
6 | ****************************************************************************** |
6 | ****************************************************************************** |
7 | * @attention |
7 | * @attention |
8 | * |
8 | * |
9 | * <h2><center>© Copyright (c) 2016 STMicroelectronics. |
9 | * Copyright (c) 2016 STMicroelectronics. |
10 | * All rights reserved.</center></h2> |
10 | * All rights reserved. |
11 | * |
11 | * |
12 | * This software component is licensed by ST under BSD 3-Clause license, |
12 | * This software is licensed under terms that can be found in the LICENSE file |
13 | * the "License"; You may not use this file except in compliance with the |
13 | * in the root directory of this software component. |
14 | * License. You may obtain a copy of the License at: |
14 | * If no LICENSE file comes with this software, it is provided AS-IS. |
15 | * opensource.org/licenses/BSD-3-Clause |
15 | * |
16 | * |
16 | ****************************************************************************** |
17 | ****************************************************************************** |
17 | */ |
18 | */ |
18 | |
19 | 19 | /* Define to prevent recursive inclusion -------------------------------------*/ |
|
20 | /* Define to prevent recursive inclusion -------------------------------------*/ |
20 | #ifndef __STM32F1xx_HAL_PWR_H |
21 | #ifndef __STM32F1xx_HAL_PWR_H |
21 | #define __STM32F1xx_HAL_PWR_H |
22 | #define __STM32F1xx_HAL_PWR_H |
22 | |
23 | 23 | #ifdef __cplusplus |
|
24 | #ifdef __cplusplus |
24 | extern "C" { |
25 | extern "C" { |
25 | #endif |
26 | #endif |
26 | |
27 | 27 | /* Includes ------------------------------------------------------------------*/ |
|
28 | /* Includes ------------------------------------------------------------------*/ |
28 | #include "stm32f1xx_hal_def.h" |
29 | #include "stm32f1xx_hal_def.h" |
29 | |
30 | 30 | /** @addtogroup STM32F1xx_HAL_Driver |
|
31 | /** @addtogroup STM32F1xx_HAL_Driver |
31 | * @{ |
32 | * @{ |
32 | */ |
33 | */ |
33 | |
34 | 34 | /** @addtogroup PWR |
|
35 | /** @addtogroup PWR |
35 | * @{ |
36 | * @{ |
36 | */ |
37 | */ |
37 | |
38 | 38 | /* Exported types ------------------------------------------------------------*/ |
|
39 | /* Exported types ------------------------------------------------------------*/ |
39 | |
40 | 40 | /** @defgroup PWR_Exported_Types PWR Exported Types |
|
41 | /** @defgroup PWR_Exported_Types PWR Exported Types |
41 | * @{ |
42 | * @{ |
42 | */ |
43 | */ |
43 | |
44 | 44 | /** |
|
45 | /** |
45 | * @brief PWR PVD configuration structure definition |
46 | * @brief PWR PVD configuration structure definition |
46 | */ |
47 | */ |
47 | typedef struct |
48 | typedef struct |
48 | { |
49 | { |
49 | uint32_t PVDLevel; /*!< PVDLevel: Specifies the PVD detection level. |
50 | uint32_t PVDLevel; /*!< PVDLevel: Specifies the PVD detection level. |
50 | This parameter can be a value of @ref PWR_PVD_detection_level */ |
51 | This parameter can be a value of @ref PWR_PVD_detection_level */ |
51 | |
52 | 52 | uint32_t Mode; /*!< Mode: Specifies the operating mode for the selected pins. |
|
53 | uint32_t Mode; /*!< Mode: Specifies the operating mode for the selected pins. |
53 | This parameter can be a value of @ref PWR_PVD_Mode */ |
54 | This parameter can be a value of @ref PWR_PVD_Mode */ |
54 | }PWR_PVDTypeDef; |
55 | }PWR_PVDTypeDef; |
55 | |
56 | 56 | ||
57 | 57 | /** |
|
58 | /** |
58 | * @} |
59 | * @} |
59 | */ |
60 | */ |
60 | |
61 | 61 | ||
62 | 62 | /* Internal constants --------------------------------------------------------*/ |
|
63 | /* Internal constants --------------------------------------------------------*/ |
63 | |
64 | 64 | /** @addtogroup PWR_Private_Constants |
|
65 | /** @addtogroup PWR_Private_Constants |
65 | * @{ |
66 | * @{ |
66 | */ |
67 | */ |
67 | |
68 | 68 | #define PWR_EXTI_LINE_PVD ((uint32_t)0x00010000) /*!< External interrupt line 16 Connected to the PVD EXTI Line */ |
|
69 | #define PWR_EXTI_LINE_PVD ((uint32_t)0x00010000) /*!< External interrupt line 16 Connected to the PVD EXTI Line */ |
69 | |
70 | 70 | /** |
|
71 | /** |
71 | * @} |
72 | * @} |
72 | */ |
73 | */ |
73 | |
74 | 74 | ||
75 | 75 | /* Exported constants --------------------------------------------------------*/ |
|
76 | /* Exported constants --------------------------------------------------------*/ |
76 | |
77 | 77 | /** @defgroup PWR_Exported_Constants PWR Exported Constants |
|
78 | /** @defgroup PWR_Exported_Constants PWR Exported Constants |
78 | * @{ |
79 | * @{ |
79 | */ |
80 | */ |
80 | |
81 | 81 | /** @defgroup PWR_PVD_detection_level PWR PVD detection level |
|
82 | /** @defgroup PWR_PVD_detection_level PWR PVD detection level |
82 | * @{ |
83 | * @{ |
83 | */ |
84 | */ |
84 | #define PWR_PVDLEVEL_0 PWR_CR_PLS_2V2 |
85 | #define PWR_PVDLEVEL_0 PWR_CR_PLS_2V2 |
85 | #define PWR_PVDLEVEL_1 PWR_CR_PLS_2V3 |
86 | #define PWR_PVDLEVEL_1 PWR_CR_PLS_2V3 |
86 | #define PWR_PVDLEVEL_2 PWR_CR_PLS_2V4 |
87 | #define PWR_PVDLEVEL_2 PWR_CR_PLS_2V4 |
87 | #define PWR_PVDLEVEL_3 PWR_CR_PLS_2V5 |
88 | #define PWR_PVDLEVEL_3 PWR_CR_PLS_2V5 |
88 | #define PWR_PVDLEVEL_4 PWR_CR_PLS_2V6 |
89 | #define PWR_PVDLEVEL_4 PWR_CR_PLS_2V6 |
89 | #define PWR_PVDLEVEL_5 PWR_CR_PLS_2V7 |
90 | #define PWR_PVDLEVEL_5 PWR_CR_PLS_2V7 |
90 | #define PWR_PVDLEVEL_6 PWR_CR_PLS_2V8 |
91 | #define PWR_PVDLEVEL_6 PWR_CR_PLS_2V8 |
91 | #define PWR_PVDLEVEL_7 PWR_CR_PLS_2V9 |
92 | #define PWR_PVDLEVEL_7 PWR_CR_PLS_2V9 |
92 | |
93 | 93 | /** |
|
94 | /** |
94 | * @} |
95 | * @} |
95 | */ |
96 | */ |
96 | |
97 | 97 | /** @defgroup PWR_PVD_Mode PWR PVD Mode |
|
98 | /** @defgroup PWR_PVD_Mode PWR PVD Mode |
98 | * @{ |
99 | * @{ |
99 | */ |
100 | */ |
100 | #define PWR_PVD_MODE_NORMAL 0x00000000U /*!< basic mode is used */ |
101 | #define PWR_PVD_MODE_NORMAL 0x00000000U /*!< basic mode is used */ |
101 | #define PWR_PVD_MODE_IT_RISING 0x00010001U /*!< External Interrupt Mode with Rising edge trigger detection */ |
102 | #define PWR_PVD_MODE_IT_RISING 0x00010001U /*!< External Interrupt Mode with Rising edge trigger detection */ |
102 | #define PWR_PVD_MODE_IT_FALLING 0x00010002U /*!< External Interrupt Mode with Falling edge trigger detection */ |
103 | #define PWR_PVD_MODE_IT_FALLING 0x00010002U /*!< External Interrupt Mode with Falling edge trigger detection */ |
103 | #define PWR_PVD_MODE_IT_RISING_FALLING 0x00010003U /*!< External Interrupt Mode with Rising/Falling edge trigger detection */ |
104 | #define PWR_PVD_MODE_IT_RISING_FALLING 0x00010003U /*!< External Interrupt Mode with Rising/Falling edge trigger detection */ |
104 | #define PWR_PVD_MODE_EVENT_RISING 0x00020001U /*!< Event Mode with Rising edge trigger detection */ |
105 | #define PWR_PVD_MODE_EVENT_RISING 0x00020001U /*!< Event Mode with Rising edge trigger detection */ |
105 | #define PWR_PVD_MODE_EVENT_FALLING 0x00020002U /*!< Event Mode with Falling edge trigger detection */ |
106 | #define PWR_PVD_MODE_EVENT_FALLING 0x00020002U /*!< Event Mode with Falling edge trigger detection */ |
106 | #define PWR_PVD_MODE_EVENT_RISING_FALLING 0x00020003U /*!< Event Mode with Rising/Falling edge trigger detection */ |
107 | #define PWR_PVD_MODE_EVENT_RISING_FALLING 0x00020003U /*!< Event Mode with Rising/Falling edge trigger detection */ |
107 | |
108 | 108 | /** |
|
109 | /** |
109 | * @} |
110 | * @} |
110 | */ |
111 | */ |
111 | |
112 | 112 | ||
113 | 113 | /** @defgroup PWR_WakeUp_Pins PWR WakeUp Pins |
|
114 | /** @defgroup PWR_WakeUp_Pins PWR WakeUp Pins |
114 | * @{ |
115 | * @{ |
115 | */ |
116 | */ |
116 | |
117 | 117 | #define PWR_WAKEUP_PIN1 PWR_CSR_EWUP |
|
118 | #define PWR_WAKEUP_PIN1 PWR_CSR_EWUP |
118 | |
119 | 119 | /** |
|
120 | /** |
120 | * @} |
121 | * @} |
121 | */ |
122 | */ |
122 | |
123 | 123 | /** @defgroup PWR_Regulator_state_in_SLEEP_STOP_mode PWR Regulator state in SLEEP/STOP mode |
|
124 | /** @defgroup PWR_Regulator_state_in_SLEEP_STOP_mode PWR Regulator state in SLEEP/STOP mode |
124 | * @{ |
125 | * @{ |
125 | */ |
126 | */ |
126 | #define PWR_MAINREGULATOR_ON 0x00000000U |
127 | #define PWR_MAINREGULATOR_ON 0x00000000U |
127 | #define PWR_LOWPOWERREGULATOR_ON PWR_CR_LPDS |
128 | #define PWR_LOWPOWERREGULATOR_ON PWR_CR_LPDS |
128 | |
129 | 129 | /** |
|
130 | /** |
130 | * @} |
131 | * @} |
131 | */ |
132 | */ |
132 | |
133 | 133 | /** @defgroup PWR_SLEEP_mode_entry PWR SLEEP mode entry |
|
134 | /** @defgroup PWR_SLEEP_mode_entry PWR SLEEP mode entry |
134 | * @{ |
135 | * @{ |
135 | */ |
136 | */ |
136 | #define PWR_SLEEPENTRY_WFI ((uint8_t)0x01) |
137 | #define PWR_SLEEPENTRY_WFI ((uint8_t)0x01) |
137 | #define PWR_SLEEPENTRY_WFE ((uint8_t)0x02) |
138 | #define PWR_SLEEPENTRY_WFE ((uint8_t)0x02) |
138 | |
139 | 139 | /** |
|
140 | /** |
140 | * @} |
141 | * @} |
141 | */ |
142 | */ |
142 | |
143 | 143 | /** @defgroup PWR_STOP_mode_entry PWR STOP mode entry |
|
144 | /** @defgroup PWR_STOP_mode_entry PWR STOP mode entry |
144 | * @{ |
145 | * @{ |
145 | */ |
146 | */ |
146 | #define PWR_STOPENTRY_WFI ((uint8_t)0x01) |
147 | #define PWR_STOPENTRY_WFI ((uint8_t)0x01) |
147 | #define PWR_STOPENTRY_WFE ((uint8_t)0x02) |
148 | #define PWR_STOPENTRY_WFE ((uint8_t)0x02) |
148 | |
149 | 149 | /** |
|
150 | /** |
150 | * @} |
151 | * @} |
151 | */ |
152 | */ |
152 | |
153 | 153 | /** @defgroup PWR_Flag PWR Flag |
|
154 | /** @defgroup PWR_Flag PWR Flag |
154 | * @{ |
155 | * @{ |
155 | */ |
156 | */ |
156 | #define PWR_FLAG_WU PWR_CSR_WUF |
157 | #define PWR_FLAG_WU PWR_CSR_WUF |
157 | #define PWR_FLAG_SB PWR_CSR_SBF |
158 | #define PWR_FLAG_SB PWR_CSR_SBF |
158 | #define PWR_FLAG_PVDO PWR_CSR_PVDO |
159 | #define PWR_FLAG_PVDO PWR_CSR_PVDO |
159 | |
160 | 160 | ||
161 | 161 | /** |
|
162 | /** |
162 | * @} |
163 | * @} |
163 | */ |
164 | */ |
164 | |
165 | 165 | /** |
|
166 | /** |
166 | * @} |
167 | * @} |
167 | */ |
168 | */ |
168 | |
169 | 169 | /* Exported macro ------------------------------------------------------------*/ |
|
170 | /* Exported macro ------------------------------------------------------------*/ |
170 | /** @defgroup PWR_Exported_Macros PWR Exported Macros |
171 | /** @defgroup PWR_Exported_Macros PWR Exported Macros |
171 | * @{ |
172 | * @{ |
172 | */ |
173 | */ |
173 | |
174 | 174 | /** @brief Check PWR flag is set or not. |
|
175 | /** @brief Check PWR flag is set or not. |
175 | * @param __FLAG__: specifies the flag to check. |
176 | * @param __FLAG__: specifies the flag to check. |
176 | * This parameter can be one of the following values: |
177 | * This parameter can be one of the following values: |
177 | * @arg PWR_FLAG_WU: Wake Up flag. This flag indicates that a wakeup event |
178 | * @arg PWR_FLAG_WU: Wake Up flag. This flag indicates that a wakeup event |
178 | * was received from the WKUP pin or from the RTC alarm |
179 | * was received from the WKUP pin or from the RTC alarm |
179 | * An additional wakeup event is detected if the WKUP pin is enabled |
180 | * An additional wakeup event is detected if the WKUP pin is enabled |
180 | * (by setting the EWUP bit) when the WKUP pin level is already high. |
181 | * (by setting the EWUP bit) when the WKUP pin level is already high. |
181 | * @arg PWR_FLAG_SB: StandBy flag. This flag indicates that the system was |
182 | * @arg PWR_FLAG_SB: StandBy flag. This flag indicates that the system was |
182 | * resumed from StandBy mode. |
183 | * resumed from StandBy mode. |
183 | * @arg PWR_FLAG_PVDO: PVD Output. This flag is valid only if PVD is enabled |
184 | * @arg PWR_FLAG_PVDO: PVD Output. This flag is valid only if PVD is enabled |
184 | * by the HAL_PWR_EnablePVD() function. The PVD is stopped by Standby mode |
185 | * by the HAL_PWR_EnablePVD() function. The PVD is stopped by Standby mode |
185 | * For this reason, this bit is equal to 0 after Standby or reset |
186 | * For this reason, this bit is equal to 0 after Standby or reset |
186 | * until the PVDE bit is set. |
187 | * until the PVDE bit is set. |
187 | * @retval The new state of __FLAG__ (TRUE or FALSE). |
188 | * @retval The new state of __FLAG__ (TRUE or FALSE). |
188 | */ |
189 | */ |
189 | #define __HAL_PWR_GET_FLAG(__FLAG__) ((PWR->CSR & (__FLAG__)) == (__FLAG__)) |
190 | #define __HAL_PWR_GET_FLAG(__FLAG__) ((PWR->CSR & (__FLAG__)) == (__FLAG__)) |
190 | |
191 | 191 | /** @brief Clear the PWR's pending flags. |
|
192 | /** @brief Clear the PWR's pending flags. |
192 | * @param __FLAG__: specifies the flag to clear. |
193 | * @param __FLAG__: specifies the flag to clear. |
193 | * This parameter can be one of the following values: |
194 | * This parameter can be one of the following values: |
194 | * @arg PWR_FLAG_WU: Wake Up flag |
195 | * @arg PWR_FLAG_WU: Wake Up flag |
195 | * @arg PWR_FLAG_SB: StandBy flag |
196 | * @arg PWR_FLAG_SB: StandBy flag |
196 | */ |
197 | */ |
197 | #define __HAL_PWR_CLEAR_FLAG(__FLAG__) SET_BIT(PWR->CR, ((__FLAG__) << 2)) |
198 | #define __HAL_PWR_CLEAR_FLAG(__FLAG__) SET_BIT(PWR->CR, ((__FLAG__) << 2)) |
198 | |
199 | 199 | /** |
|
200 | /** |
200 | * @brief Enable interrupt on PVD Exti Line 16. |
201 | * @brief Enable interrupt on PVD Exti Line 16. |
201 | * @retval None. |
202 | * @retval None. |
202 | */ |
203 | */ |
203 | #define __HAL_PWR_PVD_EXTI_ENABLE_IT() SET_BIT(EXTI->IMR, PWR_EXTI_LINE_PVD) |
204 | #define __HAL_PWR_PVD_EXTI_ENABLE_IT() SET_BIT(EXTI->IMR, PWR_EXTI_LINE_PVD) |
204 | |
205 | 205 | /** |
|
206 | /** |
206 | * @brief Disable interrupt on PVD Exti Line 16. |
207 | * @brief Disable interrupt on PVD Exti Line 16. |
207 | * @retval None. |
208 | * @retval None. |
208 | */ |
209 | */ |
209 | #define __HAL_PWR_PVD_EXTI_DISABLE_IT() CLEAR_BIT(EXTI->IMR, PWR_EXTI_LINE_PVD) |
210 | #define __HAL_PWR_PVD_EXTI_DISABLE_IT() CLEAR_BIT(EXTI->IMR, PWR_EXTI_LINE_PVD) |
210 | |
211 | 211 | /** |
|
212 | /** |
212 | * @brief Enable event on PVD Exti Line 16. |
213 | * @brief Enable event on PVD Exti Line 16. |
213 | * @retval None. |
214 | * @retval None. |
214 | */ |
215 | */ |
215 | #define __HAL_PWR_PVD_EXTI_ENABLE_EVENT() SET_BIT(EXTI->EMR, PWR_EXTI_LINE_PVD) |
216 | #define __HAL_PWR_PVD_EXTI_ENABLE_EVENT() SET_BIT(EXTI->EMR, PWR_EXTI_LINE_PVD) |
216 | |
217 | 217 | /** |
|
218 | /** |
218 | * @brief Disable event on PVD Exti Line 16. |
219 | * @brief Disable event on PVD Exti Line 16. |
219 | * @retval None. |
220 | * @retval None. |
220 | */ |
221 | */ |
221 | #define __HAL_PWR_PVD_EXTI_DISABLE_EVENT() CLEAR_BIT(EXTI->EMR, PWR_EXTI_LINE_PVD) |
222 | #define __HAL_PWR_PVD_EXTI_DISABLE_EVENT() CLEAR_BIT(EXTI->EMR, PWR_EXTI_LINE_PVD) |
222 | |
223 | 223 | ||
224 | 224 | /** |
|
225 | /** |
225 | * @brief PVD EXTI line configuration: set falling edge trigger. |
226 | * @brief PVD EXTI line configuration: set falling edge trigger. |
226 | * @retval None. |
227 | * @retval None. |
227 | */ |
228 | */ |
228 | #define __HAL_PWR_PVD_EXTI_ENABLE_FALLING_EDGE() SET_BIT(EXTI->FTSR, PWR_EXTI_LINE_PVD) |
229 | #define __HAL_PWR_PVD_EXTI_ENABLE_FALLING_EDGE() SET_BIT(EXTI->FTSR, PWR_EXTI_LINE_PVD) |
229 | |
230 | 230 | ||
231 | 231 | /** |
|
232 | /** |
232 | * @brief Disable the PVD Extended Interrupt Falling Trigger. |
233 | * @brief Disable the PVD Extended Interrupt Falling Trigger. |
233 | * @retval None. |
234 | * @retval None. |
234 | */ |
235 | */ |
235 | #define __HAL_PWR_PVD_EXTI_DISABLE_FALLING_EDGE() CLEAR_BIT(EXTI->FTSR, PWR_EXTI_LINE_PVD) |
236 | #define __HAL_PWR_PVD_EXTI_DISABLE_FALLING_EDGE() CLEAR_BIT(EXTI->FTSR, PWR_EXTI_LINE_PVD) |
236 | |
237 | 237 | ||
238 | 238 | /** |
|
239 | /** |
239 | * @brief PVD EXTI line configuration: set rising edge trigger. |
240 | * @brief PVD EXTI line configuration: set rising edge trigger. |
240 | * @retval None. |
241 | * @retval None. |
241 | */ |
242 | */ |
242 | #define __HAL_PWR_PVD_EXTI_ENABLE_RISING_EDGE() SET_BIT(EXTI->RTSR, PWR_EXTI_LINE_PVD) |
243 | #define __HAL_PWR_PVD_EXTI_ENABLE_RISING_EDGE() SET_BIT(EXTI->RTSR, PWR_EXTI_LINE_PVD) |
243 | |
244 | 244 | /** |
|
245 | /** |
245 | * @brief Disable the PVD Extended Interrupt Rising Trigger. |
246 | * @brief Disable the PVD Extended Interrupt Rising Trigger. |
246 | * This parameter can be: |
247 | * This parameter can be: |
247 | * @retval None. |
248 | * @retval None. |
248 | */ |
249 | */ |
249 | #define __HAL_PWR_PVD_EXTI_DISABLE_RISING_EDGE() CLEAR_BIT(EXTI->RTSR, PWR_EXTI_LINE_PVD) |
250 | #define __HAL_PWR_PVD_EXTI_DISABLE_RISING_EDGE() CLEAR_BIT(EXTI->RTSR, PWR_EXTI_LINE_PVD) |
250 | |
251 | 251 | /** |
|
252 | /** |
252 | * @brief PVD EXTI line configuration: set rising & falling edge trigger. |
253 | * @brief PVD EXTI line configuration: set rising & falling edge trigger. |
253 | * @retval None. |
254 | * @retval None. |
254 | */ |
255 | */ |
255 | #define __HAL_PWR_PVD_EXTI_ENABLE_RISING_FALLING_EDGE() __HAL_PWR_PVD_EXTI_ENABLE_RISING_EDGE();__HAL_PWR_PVD_EXTI_ENABLE_FALLING_EDGE(); |
256 | #define __HAL_PWR_PVD_EXTI_ENABLE_RISING_FALLING_EDGE() __HAL_PWR_PVD_EXTI_ENABLE_RISING_EDGE();__HAL_PWR_PVD_EXTI_ENABLE_FALLING_EDGE(); |
256 | |
257 | 257 | /** |
|
258 | /** |
258 | * @brief Disable the PVD Extended Interrupt Rising & Falling Trigger. |
259 | * @brief Disable the PVD Extended Interrupt Rising & Falling Trigger. |
259 | * This parameter can be: |
260 | * This parameter can be: |
260 | * @retval None. |
261 | * @retval None. |
261 | */ |
262 | */ |
262 | #define __HAL_PWR_PVD_EXTI_DISABLE_RISING_FALLING_EDGE() __HAL_PWR_PVD_EXTI_DISABLE_RISING_EDGE();__HAL_PWR_PVD_EXTI_DISABLE_FALLING_EDGE(); |
263 | #define __HAL_PWR_PVD_EXTI_DISABLE_RISING_FALLING_EDGE() __HAL_PWR_PVD_EXTI_DISABLE_RISING_EDGE();__HAL_PWR_PVD_EXTI_DISABLE_FALLING_EDGE(); |
263 | |
264 | 264 | ||
265 | 265 | ||
266 | 266 | /** |
|
267 | /** |
267 | * @brief Check whether the specified PVD EXTI interrupt flag is set or not. |
268 | * @brief Check whether the specified PVD EXTI interrupt flag is set or not. |
268 | * @retval EXTI PVD Line Status. |
269 | * @retval EXTI PVD Line Status. |
269 | */ |
270 | */ |
270 | #define __HAL_PWR_PVD_EXTI_GET_FLAG() (EXTI->PR & (PWR_EXTI_LINE_PVD)) |
271 | #define __HAL_PWR_PVD_EXTI_GET_FLAG() (EXTI->PR & (PWR_EXTI_LINE_PVD)) |
271 | |
272 | 272 | /** |
|
273 | /** |
273 | * @brief Clear the PVD EXTI flag. |
274 | * @brief Clear the PVD EXTI flag. |
274 | * @retval None. |
275 | * @retval None. |
275 | */ |
276 | */ |
276 | #define __HAL_PWR_PVD_EXTI_CLEAR_FLAG() (EXTI->PR = (PWR_EXTI_LINE_PVD)) |
277 | #define __HAL_PWR_PVD_EXTI_CLEAR_FLAG() (EXTI->PR = (PWR_EXTI_LINE_PVD)) |
277 | |
278 | 278 | /** |
|
279 | /** |
279 | * @brief Generate a Software interrupt on selected EXTI line. |
280 | * @brief Generate a Software interrupt on selected EXTI line. |
280 | * @retval None. |
281 | * @retval None. |
281 | */ |
282 | */ |
282 | #define __HAL_PWR_PVD_EXTI_GENERATE_SWIT() SET_BIT(EXTI->SWIER, PWR_EXTI_LINE_PVD) |
283 | #define __HAL_PWR_PVD_EXTI_GENERATE_SWIT() SET_BIT(EXTI->SWIER, PWR_EXTI_LINE_PVD) |
283 | /** |
284 | /** |
284 | * @} |
285 | * @} |
285 | */ |
286 | */ |
286 | |
287 | 287 | /* Private macro -------------------------------------------------------------*/ |
|
288 | /* Private macro -------------------------------------------------------------*/ |
288 | /** @defgroup PWR_Private_Macros PWR Private Macros |
289 | /** @defgroup PWR_Private_Macros PWR Private Macros |
289 | * @{ |
290 | * @{ |
290 | */ |
291 | */ |
291 | #define IS_PWR_PVD_LEVEL(LEVEL) (((LEVEL) == PWR_PVDLEVEL_0) || ((LEVEL) == PWR_PVDLEVEL_1)|| \ |
292 | #define IS_PWR_PVD_LEVEL(LEVEL) (((LEVEL) == PWR_PVDLEVEL_0) || ((LEVEL) == PWR_PVDLEVEL_1)|| \ |
292 | ((LEVEL) == PWR_PVDLEVEL_2) || ((LEVEL) == PWR_PVDLEVEL_3)|| \ |
293 | ((LEVEL) == PWR_PVDLEVEL_2) || ((LEVEL) == PWR_PVDLEVEL_3)|| \ |
293 | ((LEVEL) == PWR_PVDLEVEL_4) || ((LEVEL) == PWR_PVDLEVEL_5)|| \ |
294 | ((LEVEL) == PWR_PVDLEVEL_4) || ((LEVEL) == PWR_PVDLEVEL_5)|| \ |
294 | ((LEVEL) == PWR_PVDLEVEL_6) || ((LEVEL) == PWR_PVDLEVEL_7)) |
295 | ((LEVEL) == PWR_PVDLEVEL_6) || ((LEVEL) == PWR_PVDLEVEL_7)) |
295 | |
296 | 296 | ||
297 | 297 | #define IS_PWR_PVD_MODE(MODE) (((MODE) == PWR_PVD_MODE_IT_RISING)|| ((MODE) == PWR_PVD_MODE_IT_FALLING) || \ |
|
298 | #define IS_PWR_PVD_MODE(MODE) (((MODE) == PWR_PVD_MODE_IT_RISING)|| ((MODE) == PWR_PVD_MODE_IT_FALLING) || \ |
298 | ((MODE) == PWR_PVD_MODE_IT_RISING_FALLING) || ((MODE) == PWR_PVD_MODE_EVENT_RISING) || \ |
299 | ((MODE) == PWR_PVD_MODE_IT_RISING_FALLING) || ((MODE) == PWR_PVD_MODE_EVENT_RISING) || \ |
299 | ((MODE) == PWR_PVD_MODE_EVENT_FALLING) || ((MODE) == PWR_PVD_MODE_EVENT_RISING_FALLING) || \ |
300 | ((MODE) == PWR_PVD_MODE_EVENT_FALLING) || ((MODE) == PWR_PVD_MODE_EVENT_RISING_FALLING) || \ |
300 | ((MODE) == PWR_PVD_MODE_NORMAL)) |
301 | ((MODE) == PWR_PVD_MODE_NORMAL)) |
301 | |
302 | 302 | #define IS_PWR_WAKEUP_PIN(PIN) (((PIN) == PWR_WAKEUP_PIN1)) |
|
303 | #define IS_PWR_WAKEUP_PIN(PIN) (((PIN) == PWR_WAKEUP_PIN1)) |
303 | |
304 | 304 | #define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_MAINREGULATOR_ON) || \ |
|
305 | #define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_MAINREGULATOR_ON) || \ |
305 | ((REGULATOR) == PWR_LOWPOWERREGULATOR_ON)) |
306 | ((REGULATOR) == PWR_LOWPOWERREGULATOR_ON)) |
306 | |
307 | 307 | #define IS_PWR_SLEEP_ENTRY(ENTRY) (((ENTRY) == PWR_SLEEPENTRY_WFI) || ((ENTRY) == PWR_SLEEPENTRY_WFE)) |
|
308 | #define IS_PWR_SLEEP_ENTRY(ENTRY) (((ENTRY) == PWR_SLEEPENTRY_WFI) || ((ENTRY) == PWR_SLEEPENTRY_WFE)) |
308 | |
309 | 309 | #define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPENTRY_WFI) || ((ENTRY) == PWR_STOPENTRY_WFE)) |
|
310 | #define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPENTRY_WFI) || ((ENTRY) == PWR_STOPENTRY_WFE)) |
310 | |
311 | 311 | /** |
|
312 | /** |
312 | * @} |
313 | * @} |
313 | */ |
314 | */ |
314 | |
315 | 315 | ||
316 | 316 | ||
317 | 317 | /* Exported functions --------------------------------------------------------*/ |
|
318 | /* Exported functions --------------------------------------------------------*/ |
318 | |
319 | 319 | /** @addtogroup PWR_Exported_Functions PWR Exported Functions |
|
320 | /** @addtogroup PWR_Exported_Functions PWR Exported Functions |
320 | * @{ |
321 | * @{ |
321 | */ |
322 | */ |
322 | |
323 | 323 | /** @addtogroup PWR_Exported_Functions_Group1 Initialization and de-initialization functions |
|
324 | /** @addtogroup PWR_Exported_Functions_Group1 Initialization and de-initialization functions |
324 | * @{ |
325 | * @{ |
325 | */ |
326 | */ |
326 | |
327 | 327 | /* Initialization and de-initialization functions *******************************/ |
|
328 | /* Initialization and de-initialization functions *******************************/ |
328 | void HAL_PWR_DeInit(void); |
329 | void HAL_PWR_DeInit(void); |
329 | void HAL_PWR_EnableBkUpAccess(void); |
330 | void HAL_PWR_EnableBkUpAccess(void); |
330 | void HAL_PWR_DisableBkUpAccess(void); |
331 | void HAL_PWR_DisableBkUpAccess(void); |
331 | |
332 | 332 | /** |
|
333 | /** |
333 | * @} |
334 | * @} |
334 | */ |
335 | */ |
335 | |
336 | 336 | /** @addtogroup PWR_Exported_Functions_Group2 Peripheral Control functions |
|
337 | /** @addtogroup PWR_Exported_Functions_Group2 Peripheral Control functions |
337 | * @{ |
338 | * @{ |
338 | */ |
339 | */ |
339 | |
340 | 340 | /* Peripheral Control functions ************************************************/ |
|
341 | /* Peripheral Control functions ************************************************/ |
341 | void HAL_PWR_ConfigPVD(PWR_PVDTypeDef *sConfigPVD); |
342 | void HAL_PWR_ConfigPVD(PWR_PVDTypeDef *sConfigPVD); |
342 | /* #define HAL_PWR_ConfigPVD 12*/ |
343 | /* #define HAL_PWR_ConfigPVD 12*/ |
343 | void HAL_PWR_EnablePVD(void); |
344 | void HAL_PWR_EnablePVD(void); |
344 | void HAL_PWR_DisablePVD(void); |
345 | void HAL_PWR_DisablePVD(void); |
345 | |
346 | 346 | /* WakeUp pins configuration functions ****************************************/ |
|
347 | /* WakeUp pins configuration functions ****************************************/ |
347 | void HAL_PWR_EnableWakeUpPin(uint32_t WakeUpPinx); |
348 | void HAL_PWR_EnableWakeUpPin(uint32_t WakeUpPinx); |
348 | void HAL_PWR_DisableWakeUpPin(uint32_t WakeUpPinx); |
349 | void HAL_PWR_DisableWakeUpPin(uint32_t WakeUpPinx); |
349 | |
350 | 350 | /* Low Power modes configuration functions ************************************/ |
|
351 | /* Low Power modes configuration functions ************************************/ |
351 | void HAL_PWR_EnterSTOPMode(uint32_t Regulator, uint8_t STOPEntry); |
352 | void HAL_PWR_EnterSTOPMode(uint32_t Regulator, uint8_t STOPEntry); |
352 | void HAL_PWR_EnterSLEEPMode(uint32_t Regulator, uint8_t SLEEPEntry); |
353 | void HAL_PWR_EnterSLEEPMode(uint32_t Regulator, uint8_t SLEEPEntry); |
353 | void HAL_PWR_EnterSTANDBYMode(void); |
354 | void HAL_PWR_EnterSTANDBYMode(void); |
354 | |
355 | 355 | void HAL_PWR_EnableSleepOnExit(void); |
|
356 | void HAL_PWR_EnableSleepOnExit(void); |
356 | void HAL_PWR_DisableSleepOnExit(void); |
357 | void HAL_PWR_DisableSleepOnExit(void); |
357 | void HAL_PWR_EnableSEVOnPend(void); |
358 | void HAL_PWR_EnableSEVOnPend(void); |
358 | void HAL_PWR_DisableSEVOnPend(void); |
359 | void HAL_PWR_DisableSEVOnPend(void); |
359 | |
360 | 360 | ||
361 | 361 | ||
362 | 362 | void HAL_PWR_PVD_IRQHandler(void); |
|
363 | void HAL_PWR_PVD_IRQHandler(void); |
363 | void HAL_PWR_PVDCallback(void); |
364 | void HAL_PWR_PVDCallback(void); |
364 | /** |
365 | /** |
365 | * @} |
366 | * @} |
366 | */ |
367 | */ |
367 | |
368 | 368 | /** |
|
369 | /** |
369 | * @} |
370 | * @} |
370 | */ |
371 | */ |
371 | |
372 | 372 | /** |
|
373 | /** |
373 | * @} |
374 | * @} |
374 | */ |
375 | */ |
375 | |
376 | 376 | /** |
|
377 | /** |
377 | * @} |
378 | * @} |
378 | */ |
379 | */ |
379 | |
380 | 380 | #ifdef __cplusplus |
|
381 | #ifdef __cplusplus |
381 | } |
382 | } |
382 | #endif |
383 | #endif |
383 | |
384 | 384 | ||
385 | 385 | #endif /* __STM32F1xx_HAL_PWR_H */ |
|
386 | #endif /* __STM32F1xx_HAL_PWR_H */ |
- | |
387 | - | ||
388 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
- |