stm32f0xx_ll_pwr.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552
  1. /**
  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>&copy; Copyright (c) 2016 STMicroelectronics.
  10. * All rights reserved.</center></h2>
  11. *
  12. * This software component is licensed by ST under BSD 3-Clause license,
  13. * the "License"; You may not use this file except in compliance with the
  14. * License. You may obtain a copy of the License at:
  15. * opensource.org/licenses/BSD-3-Clause
  16. *
  17. ******************************************************************************
  18. */
  19. /* Define to prevent recursive inclusion -------------------------------------*/
  20. #ifndef __STM32F0xx_LL_PWR_H
  21. #define __STM32F0xx_LL_PWR_H
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. /* Includes ------------------------------------------------------------------*/
  26. #include "stm32f0xx.h"
  27. /** @addtogroup STM32F0xx_LL_Driver
  28. * @{
  29. */
  30. #if defined(PWR)
  31. /** @defgroup PWR_LL PWR
  32. * @{
  33. */
  34. /* Private types -------------------------------------------------------------*/
  35. /* Private variables ---------------------------------------------------------*/
  36. /* Private constants ---------------------------------------------------------*/
  37. /* Private macros ------------------------------------------------------------*/
  38. /* Exported types ------------------------------------------------------------*/
  39. /* Exported constants --------------------------------------------------------*/
  40. /** @defgroup PWR_LL_Exported_Constants PWR Exported Constants
  41. * @{
  42. */
  43. /** @defgroup PWR_LL_EC_CLEAR_FLAG Clear Flags Defines
  44. * @brief Flags defines which can be used with LL_PWR_WriteReg function
  45. * @{
  46. */
  47. #define LL_PWR_CR_CSBF PWR_CR_CSBF /*!< Clear standby flag */
  48. #define LL_PWR_CR_CWUF PWR_CR_CWUF /*!< Clear wakeup flag */
  49. /**
  50. * @}
  51. */
  52. /** @defgroup PWR_LL_EC_GET_FLAG Get Flags Defines
  53. * @brief Flags defines which can be used with LL_PWR_ReadReg function
  54. * @{
  55. */
  56. #define LL_PWR_CSR_WUF PWR_CSR_WUF /*!< Wakeup flag */
  57. #define LL_PWR_CSR_SBF PWR_CSR_SBF /*!< Standby flag */
  58. #if defined(PWR_PVD_SUPPORT)
  59. #define LL_PWR_CSR_PVDO PWR_CSR_PVDO /*!< Power voltage detector output flag */
  60. #endif /* PWR_PVD_SUPPORT */
  61. #if defined(PWR_CSR_VREFINTRDYF)
  62. #define LL_PWR_CSR_VREFINTRDYF PWR_CSR_VREFINTRDYF /*!< VREFINT ready flag */
  63. #endif /* PWR_CSR_VREFINTRDYF */
  64. #define LL_PWR_CSR_EWUP1 PWR_CSR_EWUP1 /*!< Enable WKUP pin 1 */
  65. #define LL_PWR_CSR_EWUP2 PWR_CSR_EWUP2 /*!< Enable WKUP pin 2 */
  66. #if defined(PWR_CSR_EWUP3)
  67. #define LL_PWR_CSR_EWUP3 PWR_CSR_EWUP3 /*!< Enable WKUP pin 3 */
  68. #endif /* PWR_CSR_EWUP3 */
  69. #if defined(PWR_CSR_EWUP4)
  70. #define LL_PWR_CSR_EWUP4 PWR_CSR_EWUP4 /*!< Enable WKUP pin 4 */
  71. #endif /* PWR_CSR_EWUP4 */
  72. #if defined(PWR_CSR_EWUP5)
  73. #define LL_PWR_CSR_EWUP5 PWR_CSR_EWUP5 /*!< Enable WKUP pin 5 */
  74. #endif /* PWR_CSR_EWUP5 */
  75. #if defined(PWR_CSR_EWUP6)
  76. #define LL_PWR_CSR_EWUP6 PWR_CSR_EWUP6 /*!< Enable WKUP pin 6 */
  77. #endif /* PWR_CSR_EWUP6 */
  78. #if defined(PWR_CSR_EWUP7)
  79. #define LL_PWR_CSR_EWUP7 PWR_CSR_EWUP7 /*!< Enable WKUP pin 7 */
  80. #endif /* PWR_CSR_EWUP7 */
  81. #if defined(PWR_CSR_EWUP8)
  82. #define LL_PWR_CSR_EWUP8 PWR_CSR_EWUP8 /*!< Enable WKUP pin 8 */
  83. #endif /* PWR_CSR_EWUP8 */
  84. /**
  85. * @}
  86. */
  87. /** @defgroup PWR_LL_EC_MODE_PWR Mode Power
  88. * @{
  89. */
  90. #define LL_PWR_MODE_STOP_MAINREGU 0x00000000U /*!< Enter Stop mode when the CPU enters deepsleep */
  91. #define LL_PWR_MODE_STOP_LPREGU (PWR_CR_LPDS) /*!< Enter Stop mode (with low power Regulator ON) when the CPU enters deepsleep */
  92. #define LL_PWR_MODE_STANDBY (PWR_CR_PDDS) /*!< Enter Standby mode when the CPU enters deepsleep */
  93. /**
  94. * @}
  95. */
  96. #if defined(PWR_CR_LPDS)
  97. /** @defgroup PWR_LL_EC_REGU_MODE_DS_MODE Regulator Mode In Deep Sleep Mode
  98. * @{
  99. */
  100. #define LL_PWR_REGU_DSMODE_MAIN 0x00000000U /*!< Voltage Regulator in main mode during deepsleep mode */
  101. #define LL_PWR_REGU_DSMODE_LOW_POWER (PWR_CR_LPDS) /*!< Voltage Regulator in low-power mode during deepsleep mode */
  102. /**
  103. * @}
  104. */
  105. #endif /* PWR_CR_LPDS */
  106. #if defined(PWR_PVD_SUPPORT)
  107. /** @defgroup PWR_LL_EC_PVDLEVEL Power Voltage Detector Level
  108. * @{
  109. */
  110. #define LL_PWR_PVDLEVEL_0 (PWR_CR_PLS_LEV0) /*!< Voltage threshold 0 */
  111. #define LL_PWR_PVDLEVEL_1 (PWR_CR_PLS_LEV1) /*!< Voltage threshold 1 */
  112. #define LL_PWR_PVDLEVEL_2 (PWR_CR_PLS_LEV2) /*!< Voltage threshold 2 */
  113. #define LL_PWR_PVDLEVEL_3 (PWR_CR_PLS_LEV3) /*!< Voltage threshold 3 */
  114. #define LL_PWR_PVDLEVEL_4 (PWR_CR_PLS_LEV4) /*!< Voltage threshold 4 */
  115. #define LL_PWR_PVDLEVEL_5 (PWR_CR_PLS_LEV5) /*!< Voltage threshold 5 */
  116. #define LL_PWR_PVDLEVEL_6 (PWR_CR_PLS_LEV6) /*!< Voltage threshold 6 */
  117. #define LL_PWR_PVDLEVEL_7 (PWR_CR_PLS_LEV7) /*!< Voltage threshold 7 */
  118. /**
  119. * @}
  120. */
  121. #endif /* PWR_PVD_SUPPORT */
  122. /** @defgroup PWR_LL_EC_WAKEUP_PIN Wakeup Pins
  123. * @{
  124. */
  125. #define LL_PWR_WAKEUP_PIN1 (PWR_CSR_EWUP1) /*!< WKUP pin 1 : PA0 */
  126. #define LL_PWR_WAKEUP_PIN2 (PWR_CSR_EWUP2) /*!< WKUP pin 2 : PC13 */
  127. #if defined(PWR_CSR_EWUP3)
  128. #define LL_PWR_WAKEUP_PIN3 (PWR_CSR_EWUP3) /*!< WKUP pin 3 : PE6 or PA2 according to device */
  129. #endif /* PWR_CSR_EWUP3 */
  130. #if defined(PWR_CSR_EWUP4)
  131. #define LL_PWR_WAKEUP_PIN4 (PWR_CSR_EWUP4) /*!< WKUP pin 4 : LLG TBD */
  132. #endif /* PWR_CSR_EWUP4 */
  133. #if defined(PWR_CSR_EWUP5)
  134. #define LL_PWR_WAKEUP_PIN5 (PWR_CSR_EWUP5) /*!< WKUP pin 5 : LLG TBD */
  135. #endif /* PWR_CSR_EWUP5 */
  136. #if defined(PWR_CSR_EWUP6)
  137. #define LL_PWR_WAKEUP_PIN6 (PWR_CSR_EWUP6) /*!< WKUP pin 6 : LLG TBD */
  138. #endif /* PWR_CSR_EWUP6 */
  139. #if defined(PWR_CSR_EWUP7)
  140. #define LL_PWR_WAKEUP_PIN7 (PWR_CSR_EWUP7) /*!< WKUP pin 7 : LLG TBD */
  141. #endif /* PWR_CSR_EWUP7 */
  142. #if defined(PWR_CSR_EWUP8)
  143. #define LL_PWR_WAKEUP_PIN8 (PWR_CSR_EWUP8) /*!< WKUP pin 8 : LLG TBD */
  144. #endif /* PWR_CSR_EWUP8 */
  145. /**
  146. * @}
  147. */
  148. /**
  149. * @}
  150. */
  151. /* Exported macro ------------------------------------------------------------*/
  152. /** @defgroup PWR_LL_Exported_Macros PWR Exported Macros
  153. * @{
  154. */
  155. /** @defgroup PWR_LL_EM_WRITE_READ Common write and read registers Macros
  156. * @{
  157. */
  158. /**
  159. * @brief Write a value in PWR register
  160. * @param __REG__ Register to be written
  161. * @param __VALUE__ Value to be written in the register
  162. * @retval None
  163. */
  164. #define LL_PWR_WriteReg(__REG__, __VALUE__) WRITE_REG(PWR->__REG__, (__VALUE__))
  165. /**
  166. * @brief Read a value in PWR register
  167. * @param __REG__ Register to be read
  168. * @retval Register value
  169. */
  170. #define LL_PWR_ReadReg(__REG__) READ_REG(PWR->__REG__)
  171. /**
  172. * @}
  173. */
  174. /**
  175. * @}
  176. */
  177. /* Exported functions --------------------------------------------------------*/
  178. /** @defgroup PWR_LL_Exported_Functions PWR Exported Functions
  179. * @{
  180. */
  181. /** @defgroup PWR_LL_EF_Configuration Configuration
  182. * @{
  183. */
  184. /**
  185. * @brief Enable access to the backup domain
  186. * @rmtoll CR DBP LL_PWR_EnableBkUpAccess
  187. * @retval None
  188. */
  189. __STATIC_INLINE void LL_PWR_EnableBkUpAccess(void)
  190. {
  191. SET_BIT(PWR->CR, PWR_CR_DBP);
  192. }
  193. /**
  194. * @brief Disable access to the backup domain
  195. * @rmtoll CR DBP LL_PWR_DisableBkUpAccess
  196. * @retval None
  197. */
  198. __STATIC_INLINE void LL_PWR_DisableBkUpAccess(void)
  199. {
  200. CLEAR_BIT(PWR->CR, PWR_CR_DBP);
  201. }
  202. /**
  203. * @brief Check if the backup domain is enabled
  204. * @rmtoll CR DBP LL_PWR_IsEnabledBkUpAccess
  205. * @retval State of bit (1 or 0).
  206. */
  207. __STATIC_INLINE uint32_t LL_PWR_IsEnabledBkUpAccess(void)
  208. {
  209. return (READ_BIT(PWR->CR, PWR_CR_DBP) == (PWR_CR_DBP));
  210. }
  211. #if defined(PWR_CR_LPDS)
  212. /**
  213. * @brief Set voltage Regulator mode during deep sleep mode
  214. * @rmtoll CR LPDS LL_PWR_SetRegulModeDS
  215. * @param RegulMode This parameter can be one of the following values:
  216. * @arg @ref LL_PWR_REGU_DSMODE_MAIN
  217. * @arg @ref LL_PWR_REGU_DSMODE_LOW_POWER
  218. * @retval None
  219. */
  220. __STATIC_INLINE void LL_PWR_SetRegulModeDS(uint32_t RegulMode)
  221. {
  222. MODIFY_REG(PWR->CR, PWR_CR_LPDS, RegulMode);
  223. }
  224. /**
  225. * @brief Get voltage Regulator mode during deep sleep mode
  226. * @rmtoll CR LPDS LL_PWR_GetRegulModeDS
  227. * @retval Returned value can be one of the following values:
  228. * @arg @ref LL_PWR_REGU_DSMODE_MAIN
  229. * @arg @ref LL_PWR_REGU_DSMODE_LOW_POWER
  230. */
  231. __STATIC_INLINE uint32_t LL_PWR_GetRegulModeDS(void)
  232. {
  233. return (uint32_t)(READ_BIT(PWR->CR, PWR_CR_LPDS));
  234. }
  235. #endif /* PWR_CR_LPDS */
  236. /**
  237. * @brief Set Power Down mode when CPU enters deepsleep
  238. * @rmtoll CR PDDS LL_PWR_SetPowerMode\n
  239. * @rmtoll CR LPDS LL_PWR_SetPowerMode
  240. * @param PDMode This parameter can be one of the following values:
  241. * @arg @ref LL_PWR_MODE_STOP_MAINREGU
  242. * @arg @ref LL_PWR_MODE_STOP_LPREGU
  243. * @arg @ref LL_PWR_MODE_STANDBY
  244. * @retval None
  245. */
  246. __STATIC_INLINE void LL_PWR_SetPowerMode(uint32_t PDMode)
  247. {
  248. MODIFY_REG(PWR->CR, (PWR_CR_PDDS| PWR_CR_LPDS), PDMode);
  249. }
  250. /**
  251. * @brief Get Power Down mode when CPU enters deepsleep
  252. * @rmtoll CR PDDS LL_PWR_GetPowerMode\n
  253. * @rmtoll CR LPDS LL_PWR_GetPowerMode
  254. * @retval Returned value can be one of the following values:
  255. * @arg @ref LL_PWR_MODE_STOP_MAINREGU
  256. * @arg @ref LL_PWR_MODE_STOP_LPREGU
  257. * @arg @ref LL_PWR_MODE_STANDBY
  258. */
  259. __STATIC_INLINE uint32_t LL_PWR_GetPowerMode(void)
  260. {
  261. return (uint32_t)(READ_BIT(PWR->CR, (PWR_CR_PDDS| PWR_CR_LPDS)));
  262. }
  263. #if defined(PWR_PVD_SUPPORT)
  264. /**
  265. * @brief Configure the voltage threshold detected by the Power Voltage Detector
  266. * @rmtoll CR PLS LL_PWR_SetPVDLevel
  267. * @param PVDLevel This parameter can be one of the following values:
  268. * @arg @ref LL_PWR_PVDLEVEL_0
  269. * @arg @ref LL_PWR_PVDLEVEL_1
  270. * @arg @ref LL_PWR_PVDLEVEL_2
  271. * @arg @ref LL_PWR_PVDLEVEL_3
  272. * @arg @ref LL_PWR_PVDLEVEL_4
  273. * @arg @ref LL_PWR_PVDLEVEL_5
  274. * @arg @ref LL_PWR_PVDLEVEL_6
  275. * @arg @ref LL_PWR_PVDLEVEL_7
  276. * @retval None
  277. */
  278. __STATIC_INLINE void LL_PWR_SetPVDLevel(uint32_t PVDLevel)
  279. {
  280. MODIFY_REG(PWR->CR, PWR_CR_PLS, PVDLevel);
  281. }
  282. /**
  283. * @brief Get the voltage threshold detection
  284. * @rmtoll CR PLS LL_PWR_GetPVDLevel
  285. * @retval Returned value can be one of the following values:
  286. * @arg @ref LL_PWR_PVDLEVEL_0
  287. * @arg @ref LL_PWR_PVDLEVEL_1
  288. * @arg @ref LL_PWR_PVDLEVEL_2
  289. * @arg @ref LL_PWR_PVDLEVEL_3
  290. * @arg @ref LL_PWR_PVDLEVEL_4
  291. * @arg @ref LL_PWR_PVDLEVEL_5
  292. * @arg @ref LL_PWR_PVDLEVEL_6
  293. * @arg @ref LL_PWR_PVDLEVEL_7
  294. */
  295. __STATIC_INLINE uint32_t LL_PWR_GetPVDLevel(void)
  296. {
  297. return (uint32_t)(READ_BIT(PWR->CR, PWR_CR_PLS));
  298. }
  299. /**
  300. * @brief Enable Power Voltage Detector
  301. * @rmtoll CR PVDE LL_PWR_EnablePVD
  302. * @retval None
  303. */
  304. __STATIC_INLINE void LL_PWR_EnablePVD(void)
  305. {
  306. SET_BIT(PWR->CR, PWR_CR_PVDE);
  307. }
  308. /**
  309. * @brief Disable Power Voltage Detector
  310. * @rmtoll CR PVDE LL_PWR_DisablePVD
  311. * @retval None
  312. */
  313. __STATIC_INLINE void LL_PWR_DisablePVD(void)
  314. {
  315. CLEAR_BIT(PWR->CR, PWR_CR_PVDE);
  316. }
  317. /**
  318. * @brief Check if Power Voltage Detector is enabled
  319. * @rmtoll CR PVDE LL_PWR_IsEnabledPVD
  320. * @retval State of bit (1 or 0).
  321. */
  322. __STATIC_INLINE uint32_t LL_PWR_IsEnabledPVD(void)
  323. {
  324. return (READ_BIT(PWR->CR, PWR_CR_PVDE) == (PWR_CR_PVDE));
  325. }
  326. #endif /* PWR_PVD_SUPPORT */
  327. /**
  328. * @brief Enable the WakeUp PINx functionality
  329. * @rmtoll CSR EWUP1 LL_PWR_EnableWakeUpPin\n
  330. * @rmtoll CSR EWUP2 LL_PWR_EnableWakeUpPin\n
  331. * @rmtoll CSR EWUP3 LL_PWR_EnableWakeUpPin\n
  332. * @rmtoll CSR EWUP4 LL_PWR_EnableWakeUpPin\n
  333. * @rmtoll CSR EWUP5 LL_PWR_EnableWakeUpPin\n
  334. * @rmtoll CSR EWUP6 LL_PWR_EnableWakeUpPin\n
  335. * @rmtoll CSR EWUP7 LL_PWR_EnableWakeUpPin\n
  336. * @rmtoll CSR EWUP8 LL_PWR_EnableWakeUpPin
  337. * @param WakeUpPin This parameter can be one of the following values:
  338. * @arg @ref LL_PWR_WAKEUP_PIN1
  339. * @arg @ref LL_PWR_WAKEUP_PIN2
  340. * @arg @ref LL_PWR_WAKEUP_PIN3 (*)
  341. * @arg @ref LL_PWR_WAKEUP_PIN4 (*)
  342. * @arg @ref LL_PWR_WAKEUP_PIN5 (*)
  343. * @arg @ref LL_PWR_WAKEUP_PIN6 (*)
  344. * @arg @ref LL_PWR_WAKEUP_PIN7 (*)
  345. * @arg @ref LL_PWR_WAKEUP_PIN8 (*)
  346. *
  347. * (*) not available on all devices
  348. * @retval None
  349. */
  350. __STATIC_INLINE void LL_PWR_EnableWakeUpPin(uint32_t WakeUpPin)
  351. {
  352. SET_BIT(PWR->CSR, WakeUpPin);
  353. }
  354. /**
  355. * @brief Disable the WakeUp PINx functionality
  356. * @rmtoll CSR EWUP1 LL_PWR_DisableWakeUpPin\n
  357. * @rmtoll CSR EWUP2 LL_PWR_DisableWakeUpPin\n
  358. * @rmtoll CSR EWUP3 LL_PWR_DisableWakeUpPin\n
  359. * @rmtoll CSR EWUP4 LL_PWR_DisableWakeUpPin\n
  360. * @rmtoll CSR EWUP5 LL_PWR_DisableWakeUpPin\n
  361. * @rmtoll CSR EWUP6 LL_PWR_DisableWakeUpPin\n
  362. * @rmtoll CSR EWUP7 LL_PWR_DisableWakeUpPin\n
  363. * @rmtoll CSR EWUP8 LL_PWR_DisableWakeUpPin
  364. * @param WakeUpPin This parameter can be one of the following values:
  365. * @arg @ref LL_PWR_WAKEUP_PIN1
  366. * @arg @ref LL_PWR_WAKEUP_PIN2
  367. * @arg @ref LL_PWR_WAKEUP_PIN3 (*)
  368. * @arg @ref LL_PWR_WAKEUP_PIN4 (*)
  369. * @arg @ref LL_PWR_WAKEUP_PIN5 (*)
  370. * @arg @ref LL_PWR_WAKEUP_PIN6 (*)
  371. * @arg @ref LL_PWR_WAKEUP_PIN7 (*)
  372. * @arg @ref LL_PWR_WAKEUP_PIN8 (*)
  373. *
  374. * (*) not available on all devices
  375. * @retval None
  376. */
  377. __STATIC_INLINE void LL_PWR_DisableWakeUpPin(uint32_t WakeUpPin)
  378. {
  379. CLEAR_BIT(PWR->CSR, WakeUpPin);
  380. }
  381. /**
  382. * @brief Check if the WakeUp PINx functionality is enabled
  383. * @rmtoll CSR EWUP1 LL_PWR_IsEnabledWakeUpPin\n
  384. * @rmtoll CSR EWUP2 LL_PWR_IsEnabledWakeUpPin\n
  385. * @rmtoll CSR EWUP3 LL_PWR_IsEnabledWakeUpPin\n
  386. * @rmtoll CSR EWUP4 LL_PWR_IsEnabledWakeUpPin\n
  387. * @rmtoll CSR EWUP5 LL_PWR_IsEnabledWakeUpPin\n
  388. * @rmtoll CSR EWUP6 LL_PWR_IsEnabledWakeUpPin\n
  389. * @rmtoll CSR EWUP7 LL_PWR_IsEnabledWakeUpPin\n
  390. * @rmtoll CSR EWUP8 LL_PWR_IsEnabledWakeUpPin
  391. * @param WakeUpPin This parameter can be one of the following values:
  392. * @arg @ref LL_PWR_WAKEUP_PIN1
  393. * @arg @ref LL_PWR_WAKEUP_PIN2
  394. * @arg @ref LL_PWR_WAKEUP_PIN3 (*)
  395. * @arg @ref LL_PWR_WAKEUP_PIN4 (*)
  396. * @arg @ref LL_PWR_WAKEUP_PIN5 (*)
  397. * @arg @ref LL_PWR_WAKEUP_PIN6 (*)
  398. * @arg @ref LL_PWR_WAKEUP_PIN7 (*)
  399. * @arg @ref LL_PWR_WAKEUP_PIN8 (*)
  400. *
  401. * (*) not available on all devices
  402. * @retval State of bit (1 or 0).
  403. */
  404. __STATIC_INLINE uint32_t LL_PWR_IsEnabledWakeUpPin(uint32_t WakeUpPin)
  405. {
  406. return (READ_BIT(PWR->CSR, WakeUpPin) == (WakeUpPin));
  407. }
  408. /**
  409. * @}
  410. */
  411. /** @defgroup PWR_LL_EF_FLAG_Management FLAG_Management
  412. * @{
  413. */
  414. /**
  415. * @brief Get Wake-up Flag
  416. * @rmtoll CSR WUF LL_PWR_IsActiveFlag_WU
  417. * @retval State of bit (1 or 0).
  418. */
  419. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_WU(void)
  420. {
  421. return (READ_BIT(PWR->CSR, PWR_CSR_WUF) == (PWR_CSR_WUF));
  422. }
  423. /**
  424. * @brief Get Standby Flag
  425. * @rmtoll CSR SBF LL_PWR_IsActiveFlag_SB
  426. * @retval State of bit (1 or 0).
  427. */
  428. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_SB(void)
  429. {
  430. return (READ_BIT(PWR->CSR, PWR_CSR_SBF) == (PWR_CSR_SBF));
  431. }
  432. #if defined(PWR_PVD_SUPPORT)
  433. /**
  434. * @brief Indicate whether VDD voltage is below the selected PVD threshold
  435. * @rmtoll CSR PVDO LL_PWR_IsActiveFlag_PVDO
  436. * @retval State of bit (1 or 0).
  437. */
  438. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_PVDO(void)
  439. {
  440. return (READ_BIT(PWR->CSR, PWR_CSR_PVDO) == (PWR_CSR_PVDO));
  441. }
  442. #endif /* PWR_PVD_SUPPORT */
  443. #if defined(PWR_CSR_VREFINTRDYF)
  444. /**
  445. * @brief Get Internal Reference VrefInt Flag
  446. * @rmtoll CSR VREFINTRDYF LL_PWR_IsActiveFlag_VREFINTRDY
  447. * @retval State of bit (1 or 0).
  448. */
  449. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_VREFINTRDY(void)
  450. {
  451. return (READ_BIT(PWR->CSR, PWR_CSR_VREFINTRDYF) == (PWR_CSR_VREFINTRDYF));
  452. }
  453. #endif /* PWR_CSR_VREFINTRDYF */
  454. /**
  455. * @brief Clear Standby Flag
  456. * @rmtoll CR CSBF LL_PWR_ClearFlag_SB
  457. * @retval None
  458. */
  459. __STATIC_INLINE void LL_PWR_ClearFlag_SB(void)
  460. {
  461. SET_BIT(PWR->CR, PWR_CR_CSBF);
  462. }
  463. /**
  464. * @brief Clear Wake-up Flags
  465. * @rmtoll CR CWUF LL_PWR_ClearFlag_WU
  466. * @retval None
  467. */
  468. __STATIC_INLINE void LL_PWR_ClearFlag_WU(void)
  469. {
  470. SET_BIT(PWR->CR, PWR_CR_CWUF);
  471. }
  472. /**
  473. * @}
  474. */
  475. #if defined(USE_FULL_LL_DRIVER)
  476. /** @defgroup PWR_LL_EF_Init De-initialization function
  477. * @{
  478. */
  479. ErrorStatus LL_PWR_DeInit(void);
  480. /**
  481. * @}
  482. */
  483. #endif /* USE_FULL_LL_DRIVER */
  484. /**
  485. * @}
  486. */
  487. /**
  488. * @}
  489. */
  490. #endif /* defined(PWR) */
  491. /**
  492. * @}
  493. */
  494. #ifdef __cplusplus
  495. }
  496. #endif
  497. #endif /* __STM32F0xx_LL_PWR_H */
  498. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/