提交 | 用户 | age
|
483170
|
1 |
/** |
Q |
2 |
****************************************************************************** |
|
3 |
* @file stm32f0xx_ll_pwr.h |
|
4 |
* @author MCD Application Team |
|
5 |
* @brief Header file of PWR LL module. |
|
6 |
****************************************************************************** |
|
7 |
* @attention |
|
8 |
* |
|
9 |
* <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> |
|
10 |
* |
|
11 |
* Redistribution and use in source and binary forms, with or without modification, |
|
12 |
* are permitted provided that the following conditions are met: |
|
13 |
* 1. Redistributions of source code must retain the above copyright notice, |
|
14 |
* this list of conditions and the following disclaimer. |
|
15 |
* 2. Redistributions in binary form must reproduce the above copyright notice, |
|
16 |
* this list of conditions and the following disclaimer in the documentation |
|
17 |
* and/or other materials provided with the distribution. |
|
18 |
* 3. Neither the name of STMicroelectronics nor the names of its contributors |
|
19 |
* may be used to endorse or promote products derived from this software |
|
20 |
* without specific prior written permission. |
|
21 |
* |
|
22 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
|
23 |
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
|
24 |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
|
25 |
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
|
26 |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
|
27 |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
|
28 |
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
|
29 |
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
|
30 |
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|
31 |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
32 |
* |
|
33 |
****************************************************************************** |
|
34 |
*/ |
|
35 |
|
|
36 |
/* Define to prevent recursive inclusion -------------------------------------*/ |
|
37 |
#ifndef __STM32F0xx_LL_PWR_H |
|
38 |
#define __STM32F0xx_LL_PWR_H |
|
39 |
|
|
40 |
#ifdef __cplusplus |
|
41 |
extern "C" { |
|
42 |
#endif |
|
43 |
|
|
44 |
/* Includes ------------------------------------------------------------------*/ |
|
45 |
#include "stm32f0xx.h" |
|
46 |
|
|
47 |
/** @addtogroup STM32F0xx_LL_Driver |
|
48 |
* @{ |
|
49 |
*/ |
|
50 |
|
|
51 |
#if defined(PWR) |
|
52 |
|
|
53 |
/** @defgroup PWR_LL PWR |
|
54 |
* @{ |
|
55 |
*/ |
|
56 |
|
|
57 |
/* Private types -------------------------------------------------------------*/ |
|
58 |
/* Private variables ---------------------------------------------------------*/ |
|
59 |
/* Private constants ---------------------------------------------------------*/ |
|
60 |
/* Private macros ------------------------------------------------------------*/ |
|
61 |
/* Exported types ------------------------------------------------------------*/ |
|
62 |
/* Exported constants --------------------------------------------------------*/ |
|
63 |
/** @defgroup PWR_LL_Exported_Constants PWR Exported Constants |
|
64 |
* @{ |
|
65 |
*/ |
|
66 |
|
|
67 |
/** @defgroup PWR_LL_EC_CLEAR_FLAG Clear Flags Defines |
|
68 |
* @brief Flags defines which can be used with LL_PWR_WriteReg function |
|
69 |
* @{ |
|
70 |
*/ |
|
71 |
#define LL_PWR_CR_CSBF PWR_CR_CSBF /*!< Clear standby flag */ |
|
72 |
#define LL_PWR_CR_CWUF PWR_CR_CWUF /*!< Clear wakeup flag */ |
|
73 |
/** |
|
74 |
* @} |
|
75 |
*/ |
|
76 |
|
|
77 |
/** @defgroup PWR_LL_EC_GET_FLAG Get Flags Defines |
|
78 |
* @brief Flags defines which can be used with LL_PWR_ReadReg function |
|
79 |
* @{ |
|
80 |
*/ |
|
81 |
#define LL_PWR_CSR_WUF PWR_CSR_WUF /*!< Wakeup flag */ |
|
82 |
#define LL_PWR_CSR_SBF PWR_CSR_SBF /*!< Standby flag */ |
|
83 |
#if defined(PWR_PVD_SUPPORT) |
|
84 |
#define LL_PWR_CSR_PVDO PWR_CSR_PVDO /*!< Power voltage detector output flag */ |
|
85 |
#endif /* PWR_PVD_SUPPORT */ |
|
86 |
#if defined(PWR_CSR_VREFINTRDYF) |
|
87 |
#define LL_PWR_CSR_VREFINTRDYF PWR_CSR_VREFINTRDYF /*!< VREFINT ready flag */ |
|
88 |
#endif /* PWR_CSR_VREFINTRDYF */ |
|
89 |
#define LL_PWR_CSR_EWUP1 PWR_CSR_EWUP1 /*!< Enable WKUP pin 1 */ |
|
90 |
#define LL_PWR_CSR_EWUP2 PWR_CSR_EWUP2 /*!< Enable WKUP pin 2 */ |
|
91 |
#if defined(PWR_CSR_EWUP3) |
|
92 |
#define LL_PWR_CSR_EWUP3 PWR_CSR_EWUP3 /*!< Enable WKUP pin 3 */ |
|
93 |
#endif /* PWR_CSR_EWUP3 */ |
|
94 |
#if defined(PWR_CSR_EWUP4) |
|
95 |
#define LL_PWR_CSR_EWUP4 PWR_CSR_EWUP4 /*!< Enable WKUP pin 4 */ |
|
96 |
#endif /* PWR_CSR_EWUP4 */ |
|
97 |
#if defined(PWR_CSR_EWUP5) |
|
98 |
#define LL_PWR_CSR_EWUP5 PWR_CSR_EWUP5 /*!< Enable WKUP pin 5 */ |
|
99 |
#endif /* PWR_CSR_EWUP5 */ |
|
100 |
#if defined(PWR_CSR_EWUP6) |
|
101 |
#define LL_PWR_CSR_EWUP6 PWR_CSR_EWUP6 /*!< Enable WKUP pin 6 */ |
|
102 |
#endif /* PWR_CSR_EWUP6 */ |
|
103 |
#if defined(PWR_CSR_EWUP7) |
|
104 |
#define LL_PWR_CSR_EWUP7 PWR_CSR_EWUP7 /*!< Enable WKUP pin 7 */ |
|
105 |
#endif /* PWR_CSR_EWUP7 */ |
|
106 |
#if defined(PWR_CSR_EWUP8) |
|
107 |
#define LL_PWR_CSR_EWUP8 PWR_CSR_EWUP8 /*!< Enable WKUP pin 8 */ |
|
108 |
#endif /* PWR_CSR_EWUP8 */ |
|
109 |
/** |
|
110 |
* @} |
|
111 |
*/ |
|
112 |
|
|
113 |
|
|
114 |
/** @defgroup PWR_LL_EC_MODE_PWR Mode Power |
|
115 |
* @{ |
|
116 |
*/ |
|
117 |
#define LL_PWR_MODE_STOP_MAINREGU 0x00000000U /*!< Enter Stop mode when the CPU enters deepsleep */ |
|
118 |
#define LL_PWR_MODE_STOP_LPREGU (PWR_CR_LPDS) /*!< Enter Stop mode (with low power Regulator ON) when the CPU enters deepsleep */ |
|
119 |
#define LL_PWR_MODE_STANDBY (PWR_CR_PDDS) /*!< Enter Standby mode when the CPU enters deepsleep */ |
|
120 |
/** |
|
121 |
* @} |
|
122 |
*/ |
|
123 |
|
|
124 |
#if defined(PWR_CR_LPDS) |
|
125 |
/** @defgroup PWR_LL_EC_REGU_MODE_DS_MODE Regulator Mode In Deep Sleep Mode |
|
126 |
* @{ |
|
127 |
*/ |
|
128 |
#define LL_PWR_REGU_DSMODE_MAIN 0x00000000U /*!< Voltage Regulator in main mode during deepsleep mode */ |
|
129 |
#define LL_PWR_REGU_DSMODE_LOW_POWER (PWR_CR_LPDS) /*!< Voltage Regulator in low-power mode during deepsleep mode */ |
|
130 |
/** |
|
131 |
* @} |
|
132 |
*/ |
|
133 |
#endif /* PWR_CR_LPDS */ |
|
134 |
|
|
135 |
#if defined(PWR_PVD_SUPPORT) |
|
136 |
/** @defgroup PWR_LL_EC_PVDLEVEL Power Voltage Detector Level |
|
137 |
* @{ |
|
138 |
*/ |
|
139 |
#define LL_PWR_PVDLEVEL_0 (PWR_CR_PLS_LEV0) /*!< Voltage threshold 0 */ |
|
140 |
#define LL_PWR_PVDLEVEL_1 (PWR_CR_PLS_LEV1) /*!< Voltage threshold 1 */ |
|
141 |
#define LL_PWR_PVDLEVEL_2 (PWR_CR_PLS_LEV2) /*!< Voltage threshold 2 */ |
|
142 |
#define LL_PWR_PVDLEVEL_3 (PWR_CR_PLS_LEV3) /*!< Voltage threshold 3 */ |
|
143 |
#define LL_PWR_PVDLEVEL_4 (PWR_CR_PLS_LEV4) /*!< Voltage threshold 4 */ |
|
144 |
#define LL_PWR_PVDLEVEL_5 (PWR_CR_PLS_LEV5) /*!< Voltage threshold 5 */ |
|
145 |
#define LL_PWR_PVDLEVEL_6 (PWR_CR_PLS_LEV6) /*!< Voltage threshold 6 */ |
|
146 |
#define LL_PWR_PVDLEVEL_7 (PWR_CR_PLS_LEV7) /*!< Voltage threshold 7 */ |
|
147 |
/** |
|
148 |
* @} |
|
149 |
*/ |
|
150 |
#endif /* PWR_PVD_SUPPORT */ |
|
151 |
/** @defgroup PWR_LL_EC_WAKEUP_PIN Wakeup Pins |
|
152 |
* @{ |
|
153 |
*/ |
|
154 |
#define LL_PWR_WAKEUP_PIN1 (PWR_CSR_EWUP1) /*!< WKUP pin 1 : PA0 */ |
|
155 |
#define LL_PWR_WAKEUP_PIN2 (PWR_CSR_EWUP2) /*!< WKUP pin 2 : PC13 */ |
|
156 |
#if defined(PWR_CSR_EWUP3) |
|
157 |
#define LL_PWR_WAKEUP_PIN3 (PWR_CSR_EWUP3) /*!< WKUP pin 3 : PE6 or PA2 according to device */ |
|
158 |
#endif /* PWR_CSR_EWUP3 */ |
|
159 |
#if defined(PWR_CSR_EWUP4) |
|
160 |
#define LL_PWR_WAKEUP_PIN4 (PWR_CSR_EWUP4) /*!< WKUP pin 4 : LLG TBD */ |
|
161 |
#endif /* PWR_CSR_EWUP4 */ |
|
162 |
#if defined(PWR_CSR_EWUP5) |
|
163 |
#define LL_PWR_WAKEUP_PIN5 (PWR_CSR_EWUP5) /*!< WKUP pin 5 : LLG TBD */ |
|
164 |
#endif /* PWR_CSR_EWUP5 */ |
|
165 |
#if defined(PWR_CSR_EWUP6) |
|
166 |
#define LL_PWR_WAKEUP_PIN6 (PWR_CSR_EWUP6) /*!< WKUP pin 6 : LLG TBD */ |
|
167 |
#endif /* PWR_CSR_EWUP6 */ |
|
168 |
#if defined(PWR_CSR_EWUP7) |
|
169 |
#define LL_PWR_WAKEUP_PIN7 (PWR_CSR_EWUP7) /*!< WKUP pin 7 : LLG TBD */ |
|
170 |
#endif /* PWR_CSR_EWUP7 */ |
|
171 |
#if defined(PWR_CSR_EWUP8) |
|
172 |
#define LL_PWR_WAKEUP_PIN8 (PWR_CSR_EWUP8) /*!< WKUP pin 8 : LLG TBD */ |
|
173 |
#endif /* PWR_CSR_EWUP8 */ |
|
174 |
/** |
|
175 |
* @} |
|
176 |
*/ |
|
177 |
|
|
178 |
/** |
|
179 |
* @} |
|
180 |
*/ |
|
181 |
|
|
182 |
|
|
183 |
/* Exported macro ------------------------------------------------------------*/ |
|
184 |
/** @defgroup PWR_LL_Exported_Macros PWR Exported Macros |
|
185 |
* @{ |
|
186 |
*/ |
|
187 |
|
|
188 |
/** @defgroup PWR_LL_EM_WRITE_READ Common write and read registers Macros |
|
189 |
* @{ |
|
190 |
*/ |
|
191 |
|
|
192 |
/** |
|
193 |
* @brief Write a value in PWR register |
|
194 |
* @param __REG__ Register to be written |
|
195 |
* @param __VALUE__ Value to be written in the register |
|
196 |
* @retval None |
|
197 |
*/ |
|
198 |
#define LL_PWR_WriteReg(__REG__, __VALUE__) WRITE_REG(PWR->__REG__, (__VALUE__)) |
|
199 |
|
|
200 |
/** |
|
201 |
* @brief Read a value in PWR register |
|
202 |
* @param __REG__ Register to be read |
|
203 |
* @retval Register value |
|
204 |
*/ |
|
205 |
#define LL_PWR_ReadReg(__REG__) READ_REG(PWR->__REG__) |
|
206 |
/** |
|
207 |
* @} |
|
208 |
*/ |
|
209 |
|
|
210 |
/** |
|
211 |
* @} |
|
212 |
*/ |
|
213 |
|
|
214 |
/* Exported functions --------------------------------------------------------*/ |
|
215 |
/** @defgroup PWR_LL_Exported_Functions PWR Exported Functions |
|
216 |
* @{ |
|
217 |
*/ |
|
218 |
|
|
219 |
/** @defgroup PWR_LL_EF_Configuration Configuration |
|
220 |
* @{ |
|
221 |
*/ |
|
222 |
|
|
223 |
/** |
|
224 |
* @brief Enable access to the backup domain |
|
225 |
* @rmtoll CR DBP LL_PWR_EnableBkUpAccess |
|
226 |
* @retval None |
|
227 |
*/ |
|
228 |
__STATIC_INLINE void LL_PWR_EnableBkUpAccess(void) |
|
229 |
{ |
|
230 |
SET_BIT(PWR->CR, PWR_CR_DBP); |
|
231 |
} |
|
232 |
|
|
233 |
/** |
|
234 |
* @brief Disable access to the backup domain |
|
235 |
* @rmtoll CR DBP LL_PWR_DisableBkUpAccess |
|
236 |
* @retval None |
|
237 |
*/ |
|
238 |
__STATIC_INLINE void LL_PWR_DisableBkUpAccess(void) |
|
239 |
{ |
|
240 |
CLEAR_BIT(PWR->CR, PWR_CR_DBP); |
|
241 |
} |
|
242 |
|
|
243 |
/** |
|
244 |
* @brief Check if the backup domain is enabled |
|
245 |
* @rmtoll CR DBP LL_PWR_IsEnabledBkUpAccess |
|
246 |
* @retval State of bit (1 or 0). |
|
247 |
*/ |
|
248 |
__STATIC_INLINE uint32_t LL_PWR_IsEnabledBkUpAccess(void) |
|
249 |
{ |
|
250 |
return (READ_BIT(PWR->CR, PWR_CR_DBP) == (PWR_CR_DBP)); |
|
251 |
} |
|
252 |
|
|
253 |
#if defined(PWR_CR_LPDS) |
|
254 |
/** |
|
255 |
* @brief Set voltage Regulator mode during deep sleep mode |
|
256 |
* @rmtoll CR LPDS LL_PWR_SetRegulModeDS |
|
257 |
* @param RegulMode This parameter can be one of the following values: |
|
258 |
* @arg @ref LL_PWR_REGU_DSMODE_MAIN |
|
259 |
* @arg @ref LL_PWR_REGU_DSMODE_LOW_POWER |
|
260 |
* @retval None |
|
261 |
*/ |
|
262 |
__STATIC_INLINE void LL_PWR_SetRegulModeDS(uint32_t RegulMode) |
|
263 |
{ |
|
264 |
MODIFY_REG(PWR->CR, PWR_CR_LPDS, RegulMode); |
|
265 |
} |
|
266 |
|
|
267 |
/** |
|
268 |
* @brief Get voltage Regulator mode during deep sleep mode |
|
269 |
* @rmtoll CR LPDS LL_PWR_GetRegulModeDS |
|
270 |
* @retval Returned value can be one of the following values: |
|
271 |
* @arg @ref LL_PWR_REGU_DSMODE_MAIN |
|
272 |
* @arg @ref LL_PWR_REGU_DSMODE_LOW_POWER |
|
273 |
*/ |
|
274 |
__STATIC_INLINE uint32_t LL_PWR_GetRegulModeDS(void) |
|
275 |
{ |
|
276 |
return (uint32_t)(READ_BIT(PWR->CR, PWR_CR_LPDS)); |
|
277 |
} |
|
278 |
#endif /* PWR_CR_LPDS */ |
|
279 |
|
|
280 |
/** |
|
281 |
* @brief Set Power Down mode when CPU enters deepsleep |
|
282 |
* @rmtoll CR PDDS LL_PWR_SetPowerMode\n |
|
283 |
* @rmtoll CR LPDS LL_PWR_SetPowerMode |
|
284 |
* @param PDMode This parameter can be one of the following values: |
|
285 |
* @arg @ref LL_PWR_MODE_STOP_MAINREGU |
|
286 |
* @arg @ref LL_PWR_MODE_STOP_LPREGU |
|
287 |
* @arg @ref LL_PWR_MODE_STANDBY |
|
288 |
* @retval None |
|
289 |
*/ |
|
290 |
__STATIC_INLINE void LL_PWR_SetPowerMode(uint32_t PDMode) |
|
291 |
{ |
|
292 |
MODIFY_REG(PWR->CR, (PWR_CR_PDDS| PWR_CR_LPDS), PDMode); |
|
293 |
} |
|
294 |
|
|
295 |
/** |
|
296 |
* @brief Get Power Down mode when CPU enters deepsleep |
|
297 |
* @rmtoll CR PDDS LL_PWR_GetPowerMode\n |
|
298 |
* @rmtoll CR LPDS LL_PWR_GetPowerMode |
|
299 |
* @retval Returned value can be one of the following values: |
|
300 |
* @arg @ref LL_PWR_MODE_STOP_MAINREGU |
|
301 |
* @arg @ref LL_PWR_MODE_STOP_LPREGU |
|
302 |
* @arg @ref LL_PWR_MODE_STANDBY |
|
303 |
*/ |
|
304 |
__STATIC_INLINE uint32_t LL_PWR_GetPowerMode(void) |
|
305 |
{ |
|
306 |
return (uint32_t)(READ_BIT(PWR->CR, (PWR_CR_PDDS| PWR_CR_LPDS))); |
|
307 |
} |
|
308 |
|
|
309 |
#if defined(PWR_PVD_SUPPORT) |
|
310 |
/** |
|
311 |
* @brief Configure the voltage threshold detected by the Power Voltage Detector |
|
312 |
* @rmtoll CR PLS LL_PWR_SetPVDLevel |
|
313 |
* @param PVDLevel This parameter can be one of the following values: |
|
314 |
* @arg @ref LL_PWR_PVDLEVEL_0 |
|
315 |
* @arg @ref LL_PWR_PVDLEVEL_1 |
|
316 |
* @arg @ref LL_PWR_PVDLEVEL_2 |
|
317 |
* @arg @ref LL_PWR_PVDLEVEL_3 |
|
318 |
* @arg @ref LL_PWR_PVDLEVEL_4 |
|
319 |
* @arg @ref LL_PWR_PVDLEVEL_5 |
|
320 |
* @arg @ref LL_PWR_PVDLEVEL_6 |
|
321 |
* @arg @ref LL_PWR_PVDLEVEL_7 |
|
322 |
* @retval None |
|
323 |
*/ |
|
324 |
__STATIC_INLINE void LL_PWR_SetPVDLevel(uint32_t PVDLevel) |
|
325 |
{ |
|
326 |
MODIFY_REG(PWR->CR, PWR_CR_PLS, PVDLevel); |
|
327 |
} |
|
328 |
|
|
329 |
/** |
|
330 |
* @brief Get the voltage threshold detection |
|
331 |
* @rmtoll CR PLS LL_PWR_GetPVDLevel |
|
332 |
* @retval Returned value can be one of the following values: |
|
333 |
* @arg @ref LL_PWR_PVDLEVEL_0 |
|
334 |
* @arg @ref LL_PWR_PVDLEVEL_1 |
|
335 |
* @arg @ref LL_PWR_PVDLEVEL_2 |
|
336 |
* @arg @ref LL_PWR_PVDLEVEL_3 |
|
337 |
* @arg @ref LL_PWR_PVDLEVEL_4 |
|
338 |
* @arg @ref LL_PWR_PVDLEVEL_5 |
|
339 |
* @arg @ref LL_PWR_PVDLEVEL_6 |
|
340 |
* @arg @ref LL_PWR_PVDLEVEL_7 |
|
341 |
*/ |
|
342 |
__STATIC_INLINE uint32_t LL_PWR_GetPVDLevel(void) |
|
343 |
{ |
|
344 |
return (uint32_t)(READ_BIT(PWR->CR, PWR_CR_PLS)); |
|
345 |
} |
|
346 |
|
|
347 |
/** |
|
348 |
* @brief Enable Power Voltage Detector |
|
349 |
* @rmtoll CR PVDE LL_PWR_EnablePVD |
|
350 |
* @retval None |
|
351 |
*/ |
|
352 |
__STATIC_INLINE void LL_PWR_EnablePVD(void) |
|
353 |
{ |
|
354 |
SET_BIT(PWR->CR, PWR_CR_PVDE); |
|
355 |
} |
|
356 |
|
|
357 |
/** |
|
358 |
* @brief Disable Power Voltage Detector |
|
359 |
* @rmtoll CR PVDE LL_PWR_DisablePVD |
|
360 |
* @retval None |
|
361 |
*/ |
|
362 |
__STATIC_INLINE void LL_PWR_DisablePVD(void) |
|
363 |
{ |
|
364 |
CLEAR_BIT(PWR->CR, PWR_CR_PVDE); |
|
365 |
} |
|
366 |
|
|
367 |
/** |
|
368 |
* @brief Check if Power Voltage Detector is enabled |
|
369 |
* @rmtoll CR PVDE LL_PWR_IsEnabledPVD |
|
370 |
* @retval State of bit (1 or 0). |
|
371 |
*/ |
|
372 |
__STATIC_INLINE uint32_t LL_PWR_IsEnabledPVD(void) |
|
373 |
{ |
|
374 |
return (READ_BIT(PWR->CR, PWR_CR_PVDE) == (PWR_CR_PVDE)); |
|
375 |
} |
|
376 |
#endif /* PWR_PVD_SUPPORT */ |
|
377 |
|
|
378 |
/** |
|
379 |
* @brief Enable the WakeUp PINx functionality |
|
380 |
* @rmtoll CSR EWUP1 LL_PWR_EnableWakeUpPin\n |
|
381 |
* @rmtoll CSR EWUP2 LL_PWR_EnableWakeUpPin\n |
|
382 |
* @rmtoll CSR EWUP3 LL_PWR_EnableWakeUpPin\n |
|
383 |
* @rmtoll CSR EWUP4 LL_PWR_EnableWakeUpPin\n |
|
384 |
* @rmtoll CSR EWUP5 LL_PWR_EnableWakeUpPin\n |
|
385 |
* @rmtoll CSR EWUP6 LL_PWR_EnableWakeUpPin\n |
|
386 |
* @rmtoll CSR EWUP7 LL_PWR_EnableWakeUpPin\n |
|
387 |
* @rmtoll CSR EWUP8 LL_PWR_EnableWakeUpPin |
|
388 |
* @param WakeUpPin This parameter can be one of the following values: |
|
389 |
* @arg @ref LL_PWR_WAKEUP_PIN1 |
|
390 |
* @arg @ref LL_PWR_WAKEUP_PIN2 |
|
391 |
* @arg @ref LL_PWR_WAKEUP_PIN3 (*) |
|
392 |
* @arg @ref LL_PWR_WAKEUP_PIN4 (*) |
|
393 |
* @arg @ref LL_PWR_WAKEUP_PIN5 (*) |
|
394 |
* @arg @ref LL_PWR_WAKEUP_PIN6 (*) |
|
395 |
* @arg @ref LL_PWR_WAKEUP_PIN7 (*) |
|
396 |
* @arg @ref LL_PWR_WAKEUP_PIN8 (*) |
|
397 |
* |
|
398 |
* (*) not available on all devices |
|
399 |
* @retval None |
|
400 |
*/ |
|
401 |
__STATIC_INLINE void LL_PWR_EnableWakeUpPin(uint32_t WakeUpPin) |
|
402 |
{ |
|
403 |
SET_BIT(PWR->CSR, WakeUpPin); |
|
404 |
} |
|
405 |
|
|
406 |
/** |
|
407 |
* @brief Disable the WakeUp PINx functionality |
|
408 |
* @rmtoll CSR EWUP1 LL_PWR_DisableWakeUpPin\n |
|
409 |
* @rmtoll CSR EWUP2 LL_PWR_DisableWakeUpPin\n |
|
410 |
* @rmtoll CSR EWUP3 LL_PWR_DisableWakeUpPin\n |
|
411 |
* @rmtoll CSR EWUP4 LL_PWR_DisableWakeUpPin\n |
|
412 |
* @rmtoll CSR EWUP5 LL_PWR_DisableWakeUpPin\n |
|
413 |
* @rmtoll CSR EWUP6 LL_PWR_DisableWakeUpPin\n |
|
414 |
* @rmtoll CSR EWUP7 LL_PWR_DisableWakeUpPin\n |
|
415 |
* @rmtoll CSR EWUP8 LL_PWR_DisableWakeUpPin |
|
416 |
* @param WakeUpPin This parameter can be one of the following values: |
|
417 |
* @arg @ref LL_PWR_WAKEUP_PIN1 |
|
418 |
* @arg @ref LL_PWR_WAKEUP_PIN2 |
|
419 |
* @arg @ref LL_PWR_WAKEUP_PIN3 (*) |
|
420 |
* @arg @ref LL_PWR_WAKEUP_PIN4 (*) |
|
421 |
* @arg @ref LL_PWR_WAKEUP_PIN5 (*) |
|
422 |
* @arg @ref LL_PWR_WAKEUP_PIN6 (*) |
|
423 |
* @arg @ref LL_PWR_WAKEUP_PIN7 (*) |
|
424 |
* @arg @ref LL_PWR_WAKEUP_PIN8 (*) |
|
425 |
* |
|
426 |
* (*) not available on all devices |
|
427 |
* @retval None |
|
428 |
*/ |
|
429 |
__STATIC_INLINE void LL_PWR_DisableWakeUpPin(uint32_t WakeUpPin) |
|
430 |
{ |
|
431 |
CLEAR_BIT(PWR->CSR, WakeUpPin); |
|
432 |
} |
|
433 |
|
|
434 |
/** |
|
435 |
* @brief Check if the WakeUp PINx functionality is enabled |
|
436 |
* @rmtoll CSR EWUP1 LL_PWR_IsEnabledWakeUpPin\n |
|
437 |
* @rmtoll CSR EWUP2 LL_PWR_IsEnabledWakeUpPin\n |
|
438 |
* @rmtoll CSR EWUP3 LL_PWR_IsEnabledWakeUpPin\n |
|
439 |
* @rmtoll CSR EWUP4 LL_PWR_IsEnabledWakeUpPin\n |
|
440 |
* @rmtoll CSR EWUP5 LL_PWR_IsEnabledWakeUpPin\n |
|
441 |
* @rmtoll CSR EWUP6 LL_PWR_IsEnabledWakeUpPin\n |
|
442 |
* @rmtoll CSR EWUP7 LL_PWR_IsEnabledWakeUpPin\n |
|
443 |
* @rmtoll CSR EWUP8 LL_PWR_IsEnabledWakeUpPin |
|
444 |
* @param WakeUpPin This parameter can be one of the following values: |
|
445 |
* @arg @ref LL_PWR_WAKEUP_PIN1 |
|
446 |
* @arg @ref LL_PWR_WAKEUP_PIN2 |
|
447 |
* @arg @ref LL_PWR_WAKEUP_PIN3 (*) |
|
448 |
* @arg @ref LL_PWR_WAKEUP_PIN4 (*) |
|
449 |
* @arg @ref LL_PWR_WAKEUP_PIN5 (*) |
|
450 |
* @arg @ref LL_PWR_WAKEUP_PIN6 (*) |
|
451 |
* @arg @ref LL_PWR_WAKEUP_PIN7 (*) |
|
452 |
* @arg @ref LL_PWR_WAKEUP_PIN8 (*) |
|
453 |
* |
|
454 |
* (*) not available on all devices |
|
455 |
* @retval State of bit (1 or 0). |
|
456 |
*/ |
|
457 |
__STATIC_INLINE uint32_t LL_PWR_IsEnabledWakeUpPin(uint32_t WakeUpPin) |
|
458 |
{ |
|
459 |
return (READ_BIT(PWR->CSR, WakeUpPin) == (WakeUpPin)); |
|
460 |
} |
|
461 |
|
|
462 |
|
|
463 |
/** |
|
464 |
* @} |
|
465 |
*/ |
|
466 |
|
|
467 |
/** @defgroup PWR_LL_EF_FLAG_Management FLAG_Management |
|
468 |
* @{ |
|
469 |
*/ |
|
470 |
|
|
471 |
/** |
|
472 |
* @brief Get Wake-up Flag |
|
473 |
* @rmtoll CSR WUF LL_PWR_IsActiveFlag_WU |
|
474 |
* @retval State of bit (1 or 0). |
|
475 |
*/ |
|
476 |
__STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_WU(void) |
|
477 |
{ |
|
478 |
return (READ_BIT(PWR->CSR, PWR_CSR_WUF) == (PWR_CSR_WUF)); |
|
479 |
} |
|
480 |
|
|
481 |
/** |
|
482 |
* @brief Get Standby Flag |
|
483 |
* @rmtoll CSR SBF LL_PWR_IsActiveFlag_SB |
|
484 |
* @retval State of bit (1 or 0). |
|
485 |
*/ |
|
486 |
__STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_SB(void) |
|
487 |
{ |
|
488 |
return (READ_BIT(PWR->CSR, PWR_CSR_SBF) == (PWR_CSR_SBF)); |
|
489 |
} |
|
490 |
|
|
491 |
#if defined(PWR_PVD_SUPPORT) |
|
492 |
/** |
|
493 |
* @brief Indicate whether VDD voltage is below the selected PVD threshold |
|
494 |
* @rmtoll CSR PVDO LL_PWR_IsActiveFlag_PVDO |
|
495 |
* @retval State of bit (1 or 0). |
|
496 |
*/ |
|
497 |
__STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_PVDO(void) |
|
498 |
{ |
|
499 |
return (READ_BIT(PWR->CSR, PWR_CSR_PVDO) == (PWR_CSR_PVDO)); |
|
500 |
} |
|
501 |
#endif /* PWR_PVD_SUPPORT */ |
|
502 |
|
|
503 |
#if defined(PWR_CSR_VREFINTRDYF) |
|
504 |
/** |
|
505 |
* @brief Get Internal Reference VrefInt Flag |
|
506 |
* @rmtoll CSR VREFINTRDYF LL_PWR_IsActiveFlag_VREFINTRDY |
|
507 |
* @retval State of bit (1 or 0). |
|
508 |
*/ |
|
509 |
__STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_VREFINTRDY(void) |
|
510 |
{ |
|
511 |
return (READ_BIT(PWR->CSR, PWR_CSR_VREFINTRDYF) == (PWR_CSR_VREFINTRDYF)); |
|
512 |
} |
|
513 |
#endif /* PWR_CSR_VREFINTRDYF */ |
|
514 |
/** |
|
515 |
* @brief Clear Standby Flag |
|
516 |
* @rmtoll CR CSBF LL_PWR_ClearFlag_SB |
|
517 |
* @retval None |
|
518 |
*/ |
|
519 |
__STATIC_INLINE void LL_PWR_ClearFlag_SB(void) |
|
520 |
{ |
|
521 |
SET_BIT(PWR->CR, PWR_CR_CSBF); |
|
522 |
} |
|
523 |
|
|
524 |
/** |
|
525 |
* @brief Clear Wake-up Flags |
|
526 |
* @rmtoll CR CWUF LL_PWR_ClearFlag_WU |
|
527 |
* @retval None |
|
528 |
*/ |
|
529 |
__STATIC_INLINE void LL_PWR_ClearFlag_WU(void) |
|
530 |
{ |
|
531 |
SET_BIT(PWR->CR, PWR_CR_CWUF); |
|
532 |
} |
|
533 |
|
|
534 |
/** |
|
535 |
* @} |
|
536 |
*/ |
|
537 |
|
|
538 |
#if defined(USE_FULL_LL_DRIVER) |
|
539 |
/** @defgroup PWR_LL_EF_Init De-initialization function |
|
540 |
* @{ |
|
541 |
*/ |
|
542 |
ErrorStatus LL_PWR_DeInit(void); |
|
543 |
/** |
|
544 |
* @} |
|
545 |
*/ |
|
546 |
#endif /* USE_FULL_LL_DRIVER */ |
|
547 |
|
|
548 |
/** |
|
549 |
* @} |
|
550 |
*/ |
|
551 |
|
|
552 |
/** |
|
553 |
* @} |
|
554 |
*/ |
|
555 |
|
|
556 |
#endif /* defined(PWR) */ |
|
557 |
|
|
558 |
/** |
|
559 |
* @} |
|
560 |
*/ |
|
561 |
|
|
562 |
#ifdef __cplusplus |
|
563 |
} |
|
564 |
#endif |
|
565 |
|
|
566 |
#endif /* __STM32F0xx_LL_PWR_H */ |
|
567 |
|
|
568 |
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |