stm32f3xx_ll_pwr.h 18 KB

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