stm32f7xx_ll_pwr.h 33 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034
  1. /**
  2. ******************************************************************************
  3. * @file stm32f7xx_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 __STM32F7xx_LL_PWR_H
  37. #define __STM32F7xx_LL_PWR_H
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif
  41. /* Includes ------------------------------------------------------------------*/
  42. #include "stm32f7xx.h"
  43. /** @addtogroup STM32F7xx_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_CR1_CSBF PWR_CR1_CSBF /*!< Clear standby flag */
  64. #define LL_PWR_CR2_CWUF6 PWR_CR2_CWUF6 /*!< Clear WKUP pin 6 */
  65. #define LL_PWR_CR2_CWUF5 PWR_CR2_CWUF5 /*!< Clear WKUP pin 5 */
  66. #define LL_PWR_CR2_CWUF4 PWR_CR2_CWUF4 /*!< Clear WKUP pin 4 */
  67. #define LL_PWR_CR2_CWUF3 PWR_CR2_CWUF3 /*!< Clear WKUP pin 3 */
  68. #define LL_PWR_CR2_CWUF2 PWR_CR2_CWUF2 /*!< Clear WKUP pin 2 */
  69. #define LL_PWR_CR2_CWUF1 PWR_CR2_CWUF1 /*!< Clear WKUP pin 1 */
  70. /**
  71. * @}
  72. */
  73. /** @defgroup PWR_LL_EC_GET_FLAG Get Flags Defines
  74. * @brief Flags defines which can be used with LL_PWR_ReadReg function
  75. * @{
  76. */
  77. #define LL_PWR_CSR1_WUIF PWR_CSR1_WUIF /*!< Wakeup flag */
  78. #define LL_PWR_CSR1_SBF PWR_CSR1_SBF /*!< Standby flag */
  79. #define LL_PWR_CSR1_PVDO PWR_CSR1_PVDO /*!< Power voltage detector output flag */
  80. #define LL_PWR_CSR1_BRR PWR_CSR1_BRR /*!< Backup Regulator ready flag */
  81. #define LL_PWR_CSR1_VOSRDY PWR_CSR1_VOSRDY /*!< Voltage scaling select flag */
  82. #define LL_PWR_CSR1_ODRDY PWR_CSR1_ODRDY /*!< Over-drive mode ready */
  83. #define LL_PWR_CSR1_ODSWRDY PWR_CSR1_ODSWRDY /*!< Over-drive mode switching ready */
  84. #define LL_PWR_CSR1_UDRDY PWR_CSR1_UDRDY /*!< Under-drive ready flag */
  85. #define LL_PWR_CSR2_EWUP1 PWR_CSR2_EWUP1 /*!< Enable WKUP pin 1 */
  86. #define LL_PWR_CSR2_EWUP2 PWR_CSR2_EWUP2 /*!< Enable WKUP pin 2 */
  87. #define LL_PWR_CSR2_EWUP3 PWR_CSR2_EWUP3 /*!< Enable WKUP pin 3 */
  88. #define LL_PWR_CSR2_EWUP4 PWR_CSR2_EWUP4 /*!< Enable WKUP pin 4 */
  89. #define LL_PWR_CSR2_EWUP5 PWR_CSR2_EWUP5 /*!< Enable WKUP pin 5 */
  90. #define LL_PWR_CSR2_EWUP6 PWR_CSR2_EWUP6 /*!< Enable WKUP pin 6 */
  91. /**
  92. * @}
  93. */
  94. /** @defgroup PWR_LL_EC_MODE_PWR Mode Power
  95. * @{
  96. */
  97. #define LL_PWR_MODE_STOP_MAINREGU 0x00000000U /*!< Enter Stop mode (with main Regulator ON) when the CPU enters deepsleep */
  98. #define LL_PWR_MODE_STOP_MAINREGU_UNDERDRIVE (PWR_CR1_MRUDS | PWR_CR1_FPDS) /*!< Enter Stop mode (with main Regulator in under-drive mode) when the CPU enters deepsleep */
  99. #define LL_PWR_MODE_STOP_LPREGU PWR_CR1_LPDS /*!< Enter Stop mode (with low power Regulator ON) when the CPU enters deepsleep */
  100. #define LL_PWR_MODE_STOP_LPREGU_UNDERDRIVE (PWR_CR1_LPDS | PWR_CR1_LPUDS | PWR_CR1_FPDS) /*!< Enter Stop mode (with low power Regulator in under-drive mode) when the CPU enters deepsleep */
  101. #define LL_PWR_MODE_STANDBY PWR_CR1_PDDS /*!< Enter Standby mode when the CPU enters deepsleep */
  102. /**
  103. * @}
  104. */
  105. /** @defgroup PWR_LL_EC_REGU_VOLTAGE Regulator Voltage
  106. * @{
  107. */
  108. #define LL_PWR_REGU_VOLTAGE_SCALE3 PWR_CR1_VOS_0
  109. #define LL_PWR_REGU_VOLTAGE_SCALE2 PWR_CR1_VOS_1
  110. #define LL_PWR_REGU_VOLTAGE_SCALE1 (PWR_CR1_VOS_0 | PWR_CR1_VOS_1)
  111. /**
  112. * @}
  113. */
  114. /** @defgroup PWR_LL_EC_REGU_MODE_DS_MODE Regulator Mode In Deep Sleep Mode
  115. * @{
  116. */
  117. #define LL_PWR_REGU_DSMODE_MAIN 0x00000000U /*!< Voltage Regulator in main mode during deepsleep mode */
  118. #define LL_PWR_REGU_DSMODE_LOW_POWER PWR_CR1_LPDS /*!< Voltage Regulator in low-power mode during deepsleep mode */
  119. /**
  120. * @}
  121. */
  122. /** @defgroup PWR_LL_EC_PVDLEVEL Power Voltage Detector Level
  123. * @{
  124. */
  125. #define LL_PWR_PVDLEVEL_0 PWR_CR1_PLS_LEV0 /*!< Voltage threshold detected by PVD 2.0 V */
  126. #define LL_PWR_PVDLEVEL_1 PWR_CR1_PLS_LEV1 /*!< Voltage threshold detected by PVD 2.1 V */
  127. #define LL_PWR_PVDLEVEL_2 PWR_CR1_PLS_LEV2 /*!< Voltage threshold detected by PVD 2.3 V */
  128. #define LL_PWR_PVDLEVEL_3 PWR_CR1_PLS_LEV3 /*!< Voltage threshold detected by PVD 2.5 V */
  129. #define LL_PWR_PVDLEVEL_4 PWR_CR1_PLS_LEV4 /*!< Voltage threshold detected by PVD 2.6 V */
  130. #define LL_PWR_PVDLEVEL_5 PWR_CR1_PLS_LEV5 /*!< Voltage threshold detected by PVD 2.7 V */
  131. #define LL_PWR_PVDLEVEL_6 PWR_CR1_PLS_LEV6 /*!< Voltage threshold detected by PVD 2.8 V */
  132. #define LL_PWR_PVDLEVEL_7 PWR_CR1_PLS_LEV7 /*!< Voltage threshold detected by PVD 2.9 V */
  133. /**
  134. * @}
  135. */
  136. /** @defgroup PWR_LL_EC_WAKEUP_PIN Wakeup Pins
  137. * @{
  138. */
  139. #define LL_PWR_WAKEUP_PIN1 PWR_CSR2_EWUP1 /*!< WKUP pin 1 : PA0 */
  140. #define LL_PWR_WAKEUP_PIN2 PWR_CSR2_EWUP2 /*!< WKUP pin 2 : PA2 */
  141. #define LL_PWR_WAKEUP_PIN3 PWR_CSR2_EWUP3 /*!< WKUP pin 3 : PC1 */
  142. #define LL_PWR_WAKEUP_PIN4 PWR_CSR2_EWUP4 /*!< WKUP pin 4 : PC13 */
  143. #define LL_PWR_WAKEUP_PIN5 PWR_CSR2_EWUP5 /*!< WKUP pin 5 : PI8 */
  144. #define LL_PWR_WAKEUP_PIN6 PWR_CSR2_EWUP6 /*!< WKUP pin 6 : PI11 */
  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 Under Drive Mode
  186. * @rmtoll CR1 UDEN LL_PWR_EnableUnderDriveMode
  187. * @note This mode is enabled only with STOP low power mode.
  188. * In this mode, the 1.2V domain is preserved in reduced leakage mode. This
  189. * mode is only available when the main Regulator or the low power Regulator
  190. * is in low voltage mode.
  191. * @note If the Under-drive mode was enabled, it is automatically disabled after
  192. * exiting Stop mode.
  193. * When the voltage Regulator operates in Under-drive mode, an additional
  194. * startup delay is induced when waking up from Stop mode.
  195. * @retval None
  196. */
  197. __STATIC_INLINE void LL_PWR_EnableUnderDriveMode(void)
  198. {
  199. SET_BIT(PWR->CR1, PWR_CR1_UDEN);
  200. }
  201. /**
  202. * @brief Disable Under Drive Mode
  203. * @rmtoll CR1 UDEN LL_PWR_DisableUnderDriveMode
  204. * @retval None
  205. */
  206. __STATIC_INLINE void LL_PWR_DisableUnderDriveMode(void)
  207. {
  208. CLEAR_BIT(PWR->CR1, PWR_CR1_UDEN);
  209. }
  210. /**
  211. * @brief Check if Under Drive Mode is enabled
  212. * @rmtoll CR1 UDEN LL_PWR_IsEnabledUnderDriveMode
  213. * @retval State of bit (1 or 0).
  214. */
  215. __STATIC_INLINE uint32_t LL_PWR_IsEnabledUnderDriveMode(void)
  216. {
  217. return (READ_BIT(PWR->CR1, PWR_CR1_UDEN) == (PWR_CR1_UDEN));
  218. }
  219. /**
  220. * @brief Enable Over drive switching
  221. * @rmtoll CR1 ODSWEN LL_PWR_EnableOverDriveSwitching
  222. * @retval None
  223. */
  224. __STATIC_INLINE void LL_PWR_EnableOverDriveSwitching(void)
  225. {
  226. SET_BIT(PWR->CR1, PWR_CR1_ODSWEN);
  227. }
  228. /**
  229. * @brief Disable Over drive switching
  230. * @rmtoll CR1 ODSWEN LL_PWR_DisableOverDriveSwitching
  231. * @retval None
  232. */
  233. __STATIC_INLINE void LL_PWR_DisableOverDriveSwitching(void)
  234. {
  235. CLEAR_BIT(PWR->CR1, PWR_CR1_ODSWEN);
  236. }
  237. /**
  238. * @brief Check if Over drive switching is enabled
  239. * @rmtoll CR1 ODSWEN LL_PWR_IsEnabledOverDriveSwitching
  240. * @retval State of bit (1 or 0).
  241. */
  242. __STATIC_INLINE uint32_t LL_PWR_IsEnabledOverDriveSwitching(void)
  243. {
  244. return (READ_BIT(PWR->CR1, PWR_CR1_ODSWEN) == (PWR_CR1_ODSWEN));
  245. }
  246. /**
  247. * @brief Enable Over drive Mode
  248. * @rmtoll CR1 ODEN LL_PWR_EnableOverDriveMode
  249. * @retval None
  250. */
  251. __STATIC_INLINE void LL_PWR_EnableOverDriveMode(void)
  252. {
  253. SET_BIT(PWR->CR1, PWR_CR1_ODEN);
  254. }
  255. /**
  256. * @brief Disable Over drive Mode
  257. * @rmtoll CR1 ODEN LL_PWR_DisableOverDriveMode
  258. * @retval None
  259. */
  260. __STATIC_INLINE void LL_PWR_DisableOverDriveMode(void)
  261. {
  262. CLEAR_BIT(PWR->CR1, PWR_CR1_ODEN);
  263. }
  264. /**
  265. * @brief Check if Over drive switching is enabled
  266. * @rmtoll CR1 ODEN LL_PWR_IsEnabledOverDriveMode
  267. * @retval State of bit (1 or 0).
  268. */
  269. __STATIC_INLINE uint32_t LL_PWR_IsEnabledOverDriveMode(void)
  270. {
  271. return (READ_BIT(PWR->CR1, PWR_CR1_ODEN) == (PWR_CR1_ODEN));
  272. }
  273. /**
  274. * @brief Set the main internal Regulator output voltage
  275. * @rmtoll CR1 VOS LL_PWR_SetRegulVoltageScaling
  276. * @param VoltageScaling This parameter can be one of the following values:
  277. * @arg @ref LL_PWR_REGU_VOLTAGE_SCALE1
  278. * @arg @ref LL_PWR_REGU_VOLTAGE_SCALE2
  279. * @arg @ref LL_PWR_REGU_VOLTAGE_SCALE3
  280. * @retval None
  281. */
  282. __STATIC_INLINE void LL_PWR_SetRegulVoltageScaling(uint32_t VoltageScaling)
  283. {
  284. MODIFY_REG(PWR->CR1, PWR_CR1_VOS, VoltageScaling);
  285. }
  286. /**
  287. * @brief Get the main internal Regulator output voltage
  288. * @rmtoll CR1 VOS LL_PWR_GetRegulVoltageScaling
  289. * @retval Returned value can be one of the following values:
  290. * @arg @ref LL_PWR_REGU_VOLTAGE_SCALE1
  291. * @arg @ref LL_PWR_REGU_VOLTAGE_SCALE2
  292. * @arg @ref LL_PWR_REGU_VOLTAGE_SCALE3
  293. */
  294. __STATIC_INLINE uint32_t LL_PWR_GetRegulVoltageScaling(void)
  295. {
  296. return (uint32_t)(READ_BIT(PWR->CR1, PWR_CR1_VOS));
  297. }
  298. /**
  299. * @brief Enable Main Regulator in deepsleep under-drive Mode
  300. * @rmtoll CR1 MRUDS LL_PWR_EnableMainRegulatorDeepSleepUDMode
  301. * @retval None
  302. */
  303. __STATIC_INLINE void LL_PWR_EnableMainRegulatorDeepSleepUDMode(void)
  304. {
  305. SET_BIT(PWR->CR1, PWR_CR1_MRUDS);
  306. }
  307. /**
  308. * @brief Disable Main Regulator in deepsleep under-drive Mode
  309. * @rmtoll CR1 MRUDS LL_PWR_DisableMainRegulatorDeepSleepUDMode
  310. * @retval None
  311. */
  312. __STATIC_INLINE void LL_PWR_DisableMainRegulatorDeepSleepUDMode(void)
  313. {
  314. CLEAR_BIT(PWR->CR1, PWR_CR1_MRUDS);
  315. }
  316. /**
  317. * @brief Check if Main Regulator in deepsleep under-drive Mode is enabled
  318. * @rmtoll CR1 MRUDS LL_PWR_IsEnabledMainRegulatorDeepSleepUDMode
  319. * @retval State of bit (1 or 0).
  320. */
  321. __STATIC_INLINE uint32_t LL_PWR_IsEnabledMainRegulatorDeepSleepUDMode(void)
  322. {
  323. return (READ_BIT(PWR->CR1, PWR_CR1_MRUDS) == (PWR_CR1_MRUDS));
  324. }
  325. /**
  326. * @brief Enable Low Power Regulator in deepsleep under-drive Mode
  327. * @rmtoll CR1 LPUDS LL_PWR_EnableLowPowerRegulatorDeepSleepUDMode
  328. * @retval None
  329. */
  330. __STATIC_INLINE void LL_PWR_EnableLowPowerRegulatorDeepSleepUDMode(void)
  331. {
  332. SET_BIT(PWR->CR1, PWR_CR1_LPUDS);
  333. }
  334. /**
  335. * @brief Disable Low Power Regulator in deepsleep under-drive Mode
  336. * @rmtoll CR1 LPUDS LL_PWR_DisableLowPowerRegulatorDeepSleepUDMode
  337. * @retval None
  338. */
  339. __STATIC_INLINE void LL_PWR_DisableLowPowerRegulatorDeepSleepUDMode(void)
  340. {
  341. CLEAR_BIT(PWR->CR1, PWR_CR1_LPUDS);
  342. }
  343. /**
  344. * @brief Check if Low Power Regulator in deepsleep under-drive Mode is enabled
  345. * @rmtoll CR1 LPUDS LL_PWR_IsEnabledLowPowerRegulatorDeepSleepUDMode
  346. * @retval State of bit (1 or 0).
  347. */
  348. __STATIC_INLINE uint32_t LL_PWR_IsEnabledLowPowerRegulatorDeepSleepUDMode(void)
  349. {
  350. return (READ_BIT(PWR->CR1, PWR_CR1_LPUDS) == (PWR_CR1_LPUDS));
  351. }
  352. /**
  353. * @brief Enable the Flash Power Down in Stop Mode
  354. * @rmtoll CR1 FPDS LL_PWR_EnableFlashPowerDown
  355. * @retval None
  356. */
  357. __STATIC_INLINE void LL_PWR_EnableFlashPowerDown(void)
  358. {
  359. SET_BIT(PWR->CR1, PWR_CR1_FPDS);
  360. }
  361. /**
  362. * @brief Disable the Flash Power Down in Stop Mode
  363. * @rmtoll CR1 FPDS LL_PWR_DisableFlashPowerDown
  364. * @retval None
  365. */
  366. __STATIC_INLINE void LL_PWR_DisableFlashPowerDown(void)
  367. {
  368. CLEAR_BIT(PWR->CR1, PWR_CR1_FPDS);
  369. }
  370. /**
  371. * @brief Check if the Flash Power Down in Stop Mode is enabled
  372. * @rmtoll CR1 FPDS LL_PWR_IsEnabledFlashPowerDown
  373. * @retval State of bit (1 or 0).
  374. */
  375. __STATIC_INLINE uint32_t LL_PWR_IsEnabledFlashPowerDown(void)
  376. {
  377. return (READ_BIT(PWR->CR1, PWR_CR1_FPDS) == (PWR_CR1_FPDS));
  378. }
  379. /**
  380. * @brief Enable access to the backup domain
  381. * @rmtoll CR1 DBP LL_PWR_EnableBkUpAccess
  382. * @retval None
  383. */
  384. __STATIC_INLINE void LL_PWR_EnableBkUpAccess(void)
  385. {
  386. SET_BIT(PWR->CR1, PWR_CR1_DBP);
  387. }
  388. /**
  389. * @brief Disable access to the backup domain
  390. * @rmtoll CR1 DBP LL_PWR_DisableBkUpAccess
  391. * @retval None
  392. */
  393. __STATIC_INLINE void LL_PWR_DisableBkUpAccess(void)
  394. {
  395. CLEAR_BIT(PWR->CR1, PWR_CR1_DBP);
  396. }
  397. /**
  398. * @brief Check if the backup domain is enabled
  399. * @rmtoll CR1 DBP LL_PWR_IsEnabledBkUpAccess
  400. * @retval State of bit (1 or 0).
  401. */
  402. __STATIC_INLINE uint32_t LL_PWR_IsEnabledBkUpAccess(void)
  403. {
  404. return (READ_BIT(PWR->CR1, PWR_CR1_DBP) == (PWR_CR1_DBP));
  405. }
  406. /**
  407. * @brief Enable Backup Regulator
  408. * @rmtoll CSR1 BRE LL_PWR_EnableBkUpRegulator
  409. * @note When set, the Backup Regulator (used to maintain backup SRAM content in Standby and
  410. * VBAT modes) is enabled. If BRE is reset, the backup Regulator is switched off. The backup
  411. * SRAM can still be used but its content will be lost in the Standby and VBAT modes. Once set,
  412. * the application must wait that the Backup Regulator Ready flag (BRR) is set to indicate that
  413. * the data written into the RAM will be maintained in the Standby and VBAT modes.
  414. * @retval None
  415. */
  416. __STATIC_INLINE void LL_PWR_EnableBkUpRegulator(void)
  417. {
  418. SET_BIT(PWR->CSR1, PWR_CSR1_BRE);
  419. }
  420. /**
  421. * @brief Disable Backup Regulator
  422. * @rmtoll CSR1 BRE LL_PWR_DisableBkUpRegulator
  423. * @retval None
  424. */
  425. __STATIC_INLINE void LL_PWR_DisableBkUpRegulator(void)
  426. {
  427. CLEAR_BIT(PWR->CSR1, PWR_CSR1_BRE);
  428. }
  429. /**
  430. * @brief Check if the backup Regulator is enabled
  431. * @rmtoll CSR1 BRE LL_PWR_IsEnabledBkUpRegulator
  432. * @retval State of bit (1 or 0).
  433. */
  434. __STATIC_INLINE uint32_t LL_PWR_IsEnabledBkUpRegulator(void)
  435. {
  436. return (READ_BIT(PWR->CSR1, PWR_CSR1_BRE) == (PWR_CSR1_BRE));
  437. }
  438. /**
  439. * @brief Set voltage Regulator mode during deep sleep mode
  440. * @rmtoll CR1 LPDS LL_PWR_SetRegulModeDS
  441. * @param RegulMode This parameter can be one of the following values:
  442. * @arg @ref LL_PWR_REGU_DSMODE_MAIN
  443. * @arg @ref LL_PWR_REGU_DSMODE_LOW_POWER
  444. * @retval None
  445. */
  446. __STATIC_INLINE void LL_PWR_SetRegulModeDS(uint32_t RegulMode)
  447. {
  448. MODIFY_REG(PWR->CR1, PWR_CR1_LPDS, RegulMode);
  449. }
  450. /**
  451. * @brief Get voltage Regulator mode during deep sleep mode
  452. * @rmtoll CR1 LPDS LL_PWR_GetRegulModeDS
  453. * @retval Returned value can be one of the following values:
  454. * @arg @ref LL_PWR_REGU_DSMODE_MAIN
  455. * @arg @ref LL_PWR_REGU_DSMODE_LOW_POWER
  456. */
  457. __STATIC_INLINE uint32_t LL_PWR_GetRegulModeDS(void)
  458. {
  459. return (uint32_t)(READ_BIT(PWR->CR1, PWR_CR1_LPDS));
  460. }
  461. /**
  462. * @brief Set Power Down mode when CPU enters deepsleep
  463. * @rmtoll CR1 PDDS LL_PWR_SetPowerMode\n
  464. * CR1 LPDS LL_PWR_SetPowerMode\n
  465. * CR1 FPDS LL_PWR_SetPowerMode\n
  466. * CR1 LPUDS LL_PWR_SetPowerMode\n
  467. * CR1 MRUDS LL_PWR_SetPowerMode
  468. * @param PDMode This parameter can be one of the following values:
  469. * @arg @ref LL_PWR_MODE_STOP_MAINREGU
  470. * @arg @ref LL_PWR_MODE_STOP_MAINREGU_UNDERDRIVE
  471. * @arg @ref LL_PWR_MODE_STOP_LPREGU
  472. * @arg @ref LL_PWR_MODE_STOP_LPREGU_UNDERDRIVE
  473. * @arg @ref LL_PWR_MODE_STANDBY
  474. * @retval None
  475. */
  476. __STATIC_INLINE void LL_PWR_SetPowerMode(uint32_t PDMode)
  477. {
  478. MODIFY_REG(PWR->CR1, (PWR_CR1_PDDS | PWR_CR1_LPDS | PWR_CR1_FPDS | PWR_CR1_LPUDS | PWR_CR1_MRUDS), PDMode);
  479. }
  480. /**
  481. * @brief Get Power Down mode when CPU enters deepsleep
  482. * @rmtoll CR1 PDDS LL_PWR_GetPowerMode\n
  483. * CR1 LPDS LL_PWR_GetPowerMode\n
  484. * CR1 FPDS LL_PWR_GetPowerMode\n
  485. * CR1 LPUDS LL_PWR_GetPowerMode\n
  486. * CR1 MRUDS LL_PWR_GetPowerMode
  487. * @retval Returned value can be one of the following values:
  488. * @arg @ref LL_PWR_MODE_STOP_MAINREGU
  489. * @arg @ref LL_PWR_MODE_STOP_MAINREGU_UNDERDRIVE
  490. * @arg @ref LL_PWR_MODE_STOP_LPREGU
  491. * @arg @ref LL_PWR_MODE_STOP_LPREGU_UNDERDRIVE
  492. * @arg @ref LL_PWR_MODE_STANDBY
  493. */
  494. __STATIC_INLINE uint32_t LL_PWR_GetPowerMode(void)
  495. {
  496. return (uint32_t)(READ_BIT(PWR->CR1, (PWR_CR1_PDDS | PWR_CR1_LPDS | PWR_CR1_FPDS | PWR_CR1_LPUDS | PWR_CR1_MRUDS)));
  497. }
  498. /**
  499. * @brief Configure the voltage threshold detected by the Power Voltage Detector
  500. * @rmtoll CR1 PLS LL_PWR_SetPVDLevel
  501. * @param PVDLevel This parameter can be one of the following values:
  502. * @arg @ref LL_PWR_PVDLEVEL_0
  503. * @arg @ref LL_PWR_PVDLEVEL_1
  504. * @arg @ref LL_PWR_PVDLEVEL_2
  505. * @arg @ref LL_PWR_PVDLEVEL_3
  506. * @arg @ref LL_PWR_PVDLEVEL_4
  507. * @arg @ref LL_PWR_PVDLEVEL_5
  508. * @arg @ref LL_PWR_PVDLEVEL_6
  509. * @arg @ref LL_PWR_PVDLEVEL_7
  510. * @retval None
  511. */
  512. __STATIC_INLINE void LL_PWR_SetPVDLevel(uint32_t PVDLevel)
  513. {
  514. MODIFY_REG(PWR->CR1, PWR_CR1_PLS, PVDLevel);
  515. }
  516. /**
  517. * @brief Get the voltage threshold detection
  518. * @rmtoll CR1 PLS LL_PWR_GetPVDLevel
  519. * @retval Returned value can be one of the following values:
  520. * @arg @ref LL_PWR_PVDLEVEL_0
  521. * @arg @ref LL_PWR_PVDLEVEL_1
  522. * @arg @ref LL_PWR_PVDLEVEL_2
  523. * @arg @ref LL_PWR_PVDLEVEL_3
  524. * @arg @ref LL_PWR_PVDLEVEL_4
  525. * @arg @ref LL_PWR_PVDLEVEL_5
  526. * @arg @ref LL_PWR_PVDLEVEL_6
  527. * @arg @ref LL_PWR_PVDLEVEL_7
  528. */
  529. __STATIC_INLINE uint32_t LL_PWR_GetPVDLevel(void)
  530. {
  531. return (uint32_t)(READ_BIT(PWR->CR1, PWR_CR1_PLS));
  532. }
  533. /**
  534. * @brief Enable Power Voltage Detector
  535. * @rmtoll CR1 PVDE LL_PWR_EnablePVD
  536. * @retval None
  537. */
  538. __STATIC_INLINE void LL_PWR_EnablePVD(void)
  539. {
  540. SET_BIT(PWR->CR1, PWR_CR1_PVDE);
  541. }
  542. /**
  543. * @brief Disable Power Voltage Detector
  544. * @rmtoll CR1 PVDE LL_PWR_DisablePVD
  545. * @retval None
  546. */
  547. __STATIC_INLINE void LL_PWR_DisablePVD(void)
  548. {
  549. CLEAR_BIT(PWR->CR1, PWR_CR1_PVDE);
  550. }
  551. /**
  552. * @brief Check if Power Voltage Detector is enabled
  553. * @rmtoll CR1 PVDE LL_PWR_IsEnabledPVD
  554. * @retval State of bit (1 or 0).
  555. */
  556. __STATIC_INLINE uint32_t LL_PWR_IsEnabledPVD(void)
  557. {
  558. return (READ_BIT(PWR->CR1, PWR_CR1_PVDE) == (PWR_CR1_PVDE));
  559. }
  560. /**
  561. * @brief Enable the WakeUp PINx functionality
  562. * @rmtoll CSR2 EWUP1 LL_PWR_EnableWakeUpPin\n
  563. * CSR2 EWUP2 LL_PWR_EnableWakeUpPin\n
  564. * CSR2 EWUP3 LL_PWR_EnableWakeUpPin\n
  565. * CSR2 EWUP4 LL_PWR_EnableWakeUpPin\n
  566. * CSR2 EWUP5 LL_PWR_EnableWakeUpPin\n
  567. * CSR2 EWUP6 LL_PWR_EnableWakeUpPin
  568. * @param WakeUpPin This parameter can be one of the following values:
  569. * @arg @ref LL_PWR_WAKEUP_PIN1
  570. * @arg @ref LL_PWR_WAKEUP_PIN2
  571. * @arg @ref LL_PWR_WAKEUP_PIN3
  572. * @arg @ref LL_PWR_WAKEUP_PIN4
  573. * @arg @ref LL_PWR_WAKEUP_PIN5
  574. * @arg @ref LL_PWR_WAKEUP_PIN6
  575. * @retval None
  576. */
  577. __STATIC_INLINE void LL_PWR_EnableWakeUpPin(uint32_t WakeUpPin)
  578. {
  579. SET_BIT(PWR->CSR2, WakeUpPin);
  580. }
  581. /**
  582. * @brief Disable the WakeUp PINx functionality
  583. * @rmtoll CSR2 EWUP1 LL_PWR_DisableWakeUpPin\n
  584. * CSR2 EWUP2 LL_PWR_DisableWakeUpPin\n
  585. * CSR2 EWUP3 LL_PWR_DisableWakeUpPin\n
  586. * CSR2 EWUP4 LL_PWR_DisableWakeUpPin\n
  587. * CSR2 EWUP5 LL_PWR_DisableWakeUpPin\n
  588. * CSR2 EWUP6 LL_PWR_DisableWakeUpPin
  589. * @param WakeUpPin This parameter can be one of the following values:
  590. * @arg @ref LL_PWR_WAKEUP_PIN1
  591. * @arg @ref LL_PWR_WAKEUP_PIN2
  592. * @arg @ref LL_PWR_WAKEUP_PIN3
  593. * @arg @ref LL_PWR_WAKEUP_PIN4
  594. * @arg @ref LL_PWR_WAKEUP_PIN5
  595. * @arg @ref LL_PWR_WAKEUP_PIN6
  596. * @retval None
  597. */
  598. __STATIC_INLINE void LL_PWR_DisableWakeUpPin(uint32_t WakeUpPin)
  599. {
  600. CLEAR_BIT(PWR->CSR2, WakeUpPin);
  601. }
  602. /**
  603. * @brief Check if the WakeUp PINx functionality is enabled
  604. * @rmtoll CSR2 EWUP1 LL_PWR_IsEnabledWakeUpPin\n
  605. * CSR2 EWUP2 LL_PWR_IsEnabledWakeUpPin\n
  606. * CSR2 EWUP3 LL_PWR_IsEnabledWakeUpPin\n
  607. * CSR2 EWUP4 LL_PWR_IsEnabledWakeUpPin\n
  608. * CSR2 EWUP5 LL_PWR_IsEnabledWakeUpPin\n
  609. * CSR2 EWUP6 LL_PWR_IsEnabledWakeUpPin
  610. * @param WakeUpPin This parameter can be one of the following values:
  611. * @arg @ref LL_PWR_WAKEUP_PIN1
  612. * @arg @ref LL_PWR_WAKEUP_PIN2
  613. * @arg @ref LL_PWR_WAKEUP_PIN3
  614. * @arg @ref LL_PWR_WAKEUP_PIN4
  615. * @arg @ref LL_PWR_WAKEUP_PIN5
  616. * @arg @ref LL_PWR_WAKEUP_PIN6
  617. * @retval State of bit (1 or 0).
  618. */
  619. __STATIC_INLINE uint32_t LL_PWR_IsEnabledWakeUpPin(uint32_t WakeUpPin)
  620. {
  621. return (READ_BIT(PWR->CSR2, WakeUpPin) == (WakeUpPin));
  622. }
  623. /**
  624. * @brief Set the Wake-Up pin polarity low for the event detection
  625. * @rmtoll CR2 WUPP1 LL_PWR_SetWakeUpPinPolarityLow\n
  626. * CR2 WUPP2 LL_PWR_SetWakeUpPinPolarityLow\n
  627. * CR2 WUPP3 LL_PWR_SetWakeUpPinPolarityLow\n
  628. * CR2 WUPP4 LL_PWR_SetWakeUpPinPolarityLow\n
  629. * CR2 WUPP5 LL_PWR_SetWakeUpPinPolarityLow\n
  630. * CR2 WUPP6 LL_PWR_SetWakeUpPinPolarityLow
  631. * @param WakeUpPin This parameter can be one of the following values:
  632. * @arg @ref LL_PWR_WAKEUP_PIN1
  633. * @arg @ref LL_PWR_WAKEUP_PIN2
  634. * @arg @ref LL_PWR_WAKEUP_PIN3
  635. * @arg @ref LL_PWR_WAKEUP_PIN4
  636. * @arg @ref LL_PWR_WAKEUP_PIN5
  637. * @arg @ref LL_PWR_WAKEUP_PIN6
  638. * @retval None
  639. */
  640. __STATIC_INLINE void LL_PWR_SetWakeUpPinPolarityLow(uint32_t WakeUpPin)
  641. {
  642. SET_BIT(PWR->CR2, WakeUpPin);
  643. }
  644. /**
  645. * @brief Set the Wake-Up pin polarity high for the event detection
  646. * @rmtoll CR2 WUPP1 LL_PWR_SetWakeUpPinPolarityHigh\n
  647. * CR2 WUPP2 LL_PWR_SetWakeUpPinPolarityHigh\n
  648. * CR2 WUPP3 LL_PWR_SetWakeUpPinPolarityHigh\n
  649. * CR2 WUPP4 LL_PWR_SetWakeUpPinPolarityHigh\n
  650. * CR2 WUPP5 LL_PWR_SetWakeUpPinPolarityHigh\n
  651. * CR2 WUPP6 LL_PWR_SetWakeUpPinPolarityHigh
  652. * @param WakeUpPin This parameter can be one of the following values:
  653. * @arg @ref LL_PWR_WAKEUP_PIN1
  654. * @arg @ref LL_PWR_WAKEUP_PIN2
  655. * @arg @ref LL_PWR_WAKEUP_PIN3
  656. * @arg @ref LL_PWR_WAKEUP_PIN4
  657. * @arg @ref LL_PWR_WAKEUP_PIN5
  658. * @arg @ref LL_PWR_WAKEUP_PIN6
  659. * @retval None
  660. */
  661. __STATIC_INLINE void LL_PWR_SetWakeUpPinPolarityHigh(uint32_t WakeUpPin)
  662. {
  663. CLEAR_BIT(PWR->CR2, WakeUpPin);
  664. }
  665. /**
  666. * @brief Get the Wake-Up pin polarity for the event detection
  667. * @rmtoll CR2 WUPP1 LL_PWR_IsWakeUpPinPolarityLow\n
  668. * CR2 WUPP2 LL_PWR_IsWakeUpPinPolarityLow\n
  669. * CR2 WUPP3 LL_PWR_IsWakeUpPinPolarityLow\n
  670. * CR2 WUPP4 LL_PWR_IsWakeUpPinPolarityLow\n
  671. * CR2 WUPP5 LL_PWR_IsWakeUpPinPolarityLow\n
  672. * CR2 WUPP6 LL_PWR_IsWakeUpPinPolarityLow
  673. * @param WakeUpPin This parameter can be one of the following values:
  674. * @arg @ref LL_PWR_WAKEUP_PIN1
  675. * @arg @ref LL_PWR_WAKEUP_PIN2
  676. * @arg @ref LL_PWR_WAKEUP_PIN3
  677. * @arg @ref LL_PWR_WAKEUP_PIN4
  678. * @arg @ref LL_PWR_WAKEUP_PIN5
  679. * @arg @ref LL_PWR_WAKEUP_PIN6
  680. * @retval State of bit (1 or 0).
  681. */
  682. __STATIC_INLINE uint32_t LL_PWR_IsWakeUpPinPolarityLow(uint32_t WakeUpPin)
  683. {
  684. return (READ_BIT(PWR->CR2, WakeUpPin) == (WakeUpPin));
  685. }
  686. /**
  687. * @brief Enable Internal WakeUp
  688. * @rmtoll CSR1 EIWUP LL_PWR_EnableInternalWakeUp
  689. * @note This API must be used when RTC events (Alarm A or Alarm B, RTC Tamper, RTC TimeStamp
  690. * or RTC Wakeup time) are used to wake up the system from Standby mode.
  691. * @retval None
  692. */
  693. __STATIC_INLINE void LL_PWR_EnableInternalWakeUp(void)
  694. {
  695. SET_BIT(PWR->CSR1, PWR_CSR1_EIWUP);
  696. }
  697. /**
  698. * @brief Disable Internal WakeUp
  699. * @rmtoll CSR1 EIWUP LL_PWR_DisableInternalWakeUp
  700. * @retval None
  701. */
  702. __STATIC_INLINE void LL_PWR_DisableInternalWakeUp(void)
  703. {
  704. CLEAR_BIT(PWR->CSR1, PWR_CSR1_EIWUP);
  705. }
  706. /**
  707. * @brief Check if the Internal WakeUp functionality is enabled
  708. * @rmtoll CSR1 EIWUP LL_PWR_IsEnabledInternalWakeUp
  709. * @retval State of bit (1 or 0).
  710. */
  711. __STATIC_INLINE uint32_t LL_PWR_IsEnabledInternalWakeUp(void)
  712. {
  713. return (READ_BIT(PWR->CSR1, PWR_CSR1_EIWUP) == (PWR_CSR1_EIWUP));
  714. }
  715. /**
  716. * @}
  717. */
  718. /** @defgroup PWR_LL_EF_FLAG_Management FLAG_Management
  719. * @{
  720. */
  721. /**
  722. * @brief Get Wake-up Flag 6
  723. * @rmtoll CSR2 WUPF6 LL_PWR_IsActiveFlag_WU6
  724. * @retval State of bit (1 or 0).
  725. */
  726. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_WU6(void)
  727. {
  728. return (READ_BIT(PWR->CSR2, PWR_CSR2_WUPF6) == (PWR_CSR2_WUPF6));
  729. }
  730. /**
  731. * @brief Get Wake-up Flag 5
  732. * @rmtoll CSR2 WUPF5 LL_PWR_IsActiveFlag_WU5
  733. * @retval State of bit (1 or 0).
  734. */
  735. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_WU5(void)
  736. {
  737. return (READ_BIT(PWR->CSR2, PWR_CSR2_WUPF5) == (PWR_CSR2_WUPF5));
  738. }
  739. /**
  740. * @brief Get Wake-up Flag 4
  741. * @rmtoll CSR2 WUPF4 LL_PWR_IsActiveFlag_WU4
  742. * @retval State of bit (1 or 0).
  743. */
  744. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_WU4(void)
  745. {
  746. return (READ_BIT(PWR->CSR2, PWR_CSR2_WUPF4) == (PWR_CSR2_WUPF4));
  747. }
  748. /**
  749. * @brief Get Wake-up Flag 3
  750. * @rmtoll CSR2 WUPF3 LL_PWR_IsActiveFlag_WU3
  751. * @retval State of bit (1 or 0).
  752. */
  753. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_WU3(void)
  754. {
  755. return (READ_BIT(PWR->CSR2, PWR_CSR2_WUPF3) == (PWR_CSR2_WUPF3));
  756. }
  757. /**
  758. * @brief Get Wake-up Flag 2
  759. * @rmtoll CSR2 WUPF2 LL_PWR_IsActiveFlag_WU2
  760. * @retval State of bit (1 or 0).
  761. */
  762. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_WU2(void)
  763. {
  764. return (READ_BIT(PWR->CSR2, PWR_CSR2_WUPF2) == (PWR_CSR2_WUPF2));
  765. }
  766. /**
  767. * @brief Get Wake-up Flag 1
  768. * @rmtoll CSR2 WUPF1 LL_PWR_IsActiveFlag_WU1
  769. * @retval State of bit (1 or 0).
  770. */
  771. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_WU1(void)
  772. {
  773. return (READ_BIT(PWR->CSR2, PWR_CSR2_WUPF1) == (PWR_CSR2_WUPF1));
  774. }
  775. /**
  776. * @brief Get Standby Flag
  777. * @rmtoll CSR1 SBF LL_PWR_IsActiveFlag_SB
  778. * @retval State of bit (1 or 0).
  779. */
  780. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_SB(void)
  781. {
  782. return (READ_BIT(PWR->CSR1, PWR_CSR1_SBF) == (PWR_CSR1_SBF));
  783. }
  784. /**
  785. * @brief Indicate whether VDD voltage is below the selected PVD threshold
  786. * @rmtoll CSR1 PVDO LL_PWR_IsActiveFlag_PVDO
  787. * @retval State of bit (1 or 0).
  788. */
  789. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_PVDO(void)
  790. {
  791. return (READ_BIT(PWR->CSR1, PWR_CSR1_PVDO) == (PWR_CSR1_PVDO));
  792. }
  793. /**
  794. * @brief Get Backup Regulator ready Flag
  795. * @rmtoll CSR1 BRR LL_PWR_IsActiveFlag_BRR
  796. * @retval State of bit (1 or 0).
  797. */
  798. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_BRR(void)
  799. {
  800. return (READ_BIT(PWR->CSR1, PWR_CSR1_BRR) == (PWR_CSR1_BRR));
  801. }
  802. /**
  803. * @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
  804. * @rmtoll CSR1 VOSRDY LL_PWR_IsActiveFlag_VOS
  805. * @retval State of bit (1 or 0).
  806. */
  807. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_VOS(void)
  808. {
  809. return (READ_BIT(PWR->CSR1, PWR_CSR1_VOSRDY) == (PWR_CSR1_VOSRDY));
  810. }
  811. /**
  812. * @brief Indicate whether the Over-Drive mode is ready or not
  813. * @rmtoll CSR1 ODRDY LL_PWR_IsActiveFlag_OD
  814. * @retval State of bit (1 or 0).
  815. */
  816. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_OD(void)
  817. {
  818. return (READ_BIT(PWR->CSR1, PWR_CSR1_ODRDY) == (PWR_CSR1_ODRDY));
  819. }
  820. /**
  821. * @brief Indicate whether the Over-Drive mode switching is ready or not
  822. * @rmtoll CSR1 ODSWRDY LL_PWR_IsActiveFlag_ODSW
  823. * @retval State of bit (1 or 0).
  824. */
  825. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_ODSW(void)
  826. {
  827. return (READ_BIT(PWR->CSR1, PWR_CSR1_ODSWRDY) == (PWR_CSR1_ODSWRDY));
  828. }
  829. /**
  830. * @brief Indicate whether the Under-Drive mode is ready or not
  831. * @rmtoll CSR1 UDRDY LL_PWR_IsActiveFlag_UD
  832. * @retval State of bit (1 or 0).
  833. */
  834. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_UD(void)
  835. {
  836. return (READ_BIT(PWR->CSR1, PWR_CSR1_UDRDY) == (PWR_CSR1_UDRDY));
  837. }
  838. /**
  839. * @brief Clear Standby Flag
  840. * @rmtoll CR1 CSBF LL_PWR_ClearFlag_SB
  841. * @retval None
  842. */
  843. __STATIC_INLINE void LL_PWR_ClearFlag_SB(void)
  844. {
  845. SET_BIT(PWR->CR1, PWR_CR1_CSBF);
  846. }
  847. /**
  848. * @brief Clear Wake-up Flag 6
  849. * @rmtoll CR2 CWUF6 LL_PWR_ClearFlag_WU6
  850. * @retval None
  851. */
  852. __STATIC_INLINE void LL_PWR_ClearFlag_WU6(void)
  853. {
  854. WRITE_REG(PWR->CR2, PWR_CR2_CWUPF6);
  855. }
  856. /**
  857. * @brief Clear Wake-up Flag 5
  858. * @rmtoll CR2 CWUF5 LL_PWR_ClearFlag_WU5
  859. * @retval None
  860. */
  861. __STATIC_INLINE void LL_PWR_ClearFlag_WU5(void)
  862. {
  863. WRITE_REG(PWR->CR2, PWR_CR2_CWUPF5);
  864. }
  865. /**
  866. * @brief Clear Wake-up Flag 4
  867. * @rmtoll CR2 CWUF4 LL_PWR_ClearFlag_WU4
  868. * @retval None
  869. */
  870. __STATIC_INLINE void LL_PWR_ClearFlag_WU4(void)
  871. {
  872. WRITE_REG(PWR->CR2, PWR_CR2_CWUPF4);
  873. }
  874. /**
  875. * @brief Clear Wake-up Flag 3
  876. * @rmtoll CR2 CWUF3 LL_PWR_ClearFlag_WU3
  877. * @retval None
  878. */
  879. __STATIC_INLINE void LL_PWR_ClearFlag_WU3(void)
  880. {
  881. WRITE_REG(PWR->CR2, PWR_CR2_CWUPF3);
  882. }
  883. /**
  884. * @brief Clear Wake-up Flag 2
  885. * @rmtoll CR2 CWUF2 LL_PWR_ClearFlag_WU2
  886. * @retval None
  887. */
  888. __STATIC_INLINE void LL_PWR_ClearFlag_WU2(void)
  889. {
  890. WRITE_REG(PWR->CR2, PWR_CR2_CWUPF2);
  891. }
  892. /**
  893. * @brief Clear Wake-up Flag 1
  894. * @rmtoll CR2 CWUF1 LL_PWR_ClearFlag_WU1
  895. * @retval None
  896. */
  897. __STATIC_INLINE void LL_PWR_ClearFlag_WU1(void)
  898. {
  899. WRITE_REG(PWR->CR2, PWR_CR2_CWUPF1);
  900. }
  901. /**
  902. * @brief Clear Under-Drive ready Flag
  903. * @rmtoll CSR1 UDRDY LL_PWR_ClearFlag_UD
  904. * @retval None
  905. */
  906. __STATIC_INLINE void LL_PWR_ClearFlag_UD(void)
  907. {
  908. WRITE_REG(PWR->CSR1, PWR_CSR1_UDRDY);
  909. }
  910. #if defined(USE_FULL_LL_DRIVER)
  911. /** @defgroup PWR_LL_EF_Init De-initialization function
  912. * @{
  913. */
  914. ErrorStatus LL_PWR_DeInit(void);
  915. /**
  916. * @}
  917. */
  918. #endif /* USE_FULL_LL_DRIVER */
  919. /**
  920. * @}
  921. */
  922. /**
  923. * @}
  924. */
  925. /**
  926. * @}
  927. */
  928. #endif /* defined(PWR) */
  929. /**
  930. * @}
  931. */
  932. #ifdef __cplusplus
  933. }
  934. #endif
  935. #endif /* __STM32F7xx_LL_PWR_H */
  936. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/