stm32f4xx_ll_pwr.h 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005
  1. /**
  2. ******************************************************************************
  3. * @file stm32f4xx_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) 2017 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 __STM32F4xx_LL_PWR_H
  37. #define __STM32F4xx_LL_PWR_H
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif
  41. /* Includes ------------------------------------------------------------------*/
  42. #include "stm32f4xx.h"
  43. /** @addtogroup STM32F4xx_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. #define LL_PWR_CSR_PVDO PWR_CSR_PVDO /*!< Power voltage detector output flag */
  75. #define LL_PWR_CSR_VOS PWR_CSR_VOSRDY /*!< Voltage scaling select flag */
  76. #if defined(PWR_CSR_EWUP)
  77. #define LL_PWR_CSR_EWUP1 PWR_CSR_EWUP /*!< Enable WKUP pin */
  78. #elif defined(PWR_CSR_EWUP1)
  79. #define LL_PWR_CSR_EWUP1 PWR_CSR_EWUP1 /*!< Enable WKUP pin 1 */
  80. #endif /* PWR_CSR_EWUP */
  81. #if defined(PWR_CSR_EWUP2)
  82. #define LL_PWR_CSR_EWUP2 PWR_CSR_EWUP2 /*!< Enable WKUP pin 2 */
  83. #endif /* PWR_CSR_EWUP2 */
  84. #if defined(PWR_CSR_EWUP3)
  85. #define LL_PWR_CSR_EWUP3 PWR_CSR_EWUP3 /*!< Enable WKUP pin 3 */
  86. #endif /* PWR_CSR_EWUP3 */
  87. /**
  88. * @}
  89. */
  90. /** @defgroup PWR_LL_EC_REGU_VOLTAGE Regulator Voltage
  91. * @{
  92. */
  93. #if defined(PWR_CR_VOS_0)
  94. #define LL_PWR_REGU_VOLTAGE_SCALE3 (PWR_CR_VOS_0)
  95. #define LL_PWR_REGU_VOLTAGE_SCALE2 (PWR_CR_VOS_1)
  96. #define LL_PWR_REGU_VOLTAGE_SCALE1 (PWR_CR_VOS_0 | PWR_CR_VOS_1) /* The SCALE1 is not available for STM32F401xx devices */
  97. #else
  98. #define LL_PWR_REGU_VOLTAGE_SCALE1 (PWR_CR_VOS)
  99. #define LL_PWR_REGU_VOLTAGE_SCALE2 0x00000000U
  100. #endif /* PWR_CR_VOS_0 */
  101. /**
  102. * @}
  103. */
  104. /** @defgroup PWR_LL_EC_MODE_PWR Mode Power
  105. * @{
  106. */
  107. #define LL_PWR_MODE_STOP_MAINREGU 0x00000000U /*!< Enter Stop mode when the CPU enters deepsleep */
  108. #define LL_PWR_MODE_STOP_LPREGU (PWR_CR_LPDS) /*!< Enter Stop mode (with low power Regulator ON) when the CPU enters deepsleep */
  109. #if defined(PWR_CR_MRUDS) && defined(PWR_CR_LPUDS) && defined(PWR_CR_FPDS)
  110. #define LL_PWR_MODE_STOP_MAINREGU_UNDERDRIVE (PWR_CR_MRUDS | PWR_CR_FPDS) /*!< Enter Stop mode (with main Regulator in under-drive mode) when the CPU enters deepsleep */
  111. #define LL_PWR_MODE_STOP_LPREGU_UNDERDRIVE (PWR_CR_LPDS | PWR_CR_LPUDS | PWR_CR_FPDS) /*!< Enter Stop mode (with low power Regulator in under-drive mode) when the CPU enters deepsleep */
  112. #endif /* PWR_CR_MRUDS && PWR_CR_LPUDS && PWR_CR_FPDS */
  113. #if defined(PWR_CR_MRLVDS) && defined(PWR_CR_LPLVDS) && defined(PWR_CR_FPDS)
  114. #define LL_PWR_MODE_STOP_MAINREGU_DEEPSLEEP (PWR_CR_MRLVDS | PWR_CR_FPDS) /*!< Enter Stop mode (with main Regulator in Deep Sleep mode) when the CPU enters deepsleep */
  115. #define LL_PWR_MODE_STOP_LPREGU_DEEPSLEEP (PWR_CR_LPDS | PWR_CR_LPLVDS | PWR_CR_FPDS) /*!< Enter Stop mode (with low power Regulator in Deep Sleep mode) when the CPU enters deepsleep */
  116. #endif /* PWR_CR_MRLVDS && PWR_CR_LPLVDS && PWR_CR_FPDS */
  117. #define LL_PWR_MODE_STANDBY (PWR_CR_PDDS) /*!< Enter Standby mode when the CPU enters deepsleep */
  118. /**
  119. * @}
  120. */
  121. /** @defgroup PWR_LL_EC_REGU_MODE_DS_MODE Regulator Mode In Deep Sleep Mode
  122. * @{
  123. */
  124. #define LL_PWR_REGU_DSMODE_MAIN 0x00000000U /*!< Voltage Regulator in main mode during deepsleep mode */
  125. #define LL_PWR_REGU_DSMODE_LOW_POWER (PWR_CR_LPDS) /*!< Voltage Regulator in low-power mode during deepsleep mode */
  126. /**
  127. * @}
  128. */
  129. /** @defgroup PWR_LL_EC_PVDLEVEL Power Voltage Detector Level
  130. * @{
  131. */
  132. #define LL_PWR_PVDLEVEL_0 (PWR_CR_PLS_LEV0) /*!< Voltage threshold detected by PVD 2.2 V */
  133. #define LL_PWR_PVDLEVEL_1 (PWR_CR_PLS_LEV1) /*!< Voltage threshold detected by PVD 2.3 V */
  134. #define LL_PWR_PVDLEVEL_2 (PWR_CR_PLS_LEV2) /*!< Voltage threshold detected by PVD 2.4 V */
  135. #define LL_PWR_PVDLEVEL_3 (PWR_CR_PLS_LEV3) /*!< Voltage threshold detected by PVD 2.5 V */
  136. #define LL_PWR_PVDLEVEL_4 (PWR_CR_PLS_LEV4) /*!< Voltage threshold detected by PVD 2.6 V */
  137. #define LL_PWR_PVDLEVEL_5 (PWR_CR_PLS_LEV5) /*!< Voltage threshold detected by PVD 2.7 V */
  138. #define LL_PWR_PVDLEVEL_6 (PWR_CR_PLS_LEV6) /*!< Voltage threshold detected by PVD 2.8 V */
  139. #define LL_PWR_PVDLEVEL_7 (PWR_CR_PLS_LEV7) /*!< Voltage threshold detected by PVD 2.9 V */
  140. /**
  141. * @}
  142. */
  143. /** @defgroup PWR_LL_EC_WAKEUP_PIN Wakeup Pins
  144. * @{
  145. */
  146. #if defined(PWR_CSR_EWUP)
  147. #define LL_PWR_WAKEUP_PIN1 (PWR_CSR_EWUP) /*!< WKUP pin : PA0 */
  148. #endif /* PWR_CSR_EWUP */
  149. #if defined(PWR_CSR_EWUP1)
  150. #define LL_PWR_WAKEUP_PIN1 (PWR_CSR_EWUP1) /*!< WKUP pin 1 : PA0 */
  151. #endif /* PWR_CSR_EWUP1 */
  152. #if defined(PWR_CSR_EWUP2)
  153. #define LL_PWR_WAKEUP_PIN2 (PWR_CSR_EWUP2) /*!< WKUP pin 2 : PC0 or PC13 according to device */
  154. #endif /* PWR_CSR_EWUP2 */
  155. #if defined(PWR_CSR_EWUP3)
  156. #define LL_PWR_WAKEUP_PIN3 (PWR_CSR_EWUP3) /*!< WKUP pin 3 : PC1 */
  157. #endif /* PWR_CSR_EWUP3 */
  158. /**
  159. * @}
  160. */
  161. /**
  162. * @}
  163. */
  164. /* Exported macro ------------------------------------------------------------*/
  165. /** @defgroup PWR_LL_Exported_Macros PWR Exported Macros
  166. * @{
  167. */
  168. /** @defgroup PWR_LL_EM_WRITE_READ Common write and read registers Macros
  169. * @{
  170. */
  171. /**
  172. * @brief Write a value in PWR register
  173. * @param __REG__ Register to be written
  174. * @param __VALUE__ Value to be written in the register
  175. * @retval None
  176. */
  177. #define LL_PWR_WriteReg(__REG__, __VALUE__) WRITE_REG(PWR->__REG__, (__VALUE__))
  178. /**
  179. * @brief Read a value in PWR register
  180. * @param __REG__ Register to be read
  181. * @retval Register value
  182. */
  183. #define LL_PWR_ReadReg(__REG__) READ_REG(PWR->__REG__)
  184. /**
  185. * @}
  186. */
  187. /**
  188. * @}
  189. */
  190. /* Exported functions --------------------------------------------------------*/
  191. /** @defgroup PWR_LL_Exported_Functions PWR Exported Functions
  192. * @{
  193. */
  194. /** @defgroup PWR_LL_EF_Configuration Configuration
  195. * @{
  196. */
  197. #if defined(PWR_CR_FISSR)
  198. /**
  199. * @brief Enable FLASH interface STOP while system Run is ON
  200. * @rmtoll CR FISSR LL_PWR_EnableFLASHInterfaceSTOP
  201. * @note This mode is enabled only with STOP low power mode.
  202. * @retval None
  203. */
  204. __STATIC_INLINE void LL_PWR_EnableFLASHInterfaceSTOP(void)
  205. {
  206. SET_BIT(PWR->CR, PWR_CR_FISSR);
  207. }
  208. /**
  209. * @brief Disable FLASH Interface STOP while system Run is ON
  210. * @rmtoll CR FISSR LL_PWR_DisableFLASHInterfaceSTOP
  211. * @retval None
  212. */
  213. __STATIC_INLINE void LL_PWR_DisableFLASHInterfaceSTOP(void)
  214. {
  215. CLEAR_BIT(PWR->CR, PWR_CR_FISSR);
  216. }
  217. /**
  218. * @brief Check if FLASH Interface STOP while system Run feature is enabled
  219. * @rmtoll CR FISSR LL_PWR_IsEnabledFLASHInterfaceSTOP
  220. * @retval State of bit (1 or 0).
  221. */
  222. __STATIC_INLINE uint32_t LL_PWR_IsEnabledFLASHInterfaceSTOP(void)
  223. {
  224. return (READ_BIT(PWR->CR, PWR_CR_FISSR) == (PWR_CR_FISSR));
  225. }
  226. #endif /* PWR_CR_FISSR */
  227. #if defined(PWR_CR_FMSSR)
  228. /**
  229. * @brief Enable FLASH Memory STOP while system Run is ON
  230. * @rmtoll CR FMSSR LL_PWR_EnableFLASHMemorySTOP
  231. * @note This mode is enabled only with STOP low power mode.
  232. * @retval None
  233. */
  234. __STATIC_INLINE void LL_PWR_EnableFLASHMemorySTOP(void)
  235. {
  236. SET_BIT(PWR->CR, PWR_CR_FMSSR);
  237. }
  238. /**
  239. * @brief Disable FLASH Memory STOP while system Run is ON
  240. * @rmtoll CR FMSSR LL_PWR_DisableFLASHMemorySTOP
  241. * @retval None
  242. */
  243. __STATIC_INLINE void LL_PWR_DisableFLASHMemorySTOP(void)
  244. {
  245. CLEAR_BIT(PWR->CR, PWR_CR_FMSSR);
  246. }
  247. /**
  248. * @brief Check if FLASH Memory STOP while system Run feature is enabled
  249. * @rmtoll CR FMSSR LL_PWR_IsEnabledFLASHMemorySTOP
  250. * @retval State of bit (1 or 0).
  251. */
  252. __STATIC_INLINE uint32_t LL_PWR_IsEnabledFLASHMemorySTOP(void)
  253. {
  254. return (READ_BIT(PWR->CR, PWR_CR_FMSSR) == (PWR_CR_FMSSR));
  255. }
  256. #endif /* PWR_CR_FMSSR */
  257. #if defined(PWR_CR_UDEN)
  258. /**
  259. * @brief Enable Under Drive Mode
  260. * @rmtoll CR UDEN LL_PWR_EnableUnderDriveMode
  261. * @note This mode is enabled only with STOP low power mode.
  262. * In this mode, the 1.2V domain is preserved in reduced leakage mode. This
  263. * mode is only available when the main Regulator or the low power Regulator
  264. * is in low voltage mode.
  265. * @note If the Under-drive mode was enabled, it is automatically disabled after
  266. * exiting Stop mode.
  267. * When the voltage Regulator operates in Under-drive mode, an additional
  268. * startup delay is induced when waking up from Stop mode.
  269. * @retval None
  270. */
  271. __STATIC_INLINE void LL_PWR_EnableUnderDriveMode(void)
  272. {
  273. SET_BIT(PWR->CR, PWR_CR_UDEN);
  274. }
  275. /**
  276. * @brief Disable Under Drive Mode
  277. * @rmtoll CR UDEN LL_PWR_DisableUnderDriveMode
  278. * @retval None
  279. */
  280. __STATIC_INLINE void LL_PWR_DisableUnderDriveMode(void)
  281. {
  282. CLEAR_BIT(PWR->CR, PWR_CR_UDEN);
  283. }
  284. /**
  285. * @brief Check if Under Drive Mode is enabled
  286. * @rmtoll CR UDEN LL_PWR_IsEnabledUnderDriveMode
  287. * @retval State of bit (1 or 0).
  288. */
  289. __STATIC_INLINE uint32_t LL_PWR_IsEnabledUnderDriveMode(void)
  290. {
  291. return (READ_BIT(PWR->CR, PWR_CR_UDEN) == (PWR_CR_UDEN));
  292. }
  293. #endif /* PWR_CR_UDEN */
  294. #if defined(PWR_CR_ODSWEN)
  295. /**
  296. * @brief Enable Over drive switching
  297. * @rmtoll CR ODSWEN LL_PWR_EnableOverDriveSwitching
  298. * @retval None
  299. */
  300. __STATIC_INLINE void LL_PWR_EnableOverDriveSwitching(void)
  301. {
  302. SET_BIT(PWR->CR, PWR_CR_ODSWEN);
  303. }
  304. /**
  305. * @brief Disable Over drive switching
  306. * @rmtoll CR ODSWEN LL_PWR_DisableOverDriveSwitching
  307. * @retval None
  308. */
  309. __STATIC_INLINE void LL_PWR_DisableOverDriveSwitching(void)
  310. {
  311. CLEAR_BIT(PWR->CR, PWR_CR_ODSWEN);
  312. }
  313. /**
  314. * @brief Check if Over drive switching is enabled
  315. * @rmtoll CR ODSWEN LL_PWR_IsEnabledOverDriveSwitching
  316. * @retval State of bit (1 or 0).
  317. */
  318. __STATIC_INLINE uint32_t LL_PWR_IsEnabledOverDriveSwitching(void)
  319. {
  320. return (READ_BIT(PWR->CR, PWR_CR_ODSWEN) == (PWR_CR_ODSWEN));
  321. }
  322. #endif /* PWR_CR_ODSWEN */
  323. #if defined(PWR_CR_ODEN)
  324. /**
  325. * @brief Enable Over drive Mode
  326. * @rmtoll CR ODEN LL_PWR_EnableOverDriveMode
  327. * @retval None
  328. */
  329. __STATIC_INLINE void LL_PWR_EnableOverDriveMode(void)
  330. {
  331. SET_BIT(PWR->CR, PWR_CR_ODEN);
  332. }
  333. /**
  334. * @brief Disable Over drive Mode
  335. * @rmtoll CR ODEN LL_PWR_DisableOverDriveMode
  336. * @retval None
  337. */
  338. __STATIC_INLINE void LL_PWR_DisableOverDriveMode(void)
  339. {
  340. CLEAR_BIT(PWR->CR, PWR_CR_ODEN);
  341. }
  342. /**
  343. * @brief Check if Over drive switching is enabled
  344. * @rmtoll CR ODEN LL_PWR_IsEnabledOverDriveMode
  345. * @retval State of bit (1 or 0).
  346. */
  347. __STATIC_INLINE uint32_t LL_PWR_IsEnabledOverDriveMode(void)
  348. {
  349. return (READ_BIT(PWR->CR, PWR_CR_ODEN) == (PWR_CR_ODEN));
  350. }
  351. #endif /* PWR_CR_ODEN */
  352. #if defined(PWR_CR_MRUDS)
  353. /**
  354. * @brief Enable Main Regulator in deepsleep under-drive Mode
  355. * @rmtoll CR MRUDS LL_PWR_EnableMainRegulatorDeepSleepUDMode
  356. * @retval None
  357. */
  358. __STATIC_INLINE void LL_PWR_EnableMainRegulatorDeepSleepUDMode(void)
  359. {
  360. SET_BIT(PWR->CR, PWR_CR_MRUDS);
  361. }
  362. /**
  363. * @brief Disable Main Regulator in deepsleep under-drive Mode
  364. * @rmtoll CR MRUDS LL_PWR_DisableMainRegulatorDeepSleepUDMode
  365. * @retval None
  366. */
  367. __STATIC_INLINE void LL_PWR_DisableMainRegulatorDeepSleepUDMode(void)
  368. {
  369. CLEAR_BIT(PWR->CR, PWR_CR_MRUDS);
  370. }
  371. /**
  372. * @brief Check if Main Regulator in deepsleep under-drive Mode is enabled
  373. * @rmtoll CR MRUDS LL_PWR_IsEnabledMainRegulatorDeepSleepUDMode
  374. * @retval State of bit (1 or 0).
  375. */
  376. __STATIC_INLINE uint32_t LL_PWR_IsEnabledMainRegulatorDeepSleepUDMode(void)
  377. {
  378. return (READ_BIT(PWR->CR, PWR_CR_MRUDS) == (PWR_CR_MRUDS));
  379. }
  380. #endif /* PWR_CR_MRUDS */
  381. #if defined(PWR_CR_LPUDS)
  382. /**
  383. * @brief Enable Low Power Regulator in deepsleep under-drive Mode
  384. * @rmtoll CR LPUDS LL_PWR_EnableLowPowerRegulatorDeepSleepUDMode
  385. * @retval None
  386. */
  387. __STATIC_INLINE void LL_PWR_EnableLowPowerRegulatorDeepSleepUDMode(void)
  388. {
  389. SET_BIT(PWR->CR, PWR_CR_LPUDS);
  390. }
  391. /**
  392. * @brief Disable Low Power Regulator in deepsleep under-drive Mode
  393. * @rmtoll CR LPUDS LL_PWR_DisableLowPowerRegulatorDeepSleepUDMode
  394. * @retval None
  395. */
  396. __STATIC_INLINE void LL_PWR_DisableLowPowerRegulatorDeepSleepUDMode(void)
  397. {
  398. CLEAR_BIT(PWR->CR, PWR_CR_LPUDS);
  399. }
  400. /**
  401. * @brief Check if Low Power Regulator in deepsleep under-drive Mode is enabled
  402. * @rmtoll CR LPUDS LL_PWR_IsEnabledLowPowerRegulatorDeepSleepUDMode
  403. * @retval State of bit (1 or 0).
  404. */
  405. __STATIC_INLINE uint32_t LL_PWR_IsEnabledLowPowerRegulatorDeepSleepUDMode(void)
  406. {
  407. return (READ_BIT(PWR->CR, PWR_CR_LPUDS) == (PWR_CR_LPUDS));
  408. }
  409. #endif /* PWR_CR_LPUDS */
  410. #if defined(PWR_CR_MRLVDS)
  411. /**
  412. * @brief Enable Main Regulator low voltage Mode
  413. * @rmtoll CR MRLVDS LL_PWR_EnableMainRegulatorLowVoltageMode
  414. * @retval None
  415. */
  416. __STATIC_INLINE void LL_PWR_EnableMainRegulatorLowVoltageMode(void)
  417. {
  418. SET_BIT(PWR->CR, PWR_CR_MRLVDS);
  419. }
  420. /**
  421. * @brief Disable Main Regulator low voltage Mode
  422. * @rmtoll CR MRLVDS LL_PWR_DisableMainRegulatorLowVoltageMode
  423. * @retval None
  424. */
  425. __STATIC_INLINE void LL_PWR_DisableMainRegulatorLowVoltageMode(void)
  426. {
  427. CLEAR_BIT(PWR->CR, PWR_CR_MRLVDS);
  428. }
  429. /**
  430. * @brief Check if Main Regulator low voltage Mode is enabled
  431. * @rmtoll CR MRLVDS LL_PWR_IsEnabledMainRegulatorLowVoltageMode
  432. * @retval State of bit (1 or 0).
  433. */
  434. __STATIC_INLINE uint32_t LL_PWR_IsEnabledMainRegulatorLowVoltageMode(void)
  435. {
  436. return (READ_BIT(PWR->CR, PWR_CR_MRLVDS) == (PWR_CR_MRLVDS));
  437. }
  438. #endif /* PWR_CR_MRLVDS */
  439. #if defined(PWR_CR_LPLVDS)
  440. /**
  441. * @brief Enable Low Power Regulator low voltage Mode
  442. * @rmtoll CR LPLVDS LL_PWR_EnableLowPowerRegulatorLowVoltageMode
  443. * @retval None
  444. */
  445. __STATIC_INLINE void LL_PWR_EnableLowPowerRegulatorLowVoltageMode(void)
  446. {
  447. SET_BIT(PWR->CR, PWR_CR_LPLVDS);
  448. }
  449. /**
  450. * @brief Disable Low Power Regulator low voltage Mode
  451. * @rmtoll CR LPLVDS LL_PWR_DisableLowPowerRegulatorLowVoltageMode
  452. * @retval None
  453. */
  454. __STATIC_INLINE void LL_PWR_DisableLowPowerRegulatorLowVoltageMode(void)
  455. {
  456. CLEAR_BIT(PWR->CR, PWR_CR_LPLVDS);
  457. }
  458. /**
  459. * @brief Check if Low Power Regulator low voltage Mode is enabled
  460. * @rmtoll CR LPLVDS LL_PWR_IsEnabledLowPowerRegulatorLowVoltageMode
  461. * @retval State of bit (1 or 0).
  462. */
  463. __STATIC_INLINE uint32_t LL_PWR_IsEnabledLowPowerRegulatorLowVoltageMode(void)
  464. {
  465. return (READ_BIT(PWR->CR, PWR_CR_LPLVDS) == (PWR_CR_LPLVDS));
  466. }
  467. #endif /* PWR_CR_LPLVDS */
  468. /**
  469. * @brief Set the main internal Regulator output voltage
  470. * @rmtoll CR VOS LL_PWR_SetRegulVoltageScaling
  471. * @param VoltageScaling This parameter can be one of the following values:
  472. * @arg @ref LL_PWR_REGU_VOLTAGE_SCALE1 (*)
  473. * @arg @ref LL_PWR_REGU_VOLTAGE_SCALE2
  474. * @arg @ref LL_PWR_REGU_VOLTAGE_SCALE3
  475. * (*) LL_PWR_REGU_VOLTAGE_SCALE1 is not available for STM32F401xx devices
  476. * @retval None
  477. */
  478. __STATIC_INLINE void LL_PWR_SetRegulVoltageScaling(uint32_t VoltageScaling)
  479. {
  480. MODIFY_REG(PWR->CR, PWR_CR_VOS, VoltageScaling);
  481. }
  482. /**
  483. * @brief Get the main internal Regulator output voltage
  484. * @rmtoll CR VOS LL_PWR_GetRegulVoltageScaling
  485. * @retval Returned value can be one of the following values:
  486. * @arg @ref LL_PWR_REGU_VOLTAGE_SCALE1 (*)
  487. * @arg @ref LL_PWR_REGU_VOLTAGE_SCALE2
  488. * @arg @ref LL_PWR_REGU_VOLTAGE_SCALE3
  489. * (*) LL_PWR_REGU_VOLTAGE_SCALE1 is not available for STM32F401xx devices
  490. */
  491. __STATIC_INLINE uint32_t LL_PWR_GetRegulVoltageScaling(void)
  492. {
  493. return (uint32_t)(READ_BIT(PWR->CR, PWR_CR_VOS));
  494. }
  495. /**
  496. * @brief Enable the Flash Power Down in Stop Mode
  497. * @rmtoll CR FPDS LL_PWR_EnableFlashPowerDown
  498. * @retval None
  499. */
  500. __STATIC_INLINE void LL_PWR_EnableFlashPowerDown(void)
  501. {
  502. SET_BIT(PWR->CR, PWR_CR_FPDS);
  503. }
  504. /**
  505. * @brief Disable the Flash Power Down in Stop Mode
  506. * @rmtoll CR FPDS LL_PWR_DisableFlashPowerDown
  507. * @retval None
  508. */
  509. __STATIC_INLINE void LL_PWR_DisableFlashPowerDown(void)
  510. {
  511. CLEAR_BIT(PWR->CR, PWR_CR_FPDS);
  512. }
  513. /**
  514. * @brief Check if the Flash Power Down in Stop Mode is enabled
  515. * @rmtoll CR FPDS LL_PWR_IsEnabledFlashPowerDown
  516. * @retval State of bit (1 or 0).
  517. */
  518. __STATIC_INLINE uint32_t LL_PWR_IsEnabledFlashPowerDown(void)
  519. {
  520. return (READ_BIT(PWR->CR, PWR_CR_FPDS) == (PWR_CR_FPDS));
  521. }
  522. /**
  523. * @brief Enable access to the backup domain
  524. * @rmtoll CR DBP LL_PWR_EnableBkUpAccess
  525. * @retval None
  526. */
  527. __STATIC_INLINE void LL_PWR_EnableBkUpAccess(void)
  528. {
  529. SET_BIT(PWR->CR, PWR_CR_DBP);
  530. }
  531. /**
  532. * @brief Disable access to the backup domain
  533. * @rmtoll CR DBP LL_PWR_DisableBkUpAccess
  534. * @retval None
  535. */
  536. __STATIC_INLINE void LL_PWR_DisableBkUpAccess(void)
  537. {
  538. CLEAR_BIT(PWR->CR, PWR_CR_DBP);
  539. }
  540. /**
  541. * @brief Check if the backup domain is enabled
  542. * @rmtoll CR DBP LL_PWR_IsEnabledBkUpAccess
  543. * @retval State of bit (1 or 0).
  544. */
  545. __STATIC_INLINE uint32_t LL_PWR_IsEnabledBkUpAccess(void)
  546. {
  547. return (READ_BIT(PWR->CR, PWR_CR_DBP) == (PWR_CR_DBP));
  548. }
  549. /**
  550. * @brief Enable the backup Regulator
  551. * @rmtoll CSR BRE LL_PWR_EnableBkUpRegulator
  552. * @note The BRE bit of the PWR_CSR register is protected against parasitic write access.
  553. * The LL_PWR_EnableBkUpAccess() must be called before using this API.
  554. * @retval None
  555. */
  556. __STATIC_INLINE void LL_PWR_EnableBkUpRegulator(void)
  557. {
  558. SET_BIT(PWR->CSR, PWR_CSR_BRE);
  559. }
  560. /**
  561. * @brief Disable the backup Regulator
  562. * @rmtoll CSR BRE LL_PWR_DisableBkUpRegulator
  563. * @note The BRE bit of the PWR_CSR register is protected against parasitic write access.
  564. * The LL_PWR_EnableBkUpAccess() must be called before using this API.
  565. * @retval None
  566. */
  567. __STATIC_INLINE void LL_PWR_DisableBkUpRegulator(void)
  568. {
  569. CLEAR_BIT(PWR->CSR, PWR_CSR_BRE);
  570. }
  571. /**
  572. * @brief Check if the backup Regulator is enabled
  573. * @rmtoll CSR BRE LL_PWR_IsEnabledBkUpRegulator
  574. * @retval State of bit (1 or 0).
  575. */
  576. __STATIC_INLINE uint32_t LL_PWR_IsEnabledBkUpRegulator(void)
  577. {
  578. return (READ_BIT(PWR->CSR, PWR_CSR_BRE) == (PWR_CSR_BRE));
  579. }
  580. /**
  581. * @brief Set voltage Regulator mode during deep sleep mode
  582. * @rmtoll CR LPDS LL_PWR_SetRegulModeDS
  583. * @param RegulMode This parameter can be one of the following values:
  584. * @arg @ref LL_PWR_REGU_DSMODE_MAIN
  585. * @arg @ref LL_PWR_REGU_DSMODE_LOW_POWER
  586. * @retval None
  587. */
  588. __STATIC_INLINE void LL_PWR_SetRegulModeDS(uint32_t RegulMode)
  589. {
  590. MODIFY_REG(PWR->CR, PWR_CR_LPDS, RegulMode);
  591. }
  592. /**
  593. * @brief Get voltage Regulator mode during deep sleep mode
  594. * @rmtoll CR LPDS LL_PWR_GetRegulModeDS
  595. * @retval Returned value can be one of the following values:
  596. * @arg @ref LL_PWR_REGU_DSMODE_MAIN
  597. * @arg @ref LL_PWR_REGU_DSMODE_LOW_POWER
  598. */
  599. __STATIC_INLINE uint32_t LL_PWR_GetRegulModeDS(void)
  600. {
  601. return (uint32_t)(READ_BIT(PWR->CR, PWR_CR_LPDS));
  602. }
  603. /**
  604. * @brief Set Power Down mode when CPU enters deepsleep
  605. * @rmtoll CR PDDS LL_PWR_SetPowerMode\n
  606. * @rmtoll CR MRUDS LL_PWR_SetPowerMode\n
  607. * @rmtoll CR LPUDS LL_PWR_SetPowerMode\n
  608. * @rmtoll CR FPDS LL_PWR_SetPowerMode\n
  609. * @rmtoll CR MRLVDS LL_PWR_SetPowerMode\n
  610. * @rmtoll CR LPlVDS LL_PWR_SetPowerMode\n
  611. * @rmtoll CR FPDS LL_PWR_SetPowerMode\n
  612. * @rmtoll CR LPDS LL_PWR_SetPowerMode
  613. * @param PDMode This parameter can be one of the following values:
  614. * @arg @ref LL_PWR_MODE_STOP_MAINREGU
  615. * @arg @ref LL_PWR_MODE_STOP_LPREGU
  616. * @arg @ref LL_PWR_MODE_STOP_MAINREGU_UNDERDRIVE (*)
  617. * @arg @ref LL_PWR_MODE_STOP_LPREGU_UNDERDRIVE (*)
  618. * @arg @ref LL_PWR_MODE_STOP_MAINREGU_DEEPSLEEP (*)
  619. * @arg @ref LL_PWR_MODE_STOP_LPREGU_DEEPSLEEP (*)
  620. *
  621. * (*) not available on all devices
  622. * @arg @ref LL_PWR_MODE_STANDBY
  623. * @retval None
  624. */
  625. __STATIC_INLINE void LL_PWR_SetPowerMode(uint32_t PDMode)
  626. {
  627. #if defined(PWR_CR_MRUDS) && defined(PWR_CR_LPUDS) && defined(PWR_CR_FPDS)
  628. MODIFY_REG(PWR->CR, (PWR_CR_PDDS | PWR_CR_LPDS | PWR_CR_FPDS | PWR_CR_LPUDS | PWR_CR_MRUDS), PDMode);
  629. #elif defined(PWR_CR_MRLVDS) && defined(PWR_CR_LPLVDS) && defined(PWR_CR_FPDS)
  630. MODIFY_REG(PWR->CR, (PWR_CR_PDDS | PWR_CR_LPDS | PWR_CR_FPDS | PWR_CR_LPLVDS | PWR_CR_MRLVDS), PDMode);
  631. #else
  632. MODIFY_REG(PWR->CR, (PWR_CR_PDDS| PWR_CR_LPDS), PDMode);
  633. #endif /* PWR_CR_MRUDS && PWR_CR_LPUDS && PWR_CR_FPDS */
  634. }
  635. /**
  636. * @brief Get Power Down mode when CPU enters deepsleep
  637. * @rmtoll CR PDDS LL_PWR_GetPowerMode\n
  638. * @rmtoll CR MRUDS LL_PWR_GetPowerMode\n
  639. * @rmtoll CR LPUDS LL_PWR_GetPowerMode\n
  640. * @rmtoll CR FPDS LL_PWR_GetPowerMode\n
  641. * @rmtoll CR MRLVDS LL_PWR_GetPowerMode\n
  642. * @rmtoll CR LPLVDS LL_PWR_GetPowerMode\n
  643. * @rmtoll CR FPDS LL_PWR_GetPowerMode\n
  644. * @rmtoll CR LPDS LL_PWR_GetPowerMode
  645. * @retval Returned value can be one of the following values:
  646. * @arg @ref LL_PWR_MODE_STOP_MAINREGU
  647. * @arg @ref LL_PWR_MODE_STOP_LPREGU
  648. * @arg @ref LL_PWR_MODE_STOP_MAINREGU_UNDERDRIVE (*)
  649. * @arg @ref LL_PWR_MODE_STOP_LPREGU_UNDERDRIVE (*)
  650. * @arg @ref LL_PWR_MODE_STOP_MAINREGU_DEEPSLEEP (*)
  651. * @arg @ref LL_PWR_MODE_STOP_LPREGU_DEEPSLEEP (*)
  652. *
  653. * (*) not available on all devices
  654. * @arg @ref LL_PWR_MODE_STANDBY
  655. */
  656. __STATIC_INLINE uint32_t LL_PWR_GetPowerMode(void)
  657. {
  658. #if defined(PWR_CR_MRUDS) && defined(PWR_CR_LPUDS) && defined(PWR_CR_FPDS)
  659. return (uint32_t)(READ_BIT(PWR->CR, (PWR_CR_PDDS | PWR_CR_LPDS | PWR_CR_FPDS | PWR_CR_LPUDS | PWR_CR_MRUDS)));
  660. #elif defined(PWR_CR_MRLVDS) && defined(PWR_CR_LPLVDS) && defined(PWR_CR_FPDS)
  661. return (uint32_t)(READ_BIT(PWR->CR, (PWR_CR_PDDS | PWR_CR_LPDS | PWR_CR_FPDS | PWR_CR_LPLVDS | PWR_CR_MRLVDS)));
  662. #else
  663. return (uint32_t)(READ_BIT(PWR->CR, (PWR_CR_PDDS| PWR_CR_LPDS)));
  664. #endif /* PWR_CR_MRUDS && PWR_CR_LPUDS && PWR_CR_FPDS */
  665. }
  666. /**
  667. * @brief Configure the voltage threshold detected by the Power Voltage Detector
  668. * @rmtoll CR PLS LL_PWR_SetPVDLevel
  669. * @param PVDLevel This parameter can be one of the following values:
  670. * @arg @ref LL_PWR_PVDLEVEL_0
  671. * @arg @ref LL_PWR_PVDLEVEL_1
  672. * @arg @ref LL_PWR_PVDLEVEL_2
  673. * @arg @ref LL_PWR_PVDLEVEL_3
  674. * @arg @ref LL_PWR_PVDLEVEL_4
  675. * @arg @ref LL_PWR_PVDLEVEL_5
  676. * @arg @ref LL_PWR_PVDLEVEL_6
  677. * @arg @ref LL_PWR_PVDLEVEL_7
  678. * @retval None
  679. */
  680. __STATIC_INLINE void LL_PWR_SetPVDLevel(uint32_t PVDLevel)
  681. {
  682. MODIFY_REG(PWR->CR, PWR_CR_PLS, PVDLevel);
  683. }
  684. /**
  685. * @brief Get the voltage threshold detection
  686. * @rmtoll CR PLS LL_PWR_GetPVDLevel
  687. * @retval Returned value can be one of the following values:
  688. * @arg @ref LL_PWR_PVDLEVEL_0
  689. * @arg @ref LL_PWR_PVDLEVEL_1
  690. * @arg @ref LL_PWR_PVDLEVEL_2
  691. * @arg @ref LL_PWR_PVDLEVEL_3
  692. * @arg @ref LL_PWR_PVDLEVEL_4
  693. * @arg @ref LL_PWR_PVDLEVEL_5
  694. * @arg @ref LL_PWR_PVDLEVEL_6
  695. * @arg @ref LL_PWR_PVDLEVEL_7
  696. */
  697. __STATIC_INLINE uint32_t LL_PWR_GetPVDLevel(void)
  698. {
  699. return (uint32_t)(READ_BIT(PWR->CR, PWR_CR_PLS));
  700. }
  701. /**
  702. * @brief Enable Power Voltage Detector
  703. * @rmtoll CR PVDE LL_PWR_EnablePVD
  704. * @retval None
  705. */
  706. __STATIC_INLINE void LL_PWR_EnablePVD(void)
  707. {
  708. SET_BIT(PWR->CR, PWR_CR_PVDE);
  709. }
  710. /**
  711. * @brief Disable Power Voltage Detector
  712. * @rmtoll CR PVDE LL_PWR_DisablePVD
  713. * @retval None
  714. */
  715. __STATIC_INLINE void LL_PWR_DisablePVD(void)
  716. {
  717. CLEAR_BIT(PWR->CR, PWR_CR_PVDE);
  718. }
  719. /**
  720. * @brief Check if Power Voltage Detector is enabled
  721. * @rmtoll CR PVDE LL_PWR_IsEnabledPVD
  722. * @retval State of bit (1 or 0).
  723. */
  724. __STATIC_INLINE uint32_t LL_PWR_IsEnabledPVD(void)
  725. {
  726. return (READ_BIT(PWR->CR, PWR_CR_PVDE) == (PWR_CR_PVDE));
  727. }
  728. /**
  729. * @brief Enable the WakeUp PINx functionality
  730. * @rmtoll CSR EWUP LL_PWR_EnableWakeUpPin\n
  731. * @rmtoll CSR EWUP1 LL_PWR_EnableWakeUpPin\n
  732. * @rmtoll CSR EWUP2 LL_PWR_EnableWakeUpPin\n
  733. * @rmtoll CSR EWUP3 LL_PWR_EnableWakeUpPin
  734. * @param WakeUpPin This parameter can be one of the following values:
  735. * @arg @ref LL_PWR_WAKEUP_PIN1
  736. * @arg @ref LL_PWR_WAKEUP_PIN2 (*)
  737. * @arg @ref LL_PWR_WAKEUP_PIN3 (*)
  738. *
  739. * (*) not available on all devices
  740. * @retval None
  741. */
  742. __STATIC_INLINE void LL_PWR_EnableWakeUpPin(uint32_t WakeUpPin)
  743. {
  744. SET_BIT(PWR->CSR, WakeUpPin);
  745. }
  746. /**
  747. * @brief Disable the WakeUp PINx functionality
  748. * @rmtoll CSR EWUP LL_PWR_DisableWakeUpPin\n
  749. * @rmtoll CSR EWUP1 LL_PWR_DisableWakeUpPin\n
  750. * @rmtoll CSR EWUP2 LL_PWR_DisableWakeUpPin\n
  751. * @rmtoll CSR EWUP3 LL_PWR_DisableWakeUpPin
  752. * @param WakeUpPin This parameter can be one of the following values:
  753. * @arg @ref LL_PWR_WAKEUP_PIN1
  754. * @arg @ref LL_PWR_WAKEUP_PIN2 (*)
  755. * @arg @ref LL_PWR_WAKEUP_PIN3 (*)
  756. *
  757. * (*) not available on all devices
  758. * @retval None
  759. */
  760. __STATIC_INLINE void LL_PWR_DisableWakeUpPin(uint32_t WakeUpPin)
  761. {
  762. CLEAR_BIT(PWR->CSR, WakeUpPin);
  763. }
  764. /**
  765. * @brief Check if the WakeUp PINx functionality is enabled
  766. * @rmtoll CSR EWUP LL_PWR_IsEnabledWakeUpPin\n
  767. * @rmtoll CSR EWUP1 LL_PWR_IsEnabledWakeUpPin\n
  768. * @rmtoll CSR EWUP2 LL_PWR_IsEnabledWakeUpPin\n
  769. * @rmtoll CSR EWUP3 LL_PWR_IsEnabledWakeUpPin
  770. * @param WakeUpPin This parameter can be one of the following values:
  771. * @arg @ref LL_PWR_WAKEUP_PIN1
  772. * @arg @ref LL_PWR_WAKEUP_PIN2 (*)
  773. * @arg @ref LL_PWR_WAKEUP_PIN3 (*)
  774. *
  775. * (*) not available on all devices
  776. * @retval State of bit (1 or 0).
  777. */
  778. __STATIC_INLINE uint32_t LL_PWR_IsEnabledWakeUpPin(uint32_t WakeUpPin)
  779. {
  780. return (READ_BIT(PWR->CSR, WakeUpPin) == (WakeUpPin));
  781. }
  782. /**
  783. * @}
  784. */
  785. /** @defgroup PWR_LL_EF_FLAG_Management FLAG_Management
  786. * @{
  787. */
  788. /**
  789. * @brief Get Wake-up Flag
  790. * @rmtoll CSR WUF LL_PWR_IsActiveFlag_WU
  791. * @retval State of bit (1 or 0).
  792. */
  793. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_WU(void)
  794. {
  795. return (READ_BIT(PWR->CSR, PWR_CSR_WUF) == (PWR_CSR_WUF));
  796. }
  797. /**
  798. * @brief Get Standby Flag
  799. * @rmtoll CSR SBF LL_PWR_IsActiveFlag_SB
  800. * @retval State of bit (1 or 0).
  801. */
  802. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_SB(void)
  803. {
  804. return (READ_BIT(PWR->CSR, PWR_CSR_SBF) == (PWR_CSR_SBF));
  805. }
  806. /**
  807. * @brief Get Backup Regulator ready Flag
  808. * @rmtoll CSR BRR LL_PWR_IsActiveFlag_BRR
  809. * @retval State of bit (1 or 0).
  810. */
  811. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_BRR(void)
  812. {
  813. return (READ_BIT(PWR->CSR, PWR_CSR_BRR) == (PWR_CSR_BRR));
  814. }
  815. /**
  816. * @brief Indicate whether VDD voltage is below the selected PVD threshold
  817. * @rmtoll CSR PVDO LL_PWR_IsActiveFlag_PVDO
  818. * @retval State of bit (1 or 0).
  819. */
  820. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_PVDO(void)
  821. {
  822. return (READ_BIT(PWR->CSR, PWR_CSR_PVDO) == (PWR_CSR_PVDO));
  823. }
  824. /**
  825. * @brief Indicate whether the Regulator is ready in the selected voltage range or if its output voltage is still changing to the required voltage level
  826. * @rmtoll CSR VOS LL_PWR_IsActiveFlag_VOS
  827. * @retval State of bit (1 or 0).
  828. */
  829. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_VOS(void)
  830. {
  831. return (READ_BIT(PWR->CSR, LL_PWR_CSR_VOS) == (LL_PWR_CSR_VOS));
  832. }
  833. #if defined(PWR_CR_ODEN)
  834. /**
  835. * @brief Indicate whether the Over-Drive mode is ready or not
  836. * @rmtoll CSR ODRDY LL_PWR_IsActiveFlag_OD
  837. * @retval State of bit (1 or 0).
  838. */
  839. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_OD(void)
  840. {
  841. return (READ_BIT(PWR->CSR, PWR_CSR_ODRDY) == (PWR_CSR_ODRDY));
  842. }
  843. #endif /* PWR_CR_ODEN */
  844. #if defined(PWR_CR_ODSWEN)
  845. /**
  846. * @brief Indicate whether the Over-Drive mode switching is ready or not
  847. * @rmtoll CSR ODSWRDY LL_PWR_IsActiveFlag_ODSW
  848. * @retval State of bit (1 or 0).
  849. */
  850. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_ODSW(void)
  851. {
  852. return (READ_BIT(PWR->CSR, PWR_CSR_ODSWRDY) == (PWR_CSR_ODSWRDY));
  853. }
  854. #endif /* PWR_CR_ODSWEN */
  855. #if defined(PWR_CR_UDEN)
  856. /**
  857. * @brief Indicate whether the Under-Drive mode is ready or not
  858. * @rmtoll CSR UDRDY LL_PWR_IsActiveFlag_UD
  859. * @retval State of bit (1 or 0).
  860. */
  861. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_UD(void)
  862. {
  863. return (READ_BIT(PWR->CSR, PWR_CSR_UDRDY) == (PWR_CSR_UDRDY));
  864. }
  865. #endif /* PWR_CR_UDEN */
  866. /**
  867. * @brief Clear Standby Flag
  868. * @rmtoll CR CSBF LL_PWR_ClearFlag_SB
  869. * @retval None
  870. */
  871. __STATIC_INLINE void LL_PWR_ClearFlag_SB(void)
  872. {
  873. SET_BIT(PWR->CR, PWR_CR_CSBF);
  874. }
  875. /**
  876. * @brief Clear Wake-up Flags
  877. * @rmtoll CR CWUF LL_PWR_ClearFlag_WU
  878. * @retval None
  879. */
  880. __STATIC_INLINE void LL_PWR_ClearFlag_WU(void)
  881. {
  882. SET_BIT(PWR->CR, PWR_CR_CWUF);
  883. }
  884. #if defined(PWR_CSR_UDRDY)
  885. /**
  886. * @brief Clear Under-Drive ready Flag
  887. * @rmtoll CSR UDRDY LL_PWR_ClearFlag_UD
  888. * @retval None
  889. */
  890. __STATIC_INLINE void LL_PWR_ClearFlag_UD(void)
  891. {
  892. WRITE_REG(PWR->CSR, PWR_CSR_UDRDY);
  893. }
  894. #endif /* PWR_CSR_UDRDY */
  895. /**
  896. * @}
  897. */
  898. #if defined(USE_FULL_LL_DRIVER)
  899. /** @defgroup PWR_LL_EF_Init De-initialization function
  900. * @{
  901. */
  902. ErrorStatus LL_PWR_DeInit(void);
  903. /**
  904. * @}
  905. */
  906. #endif /* USE_FULL_LL_DRIVER */
  907. /**
  908. * @}
  909. */
  910. /**
  911. * @}
  912. */
  913. #endif /* defined(PWR) */
  914. /**
  915. * @}
  916. */
  917. #ifdef __cplusplus
  918. }
  919. #endif
  920. #endif /* __STM32F4xx_LL_PWR_H */
  921. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/