stm32f0xx_ll_pwr.h 17 KB

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