stm32g0xx_ll_pwr.h 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531
  1. /**
  2. ******************************************************************************
  3. * @file stm32g0xx_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) 2018 STMicroelectronics.
  10. * All rights reserved.</center></h2>
  11. *
  12. * This software component is licensed by ST under BSD 3-Clause license,
  13. * the "License"; You may not use this file except in compliance with the
  14. * License. You may obtain a copy of the License at:
  15. * opensource.org/licenses/BSD-3-Clause
  16. *
  17. ******************************************************************************
  18. */
  19. /* Define to prevent recursive inclusion -------------------------------------*/
  20. #ifndef STM32G0xx_LL_PWR_H
  21. #define STM32G0xx_LL_PWR_H
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. /* Includes ------------------------------------------------------------------*/
  26. #include "stm32g0xx.h"
  27. /** @addtogroup STM32G0xx_LL_Driver
  28. * @{
  29. */
  30. #if defined(PWR)
  31. /** @defgroup PWR_LL PWR
  32. * @{
  33. */
  34. /* Private types -------------------------------------------------------------*/
  35. /* Private variables ---------------------------------------------------------*/
  36. /* Private constants ---------------------------------------------------------*/
  37. /* Private macros ------------------------------------------------------------*/
  38. /* Exported types ------------------------------------------------------------*/
  39. /* Exported constants --------------------------------------------------------*/
  40. /** @defgroup PWR_LL_Exported_Constants PWR Exported Constants
  41. * @{
  42. */
  43. /** @defgroup PWR_LL_EC_CLEAR_FLAG Clear Flags Defines
  44. * @brief Flags defines which can be used with LL_PWR_WriteReg function
  45. * @{
  46. */
  47. #define LL_PWR_SCR_CSBF PWR_SCR_CSBF
  48. #define LL_PWR_SCR_CWUF PWR_SCR_CWUF
  49. #define LL_PWR_SCR_CWUF6 PWR_SCR_CWUF6
  50. #define LL_PWR_SCR_CWUF5 PWR_SCR_CWUF5
  51. #define LL_PWR_SCR_CWUF4 PWR_SCR_CWUF4
  52. #if defined(PWR_CR3_EWUP3)
  53. #define LL_PWR_SCR_CWUF3 PWR_SCR_CWUF3
  54. #endif
  55. #define LL_PWR_SCR_CWUF2 PWR_SCR_CWUF2
  56. #define LL_PWR_SCR_CWUF1 PWR_SCR_CWUF1
  57. /**
  58. * @}
  59. */
  60. /** @defgroup PWR_LL_EC_GET_FLAG Get Flags Defines
  61. * @brief Flags defines which can be used with LL_PWR_ReadReg function
  62. * @{
  63. */
  64. #define LL_PWR_SR1_WUFI PWR_SR1_WUFI
  65. #define LL_PWR_SR1_SBF PWR_SR1_SBF
  66. #define LL_PWR_SR1_WUF6 PWR_SR1_WUF6
  67. #define LL_PWR_SR1_WUF5 PWR_SR1_WUF5
  68. #define LL_PWR_SR1_WUF4 PWR_SR1_WUF4
  69. #if defined(PWR_CR3_EWUP3)
  70. #define LL_PWR_SR1_WUF3 PWR_SR1_WUF3
  71. #endif
  72. #define LL_PWR_SR1_WUF2 PWR_SR1_WUF2
  73. #define LL_PWR_SR1_WUF1 PWR_SR1_WUF1
  74. #if defined(PWR_SR2_PVDO)
  75. #define LL_PWR_SR2_PVDO PWR_SR2_PVDO
  76. #endif
  77. #define LL_PWR_SR2_VOSF PWR_SR2_VOSF
  78. #define LL_PWR_SR2_REGLPF PWR_SR2_REGLPF
  79. #define LL_PWR_SR2_REGLPS PWR_SR2_REGLPS
  80. /**
  81. * @}
  82. */
  83. /** @defgroup PWR_LL_EC_REGU_VOLTAGE REGU VOLTAGE
  84. * @{
  85. */
  86. #define LL_PWR_REGU_VOLTAGE_SCALE1 PWR_CR1_VOS_0
  87. #define LL_PWR_REGU_VOLTAGE_SCALE2 PWR_CR1_VOS_1
  88. /**
  89. * @}
  90. */
  91. /** @defgroup PWR_LL_EC_MODE_PWR MODE PWR
  92. * @{
  93. */
  94. #define LL_PWR_MODE_STOP0 (0x00000000UL)
  95. #define LL_PWR_MODE_STOP1 (PWR_CR1_LPMS_0)
  96. #define LL_PWR_MODE_STANDBY (PWR_CR1_LPMS_1|PWR_CR1_LPMS_0)
  97. #if defined (PWR_CR1_LPMS_2)
  98. #define LL_PWR_MODE_SHUTDOWN (PWR_CR1_LPMS_2)
  99. #endif
  100. /**
  101. * @}
  102. */
  103. #if defined(PWR_CR2_PVDE)
  104. /** @defgroup PWR_LL_EC_PVDLEVEL PVDLEVEL
  105. * @{
  106. */
  107. #define LL_PWR_PVDLLEVEL_0 0x000000000u /* VPVD0 > 2.05 V */
  108. #define LL_PWR_PVDLLEVEL_1 (PWR_CR2_PVDFT_0) /* VPVD0 > 2.2 V */
  109. #define LL_PWR_PVDLLEVEL_2 (PWR_CR2_PVDFT_1) /* VPVD1 > 2.36 V */
  110. #define LL_PWR_PVDLLEVEL_3 (PWR_CR2_PVDFT_1 | PWR_CR2_PVDFT_0) /* VPVD2 > 2.52 V */
  111. #define LL_PWR_PVDLLEVEL_4 (PWR_CR2_PVDFT_2) /* VPVD3 > 2.64 V */
  112. #define LL_PWR_PVDLLEVEL_5 (PWR_CR2_PVDFT_2 | PWR_CR2_PVDFT_0) /* VPVD4 > 2.81 V */
  113. #define LL_PWR_PVDLLEVEL_6 (PWR_CR2_PVDFT_2 | PWR_CR2_PVDFT_1) /* VPVD5 > 2.91 V */
  114. #define LL_PWR_PVDHLEVEL_0 0x00000000u /* VPDD0 > 2.15 V */
  115. #define LL_PWR_PVDHLEVEL_1 (PWR_CR2_PVDRT_0) /* VPVD1 > 2.3 V */
  116. #define LL_PWR_PVDHLEVEL_2 (PWR_CR2_PVDRT_1) /* VPVD1 > 2.46 V */
  117. #define LL_PWR_PVDHLEVEL_3 (PWR_CR2_PVDRT_1 | PWR_CR2_PVDRT_0) /* VPVD2 > 2.62 V */
  118. #define LL_PWR_PVDHLEVEL_4 (PWR_CR2_PVDRT_2) /* VPVD3 > 2.74 V */
  119. #define LL_PWR_PVDHLEVEL_5 (PWR_CR2_PVDRT_2 | PWR_CR2_PVDRT_0) /* VPVD4 > 2.91 V */
  120. #define LL_PWR_PVDHLEVEL_6 (PWR_CR2_PVDRT_2 | PWR_CR2_PVDRT_1) /* VPVD5 > 3.01 V */
  121. #define LL_PWR_PVDHLEVEL_7 (PWR_CR2_PVDRT_2 | PWR_CR2_PVDRT_1 | PWR_CR2_PVDRT_0) /* External input analog voltage (Compare internally to VREFINT) */
  122. /**
  123. * @}
  124. */
  125. #endif
  126. #if defined(PWR_PVM_SUPPORT)
  127. /** @defgroup PWR_LL_EC_PVM_IP PVM_IP
  128. * @{
  129. */
  130. #define LL_PWR_PVM_USB PWR_CR2_PVMEN_USB /*!< Peripheral Voltage Monitoring enable for USB peripheral: Enable to keep the USB peripheral voltage monitoring under control (power domain Vddio2) */
  131. /**
  132. * @}
  133. */
  134. #endif
  135. /** @defgroup PWR_LL_EC_WAKEUP WAKEUP
  136. * @{
  137. */
  138. #define LL_PWR_WAKEUP_PIN1 (PWR_CR3_EWUP1)
  139. #define LL_PWR_WAKEUP_PIN2 (PWR_CR3_EWUP2)
  140. #if defined(PWR_CR3_EWUP3)
  141. #define LL_PWR_WAKEUP_PIN3 (PWR_CR3_EWUP3)
  142. #endif
  143. #define LL_PWR_WAKEUP_PIN4 (PWR_CR3_EWUP4)
  144. #if defined(PWR_CR3_EWUP5)
  145. #define LL_PWR_WAKEUP_PIN5 (PWR_CR3_EWUP5)
  146. #endif
  147. #define LL_PWR_WAKEUP_PIN6 (PWR_CR3_EWUP6)
  148. /**
  149. * @}
  150. */
  151. /** @defgroup PWR_LL_EC_BATT_CHARG_RESISTOR BATT CHARG RESISTOR
  152. * @{
  153. */
  154. #define LL_PWR_BATTCHARG_RESISTOR_5K 0x000000000u
  155. #define LL_PWR_BATTCHARG_RESISTOR_1_5K (PWR_CR4_VBRS)
  156. /**
  157. * @}
  158. */
  159. /** @defgroup PWR_LL_EC_GPIO GPIO
  160. * @{
  161. */
  162. #define LL_PWR_GPIO_A ((uint32_t)(&(PWR->PUCRA)))
  163. #define LL_PWR_GPIO_B ((uint32_t)(&(PWR->PUCRB)))
  164. #define LL_PWR_GPIO_C ((uint32_t)(&(PWR->PUCRC)))
  165. #define LL_PWR_GPIO_D ((uint32_t)(&(PWR->PUCRD)))
  166. #if defined(GPIOE)
  167. #define LL_PWR_GPIO_E ((uint32_t)(&(PWR->PUCRE)))
  168. #endif
  169. #define LL_PWR_GPIO_F ((uint32_t)(&(PWR->PUCRF)))
  170. /**
  171. * @}
  172. */
  173. /** @defgroup PWR_LL_EC_GPIO_BIT GPIO BIT
  174. * @{
  175. */
  176. #define LL_PWR_GPIO_BIT_0 0x00000001u
  177. #define LL_PWR_GPIO_BIT_1 0x00000002u
  178. #define LL_PWR_GPIO_BIT_2 0x00000004u
  179. #define LL_PWR_GPIO_BIT_3 0x00000008u
  180. #define LL_PWR_GPIO_BIT_4 0x00000010u
  181. #define LL_PWR_GPIO_BIT_5 0x00000020u
  182. #define LL_PWR_GPIO_BIT_6 0x00000040u
  183. #define LL_PWR_GPIO_BIT_7 0x00000080u
  184. #define LL_PWR_GPIO_BIT_8 0x00000100u
  185. #define LL_PWR_GPIO_BIT_9 0x00000200u
  186. #define LL_PWR_GPIO_BIT_10 0x00000400u
  187. #define LL_PWR_GPIO_BIT_11 0x00000800u
  188. #define LL_PWR_GPIO_BIT_12 0x00001000u
  189. #define LL_PWR_GPIO_BIT_13 0x00002000u
  190. #define LL_PWR_GPIO_BIT_14 0x00004000u
  191. #define LL_PWR_GPIO_BIT_15 0x00008000u
  192. /**
  193. * @}
  194. */
  195. /**
  196. * @}
  197. */
  198. /* Exported macro ------------------------------------------------------------*/
  199. /** @defgroup PWR_LL_Exported_Macros PWR Exported Macros
  200. * @{
  201. */
  202. /** @defgroup PWR_LL_EM_WRITE_READ Common Write and read registers Macros
  203. * @{
  204. */
  205. /**
  206. * @brief Write a value in PWR register
  207. * @param __REG__ Register to be written
  208. * @param __VALUE__ Value to be written in the register
  209. * @retval None
  210. */
  211. #define LL_PWR_WriteReg(__REG__, __VALUE__) WRITE_REG(PWR->__REG__, (__VALUE__))
  212. /**
  213. * @brief Read a value in PWR register
  214. * @param __REG__ Register to be read
  215. * @retval Register value
  216. */
  217. #define LL_PWR_ReadReg(__REG__) READ_REG(PWR->__REG__)
  218. /**
  219. * @}
  220. */
  221. /**
  222. * @}
  223. */
  224. /* Exported functions --------------------------------------------------------*/
  225. /** @defgroup PWR_LL_Exported_Functions PWR Exported Functions
  226. * @{
  227. */
  228. /** @defgroup PWR_LL_EF_Configuration Configuration
  229. * @{
  230. */
  231. /**
  232. * @brief Set the main internal regulator output voltage
  233. * @rmtoll CR1 VOS LL_PWR_SetRegulVoltageScaling
  234. * @param VoltageScaling This parameter can be one of the following values:
  235. * @arg @ref LL_PWR_REGU_VOLTAGE_SCALE1
  236. * @arg @ref LL_PWR_REGU_VOLTAGE_SCALE2
  237. * @retval None
  238. */
  239. __STATIC_INLINE void LL_PWR_SetRegulVoltageScaling(uint32_t VoltageScaling)
  240. {
  241. MODIFY_REG(PWR->CR1, PWR_CR1_VOS, VoltageScaling);
  242. }
  243. /**
  244. * @brief Get the main internal regulator output voltage
  245. * @rmtoll CR1 VOS LL_PWR_GetRegulVoltageScaling
  246. * @retval Returned value can be one of the following values:
  247. * @arg @ref LL_PWR_REGU_VOLTAGE_SCALE1
  248. * @arg @ref LL_PWR_REGU_VOLTAGE_SCALE2
  249. */
  250. __STATIC_INLINE uint32_t LL_PWR_GetRegulVoltageScaling(void)
  251. {
  252. return (READ_BIT(PWR->CR1, PWR_CR1_VOS));
  253. }
  254. /**
  255. * @brief Switch the regulator from main mode to low-power mode
  256. * @rmtoll CR1 LPR LL_PWR_EnableLowPowerRunMode
  257. * @retval None
  258. */
  259. __STATIC_INLINE void LL_PWR_EnableLowPowerRunMode(void)
  260. {
  261. SET_BIT(PWR->CR1, PWR_CR1_LPR);
  262. }
  263. /**
  264. * @brief Switch the regulator from low-power mode to main mode
  265. * @rmtoll CR1 LPR LL_PWR_DisableLowPowerRunMode
  266. * @retval None
  267. */
  268. __STATIC_INLINE void LL_PWR_DisableLowPowerRunMode(void)
  269. {
  270. CLEAR_BIT(PWR->CR1, PWR_CR1_LPR);
  271. }
  272. /**
  273. * @brief Check if the regulator is in low-power mode
  274. * @rmtoll CR1 LPR LL_PWR_IsEnabledLowPowerRunMode
  275. * @retval State of bit (1 or 0).
  276. */
  277. __STATIC_INLINE uint32_t LL_PWR_IsEnabledLowPowerRunMode(void)
  278. {
  279. return ((READ_BIT(PWR->CR1, PWR_CR1_LPR) == (PWR_CR1_LPR)) ? 1UL : 0UL);
  280. }
  281. /**
  282. * @brief Switch from run main mode to run low-power mode.
  283. * @rmtoll CR1 LPR LL_PWR_EnterLowPowerRunMode
  284. * @retval None
  285. */
  286. __STATIC_INLINE void LL_PWR_EnterLowPowerRunMode(void)
  287. {
  288. LL_PWR_EnableLowPowerRunMode();
  289. }
  290. /**
  291. * @brief Switch from run main mode to low-power mode.
  292. * @rmtoll CR1 LPR LL_PWR_ExitLowPowerRunMode
  293. * @retval None
  294. */
  295. __STATIC_INLINE void LL_PWR_ExitLowPowerRunMode(void)
  296. {
  297. LL_PWR_DisableLowPowerRunMode();
  298. }
  299. /**
  300. * @brief Enable access to the backup domain
  301. * @rmtoll CR1 DBP LL_PWR_EnableBkUpAccess
  302. * @retval None
  303. */
  304. __STATIC_INLINE void LL_PWR_EnableBkUpAccess(void)
  305. {
  306. SET_BIT(PWR->CR1, PWR_CR1_DBP);
  307. }
  308. /**
  309. * @brief Disable access to the backup domain
  310. * @rmtoll CR1 DBP LL_PWR_DisableBkUpAccess
  311. * @retval None
  312. */
  313. __STATIC_INLINE void LL_PWR_DisableBkUpAccess(void)
  314. {
  315. CLEAR_BIT(PWR->CR1, PWR_CR1_DBP);
  316. }
  317. /**
  318. * @brief Check if the backup domain is enabled
  319. * @rmtoll CR1 DBP LL_PWR_IsEnabledBkUpAccess
  320. * @retval State of bit (1 or 0).
  321. */
  322. __STATIC_INLINE uint32_t LL_PWR_IsEnabledBkUpAccess(void)
  323. {
  324. return ((READ_BIT(PWR->CR1, PWR_CR1_DBP) == (PWR_CR1_DBP)) ? 1UL : 0UL);
  325. }
  326. /**
  327. * @brief Enable Flash Power-down mode during low power sleep mode
  328. * @rmtoll CR1 CFIPD_SLP LL_PWR_EnableFlashPowerDownInLPSleep
  329. * @retval None
  330. */
  331. __STATIC_INLINE void LL_PWR_EnableFlashPowerDownInLPSleep(void)
  332. {
  333. SET_BIT(PWR->CR1, PWR_CR1_FPD_LPSLP);
  334. }
  335. /**
  336. * @brief Disable Flash Power-down mode during Low power sleep mode
  337. * @rmtoll CR1 CFIPD_SLP LL_PWR_DisableFlashPowerDownInLPSleep
  338. * @retval None
  339. */
  340. __STATIC_INLINE void LL_PWR_DisableFlashPowerDownInLPSleep(void)
  341. {
  342. CLEAR_BIT(PWR->CR1, PWR_CR1_FPD_LPSLP);
  343. }
  344. /**
  345. * @brief Check if flash power-down mode during low power sleep mode domain is enabled
  346. * @rmtoll CR1 CFIPD_SLP LL_PWR_IsEnableFlashPowerDownInLPSleep
  347. * @retval State of bit (1 or 0).
  348. */
  349. __STATIC_INLINE uint32_t LL_PWR_IsEnableFlashPowerDownInLPSleep(void)
  350. {
  351. return ((READ_BIT(PWR->CR1, PWR_CR1_FPD_LPSLP) == (PWR_CR1_FPD_LPSLP)) ? 1UL : 0UL);
  352. }
  353. /**
  354. * @brief Enable Flash Power-down mode during low power run mode
  355. * @rmtoll CR1 CFIPD_RUN LL_PWR_EnableFlashPowerDownInLPRun
  356. * @retval None
  357. */
  358. __STATIC_INLINE void LL_PWR_EnableFlashPowerDownInLPRun(void)
  359. {
  360. SET_BIT(PWR->CR1, PWR_CR1_FPD_LPRUN);
  361. }
  362. /**
  363. * @brief Disable Flash Power-down mode during Low power run mode
  364. * @rmtoll CR1 CFIPD_RUN LL_PWR_DisableFlashPowerDownInLPRun
  365. * @retval None
  366. */
  367. __STATIC_INLINE void LL_PWR_DisableFlashPowerDownInLPRun(void)
  368. {
  369. CLEAR_BIT(PWR->CR1, PWR_CR1_FPD_LPRUN);
  370. }
  371. /**
  372. * @brief Check if flash power-down mode during low power run mode domain is enabled
  373. * @rmtoll CR1 CFIPD_RUN LL_PWR_IsEnableFlashPowerDownInLPRun
  374. * @retval State of bit (1 or 0).
  375. */
  376. __STATIC_INLINE uint32_t LL_PWR_IsEnableFlashPowerDownInLPRun(void)
  377. {
  378. return ((READ_BIT(PWR->CR1, PWR_CR1_FPD_LPRUN) == (PWR_CR1_FPD_LPRUN)) ? 1UL : 0UL);
  379. }
  380. /**
  381. * @brief Enable Flash Power-down mode during stop mode
  382. * @rmtoll CR1 CFIPD_STOP LL_PWR_EnableFlashPowerDownInStop
  383. * @retval None
  384. */
  385. __STATIC_INLINE void LL_PWR_EnableFlashPowerDownInStop(void)
  386. {
  387. SET_BIT(PWR->CR1, PWR_CR1_FPD_STOP);
  388. }
  389. /**
  390. * @brief Disable Flash Power-down mode during stop mode
  391. * @rmtoll CR1 CFIPD_STOP LL_PWR_DisableFlashPowerDownInStop
  392. * @retval None
  393. */
  394. __STATIC_INLINE void LL_PWR_DisableFlashPowerDownInStop(void)
  395. {
  396. CLEAR_BIT(PWR->CR1, PWR_CR1_FPD_STOP);
  397. }
  398. /**
  399. * @brief Check if flash power-down mode during stop mode domain is enabled
  400. * @rmtoll CR1 CFIPD_STOP LL_PWR_IsEnableFlashPowerDownInStop
  401. * @retval State of bit (1 or 0).
  402. */
  403. __STATIC_INLINE uint32_t LL_PWR_IsEnableFlashPowerDownInStop(void)
  404. {
  405. return ((READ_BIT(PWR->CR1, PWR_CR1_FPD_STOP) == (PWR_CR1_FPD_STOP)) ? 1UL : 0UL);
  406. }
  407. #if defined(STM32G0C1xx) || defined(STM32G0B1xx)
  408. /**
  409. * @brief Enable VDDIO2 supply
  410. * @rmtoll CR2 IOSV LL_PWR_EnableVddIO2
  411. * @retval None
  412. */
  413. __STATIC_INLINE void LL_PWR_EnableVddIO2(void)
  414. {
  415. SET_BIT(PWR->CR2, PWR_CR2_IOSV);
  416. }
  417. /**
  418. * @brief Disable VDDIO2 supply
  419. * @rmtoll CR2 IOSV LL_PWR_DisableVddIO2
  420. * @retval None
  421. */
  422. __STATIC_INLINE void LL_PWR_DisableVddIO2(void)
  423. {
  424. CLEAR_BIT(PWR->CR2, PWR_CR2_IOSV);
  425. }
  426. /**
  427. * @brief Check if VDDIO2 supply is enabled
  428. * @rmtoll CR2 IOSV LL_PWR_IsEnabledVddIO2
  429. * @retval State of bit (1 or 0).
  430. */
  431. __STATIC_INLINE uint32_t LL_PWR_IsEnabledVddIO2(void)
  432. {
  433. return ((READ_BIT(PWR->CR2, PWR_CR2_IOSV) == (PWR_CR2_IOSV)) ? 1UL : 0UL);
  434. }
  435. #endif
  436. #if defined(STM32G0C1xx) || defined(STM32G0B1xx)
  437. /**
  438. * @brief Enable VDDUSB supply
  439. * @rmtoll CR2 USV LL_PWR_EnableVddUSB
  440. * @retval None
  441. */
  442. __STATIC_INLINE void LL_PWR_EnableVddUSB(void)
  443. {
  444. SET_BIT(PWR->CR2, PWR_CR2_USV);
  445. }
  446. /**
  447. * @brief Disable VDDUSB supply
  448. * @rmtoll CR2 USV LL_PWR_DisableVddUSB
  449. * @retval None
  450. */
  451. __STATIC_INLINE void LL_PWR_DisableVddUSB(void)
  452. {
  453. CLEAR_BIT(PWR->CR2, PWR_CR2_USV);
  454. }
  455. /**
  456. * @brief Check if VDDUSB supply is enabled
  457. * @rmtoll CR2 USV LL_PWR_IsEnabledVddUSB
  458. * @retval State of bit (1 or 0).
  459. */
  460. __STATIC_INLINE uint32_t LL_PWR_IsEnabledVddUSB(void)
  461. {
  462. return ((READ_BIT(PWR->CR2, PWR_CR2_USV) == (PWR_CR2_USV)) ? 1UL : 0UL);
  463. }
  464. #endif
  465. #if defined (PWR_PVM_SUPPORT)
  466. /**
  467. * @brief Enable the Power Voltage Monitoring on a peripheral
  468. * @rmtoll CR2 PVMUSB LL_PWR_EnablePVM
  469. * @param PeriphVoltage This parameter can be one of the following values:
  470. * @arg @ref LL_PWR_PVM_USB (*)
  471. *
  472. * (*) value not defined in all devices
  473. * @retval None
  474. */
  475. __STATIC_INLINE void LL_PWR_EnablePVM(uint32_t PeriphVoltage)
  476. {
  477. SET_BIT(PWR->CR2, PeriphVoltage);
  478. }
  479. /**
  480. * @brief Disable the Power Voltage Monitoring on a peripheral
  481. * @rmtoll CR2 PVMUSB LL_PWR_DisablePVM
  482. * @param PeriphVoltage This parameter can be one of the following values:
  483. * @arg @ref LL_PWR_PVM_USB (*)
  484. *
  485. * (*) value not defined in all devices
  486. * @retval None
  487. */
  488. __STATIC_INLINE void LL_PWR_DisablePVM(uint32_t PeriphVoltage)
  489. {
  490. CLEAR_BIT(PWR->CR2, PeriphVoltage);
  491. }
  492. /**
  493. * @brief Check if Power Voltage Monitoring is enabled on a peripheral
  494. * @rmtoll CR2 PVMUSB LL_PWR_IsEnabledPVM
  495. * @param PeriphVoltage This parameter can be one of the following values:
  496. * @arg @ref LL_PWR_PVM_USB (*)
  497. *
  498. * (*) value not defined in all devices
  499. * @retval State of bit (1 or 0).
  500. */
  501. __STATIC_INLINE uint32_t LL_PWR_IsEnabledPVM(uint32_t PeriphVoltage)
  502. {
  503. return ((READ_BIT(PWR->CR2, PeriphVoltage) == (PeriphVoltage)) ? 1UL : 0UL);
  504. }
  505. #endif
  506. /**
  507. * @brief Set Low-Power mode
  508. * @rmtoll CR1 LPMS LL_PWR_SetPowerMode
  509. * @param LowPowerMode This parameter can be one of the following values:
  510. * @arg @ref LL_PWR_MODE_STOP0
  511. * @arg @ref LL_PWR_MODE_STOP1
  512. * @arg @ref LL_PWR_MODE_STANDBY
  513. * @arg @ref LL_PWR_MODE_SHUTDOWN
  514. * @retval None
  515. */
  516. __STATIC_INLINE void LL_PWR_SetPowerMode(uint32_t LowPowerMode)
  517. {
  518. MODIFY_REG(PWR->CR1, PWR_CR1_LPMS, LowPowerMode);
  519. }
  520. /**
  521. * @brief Get Low-Power mode
  522. * @rmtoll CR1 LPMS LL_PWR_GetPowerMode
  523. * @retval Returned value can be one of the following values:
  524. * @arg @ref LL_PWR_MODE_STOP0
  525. * @arg @ref LL_PWR_MODE_STOP1
  526. * @arg @ref LL_PWR_MODE_STANDBY
  527. * @arg @ref LL_PWR_MODE_SHUTDOWN
  528. */
  529. __STATIC_INLINE uint32_t LL_PWR_GetPowerMode(void)
  530. {
  531. return (uint32_t)(READ_BIT(PWR->CR1, PWR_CR1_LPMS));
  532. }
  533. #if defined (PWR_CR2_PVDE)
  534. /**
  535. * @brief Configure the high voltage threshold detected by the Power Voltage Detector
  536. * @rmtoll CR2 PLS LL_PWR_SetPVDHighLevel
  537. * @param PVDHighLevel This parameter can be one of the following values:
  538. * @arg @ref LL_PWR_PVDHLEVEL_0
  539. * @arg @ref LL_PWR_PVDHLEVEL_1
  540. * @arg @ref LL_PWR_PVDHLEVEL_2
  541. * @arg @ref LL_PWR_PVDHLEVEL_3
  542. * @arg @ref LL_PWR_PVDHLEVEL_4
  543. * @arg @ref LL_PWR_PVDHLEVEL_5
  544. * @arg @ref LL_PWR_PVDHLEVEL_6
  545. * @arg @ref LL_PWR_PVDHLEVEL_7
  546. * @retval None
  547. */
  548. __STATIC_INLINE void LL_PWR_SetPVDHighLevel(uint32_t PVDHighLevel)
  549. {
  550. MODIFY_REG(PWR->CR2, PWR_CR2_PVDRT, PVDHighLevel);
  551. }
  552. /**
  553. * @brief Get the voltage threshold detection
  554. * @rmtoll CR2 PLS LL_PWR_GetPVDHighLevel
  555. * @retval Returned value can be one of the following values:
  556. * @arg @ref LL_PWR_PVDHLEVEL_0
  557. * @arg @ref LL_PWR_PVDHLEVEL_1
  558. * @arg @ref LL_PWR_PVDHLEVEL_2
  559. * @arg @ref LL_PWR_PVDHLEVEL_3
  560. * @arg @ref LL_PWR_PVDHLEVEL_4
  561. * @arg @ref LL_PWR_PVDHLEVEL_5
  562. * @arg @ref LL_PWR_PVDHLEVEL_6
  563. * @arg @ref LL_PWR_PVDHLEVEL_7
  564. */
  565. __STATIC_INLINE uint32_t LL_PWR_GetPVDHighLevel(void)
  566. {
  567. return (uint32_t)(READ_BIT(PWR->CR2, PWR_CR2_PVDRT));
  568. }
  569. /**
  570. * @brief Configure the low voltage threshold detected by the Power Voltage Detector
  571. * @rmtoll CR2 PLS LL_PWR_SetPVDLowLevel
  572. * @param PVDLowLevel This parameter can be one of the following values:
  573. * @arg @ref LL_PWR_PVDLLEVEL_0
  574. * @arg @ref LL_PWR_PVDLLEVEL_1
  575. * @arg @ref LL_PWR_PVDLLEVEL_2
  576. * @arg @ref LL_PWR_PVDLLEVEL_3
  577. * @arg @ref LL_PWR_PVDLLEVEL_4
  578. * @arg @ref LL_PWR_PVDLLEVEL_5
  579. * @arg @ref LL_PWR_PVDLLEVEL_6
  580. * @retval None
  581. */
  582. __STATIC_INLINE void LL_PWR_SetPVDLowLevel(uint32_t PVDLowLevel)
  583. {
  584. MODIFY_REG(PWR->CR2, PWR_CR2_PVDFT, PVDLowLevel);
  585. }
  586. /**
  587. * @brief Get the low voltage threshold detection
  588. * @rmtoll CR2 PLS LL_PWR_GetPVDLowLevel
  589. * @retval Returned value can be one of the following values:
  590. * @arg @ref LL_PWR_PVDLLEVEL_0
  591. * @arg @ref LL_PWR_PVDLLEVEL_1
  592. * @arg @ref LL_PWR_PVDLLEVEL_2
  593. * @arg @ref LL_PWR_PVDLLEVEL_3
  594. * @arg @ref LL_PWR_PVDLLEVEL_4
  595. * @arg @ref LL_PWR_PVDLLEVEL_5
  596. * @arg @ref LL_PWR_PVDLLEVEL_6
  597. */
  598. __STATIC_INLINE uint32_t LL_PWR_GetPVDLowLevel(void)
  599. {
  600. return (uint32_t)(READ_BIT(PWR->CR2, PWR_CR2_PVDFT));
  601. }
  602. /**
  603. * @brief Enable Power Voltage Detector
  604. * @rmtoll CR2 PVDE LL_PWR_EnablePVD
  605. * @retval None
  606. */
  607. __STATIC_INLINE void LL_PWR_EnablePVD(void)
  608. {
  609. SET_BIT(PWR->CR2, PWR_CR2_PVDE);
  610. }
  611. /**
  612. * @brief Disable Power Voltage Detector
  613. * @rmtoll CR2 PVDE LL_PWR_DisablePVD
  614. * @retval None
  615. */
  616. __STATIC_INLINE void LL_PWR_DisablePVD(void)
  617. {
  618. CLEAR_BIT(PWR->CR2, PWR_CR2_PVDE);
  619. }
  620. /**
  621. * @brief Check if Power Voltage Detector is enabled
  622. * @rmtoll CR2 PVDE LL_PWR_IsEnabledPVD
  623. * @retval State of bit (1 or 0).
  624. */
  625. __STATIC_INLINE uint32_t LL_PWR_IsEnabledPVD(void)
  626. {
  627. return ((READ_BIT(PWR->CR2, PWR_CR2_PVDE) == (PWR_CR2_PVDE)) ? 1UL : 0UL);
  628. }
  629. #endif
  630. /**
  631. * @brief Enable Internal Wake-up line
  632. * @rmtoll CR3 EIWF LL_PWR_EnableInternWU
  633. * @retval None
  634. */
  635. __STATIC_INLINE void LL_PWR_EnableInternWU(void)
  636. {
  637. SET_BIT(PWR->CR3, PWR_CR3_EIWUL);
  638. }
  639. /**
  640. * @brief Disable Internal Wake-up line
  641. * @rmtoll CR3 EIWF LL_PWR_DisableInternWU
  642. * @retval None
  643. */
  644. __STATIC_INLINE void LL_PWR_DisableInternWU(void)
  645. {
  646. CLEAR_BIT(PWR->CR3, PWR_CR3_EIWUL);
  647. }
  648. /**
  649. * @brief Check if Internal Wake-up line is enabled
  650. * @rmtoll CR3 EIWF LL_PWR_IsEnabledInternWU
  651. * @retval State of bit (1 or 0).
  652. */
  653. __STATIC_INLINE uint32_t LL_PWR_IsEnabledInternWU(void)
  654. {
  655. return ((READ_BIT(PWR->CR3, PWR_CR3_EIWUL) == (PWR_CR3_EIWUL)) ? 1UL : 0UL);
  656. }
  657. /**
  658. * @brief Enable pull-up and pull-down configuration
  659. * @rmtoll CR3 APC LL_PWR_EnablePUPDCfg
  660. * @retval None
  661. */
  662. __STATIC_INLINE void LL_PWR_EnablePUPDCfg(void)
  663. {
  664. SET_BIT(PWR->CR3, PWR_CR3_APC);
  665. }
  666. /**
  667. * @brief Disable pull-up and pull-down configuration
  668. * @rmtoll CR3 APC LL_PWR_DisablePUPDCfg
  669. * @retval None
  670. */
  671. __STATIC_INLINE void LL_PWR_DisablePUPDCfg(void)
  672. {
  673. CLEAR_BIT(PWR->CR3, PWR_CR3_APC);
  674. }
  675. /**
  676. * @brief Check if pull-up and pull-down configuration is enabled
  677. * @rmtoll CR3 APC LL_PWR_IsEnabledPUPDCfg
  678. * @retval State of bit (1 or 0).
  679. */
  680. __STATIC_INLINE uint32_t LL_PWR_IsEnabledPUPDCfg(void)
  681. {
  682. return ((READ_BIT(PWR->CR3, PWR_CR3_APC) == (PWR_CR3_APC)) ? 1UL : 0UL);
  683. }
  684. #if defined(PWR_CR3_RRS)
  685. /**
  686. * @brief Enable SRAM content retention in Standby mode
  687. * @rmtoll CR3 RRS LL_PWR_EnableSRAMRetention
  688. * @retval None
  689. */
  690. __STATIC_INLINE void LL_PWR_EnableSRAMRetention(void)
  691. {
  692. SET_BIT(PWR->CR3, PWR_CR3_RRS);
  693. }
  694. /**
  695. * @brief Disable SRAM content retention in Standby mode
  696. * @rmtoll CR3 RRS LL_PWR_DisableSRAMRetention
  697. * @retval None
  698. */
  699. __STATIC_INLINE void LL_PWR_DisableSRAMRetention(void)
  700. {
  701. CLEAR_BIT(PWR->CR3, PWR_CR3_RRS);
  702. }
  703. /**
  704. * @brief Check if SRAM content retention in Standby mode is enabled
  705. * @rmtoll CR3 RRS LL_PWR_IsEnabledSRAMRetention
  706. * @retval State of bit (1 or 0).
  707. */
  708. __STATIC_INLINE uint32_t LL_PWR_IsEnabledSRAMRetention(void)
  709. {
  710. return ((READ_BIT(PWR->CR3, PWR_CR3_RRS) == (PWR_CR3_RRS)) ? 1UL : 0UL);
  711. }
  712. #endif
  713. #if defined(PWR_CR3_ENB_ULP)
  714. /**
  715. * @brief Enable sampling mode of LPMMU reset block
  716. * @rmtoll CR3 ENB_ULP LL_PWR_EnableLPMUResetSamplingMode
  717. * @retval None
  718. */
  719. __STATIC_INLINE void LL_PWR_EnableLPMUResetSamplingMode(void)
  720. {
  721. SET_BIT(PWR->CR3, PWR_CR3_ENB_ULP);
  722. }
  723. /**
  724. * @brief Disable sampling mode of LPMMU reset block
  725. * @rmtoll CR3 ENB_ULP LL_PWR_DisableLPMUResetSamplingMode
  726. * @retval None
  727. */
  728. __STATIC_INLINE void LL_PWR_DisableLPMUResetSamplingMode(void)
  729. {
  730. CLEAR_BIT(PWR->CR3, PWR_CR3_ENB_ULP);
  731. }
  732. /**
  733. * @brief Check if sampling mode of LPMMU reset block
  734. * @rmtoll CR3 ENB_ULP LL_PWR_IsEnableLPMUResetSamplingMode
  735. * @retval State of bit (1 or 0).
  736. */
  737. __STATIC_INLINE uint32_t LL_PWR_IsEnableLPMUResetSamplingMode(void)
  738. {
  739. return ((READ_BIT(PWR->CR3, PWR_CR3_ENB_ULP) == (PWR_CR3_ENB_ULP)) ? 1UL : 0UL);
  740. }
  741. #endif
  742. /**
  743. * @brief Enable the WakeUp PINx functionality
  744. * @rmtoll CR3 EWUP1 LL_PWR_EnableWakeUpPin\n
  745. * CR3 EWUP2 LL_PWR_EnableWakeUpPin\n
  746. * CR3 EWUP3 LL_PWR_EnableWakeUpPin\n
  747. * CR3 EWUP4 LL_PWR_EnableWakeUpPin\n
  748. * CR3 EWUP5 LL_PWR_EnableWakeUpPin\n
  749. * CR3 EWUP6 LL_PWR_EnableWakeUpPin
  750. * @param WakeUpPin This parameter can be one of the following values:
  751. * @arg @ref LL_PWR_WAKEUP_PIN1
  752. * @arg @ref LL_PWR_WAKEUP_PIN2
  753. * @arg @ref LL_PWR_WAKEUP_PIN3 (*)
  754. * @arg @ref LL_PWR_WAKEUP_PIN4
  755. * @arg @ref LL_PWR_WAKEUP_PIN5 (*)
  756. * @arg @ref LL_PWR_WAKEUP_PIN6
  757. * @retval None
  758. * @note (*) availability depends on devices
  759. */
  760. __STATIC_INLINE void LL_PWR_EnableWakeUpPin(uint32_t WakeUpPin)
  761. {
  762. SET_BIT(PWR->CR3, WakeUpPin);
  763. }
  764. /**
  765. * @brief Disable the WakeUp PINx functionality
  766. * @rmtoll CR3 EWUP1 LL_PWR_DisableWakeUpPin\n
  767. * CR3 EWUP2 LL_PWR_DisableWakeUpPin\n
  768. * CR3 EWUP3 LL_PWR_DisableWakeUpPin\n
  769. * CR3 EWUP4 LL_PWR_DisableWakeUpPin\n
  770. * CR3 EWUP5 LL_PWR_DisableWakeUpPin\n
  771. * CR3 EWUP6 LL_PWR_DisableWakeUpPin
  772. * @param WakeUpPin This parameter can be one of the following values:
  773. * @arg @ref LL_PWR_WAKEUP_PIN1
  774. * @arg @ref LL_PWR_WAKEUP_PIN2
  775. * @arg @ref LL_PWR_WAKEUP_PIN3 (*)
  776. * @arg @ref LL_PWR_WAKEUP_PIN4
  777. * @arg @ref LL_PWR_WAKEUP_PIN5 (*)
  778. * @arg @ref LL_PWR_WAKEUP_PIN6
  779. * @retval None
  780. * @note (*) availability depends on devices
  781. */
  782. __STATIC_INLINE void LL_PWR_DisableWakeUpPin(uint32_t WakeUpPin)
  783. {
  784. CLEAR_BIT(PWR->CR3, WakeUpPin);
  785. }
  786. /**
  787. * @brief Check if the WakeUp PINx functionality is enabled
  788. * @rmtoll CR3 EWUP1 LL_PWR_IsEnabledWakeUpPin\n
  789. * CR3 EWUP2 LL_PWR_IsEnabledWakeUpPin\n
  790. * CR3 EWUP3 LL_PWR_IsEnabledWakeUpPin\n
  791. * CR3 EWUP4 LL_PWR_IsEnabledWakeUpPin\n
  792. * CR3 EWUP5 LL_PWR_IsEnabledWakeUpPin\n
  793. * CR3 EWUP6 LL_PWR_IsEnabledWakeUpPin
  794. * @param WakeUpPin This parameter can be one of the following values:
  795. * @arg @ref LL_PWR_WAKEUP_PIN1
  796. * @arg @ref LL_PWR_WAKEUP_PIN2
  797. * @arg @ref LL_PWR_WAKEUP_PIN3 (*)
  798. * @arg @ref LL_PWR_WAKEUP_PIN4
  799. * @arg @ref LL_PWR_WAKEUP_PIN5 (*)
  800. * @arg @ref LL_PWR_WAKEUP_PIN6
  801. * @retval State of bit (1 or 0).
  802. * @note (*) availability depends on devices
  803. */
  804. __STATIC_INLINE uint32_t LL_PWR_IsEnabledWakeUpPin(uint32_t WakeUpPin)
  805. {
  806. return ((READ_BIT(PWR->CR3, WakeUpPin) == (WakeUpPin)) ? 1UL : 0UL);
  807. }
  808. /**
  809. * @brief Set the resistor impedance
  810. * @rmtoll CR4 VBRS LL_PWR_SetBattChargResistor
  811. * @param Resistor This parameter can be one of the following values:
  812. * @arg @ref LL_PWR_BATTCHARG_RESISTOR_5K
  813. * @arg @ref LL_PWR_BATTCHARG_RESISTOR_1_5K
  814. * @retval None
  815. */
  816. __STATIC_INLINE void LL_PWR_SetBattChargResistor(uint32_t Resistor)
  817. {
  818. MODIFY_REG(PWR->CR4, PWR_CR4_VBRS, Resistor);
  819. }
  820. /**
  821. * @brief Get the resistor impedance
  822. * @rmtoll CR4 VBRS LL_PWR_GetBattChargResistor
  823. * @retval Returned value can be one of the following values:
  824. * @arg @ref LL_PWR_BATTCHARG_RESISTOR_5K
  825. * @arg @ref LL_PWR_BATTCHARG_RESISTOR_1_5K
  826. */
  827. __STATIC_INLINE uint32_t LL_PWR_GetBattChargResistor(void)
  828. {
  829. return (uint32_t)(READ_BIT(PWR->CR4, PWR_CR4_VBRS));
  830. }
  831. /**
  832. * @brief Enable battery charging
  833. * @rmtoll CR4 VBE LL_PWR_EnableBatteryCharging
  834. * @retval None
  835. */
  836. __STATIC_INLINE void LL_PWR_EnableBatteryCharging(void)
  837. {
  838. SET_BIT(PWR->CR4, PWR_CR4_VBE);
  839. }
  840. /**
  841. * @brief Disable battery charging
  842. * @rmtoll CR4 VBE LL_PWR_DisableBatteryCharging
  843. * @retval None
  844. */
  845. __STATIC_INLINE void LL_PWR_DisableBatteryCharging(void)
  846. {
  847. CLEAR_BIT(PWR->CR4, PWR_CR4_VBE);
  848. }
  849. /**
  850. * @brief Check if battery charging is enabled
  851. * @rmtoll CR4 VBE LL_PWR_IsEnabledBatteryCharging
  852. * @retval State of bit (1 or 0).
  853. */
  854. __STATIC_INLINE uint32_t LL_PWR_IsEnabledBatteryCharging(void)
  855. {
  856. return ((READ_BIT(PWR->CR4, PWR_CR4_VBE) == (PWR_CR4_VBE)) ? 1UL : 0UL);
  857. }
  858. /**
  859. * @brief Set the Wake-Up pin polarity low for the event detection
  860. * @rmtoll CR4 WP1 LL_PWR_SetWakeUpPinPolarityLow\n
  861. * CR4 WP2 LL_PWR_SetWakeUpPinPolarityLow\n
  862. * CR4 WP3 LL_PWR_SetWakeUpPinPolarityLow\n
  863. * CR4 WP4 LL_PWR_SetWakeUpPinPolarityLow\n
  864. * CR4 WP5 LL_PWR_SetWakeUpPinPolarityLow\n
  865. * CR4 WP6 LL_PWR_SetWakeUpPinPolarityLow
  866. * @param WakeUpPin This parameter can be one of the following values:
  867. * @arg @ref LL_PWR_WAKEUP_PIN1
  868. * @arg @ref LL_PWR_WAKEUP_PIN2
  869. * @arg @ref LL_PWR_WAKEUP_PIN3 (*)
  870. * @arg @ref LL_PWR_WAKEUP_PIN4
  871. * @arg @ref LL_PWR_WAKEUP_PIN5 (*)
  872. * @arg @ref LL_PWR_WAKEUP_PIN6
  873. * @retval None
  874. * @note (*) availability depends on devices
  875. */
  876. __STATIC_INLINE void LL_PWR_SetWakeUpPinPolarityLow(uint32_t WakeUpPin)
  877. {
  878. SET_BIT(PWR->CR4, WakeUpPin);
  879. }
  880. /**
  881. * @brief Set the Wake-Up pin polarity high for the event detection
  882. * @rmtoll CR4 WP1 LL_PWR_SetWakeUpPinPolarityHigh\n
  883. * CR4 WP2 LL_PWR_SetWakeUpPinPolarityHigh\n
  884. * CR4 WP3 LL_PWR_SetWakeUpPinPolarityHigh\n
  885. * CR4 WP4 LL_PWR_SetWakeUpPinPolarityHigh\n
  886. * CR4 WP5 LL_PWR_SetWakeUpPinPolarityHigh\n
  887. * CR4 WP6 LL_PWR_SetWakeUpPinPolarityHigh
  888. * @param WakeUpPin This parameter can be one of the following values:
  889. * @arg @ref LL_PWR_WAKEUP_PIN1
  890. * @arg @ref LL_PWR_WAKEUP_PIN2
  891. * @arg @ref LL_PWR_WAKEUP_PIN3 (*)
  892. * @arg @ref LL_PWR_WAKEUP_PIN4
  893. * @arg @ref LL_PWR_WAKEUP_PIN5 (*)
  894. * @arg @ref LL_PWR_WAKEUP_PIN6
  895. * @note (*) availability depends on devices
  896. * @retval None
  897. */
  898. __STATIC_INLINE void LL_PWR_SetWakeUpPinPolarityHigh(uint32_t WakeUpPin)
  899. {
  900. CLEAR_BIT(PWR->CR4, WakeUpPin);
  901. }
  902. /**
  903. * @brief Get the Wake-Up pin polarity for the event detection
  904. * @rmtoll CR4 WP1 LL_PWR_IsWakeUpPinPolarityLow\n
  905. * CR4 WP2 LL_PWR_IsWakeUpPinPolarityLow\n
  906. * CR4 WP3 LL_PWR_IsWakeUpPinPolarityLow\n
  907. * CR4 WP4 LL_PWR_IsWakeUpPinPolarityLow\n
  908. * CR4 WP5 LL_PWR_IsWakeUpPinPolarityLow\n
  909. * CR4 WP6 LL_PWR_IsWakeUpPinPolarityLow
  910. * @param WakeUpPin This parameter can be one of the following values:
  911. * @arg @ref LL_PWR_WAKEUP_PIN1
  912. * @arg @ref LL_PWR_WAKEUP_PIN2
  913. * @arg @ref LL_PWR_WAKEUP_PIN3 (*)
  914. * @arg @ref LL_PWR_WAKEUP_PIN4
  915. * @arg @ref LL_PWR_WAKEUP_PIN5 (*)
  916. * @arg @ref LL_PWR_WAKEUP_PIN6
  917. * @note (*) availability depends on devices
  918. * @retval State of bit (1 or 0).
  919. */
  920. __STATIC_INLINE uint32_t LL_PWR_IsWakeUpPinPolarityLow(uint32_t WakeUpPin)
  921. {
  922. return ((READ_BIT(PWR->CR4, WakeUpPin) == (WakeUpPin)) ? 1UL : 0UL);
  923. }
  924. /**
  925. * @brief Enable GPIO pull-up state in Standby and Shutdown modes
  926. * @rmtoll PUCRA PU0-15 LL_PWR_EnableGPIOPullUp\n
  927. * PUCRB PU0-15 LL_PWR_EnableGPIOPullUp\n
  928. * PUCRC PU0-15 LL_PWR_EnableGPIOPullUp\n
  929. * PUCRD PU0-15 LL_PWR_EnableGPIOPullUp\n
  930. * PUCRE PU0-15 LL_PWR_EnableGPIOPullUp\n
  931. * PUCRF PU0-13 LL_PWR_EnableGPIOPullUp
  932. * @param GPIO This parameter can be one of the following values:
  933. * @arg @ref LL_PWR_GPIO_A
  934. * @arg @ref LL_PWR_GPIO_B
  935. * @arg @ref LL_PWR_GPIO_C
  936. * @arg @ref LL_PWR_GPIO_D
  937. * @arg @ref LL_PWR_GPIO_E (*)
  938. * @arg @ref LL_PWR_GPIO_F
  939. * @param GPIONumber This parameter can be one of the following values:
  940. * @arg @ref LL_PWR_GPIO_BIT_0
  941. * @arg @ref LL_PWR_GPIO_BIT_1
  942. * @arg @ref LL_PWR_GPIO_BIT_2
  943. * @arg @ref LL_PWR_GPIO_BIT_3
  944. * @arg @ref LL_PWR_GPIO_BIT_4
  945. * @arg @ref LL_PWR_GPIO_BIT_5
  946. * @arg @ref LL_PWR_GPIO_BIT_6
  947. * @arg @ref LL_PWR_GPIO_BIT_7
  948. * @arg @ref LL_PWR_GPIO_BIT_8
  949. * @arg @ref LL_PWR_GPIO_BIT_9
  950. * @arg @ref LL_PWR_GPIO_BIT_10
  951. * @arg @ref LL_PWR_GPIO_BIT_11
  952. * @arg @ref LL_PWR_GPIO_BIT_12
  953. * @arg @ref LL_PWR_GPIO_BIT_13
  954. * @arg @ref LL_PWR_GPIO_BIT_14
  955. * @arg @ref LL_PWR_GPIO_BIT_15
  956. * @retval None
  957. */
  958. __STATIC_INLINE void LL_PWR_EnableGPIOPullUp(uint32_t GPIO, uint32_t GPIONumber)
  959. {
  960. SET_BIT(*((__IO uint32_t *)GPIO), GPIONumber);
  961. }
  962. /**
  963. * @brief Disable GPIO pull-up state in Standby and Shutdown modes
  964. * @rmtoll PUCRA PU0-15 LL_PWR_DisableGPIOPullUp\n
  965. * PUCRB PU0-15 LL_PWR_DisableGPIOPullUp\n
  966. * PUCRC PU0-15 LL_PWR_DisableGPIOPullUp\n
  967. * PUCRD PU0-15 LL_PWR_DisableGPIOPullUp\n
  968. * PUCRE PU0-15 LL_PWR_DisableGPIOPullUp\n
  969. * PUCRF PU0-13 LL_PWR_DisableGPIOPullUp
  970. * @param GPIO This parameter can be one of the following values:
  971. * @arg @ref LL_PWR_GPIO_A
  972. * @arg @ref LL_PWR_GPIO_B
  973. * @arg @ref LL_PWR_GPIO_C
  974. * @arg @ref LL_PWR_GPIO_D
  975. * @arg @ref LL_PWR_GPIO_E (*)
  976. * @arg @ref LL_PWR_GPIO_F
  977. * @param GPIONumber This parameter can be one of the following values:
  978. * @arg @ref LL_PWR_GPIO_BIT_0
  979. * @arg @ref LL_PWR_GPIO_BIT_1
  980. * @arg @ref LL_PWR_GPIO_BIT_2
  981. * @arg @ref LL_PWR_GPIO_BIT_3
  982. * @arg @ref LL_PWR_GPIO_BIT_4
  983. * @arg @ref LL_PWR_GPIO_BIT_5
  984. * @arg @ref LL_PWR_GPIO_BIT_6
  985. * @arg @ref LL_PWR_GPIO_BIT_7
  986. * @arg @ref LL_PWR_GPIO_BIT_8
  987. * @arg @ref LL_PWR_GPIO_BIT_9
  988. * @arg @ref LL_PWR_GPIO_BIT_10
  989. * @arg @ref LL_PWR_GPIO_BIT_11
  990. * @arg @ref LL_PWR_GPIO_BIT_12
  991. * @arg @ref LL_PWR_GPIO_BIT_13
  992. * @arg @ref LL_PWR_GPIO_BIT_14
  993. * @arg @ref LL_PWR_GPIO_BIT_15
  994. * @retval None
  995. */
  996. __STATIC_INLINE void LL_PWR_DisableGPIOPullUp(uint32_t GPIO, uint32_t GPIONumber)
  997. {
  998. CLEAR_BIT(*((__IO uint32_t *)GPIO), GPIONumber);
  999. }
  1000. /**
  1001. * @brief Check if GPIO pull-up state is enabled
  1002. * @rmtoll PUCRA PU0-15 LL_PWR_IsEnabledGPIOPullUp\n
  1003. * PUCRB PU0-15 LL_PWR_IsEnabledGPIOPullUp\n
  1004. * PUCRC PU0-15 LL_PWR_IsEnabledGPIOPullUp\n
  1005. * PUCRD PU0-15 LL_PWR_IsEnabledGPIOPullUp\n
  1006. * PUCRE PU0-15 LL_PWR_IsEnabledGPIOPullUp\n
  1007. * PUCRF PU0-13 LL_PWR_IsEnabledGPIOPullUp
  1008. * @param GPIO This parameter can be one of the following values:
  1009. * @arg @ref LL_PWR_GPIO_A
  1010. * @arg @ref LL_PWR_GPIO_B
  1011. * @arg @ref LL_PWR_GPIO_C
  1012. * @arg @ref LL_PWR_GPIO_D
  1013. * @arg @ref LL_PWR_GPIO_E (*)
  1014. * @arg @ref LL_PWR_GPIO_F
  1015. * @param GPIONumber This parameter can be one of the following values:
  1016. * @arg @ref LL_PWR_GPIO_BIT_0
  1017. * @arg @ref LL_PWR_GPIO_BIT_1
  1018. * @arg @ref LL_PWR_GPIO_BIT_2
  1019. * @arg @ref LL_PWR_GPIO_BIT_3
  1020. * @arg @ref LL_PWR_GPIO_BIT_4
  1021. * @arg @ref LL_PWR_GPIO_BIT_5
  1022. * @arg @ref LL_PWR_GPIO_BIT_6
  1023. * @arg @ref LL_PWR_GPIO_BIT_7
  1024. * @arg @ref LL_PWR_GPIO_BIT_8
  1025. * @arg @ref LL_PWR_GPIO_BIT_9
  1026. * @arg @ref LL_PWR_GPIO_BIT_10
  1027. * @arg @ref LL_PWR_GPIO_BIT_11
  1028. * @arg @ref LL_PWR_GPIO_BIT_12
  1029. * @arg @ref LL_PWR_GPIO_BIT_13
  1030. * @arg @ref LL_PWR_GPIO_BIT_14
  1031. * @arg @ref LL_PWR_GPIO_BIT_15
  1032. * @retval State of bit (1 or 0).
  1033. */
  1034. __STATIC_INLINE uint32_t LL_PWR_IsEnabledGPIOPullUp(uint32_t GPIO, uint32_t GPIONumber)
  1035. {
  1036. return ((READ_BIT(*((__IO uint32_t *)GPIO), GPIONumber) == (GPIONumber)) ? 1UL : 0UL);
  1037. }
  1038. /**
  1039. * @brief Enable GPIO pull-down state in Standby and Shutdown modes
  1040. * @rmtoll PDCRA PD0-15 LL_PWR_EnableGPIOPullDown\n
  1041. * PDCRB PD0-15 LL_PWR_EnableGPIOPullDown\n
  1042. * PDCRC PD0-15 LL_PWR_EnableGPIOPullDown\n
  1043. * PDCRD PD0-15 LL_PWR_EnableGPIOPullDown\n
  1044. * PDCRE PD0-15 LL_PWR_EnableGPIOPullDown\n
  1045. * PDCRF PD0-13 LL_PWR_EnableGPIOPullDown
  1046. * @param GPIO This parameter can be one of the following values:
  1047. * @arg @ref LL_PWR_GPIO_A
  1048. * @arg @ref LL_PWR_GPIO_B
  1049. * @arg @ref LL_PWR_GPIO_C
  1050. * @arg @ref LL_PWR_GPIO_D
  1051. * @arg @ref LL_PWR_GPIO_E (*)
  1052. * @arg @ref LL_PWR_GPIO_F
  1053. * @param GPIONumber This parameter can be one of the following values:
  1054. * @arg @ref LL_PWR_GPIO_BIT_0
  1055. * @arg @ref LL_PWR_GPIO_BIT_1
  1056. * @arg @ref LL_PWR_GPIO_BIT_2
  1057. * @arg @ref LL_PWR_GPIO_BIT_3
  1058. * @arg @ref LL_PWR_GPIO_BIT_4
  1059. * @arg @ref LL_PWR_GPIO_BIT_5
  1060. * @arg @ref LL_PWR_GPIO_BIT_6
  1061. * @arg @ref LL_PWR_GPIO_BIT_7
  1062. * @arg @ref LL_PWR_GPIO_BIT_8
  1063. * @arg @ref LL_PWR_GPIO_BIT_9
  1064. * @arg @ref LL_PWR_GPIO_BIT_10
  1065. * @arg @ref LL_PWR_GPIO_BIT_11
  1066. * @arg @ref LL_PWR_GPIO_BIT_12
  1067. * @arg @ref LL_PWR_GPIO_BIT_13
  1068. * @arg @ref LL_PWR_GPIO_BIT_14
  1069. * @arg @ref LL_PWR_GPIO_BIT_15
  1070. * @retval None
  1071. */
  1072. __STATIC_INLINE void LL_PWR_EnableGPIOPullDown(uint32_t GPIO, uint32_t GPIONumber)
  1073. {
  1074. SET_BIT(*((__IO uint32_t *)(GPIO + 4U)), GPIONumber);
  1075. }
  1076. /**
  1077. * @brief Disable GPIO pull-down state in Standby and Shutdown modes
  1078. * @rmtoll PDCRA PD0-15 LL_PWR_DisableGPIOPullDown\n
  1079. * PDCRB PD0-15 LL_PWR_DisableGPIOPullDown\n
  1080. * PDCRC PD0-15 LL_PWR_DisableGPIOPullDown\n
  1081. * PDCRD PD0-15 LL_PWR_DisableGPIOPullDown\n
  1082. * PDCRE PD0-15 LL_PWR_DisableGPIOPullDown\n
  1083. * PDCRF PD0-13 LL_PWR_DisableGPIOPullDown
  1084. * @param GPIO This parameter can be one of the following values:
  1085. * @arg @ref LL_PWR_GPIO_A
  1086. * @arg @ref LL_PWR_GPIO_B
  1087. * @arg @ref LL_PWR_GPIO_C
  1088. * @arg @ref LL_PWR_GPIO_D
  1089. * @arg @ref LL_PWR_GPIO_E (*)
  1090. * @arg @ref LL_PWR_GPIO_F
  1091. * @param GPIONumber This parameter can be one of the following values:
  1092. * @arg @ref LL_PWR_GPIO_BIT_0
  1093. * @arg @ref LL_PWR_GPIO_BIT_1
  1094. * @arg @ref LL_PWR_GPIO_BIT_2
  1095. * @arg @ref LL_PWR_GPIO_BIT_3
  1096. * @arg @ref LL_PWR_GPIO_BIT_4
  1097. * @arg @ref LL_PWR_GPIO_BIT_5
  1098. * @arg @ref LL_PWR_GPIO_BIT_6
  1099. * @arg @ref LL_PWR_GPIO_BIT_7
  1100. * @arg @ref LL_PWR_GPIO_BIT_8
  1101. * @arg @ref LL_PWR_GPIO_BIT_9
  1102. * @arg @ref LL_PWR_GPIO_BIT_10
  1103. * @arg @ref LL_PWR_GPIO_BIT_11
  1104. * @arg @ref LL_PWR_GPIO_BIT_12
  1105. * @arg @ref LL_PWR_GPIO_BIT_13
  1106. * @arg @ref LL_PWR_GPIO_BIT_14
  1107. * @arg @ref LL_PWR_GPIO_BIT_15
  1108. * @retval None
  1109. */
  1110. __STATIC_INLINE void LL_PWR_DisableGPIOPullDown(uint32_t GPIO, uint32_t GPIONumber)
  1111. {
  1112. CLEAR_BIT(*((__IO uint32_t *)(GPIO + 4U)), GPIONumber);
  1113. }
  1114. /**
  1115. * @brief Check if GPIO pull-down state is enabled
  1116. * @rmtoll PDCRA PD0-15 LL_PWR_IsEnabledGPIOPullDown\n
  1117. * PDCRB PD0-15 LL_PWR_IsEnabledGPIOPullDown\n
  1118. * PDCRC PD0-15 LL_PWR_IsEnabledGPIOPullDown\n
  1119. * PDCRD PD0-15 LL_PWR_IsEnabledGPIOPullDown\n
  1120. * PDCRE PD0-15 LL_PWR_IsEnabledGPIOPullDown\n
  1121. * PDCRF PD0-13 LL_PWR_IsEnabledGPIOPullDown
  1122. * @param GPIO This parameter can be one of the following values:
  1123. * @arg @ref LL_PWR_GPIO_A
  1124. * @arg @ref LL_PWR_GPIO_B
  1125. * @arg @ref LL_PWR_GPIO_C
  1126. * @arg @ref LL_PWR_GPIO_D
  1127. * @arg @ref LL_PWR_GPIO_E (*)
  1128. * @arg @ref LL_PWR_GPIO_F
  1129. * @param GPIONumber This parameter can be one of the following values:
  1130. * @arg @ref LL_PWR_GPIO_BIT_0
  1131. * @arg @ref LL_PWR_GPIO_BIT_1
  1132. * @arg @ref LL_PWR_GPIO_BIT_2
  1133. * @arg @ref LL_PWR_GPIO_BIT_3
  1134. * @arg @ref LL_PWR_GPIO_BIT_4
  1135. * @arg @ref LL_PWR_GPIO_BIT_5
  1136. * @arg @ref LL_PWR_GPIO_BIT_6
  1137. * @arg @ref LL_PWR_GPIO_BIT_7
  1138. * @arg @ref LL_PWR_GPIO_BIT_8
  1139. * @arg @ref LL_PWR_GPIO_BIT_9
  1140. * @arg @ref LL_PWR_GPIO_BIT_10
  1141. * @arg @ref LL_PWR_GPIO_BIT_11
  1142. * @arg @ref LL_PWR_GPIO_BIT_12
  1143. * @arg @ref LL_PWR_GPIO_BIT_13
  1144. * @arg @ref LL_PWR_GPIO_BIT_14
  1145. * @arg @ref LL_PWR_GPIO_BIT_15
  1146. * @retval State of bit (1 or 0).
  1147. */
  1148. __STATIC_INLINE uint32_t LL_PWR_IsEnabledGPIOPullDown(uint32_t GPIO, uint32_t GPIONumber)
  1149. {
  1150. return ((READ_BIT(*((__IO uint32_t *)(GPIO + 4U)), GPIONumber) == (GPIONumber)) ? 1UL : 0UL);
  1151. }
  1152. /**
  1153. * @}
  1154. */
  1155. /** @defgroup PWR_LL_EF_FLAG_Management FLAG_Management
  1156. * @{
  1157. */
  1158. /**
  1159. * @brief Get Internal Wake-up line Flag
  1160. * @rmtoll SR1 WUFI LL_PWR_IsActiveFlag_InternWU
  1161. * @retval State of bit (1 or 0).
  1162. */
  1163. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_InternWU(void)
  1164. {
  1165. return ((READ_BIT(PWR->SR1, PWR_SR1_WUFI) == (PWR_SR1_WUFI)) ? 1UL : 0UL);
  1166. }
  1167. /**
  1168. * @brief Get Stand-By Flag
  1169. * @rmtoll SR1 SBF LL_PWR_IsActiveFlag_SB
  1170. * @retval State of bit (1 or 0).
  1171. */
  1172. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_SB(void)
  1173. {
  1174. return ((READ_BIT(PWR->SR1, PWR_SR1_SBF) == (PWR_SR1_SBF)) ? 1UL : 0UL);
  1175. }
  1176. /**
  1177. * @brief Get Wake-up Flag 6
  1178. * @rmtoll SR1 WUF6 LL_PWR_IsActiveFlag_WU6
  1179. * @retval State of bit (1 or 0).
  1180. */
  1181. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_WU6(void)
  1182. {
  1183. return ((READ_BIT(PWR->SR1, PWR_SR1_WUF6) == (PWR_SR1_WUF6)) ? 1UL : 0UL);
  1184. }
  1185. #if defined(PWR_CR3_EWUP5)
  1186. /**
  1187. * @brief Get Wake-up Flag 5
  1188. * @rmtoll SR1 WUF5 LL_PWR_IsActiveFlag_WU5
  1189. * @retval State of bit (1 or 0).
  1190. */
  1191. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_WU5(void)
  1192. {
  1193. return ((READ_BIT(PWR->SR1, PWR_SR1_WUF5) == (PWR_SR1_WUF5)) ? 1UL : 0UL);
  1194. }
  1195. #endif
  1196. /**
  1197. * @brief Get Wake-up Flag 4
  1198. * @rmtoll SR1 WUF4 LL_PWR_IsActiveFlag_WU4
  1199. * @retval State of bit (1 or 0).
  1200. */
  1201. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_WU4(void)
  1202. {
  1203. return ((READ_BIT(PWR->SR1, PWR_SR1_WUF4) == (PWR_SR1_WUF4)) ? 1UL : 0UL);
  1204. }
  1205. #if defined(PWR_CR3_EWUP3)
  1206. /**
  1207. * @brief Get Wake-up Flag 3
  1208. * @rmtoll SR1 WUF3 LL_PWR_IsActiveFlag_WU3
  1209. * @retval State of bit (1 or 0).
  1210. */
  1211. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_WU3(void)
  1212. {
  1213. return ((READ_BIT(PWR->SR1, PWR_SR1_WUF3) == (PWR_SR1_WUF3)) ? 1UL : 0UL);
  1214. }
  1215. #endif
  1216. /**
  1217. * @brief Get Wake-up Flag 2
  1218. * @rmtoll SR1 WUF2 LL_PWR_IsActiveFlag_WU2
  1219. * @retval State of bit (1 or 0).
  1220. */
  1221. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_WU2(void)
  1222. {
  1223. return ((READ_BIT(PWR->SR1, PWR_SR1_WUF2) == (PWR_SR1_WUF2)) ? 1UL : 0UL);
  1224. }
  1225. /**
  1226. * @brief Get Wake-up Flag 1
  1227. * @rmtoll SR1 WUF1 LL_PWR_IsActiveFlag_WU1
  1228. * @retval State of bit (1 or 0).
  1229. */
  1230. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_WU1(void)
  1231. {
  1232. return ((READ_BIT(PWR->SR1, PWR_SR1_WUF1) == (PWR_SR1_WUF1)) ? 1UL : 0UL);
  1233. }
  1234. /**
  1235. * @brief Clear Stand-By Flag
  1236. * @rmtoll SCR CSBF LL_PWR_ClearFlag_SB
  1237. * @retval None
  1238. */
  1239. __STATIC_INLINE void LL_PWR_ClearFlag_SB(void)
  1240. {
  1241. WRITE_REG(PWR->SCR, PWR_SCR_CSBF);
  1242. }
  1243. /**
  1244. * @brief Clear Wake-up Flags
  1245. * @rmtoll SCR CWUF LL_PWR_ClearFlag_WU
  1246. * @retval None
  1247. */
  1248. __STATIC_INLINE void LL_PWR_ClearFlag_WU(void)
  1249. {
  1250. WRITE_REG(PWR->SCR, PWR_SCR_CWUF);
  1251. }
  1252. /**
  1253. * @brief Clear Wake-up Flag 6
  1254. * @rmtoll SCR CWUF6 LL_PWR_ClearFlag_WU6
  1255. * @retval None
  1256. */
  1257. __STATIC_INLINE void LL_PWR_ClearFlag_WU6(void)
  1258. {
  1259. WRITE_REG(PWR->SCR, PWR_SCR_CWUF6);
  1260. }
  1261. #if defined(PWR_CR3_EWUP5)
  1262. /**
  1263. * @brief Clear Wake-up Flag 5
  1264. * @rmtoll SCR CWUF5 LL_PWR_ClearFlag_WU5
  1265. * @retval None
  1266. */
  1267. __STATIC_INLINE void LL_PWR_ClearFlag_WU5(void)
  1268. {
  1269. WRITE_REG(PWR->SCR, PWR_SCR_CWUF5);
  1270. }
  1271. #endif
  1272. /**
  1273. * @brief Clear Wake-up Flag 4
  1274. * @rmtoll SCR CWUF4 LL_PWR_ClearFlag_WU4
  1275. * @retval None
  1276. */
  1277. __STATIC_INLINE void LL_PWR_ClearFlag_WU4(void)
  1278. {
  1279. WRITE_REG(PWR->SCR, PWR_SCR_CWUF4);
  1280. }
  1281. #if defined(PWR_CR3_EWUP3)
  1282. /**
  1283. * @brief Clear Wake-up Flag 3
  1284. * @rmtoll SCR CWUF3 LL_PWR_ClearFlag_WU3
  1285. * @retval None
  1286. */
  1287. __STATIC_INLINE void LL_PWR_ClearFlag_WU3(void)
  1288. {
  1289. WRITE_REG(PWR->SCR, PWR_SCR_CWUF3);
  1290. }
  1291. #endif
  1292. /**
  1293. * @brief Clear Wake-up Flag 2
  1294. * @rmtoll SCR CWUF2 LL_PWR_ClearFlag_WU2
  1295. * @retval None
  1296. */
  1297. __STATIC_INLINE void LL_PWR_ClearFlag_WU2(void)
  1298. {
  1299. WRITE_REG(PWR->SCR, PWR_SCR_CWUF2);
  1300. }
  1301. /**
  1302. * @brief Clear Wake-up Flag 1
  1303. * @rmtoll SCR CWUF1 LL_PWR_ClearFlag_WU1
  1304. * @retval None
  1305. */
  1306. __STATIC_INLINE void LL_PWR_ClearFlag_WU1(void)
  1307. {
  1308. WRITE_REG(PWR->SCR, PWR_SCR_CWUF1);
  1309. }
  1310. #if defined (PWR_PVM_SUPPORT)
  1311. /**
  1312. * @brief Indicate whether VDD voltage is below or above the selected PVD
  1313. * threshold
  1314. * @rmtoll SR2 PVDMO_USB LL_PWR_IsActiveFlag_PVMOUSB
  1315. * @retval State of bit (1 or 0).
  1316. */
  1317. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_PVMOUSB(void)
  1318. {
  1319. return ((READ_BIT(PWR->SR2, PWR_SR2_PVMO_USB) == (PWR_SR2_PVMO_USB)) ? 1UL : 0UL);
  1320. }
  1321. #endif
  1322. #if defined(PWR_SR2_PVDO)
  1323. /**
  1324. * @brief Indicate whether VDD voltage is below or above the selected PVD
  1325. * threshold
  1326. * @rmtoll SR2 PVDO LL_PWR_IsActiveFlag_PVDO
  1327. * @retval State of bit (1 or 0).
  1328. */
  1329. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_PVDO(void)
  1330. {
  1331. return ((READ_BIT(PWR->SR2, PWR_SR2_PVDO) == (PWR_SR2_PVDO)) ? 1UL : 0UL);
  1332. }
  1333. #endif
  1334. /**
  1335. * @brief Indicate whether the regulator is ready in the selected voltage
  1336. * range or if its output voltage is still changing to the required
  1337. * voltage level
  1338. * @note: Take care, return value "0" means the regulator is ready.
  1339. * Return value "1" means the output voltage range is still changing.
  1340. * @rmtoll SR2 VOSF LL_PWR_IsActiveFlag_VOS
  1341. * @retval State of bit (1 or 0).
  1342. */
  1343. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_VOS(void)
  1344. {
  1345. return ((READ_BIT(PWR->SR2, PWR_SR2_VOSF) == (PWR_SR2_VOSF)) ? 1UL : 0UL);
  1346. }
  1347. /**
  1348. * @brief Indicate whether the regulator is ready in main mode or is in
  1349. * low-power mode
  1350. * @note: Take care, return value "0" means regulator is ready in main mode
  1351. * Return value "1" means regulator is in low-power mode (LPR)
  1352. * @rmtoll SR2 REGLPF LL_PWR_IsActiveFlag_REGLPF
  1353. * @retval State of bit (1 or 0).
  1354. */
  1355. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_REGLPF(void)
  1356. {
  1357. return ((READ_BIT(PWR->SR2, PWR_SR2_REGLPF) == (PWR_SR2_REGLPF)) ? 1UL : 0UL);
  1358. }
  1359. /**
  1360. * @brief Indicate whether or not the low-power regulator is ready
  1361. * @rmtoll SR2 REGLPS LL_PWR_IsActiveFlag_REGLPS
  1362. * @retval State of bit (1 or 0).
  1363. */
  1364. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_REGLPS(void)
  1365. {
  1366. return ((READ_BIT(PWR->SR2, PWR_SR2_REGLPS) == (PWR_SR2_REGLPS)) ? 1UL : 0UL);
  1367. }
  1368. /**
  1369. * @brief Indicate whether or not the flash is ready to be accessed
  1370. * @rmtoll SR2 FLASH_RDY LL_PWR_IsActiveFlag_FLASH_RDY
  1371. * @retval State of bit (1 or 0).
  1372. */
  1373. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_FLASH_RDY(void)
  1374. {
  1375. return ((READ_BIT(PWR->SR2, PWR_SR2_FLASH_RDY) == (PWR_SR2_FLASH_RDY)) ? 1UL : 0UL);
  1376. }
  1377. /**
  1378. * @}
  1379. */
  1380. #if defined(USE_FULL_LL_DRIVER)
  1381. /** @defgroup PWR_LL_EF_Init De-initialization function
  1382. * @{
  1383. */
  1384. ErrorStatus LL_PWR_DeInit(void);
  1385. /**
  1386. * @}
  1387. */
  1388. #endif /* USE_FULL_LL_DRIVER */
  1389. /**
  1390. * @}
  1391. */
  1392. /**
  1393. * @}
  1394. */
  1395. #endif /* defined(PWR) */
  1396. /**
  1397. * @}
  1398. */
  1399. #ifdef __cplusplus
  1400. }
  1401. #endif
  1402. #endif /* STM32G0xx_LL_PWR_H */
  1403. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/