stm32g0xx_ll_pwr.h 50 KB

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