stm32g0xx_ll_pwr.h 49 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529
  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 /* PWR_CR3_EWUP3 */
  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 /* PWR_CR3_EWUP3 */
  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 /* PWR_SR2_PVDO */
  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 /* PWR_CR1_LPMS_2 */
  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 /* PWR_CR2_PVDE */
  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 /* PWR_PVM_SUPPORT */
  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 /* PWR_CR3_EWUP3 */
  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 /* PWR_CR3_EWUP5 */
  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 /* GPIOE */
  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. /**
  436. * @brief Enable VDDUSB supply
  437. * @rmtoll CR2 USV LL_PWR_EnableVddUSB
  438. * @retval None
  439. */
  440. __STATIC_INLINE void LL_PWR_EnableVddUSB(void)
  441. {
  442. SET_BIT(PWR->CR2, PWR_CR2_USV);
  443. }
  444. /**
  445. * @brief Disable VDDUSB supply
  446. * @rmtoll CR2 USV LL_PWR_DisableVddUSB
  447. * @retval None
  448. */
  449. __STATIC_INLINE void LL_PWR_DisableVddUSB(void)
  450. {
  451. CLEAR_BIT(PWR->CR2, PWR_CR2_USV);
  452. }
  453. /**
  454. * @brief Check if VDDUSB supply is enabled
  455. * @rmtoll CR2 USV LL_PWR_IsEnabledVddUSB
  456. * @retval State of bit (1 or 0).
  457. */
  458. __STATIC_INLINE uint32_t LL_PWR_IsEnabledVddUSB(void)
  459. {
  460. return ((READ_BIT(PWR->CR2, PWR_CR2_USV) == (PWR_CR2_USV)) ? 1UL : 0UL);
  461. }
  462. #endif /* STM32G0C1xx || STM32G0B1xx */
  463. #if defined (PWR_PVM_SUPPORT)
  464. /**
  465. * @brief Enable the Power Voltage Monitoring on a peripheral
  466. * @rmtoll CR2 PVMUSB LL_PWR_EnablePVM
  467. * @param PeriphVoltage This parameter can be one of the following values:
  468. * @arg @ref LL_PWR_PVM_USB (*)
  469. *
  470. * (*) value not defined in all devices
  471. * @retval None
  472. */
  473. __STATIC_INLINE void LL_PWR_EnablePVM(uint32_t PeriphVoltage)
  474. {
  475. SET_BIT(PWR->CR2, PeriphVoltage);
  476. }
  477. /**
  478. * @brief Disable the Power Voltage Monitoring on a peripheral
  479. * @rmtoll CR2 PVMUSB LL_PWR_DisablePVM
  480. * @param PeriphVoltage This parameter can be one of the following values:
  481. * @arg @ref LL_PWR_PVM_USB (*)
  482. *
  483. * (*) value not defined in all devices
  484. * @retval None
  485. */
  486. __STATIC_INLINE void LL_PWR_DisablePVM(uint32_t PeriphVoltage)
  487. {
  488. CLEAR_BIT(PWR->CR2, PeriphVoltage);
  489. }
  490. /**
  491. * @brief Check if Power Voltage Monitoring is enabled on a peripheral
  492. * @rmtoll CR2 PVMUSB LL_PWR_IsEnabledPVM
  493. * @param PeriphVoltage This parameter can be one of the following values:
  494. * @arg @ref LL_PWR_PVM_USB (*)
  495. *
  496. * (*) value not defined in all devices
  497. * @retval State of bit (1 or 0).
  498. */
  499. __STATIC_INLINE uint32_t LL_PWR_IsEnabledPVM(uint32_t PeriphVoltage)
  500. {
  501. return ((READ_BIT(PWR->CR2, PeriphVoltage) == (PeriphVoltage)) ? 1UL : 0UL);
  502. }
  503. #endif /* PWR_PVM_SUPPORT */
  504. /**
  505. * @brief Set Low-Power mode
  506. * @rmtoll CR1 LPMS LL_PWR_SetPowerMode
  507. * @param LowPowerMode This parameter can be one of the following values:
  508. * @arg @ref LL_PWR_MODE_STOP0
  509. * @arg @ref LL_PWR_MODE_STOP1
  510. * @arg @ref LL_PWR_MODE_STANDBY
  511. * @arg @ref LL_PWR_MODE_SHUTDOWN
  512. * @retval None
  513. */
  514. __STATIC_INLINE void LL_PWR_SetPowerMode(uint32_t LowPowerMode)
  515. {
  516. MODIFY_REG(PWR->CR1, PWR_CR1_LPMS, LowPowerMode);
  517. }
  518. /**
  519. * @brief Get Low-Power mode
  520. * @rmtoll CR1 LPMS LL_PWR_GetPowerMode
  521. * @retval Returned value can be one of the following values:
  522. * @arg @ref LL_PWR_MODE_STOP0
  523. * @arg @ref LL_PWR_MODE_STOP1
  524. * @arg @ref LL_PWR_MODE_STANDBY
  525. * @arg @ref LL_PWR_MODE_SHUTDOWN
  526. */
  527. __STATIC_INLINE uint32_t LL_PWR_GetPowerMode(void)
  528. {
  529. return (uint32_t)(READ_BIT(PWR->CR1, PWR_CR1_LPMS));
  530. }
  531. #if defined (PWR_CR2_PVDE)
  532. /**
  533. * @brief Configure the high voltage threshold detected by the Power Voltage Detector
  534. * @rmtoll CR2 PLS LL_PWR_SetPVDHighLevel
  535. * @param PVDHighLevel This parameter can be one of the following values:
  536. * @arg @ref LL_PWR_PVDHLEVEL_0
  537. * @arg @ref LL_PWR_PVDHLEVEL_1
  538. * @arg @ref LL_PWR_PVDHLEVEL_2
  539. * @arg @ref LL_PWR_PVDHLEVEL_3
  540. * @arg @ref LL_PWR_PVDHLEVEL_4
  541. * @arg @ref LL_PWR_PVDHLEVEL_5
  542. * @arg @ref LL_PWR_PVDHLEVEL_6
  543. * @arg @ref LL_PWR_PVDHLEVEL_7
  544. * @retval None
  545. */
  546. __STATIC_INLINE void LL_PWR_SetPVDHighLevel(uint32_t PVDHighLevel)
  547. {
  548. MODIFY_REG(PWR->CR2, PWR_CR2_PVDRT, PVDHighLevel);
  549. }
  550. /**
  551. * @brief Get the voltage threshold detection
  552. * @rmtoll CR2 PLS LL_PWR_GetPVDHighLevel
  553. * @retval Returned value can be one of the following values:
  554. * @arg @ref LL_PWR_PVDHLEVEL_0
  555. * @arg @ref LL_PWR_PVDHLEVEL_1
  556. * @arg @ref LL_PWR_PVDHLEVEL_2
  557. * @arg @ref LL_PWR_PVDHLEVEL_3
  558. * @arg @ref LL_PWR_PVDHLEVEL_4
  559. * @arg @ref LL_PWR_PVDHLEVEL_5
  560. * @arg @ref LL_PWR_PVDHLEVEL_6
  561. * @arg @ref LL_PWR_PVDHLEVEL_7
  562. */
  563. __STATIC_INLINE uint32_t LL_PWR_GetPVDHighLevel(void)
  564. {
  565. return (uint32_t)(READ_BIT(PWR->CR2, PWR_CR2_PVDRT));
  566. }
  567. /**
  568. * @brief Configure the low voltage threshold detected by the Power Voltage Detector
  569. * @rmtoll CR2 PLS LL_PWR_SetPVDLowLevel
  570. * @param PVDLowLevel This parameter can be one of the following values:
  571. * @arg @ref LL_PWR_PVDLLEVEL_0
  572. * @arg @ref LL_PWR_PVDLLEVEL_1
  573. * @arg @ref LL_PWR_PVDLLEVEL_2
  574. * @arg @ref LL_PWR_PVDLLEVEL_3
  575. * @arg @ref LL_PWR_PVDLLEVEL_4
  576. * @arg @ref LL_PWR_PVDLLEVEL_5
  577. * @arg @ref LL_PWR_PVDLLEVEL_6
  578. * @retval None
  579. */
  580. __STATIC_INLINE void LL_PWR_SetPVDLowLevel(uint32_t PVDLowLevel)
  581. {
  582. MODIFY_REG(PWR->CR2, PWR_CR2_PVDFT, PVDLowLevel);
  583. }
  584. /**
  585. * @brief Get the low voltage threshold detection
  586. * @rmtoll CR2 PLS LL_PWR_GetPVDLowLevel
  587. * @retval Returned value can be one of the following values:
  588. * @arg @ref LL_PWR_PVDLLEVEL_0
  589. * @arg @ref LL_PWR_PVDLLEVEL_1
  590. * @arg @ref LL_PWR_PVDLLEVEL_2
  591. * @arg @ref LL_PWR_PVDLLEVEL_3
  592. * @arg @ref LL_PWR_PVDLLEVEL_4
  593. * @arg @ref LL_PWR_PVDLLEVEL_5
  594. * @arg @ref LL_PWR_PVDLLEVEL_6
  595. */
  596. __STATIC_INLINE uint32_t LL_PWR_GetPVDLowLevel(void)
  597. {
  598. return (uint32_t)(READ_BIT(PWR->CR2, PWR_CR2_PVDFT));
  599. }
  600. /**
  601. * @brief Enable Power Voltage Detector
  602. * @rmtoll CR2 PVDE LL_PWR_EnablePVD
  603. * @retval None
  604. */
  605. __STATIC_INLINE void LL_PWR_EnablePVD(void)
  606. {
  607. SET_BIT(PWR->CR2, PWR_CR2_PVDE);
  608. }
  609. /**
  610. * @brief Disable Power Voltage Detector
  611. * @rmtoll CR2 PVDE LL_PWR_DisablePVD
  612. * @retval None
  613. */
  614. __STATIC_INLINE void LL_PWR_DisablePVD(void)
  615. {
  616. CLEAR_BIT(PWR->CR2, PWR_CR2_PVDE);
  617. }
  618. /**
  619. * @brief Check if Power Voltage Detector is enabled
  620. * @rmtoll CR2 PVDE LL_PWR_IsEnabledPVD
  621. * @retval State of bit (1 or 0).
  622. */
  623. __STATIC_INLINE uint32_t LL_PWR_IsEnabledPVD(void)
  624. {
  625. return ((READ_BIT(PWR->CR2, PWR_CR2_PVDE) == (PWR_CR2_PVDE)) ? 1UL : 0UL);
  626. }
  627. #endif /* PWR_CR2_PVDE */
  628. /**
  629. * @brief Enable Internal Wake-up line
  630. * @rmtoll CR3 EIWF LL_PWR_EnableInternWU
  631. * @retval None
  632. */
  633. __STATIC_INLINE void LL_PWR_EnableInternWU(void)
  634. {
  635. SET_BIT(PWR->CR3, PWR_CR3_EIWUL);
  636. }
  637. /**
  638. * @brief Disable Internal Wake-up line
  639. * @rmtoll CR3 EIWF LL_PWR_DisableInternWU
  640. * @retval None
  641. */
  642. __STATIC_INLINE void LL_PWR_DisableInternWU(void)
  643. {
  644. CLEAR_BIT(PWR->CR3, PWR_CR3_EIWUL);
  645. }
  646. /**
  647. * @brief Check if Internal Wake-up line is enabled
  648. * @rmtoll CR3 EIWF LL_PWR_IsEnabledInternWU
  649. * @retval State of bit (1 or 0).
  650. */
  651. __STATIC_INLINE uint32_t LL_PWR_IsEnabledInternWU(void)
  652. {
  653. return ((READ_BIT(PWR->CR3, PWR_CR3_EIWUL) == (PWR_CR3_EIWUL)) ? 1UL : 0UL);
  654. }
  655. /**
  656. * @brief Enable pull-up and pull-down configuration
  657. * @rmtoll CR3 APC LL_PWR_EnablePUPDCfg
  658. * @retval None
  659. */
  660. __STATIC_INLINE void LL_PWR_EnablePUPDCfg(void)
  661. {
  662. SET_BIT(PWR->CR3, PWR_CR3_APC);
  663. }
  664. /**
  665. * @brief Disable pull-up and pull-down configuration
  666. * @rmtoll CR3 APC LL_PWR_DisablePUPDCfg
  667. * @retval None
  668. */
  669. __STATIC_INLINE void LL_PWR_DisablePUPDCfg(void)
  670. {
  671. CLEAR_BIT(PWR->CR3, PWR_CR3_APC);
  672. }
  673. /**
  674. * @brief Check if pull-up and pull-down configuration is enabled
  675. * @rmtoll CR3 APC LL_PWR_IsEnabledPUPDCfg
  676. * @retval State of bit (1 or 0).
  677. */
  678. __STATIC_INLINE uint32_t LL_PWR_IsEnabledPUPDCfg(void)
  679. {
  680. return ((READ_BIT(PWR->CR3, PWR_CR3_APC) == (PWR_CR3_APC)) ? 1UL : 0UL);
  681. }
  682. #if defined(PWR_CR3_RRS)
  683. /**
  684. * @brief Enable SRAM content retention in Standby mode
  685. * @rmtoll CR3 RRS LL_PWR_EnableSRAMRetention
  686. * @retval None
  687. */
  688. __STATIC_INLINE void LL_PWR_EnableSRAMRetention(void)
  689. {
  690. SET_BIT(PWR->CR3, PWR_CR3_RRS);
  691. }
  692. /**
  693. * @brief Disable SRAM content retention in Standby mode
  694. * @rmtoll CR3 RRS LL_PWR_DisableSRAMRetention
  695. * @retval None
  696. */
  697. __STATIC_INLINE void LL_PWR_DisableSRAMRetention(void)
  698. {
  699. CLEAR_BIT(PWR->CR3, PWR_CR3_RRS);
  700. }
  701. /**
  702. * @brief Check if SRAM content retention in Standby mode is enabled
  703. * @rmtoll CR3 RRS LL_PWR_IsEnabledSRAMRetention
  704. * @retval State of bit (1 or 0).
  705. */
  706. __STATIC_INLINE uint32_t LL_PWR_IsEnabledSRAMRetention(void)
  707. {
  708. return ((READ_BIT(PWR->CR3, PWR_CR3_RRS) == (PWR_CR3_RRS)) ? 1UL : 0UL);
  709. }
  710. #endif /* PWR_CR3_RRS */
  711. #if defined(PWR_CR3_ENB_ULP)
  712. /**
  713. * @brief Enable sampling mode of LPMMU reset block
  714. * @rmtoll CR3 ENB_ULP LL_PWR_EnableLPMUResetSamplingMode
  715. * @retval None
  716. */
  717. __STATIC_INLINE void LL_PWR_EnableLPMUResetSamplingMode(void)
  718. {
  719. SET_BIT(PWR->CR3, PWR_CR3_ENB_ULP);
  720. }
  721. /**
  722. * @brief Disable sampling mode of LPMMU reset block
  723. * @rmtoll CR3 ENB_ULP LL_PWR_DisableLPMUResetSamplingMode
  724. * @retval None
  725. */
  726. __STATIC_INLINE void LL_PWR_DisableLPMUResetSamplingMode(void)
  727. {
  728. CLEAR_BIT(PWR->CR3, PWR_CR3_ENB_ULP);
  729. }
  730. /**
  731. * @brief Check if sampling mode of LPMMU reset block
  732. * @rmtoll CR3 ENB_ULP LL_PWR_IsEnableLPMUResetSamplingMode
  733. * @retval State of bit (1 or 0).
  734. */
  735. __STATIC_INLINE uint32_t LL_PWR_IsEnableLPMUResetSamplingMode(void)
  736. {
  737. return ((READ_BIT(PWR->CR3, PWR_CR3_ENB_ULP) == (PWR_CR3_ENB_ULP)) ? 1UL : 0UL);
  738. }
  739. #endif /* PWR_CR3_ENB_ULP */
  740. /**
  741. * @brief Enable the WakeUp PINx functionality
  742. * @rmtoll CR3 EWUP1 LL_PWR_EnableWakeUpPin\n
  743. * CR3 EWUP2 LL_PWR_EnableWakeUpPin\n
  744. * CR3 EWUP3 LL_PWR_EnableWakeUpPin\n
  745. * CR3 EWUP4 LL_PWR_EnableWakeUpPin\n
  746. * CR3 EWUP5 LL_PWR_EnableWakeUpPin\n
  747. * CR3 EWUP6 LL_PWR_EnableWakeUpPin
  748. * @param WakeUpPin This parameter can be one of the following values:
  749. * @arg @ref LL_PWR_WAKEUP_PIN1
  750. * @arg @ref LL_PWR_WAKEUP_PIN2
  751. * @arg @ref LL_PWR_WAKEUP_PIN3 (*)
  752. * @arg @ref LL_PWR_WAKEUP_PIN4
  753. * @arg @ref LL_PWR_WAKEUP_PIN5 (*)
  754. * @arg @ref LL_PWR_WAKEUP_PIN6
  755. * @retval None
  756. * @note (*) availability depends on devices
  757. */
  758. __STATIC_INLINE void LL_PWR_EnableWakeUpPin(uint32_t WakeUpPin)
  759. {
  760. SET_BIT(PWR->CR3, WakeUpPin);
  761. }
  762. /**
  763. * @brief Disable the WakeUp PINx functionality
  764. * @rmtoll CR3 EWUP1 LL_PWR_DisableWakeUpPin\n
  765. * CR3 EWUP2 LL_PWR_DisableWakeUpPin\n
  766. * CR3 EWUP3 LL_PWR_DisableWakeUpPin\n
  767. * CR3 EWUP4 LL_PWR_DisableWakeUpPin\n
  768. * CR3 EWUP5 LL_PWR_DisableWakeUpPin\n
  769. * CR3 EWUP6 LL_PWR_DisableWakeUpPin
  770. * @param WakeUpPin This parameter can be one of the following values:
  771. * @arg @ref LL_PWR_WAKEUP_PIN1
  772. * @arg @ref LL_PWR_WAKEUP_PIN2
  773. * @arg @ref LL_PWR_WAKEUP_PIN3 (*)
  774. * @arg @ref LL_PWR_WAKEUP_PIN4
  775. * @arg @ref LL_PWR_WAKEUP_PIN5 (*)
  776. * @arg @ref LL_PWR_WAKEUP_PIN6
  777. * @retval None
  778. * @note (*) availability depends on devices
  779. */
  780. __STATIC_INLINE void LL_PWR_DisableWakeUpPin(uint32_t WakeUpPin)
  781. {
  782. CLEAR_BIT(PWR->CR3, WakeUpPin);
  783. }
  784. /**
  785. * @brief Check if the WakeUp PINx functionality is enabled
  786. * @rmtoll CR3 EWUP1 LL_PWR_IsEnabledWakeUpPin\n
  787. * CR3 EWUP2 LL_PWR_IsEnabledWakeUpPin\n
  788. * CR3 EWUP3 LL_PWR_IsEnabledWakeUpPin\n
  789. * CR3 EWUP4 LL_PWR_IsEnabledWakeUpPin\n
  790. * CR3 EWUP5 LL_PWR_IsEnabledWakeUpPin\n
  791. * CR3 EWUP6 LL_PWR_IsEnabledWakeUpPin
  792. * @param WakeUpPin This parameter can be one of the following values:
  793. * @arg @ref LL_PWR_WAKEUP_PIN1
  794. * @arg @ref LL_PWR_WAKEUP_PIN2
  795. * @arg @ref LL_PWR_WAKEUP_PIN3 (*)
  796. * @arg @ref LL_PWR_WAKEUP_PIN4
  797. * @arg @ref LL_PWR_WAKEUP_PIN5 (*)
  798. * @arg @ref LL_PWR_WAKEUP_PIN6
  799. * @retval State of bit (1 or 0).
  800. * @note (*) availability depends on devices
  801. */
  802. __STATIC_INLINE uint32_t LL_PWR_IsEnabledWakeUpPin(uint32_t WakeUpPin)
  803. {
  804. return ((READ_BIT(PWR->CR3, WakeUpPin) == (WakeUpPin)) ? 1UL : 0UL);
  805. }
  806. /**
  807. * @brief Set the resistor impedance
  808. * @rmtoll CR4 VBRS LL_PWR_SetBattChargResistor
  809. * @param Resistor This parameter can be one of the following values:
  810. * @arg @ref LL_PWR_BATTCHARG_RESISTOR_5K
  811. * @arg @ref LL_PWR_BATTCHARG_RESISTOR_1_5K
  812. * @retval None
  813. */
  814. __STATIC_INLINE void LL_PWR_SetBattChargResistor(uint32_t Resistor)
  815. {
  816. MODIFY_REG(PWR->CR4, PWR_CR4_VBRS, Resistor);
  817. }
  818. /**
  819. * @brief Get the resistor impedance
  820. * @rmtoll CR4 VBRS LL_PWR_GetBattChargResistor
  821. * @retval Returned value can be one of the following values:
  822. * @arg @ref LL_PWR_BATTCHARG_RESISTOR_5K
  823. * @arg @ref LL_PWR_BATTCHARG_RESISTOR_1_5K
  824. */
  825. __STATIC_INLINE uint32_t LL_PWR_GetBattChargResistor(void)
  826. {
  827. return (uint32_t)(READ_BIT(PWR->CR4, PWR_CR4_VBRS));
  828. }
  829. /**
  830. * @brief Enable battery charging
  831. * @rmtoll CR4 VBE LL_PWR_EnableBatteryCharging
  832. * @retval None
  833. */
  834. __STATIC_INLINE void LL_PWR_EnableBatteryCharging(void)
  835. {
  836. SET_BIT(PWR->CR4, PWR_CR4_VBE);
  837. }
  838. /**
  839. * @brief Disable battery charging
  840. * @rmtoll CR4 VBE LL_PWR_DisableBatteryCharging
  841. * @retval None
  842. */
  843. __STATIC_INLINE void LL_PWR_DisableBatteryCharging(void)
  844. {
  845. CLEAR_BIT(PWR->CR4, PWR_CR4_VBE);
  846. }
  847. /**
  848. * @brief Check if battery charging is enabled
  849. * @rmtoll CR4 VBE LL_PWR_IsEnabledBatteryCharging
  850. * @retval State of bit (1 or 0).
  851. */
  852. __STATIC_INLINE uint32_t LL_PWR_IsEnabledBatteryCharging(void)
  853. {
  854. return ((READ_BIT(PWR->CR4, PWR_CR4_VBE) == (PWR_CR4_VBE)) ? 1UL : 0UL);
  855. }
  856. /**
  857. * @brief Set the Wake-Up pin polarity low for the event detection
  858. * @rmtoll CR4 WP1 LL_PWR_SetWakeUpPinPolarityLow\n
  859. * CR4 WP2 LL_PWR_SetWakeUpPinPolarityLow\n
  860. * CR4 WP3 LL_PWR_SetWakeUpPinPolarityLow\n
  861. * CR4 WP4 LL_PWR_SetWakeUpPinPolarityLow\n
  862. * CR4 WP5 LL_PWR_SetWakeUpPinPolarityLow\n
  863. * CR4 WP6 LL_PWR_SetWakeUpPinPolarityLow
  864. * @param WakeUpPin This parameter can be one of the following values:
  865. * @arg @ref LL_PWR_WAKEUP_PIN1
  866. * @arg @ref LL_PWR_WAKEUP_PIN2
  867. * @arg @ref LL_PWR_WAKEUP_PIN3 (*)
  868. * @arg @ref LL_PWR_WAKEUP_PIN4
  869. * @arg @ref LL_PWR_WAKEUP_PIN5 (*)
  870. * @arg @ref LL_PWR_WAKEUP_PIN6
  871. * @retval None
  872. * @note (*) availability depends on devices
  873. */
  874. __STATIC_INLINE void LL_PWR_SetWakeUpPinPolarityLow(uint32_t WakeUpPin)
  875. {
  876. SET_BIT(PWR->CR4, WakeUpPin);
  877. }
  878. /**
  879. * @brief Set the Wake-Up pin polarity high for the event detection
  880. * @rmtoll CR4 WP1 LL_PWR_SetWakeUpPinPolarityHigh\n
  881. * CR4 WP2 LL_PWR_SetWakeUpPinPolarityHigh\n
  882. * CR4 WP3 LL_PWR_SetWakeUpPinPolarityHigh\n
  883. * CR4 WP4 LL_PWR_SetWakeUpPinPolarityHigh\n
  884. * CR4 WP5 LL_PWR_SetWakeUpPinPolarityHigh\n
  885. * CR4 WP6 LL_PWR_SetWakeUpPinPolarityHigh
  886. * @param WakeUpPin This parameter can be one of the following values:
  887. * @arg @ref LL_PWR_WAKEUP_PIN1
  888. * @arg @ref LL_PWR_WAKEUP_PIN2
  889. * @arg @ref LL_PWR_WAKEUP_PIN3 (*)
  890. * @arg @ref LL_PWR_WAKEUP_PIN4
  891. * @arg @ref LL_PWR_WAKEUP_PIN5 (*)
  892. * @arg @ref LL_PWR_WAKEUP_PIN6
  893. * @note (*) availability depends on devices
  894. * @retval None
  895. */
  896. __STATIC_INLINE void LL_PWR_SetWakeUpPinPolarityHigh(uint32_t WakeUpPin)
  897. {
  898. CLEAR_BIT(PWR->CR4, WakeUpPin);
  899. }
  900. /**
  901. * @brief Get the Wake-Up pin polarity for the event detection
  902. * @rmtoll CR4 WP1 LL_PWR_IsWakeUpPinPolarityLow\n
  903. * CR4 WP2 LL_PWR_IsWakeUpPinPolarityLow\n
  904. * CR4 WP3 LL_PWR_IsWakeUpPinPolarityLow\n
  905. * CR4 WP4 LL_PWR_IsWakeUpPinPolarityLow\n
  906. * CR4 WP5 LL_PWR_IsWakeUpPinPolarityLow\n
  907. * CR4 WP6 LL_PWR_IsWakeUpPinPolarityLow
  908. * @param WakeUpPin This parameter can be one of the following values:
  909. * @arg @ref LL_PWR_WAKEUP_PIN1
  910. * @arg @ref LL_PWR_WAKEUP_PIN2
  911. * @arg @ref LL_PWR_WAKEUP_PIN3 (*)
  912. * @arg @ref LL_PWR_WAKEUP_PIN4
  913. * @arg @ref LL_PWR_WAKEUP_PIN5 (*)
  914. * @arg @ref LL_PWR_WAKEUP_PIN6
  915. * @note (*) availability depends on devices
  916. * @retval State of bit (1 or 0).
  917. */
  918. __STATIC_INLINE uint32_t LL_PWR_IsWakeUpPinPolarityLow(uint32_t WakeUpPin)
  919. {
  920. return ((READ_BIT(PWR->CR4, WakeUpPin) == (WakeUpPin)) ? 1UL : 0UL);
  921. }
  922. /**
  923. * @brief Enable GPIO pull-up state in Standby and Shutdown modes
  924. * @rmtoll PUCRA PU0-15 LL_PWR_EnableGPIOPullUp\n
  925. * PUCRB PU0-15 LL_PWR_EnableGPIOPullUp\n
  926. * PUCRC PU0-15 LL_PWR_EnableGPIOPullUp\n
  927. * PUCRD PU0-15 LL_PWR_EnableGPIOPullUp\n
  928. * PUCRE PU0-15 LL_PWR_EnableGPIOPullUp\n
  929. * PUCRF PU0-13 LL_PWR_EnableGPIOPullUp
  930. * @param GPIO This parameter can be one of the following values:
  931. * @arg @ref LL_PWR_GPIO_A
  932. * @arg @ref LL_PWR_GPIO_B
  933. * @arg @ref LL_PWR_GPIO_C
  934. * @arg @ref LL_PWR_GPIO_D
  935. * @arg @ref LL_PWR_GPIO_E (*)
  936. * @arg @ref LL_PWR_GPIO_F
  937. * @param GPIONumber This parameter can be one of the following values:
  938. * @arg @ref LL_PWR_GPIO_BIT_0
  939. * @arg @ref LL_PWR_GPIO_BIT_1
  940. * @arg @ref LL_PWR_GPIO_BIT_2
  941. * @arg @ref LL_PWR_GPIO_BIT_3
  942. * @arg @ref LL_PWR_GPIO_BIT_4
  943. * @arg @ref LL_PWR_GPIO_BIT_5
  944. * @arg @ref LL_PWR_GPIO_BIT_6
  945. * @arg @ref LL_PWR_GPIO_BIT_7
  946. * @arg @ref LL_PWR_GPIO_BIT_8
  947. * @arg @ref LL_PWR_GPIO_BIT_9
  948. * @arg @ref LL_PWR_GPIO_BIT_10
  949. * @arg @ref LL_PWR_GPIO_BIT_11
  950. * @arg @ref LL_PWR_GPIO_BIT_12
  951. * @arg @ref LL_PWR_GPIO_BIT_13
  952. * @arg @ref LL_PWR_GPIO_BIT_14
  953. * @arg @ref LL_PWR_GPIO_BIT_15
  954. * @retval None
  955. */
  956. __STATIC_INLINE void LL_PWR_EnableGPIOPullUp(uint32_t GPIO, uint32_t GPIONumber)
  957. {
  958. SET_BIT(*((__IO uint32_t *)GPIO), GPIONumber);
  959. }
  960. /**
  961. * @brief Disable GPIO pull-up state in Standby and Shutdown modes
  962. * @rmtoll PUCRA PU0-15 LL_PWR_DisableGPIOPullUp\n
  963. * PUCRB PU0-15 LL_PWR_DisableGPIOPullUp\n
  964. * PUCRC PU0-15 LL_PWR_DisableGPIOPullUp\n
  965. * PUCRD PU0-15 LL_PWR_DisableGPIOPullUp\n
  966. * PUCRE PU0-15 LL_PWR_DisableGPIOPullUp\n
  967. * PUCRF PU0-13 LL_PWR_DisableGPIOPullUp
  968. * @param GPIO This parameter can be one of the following values:
  969. * @arg @ref LL_PWR_GPIO_A
  970. * @arg @ref LL_PWR_GPIO_B
  971. * @arg @ref LL_PWR_GPIO_C
  972. * @arg @ref LL_PWR_GPIO_D
  973. * @arg @ref LL_PWR_GPIO_E (*)
  974. * @arg @ref LL_PWR_GPIO_F
  975. * @param GPIONumber This parameter can be one of the following values:
  976. * @arg @ref LL_PWR_GPIO_BIT_0
  977. * @arg @ref LL_PWR_GPIO_BIT_1
  978. * @arg @ref LL_PWR_GPIO_BIT_2
  979. * @arg @ref LL_PWR_GPIO_BIT_3
  980. * @arg @ref LL_PWR_GPIO_BIT_4
  981. * @arg @ref LL_PWR_GPIO_BIT_5
  982. * @arg @ref LL_PWR_GPIO_BIT_6
  983. * @arg @ref LL_PWR_GPIO_BIT_7
  984. * @arg @ref LL_PWR_GPIO_BIT_8
  985. * @arg @ref LL_PWR_GPIO_BIT_9
  986. * @arg @ref LL_PWR_GPIO_BIT_10
  987. * @arg @ref LL_PWR_GPIO_BIT_11
  988. * @arg @ref LL_PWR_GPIO_BIT_12
  989. * @arg @ref LL_PWR_GPIO_BIT_13
  990. * @arg @ref LL_PWR_GPIO_BIT_14
  991. * @arg @ref LL_PWR_GPIO_BIT_15
  992. * @retval None
  993. */
  994. __STATIC_INLINE void LL_PWR_DisableGPIOPullUp(uint32_t GPIO, uint32_t GPIONumber)
  995. {
  996. CLEAR_BIT(*((__IO uint32_t *)GPIO), GPIONumber);
  997. }
  998. /**
  999. * @brief Check if GPIO pull-up state is enabled
  1000. * @rmtoll PUCRA PU0-15 LL_PWR_IsEnabledGPIOPullUp\n
  1001. * PUCRB PU0-15 LL_PWR_IsEnabledGPIOPullUp\n
  1002. * PUCRC PU0-15 LL_PWR_IsEnabledGPIOPullUp\n
  1003. * PUCRD PU0-15 LL_PWR_IsEnabledGPIOPullUp\n
  1004. * PUCRE PU0-15 LL_PWR_IsEnabledGPIOPullUp\n
  1005. * PUCRF PU0-13 LL_PWR_IsEnabledGPIOPullUp
  1006. * @param GPIO This parameter can be one of the following values:
  1007. * @arg @ref LL_PWR_GPIO_A
  1008. * @arg @ref LL_PWR_GPIO_B
  1009. * @arg @ref LL_PWR_GPIO_C
  1010. * @arg @ref LL_PWR_GPIO_D
  1011. * @arg @ref LL_PWR_GPIO_E (*)
  1012. * @arg @ref LL_PWR_GPIO_F
  1013. * @param GPIONumber This parameter can be one of the following values:
  1014. * @arg @ref LL_PWR_GPIO_BIT_0
  1015. * @arg @ref LL_PWR_GPIO_BIT_1
  1016. * @arg @ref LL_PWR_GPIO_BIT_2
  1017. * @arg @ref LL_PWR_GPIO_BIT_3
  1018. * @arg @ref LL_PWR_GPIO_BIT_4
  1019. * @arg @ref LL_PWR_GPIO_BIT_5
  1020. * @arg @ref LL_PWR_GPIO_BIT_6
  1021. * @arg @ref LL_PWR_GPIO_BIT_7
  1022. * @arg @ref LL_PWR_GPIO_BIT_8
  1023. * @arg @ref LL_PWR_GPIO_BIT_9
  1024. * @arg @ref LL_PWR_GPIO_BIT_10
  1025. * @arg @ref LL_PWR_GPIO_BIT_11
  1026. * @arg @ref LL_PWR_GPIO_BIT_12
  1027. * @arg @ref LL_PWR_GPIO_BIT_13
  1028. * @arg @ref LL_PWR_GPIO_BIT_14
  1029. * @arg @ref LL_PWR_GPIO_BIT_15
  1030. * @retval State of bit (1 or 0).
  1031. */
  1032. __STATIC_INLINE uint32_t LL_PWR_IsEnabledGPIOPullUp(uint32_t GPIO, uint32_t GPIONumber)
  1033. {
  1034. return ((READ_BIT(*((__IO uint32_t *)GPIO), GPIONumber) == (GPIONumber)) ? 1UL : 0UL);
  1035. }
  1036. /**
  1037. * @brief Enable GPIO pull-down state in Standby and Shutdown modes
  1038. * @rmtoll PDCRA PD0-15 LL_PWR_EnableGPIOPullDown\n
  1039. * PDCRB PD0-15 LL_PWR_EnableGPIOPullDown\n
  1040. * PDCRC PD0-15 LL_PWR_EnableGPIOPullDown\n
  1041. * PDCRD PD0-15 LL_PWR_EnableGPIOPullDown\n
  1042. * PDCRE PD0-15 LL_PWR_EnableGPIOPullDown\n
  1043. * PDCRF PD0-13 LL_PWR_EnableGPIOPullDown
  1044. * @param GPIO This parameter can be one of the following values:
  1045. * @arg @ref LL_PWR_GPIO_A
  1046. * @arg @ref LL_PWR_GPIO_B
  1047. * @arg @ref LL_PWR_GPIO_C
  1048. * @arg @ref LL_PWR_GPIO_D
  1049. * @arg @ref LL_PWR_GPIO_E (*)
  1050. * @arg @ref LL_PWR_GPIO_F
  1051. * @param GPIONumber This parameter can be one of the following values:
  1052. * @arg @ref LL_PWR_GPIO_BIT_0
  1053. * @arg @ref LL_PWR_GPIO_BIT_1
  1054. * @arg @ref LL_PWR_GPIO_BIT_2
  1055. * @arg @ref LL_PWR_GPIO_BIT_3
  1056. * @arg @ref LL_PWR_GPIO_BIT_4
  1057. * @arg @ref LL_PWR_GPIO_BIT_5
  1058. * @arg @ref LL_PWR_GPIO_BIT_6
  1059. * @arg @ref LL_PWR_GPIO_BIT_7
  1060. * @arg @ref LL_PWR_GPIO_BIT_8
  1061. * @arg @ref LL_PWR_GPIO_BIT_9
  1062. * @arg @ref LL_PWR_GPIO_BIT_10
  1063. * @arg @ref LL_PWR_GPIO_BIT_11
  1064. * @arg @ref LL_PWR_GPIO_BIT_12
  1065. * @arg @ref LL_PWR_GPIO_BIT_13
  1066. * @arg @ref LL_PWR_GPIO_BIT_14
  1067. * @arg @ref LL_PWR_GPIO_BIT_15
  1068. * @retval None
  1069. */
  1070. __STATIC_INLINE void LL_PWR_EnableGPIOPullDown(uint32_t GPIO, uint32_t GPIONumber)
  1071. {
  1072. SET_BIT(*((__IO uint32_t *)(GPIO + 4U)), GPIONumber);
  1073. }
  1074. /**
  1075. * @brief Disable GPIO pull-down state in Standby and Shutdown modes
  1076. * @rmtoll PDCRA PD0-15 LL_PWR_DisableGPIOPullDown\n
  1077. * PDCRB PD0-15 LL_PWR_DisableGPIOPullDown\n
  1078. * PDCRC PD0-15 LL_PWR_DisableGPIOPullDown\n
  1079. * PDCRD PD0-15 LL_PWR_DisableGPIOPullDown\n
  1080. * PDCRE PD0-15 LL_PWR_DisableGPIOPullDown\n
  1081. * PDCRF PD0-13 LL_PWR_DisableGPIOPullDown
  1082. * @param GPIO This parameter can be one of the following values:
  1083. * @arg @ref LL_PWR_GPIO_A
  1084. * @arg @ref LL_PWR_GPIO_B
  1085. * @arg @ref LL_PWR_GPIO_C
  1086. * @arg @ref LL_PWR_GPIO_D
  1087. * @arg @ref LL_PWR_GPIO_E (*)
  1088. * @arg @ref LL_PWR_GPIO_F
  1089. * @param GPIONumber This parameter can be one of the following values:
  1090. * @arg @ref LL_PWR_GPIO_BIT_0
  1091. * @arg @ref LL_PWR_GPIO_BIT_1
  1092. * @arg @ref LL_PWR_GPIO_BIT_2
  1093. * @arg @ref LL_PWR_GPIO_BIT_3
  1094. * @arg @ref LL_PWR_GPIO_BIT_4
  1095. * @arg @ref LL_PWR_GPIO_BIT_5
  1096. * @arg @ref LL_PWR_GPIO_BIT_6
  1097. * @arg @ref LL_PWR_GPIO_BIT_7
  1098. * @arg @ref LL_PWR_GPIO_BIT_8
  1099. * @arg @ref LL_PWR_GPIO_BIT_9
  1100. * @arg @ref LL_PWR_GPIO_BIT_10
  1101. * @arg @ref LL_PWR_GPIO_BIT_11
  1102. * @arg @ref LL_PWR_GPIO_BIT_12
  1103. * @arg @ref LL_PWR_GPIO_BIT_13
  1104. * @arg @ref LL_PWR_GPIO_BIT_14
  1105. * @arg @ref LL_PWR_GPIO_BIT_15
  1106. * @retval None
  1107. */
  1108. __STATIC_INLINE void LL_PWR_DisableGPIOPullDown(uint32_t GPIO, uint32_t GPIONumber)
  1109. {
  1110. CLEAR_BIT(*((__IO uint32_t *)(GPIO + 4U)), GPIONumber);
  1111. }
  1112. /**
  1113. * @brief Check if GPIO pull-down state is enabled
  1114. * @rmtoll PDCRA PD0-15 LL_PWR_IsEnabledGPIOPullDown\n
  1115. * PDCRB PD0-15 LL_PWR_IsEnabledGPIOPullDown\n
  1116. * PDCRC PD0-15 LL_PWR_IsEnabledGPIOPullDown\n
  1117. * PDCRD PD0-15 LL_PWR_IsEnabledGPIOPullDown\n
  1118. * PDCRE PD0-15 LL_PWR_IsEnabledGPIOPullDown\n
  1119. * PDCRF PD0-13 LL_PWR_IsEnabledGPIOPullDown
  1120. * @param GPIO This parameter can be one of the following values:
  1121. * @arg @ref LL_PWR_GPIO_A
  1122. * @arg @ref LL_PWR_GPIO_B
  1123. * @arg @ref LL_PWR_GPIO_C
  1124. * @arg @ref LL_PWR_GPIO_D
  1125. * @arg @ref LL_PWR_GPIO_E (*)
  1126. * @arg @ref LL_PWR_GPIO_F
  1127. * @param GPIONumber This parameter can be one of the following values:
  1128. * @arg @ref LL_PWR_GPIO_BIT_0
  1129. * @arg @ref LL_PWR_GPIO_BIT_1
  1130. * @arg @ref LL_PWR_GPIO_BIT_2
  1131. * @arg @ref LL_PWR_GPIO_BIT_3
  1132. * @arg @ref LL_PWR_GPIO_BIT_4
  1133. * @arg @ref LL_PWR_GPIO_BIT_5
  1134. * @arg @ref LL_PWR_GPIO_BIT_6
  1135. * @arg @ref LL_PWR_GPIO_BIT_7
  1136. * @arg @ref LL_PWR_GPIO_BIT_8
  1137. * @arg @ref LL_PWR_GPIO_BIT_9
  1138. * @arg @ref LL_PWR_GPIO_BIT_10
  1139. * @arg @ref LL_PWR_GPIO_BIT_11
  1140. * @arg @ref LL_PWR_GPIO_BIT_12
  1141. * @arg @ref LL_PWR_GPIO_BIT_13
  1142. * @arg @ref LL_PWR_GPIO_BIT_14
  1143. * @arg @ref LL_PWR_GPIO_BIT_15
  1144. * @retval State of bit (1 or 0).
  1145. */
  1146. __STATIC_INLINE uint32_t LL_PWR_IsEnabledGPIOPullDown(uint32_t GPIO, uint32_t GPIONumber)
  1147. {
  1148. return ((READ_BIT(*((__IO uint32_t *)(GPIO + 4U)), GPIONumber) == (GPIONumber)) ? 1UL : 0UL);
  1149. }
  1150. /**
  1151. * @}
  1152. */
  1153. /** @defgroup PWR_LL_EF_FLAG_Management FLAG_Management
  1154. * @{
  1155. */
  1156. /**
  1157. * @brief Get Internal Wake-up line Flag
  1158. * @rmtoll SR1 WUFI LL_PWR_IsActiveFlag_InternWU
  1159. * @retval State of bit (1 or 0).
  1160. */
  1161. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_InternWU(void)
  1162. {
  1163. return ((READ_BIT(PWR->SR1, PWR_SR1_WUFI) == (PWR_SR1_WUFI)) ? 1UL : 0UL);
  1164. }
  1165. /**
  1166. * @brief Get Stand-By Flag
  1167. * @rmtoll SR1 SBF LL_PWR_IsActiveFlag_SB
  1168. * @retval State of bit (1 or 0).
  1169. */
  1170. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_SB(void)
  1171. {
  1172. return ((READ_BIT(PWR->SR1, PWR_SR1_SBF) == (PWR_SR1_SBF)) ? 1UL : 0UL);
  1173. }
  1174. /**
  1175. * @brief Get Wake-up Flag 6
  1176. * @rmtoll SR1 WUF6 LL_PWR_IsActiveFlag_WU6
  1177. * @retval State of bit (1 or 0).
  1178. */
  1179. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_WU6(void)
  1180. {
  1181. return ((READ_BIT(PWR->SR1, PWR_SR1_WUF6) == (PWR_SR1_WUF6)) ? 1UL : 0UL);
  1182. }
  1183. #if defined(PWR_CR3_EWUP5)
  1184. /**
  1185. * @brief Get Wake-up Flag 5
  1186. * @rmtoll SR1 WUF5 LL_PWR_IsActiveFlag_WU5
  1187. * @retval State of bit (1 or 0).
  1188. */
  1189. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_WU5(void)
  1190. {
  1191. return ((READ_BIT(PWR->SR1, PWR_SR1_WUF5) == (PWR_SR1_WUF5)) ? 1UL : 0UL);
  1192. }
  1193. #endif /* PWR_CR3_EWUP5 */
  1194. /**
  1195. * @brief Get Wake-up Flag 4
  1196. * @rmtoll SR1 WUF4 LL_PWR_IsActiveFlag_WU4
  1197. * @retval State of bit (1 or 0).
  1198. */
  1199. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_WU4(void)
  1200. {
  1201. return ((READ_BIT(PWR->SR1, PWR_SR1_WUF4) == (PWR_SR1_WUF4)) ? 1UL : 0UL);
  1202. }
  1203. #if defined(PWR_CR3_EWUP3)
  1204. /**
  1205. * @brief Get Wake-up Flag 3
  1206. * @rmtoll SR1 WUF3 LL_PWR_IsActiveFlag_WU3
  1207. * @retval State of bit (1 or 0).
  1208. */
  1209. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_WU3(void)
  1210. {
  1211. return ((READ_BIT(PWR->SR1, PWR_SR1_WUF3) == (PWR_SR1_WUF3)) ? 1UL : 0UL);
  1212. }
  1213. #endif /* PWR_CR3_EWUP3 */
  1214. /**
  1215. * @brief Get Wake-up Flag 2
  1216. * @rmtoll SR1 WUF2 LL_PWR_IsActiveFlag_WU2
  1217. * @retval State of bit (1 or 0).
  1218. */
  1219. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_WU2(void)
  1220. {
  1221. return ((READ_BIT(PWR->SR1, PWR_SR1_WUF2) == (PWR_SR1_WUF2)) ? 1UL : 0UL);
  1222. }
  1223. /**
  1224. * @brief Get Wake-up Flag 1
  1225. * @rmtoll SR1 WUF1 LL_PWR_IsActiveFlag_WU1
  1226. * @retval State of bit (1 or 0).
  1227. */
  1228. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_WU1(void)
  1229. {
  1230. return ((READ_BIT(PWR->SR1, PWR_SR1_WUF1) == (PWR_SR1_WUF1)) ? 1UL : 0UL);
  1231. }
  1232. /**
  1233. * @brief Clear Stand-By Flag
  1234. * @rmtoll SCR CSBF LL_PWR_ClearFlag_SB
  1235. * @retval None
  1236. */
  1237. __STATIC_INLINE void LL_PWR_ClearFlag_SB(void)
  1238. {
  1239. WRITE_REG(PWR->SCR, PWR_SCR_CSBF);
  1240. }
  1241. /**
  1242. * @brief Clear Wake-up Flags
  1243. * @rmtoll SCR CWUF LL_PWR_ClearFlag_WU
  1244. * @retval None
  1245. */
  1246. __STATIC_INLINE void LL_PWR_ClearFlag_WU(void)
  1247. {
  1248. WRITE_REG(PWR->SCR, PWR_SCR_CWUF);
  1249. }
  1250. /**
  1251. * @brief Clear Wake-up Flag 6
  1252. * @rmtoll SCR CWUF6 LL_PWR_ClearFlag_WU6
  1253. * @retval None
  1254. */
  1255. __STATIC_INLINE void LL_PWR_ClearFlag_WU6(void)
  1256. {
  1257. WRITE_REG(PWR->SCR, PWR_SCR_CWUF6);
  1258. }
  1259. #if defined(PWR_CR3_EWUP5)
  1260. /**
  1261. * @brief Clear Wake-up Flag 5
  1262. * @rmtoll SCR CWUF5 LL_PWR_ClearFlag_WU5
  1263. * @retval None
  1264. */
  1265. __STATIC_INLINE void LL_PWR_ClearFlag_WU5(void)
  1266. {
  1267. WRITE_REG(PWR->SCR, PWR_SCR_CWUF5);
  1268. }
  1269. #endif /* PWR_CR3_EWUP5 */
  1270. /**
  1271. * @brief Clear Wake-up Flag 4
  1272. * @rmtoll SCR CWUF4 LL_PWR_ClearFlag_WU4
  1273. * @retval None
  1274. */
  1275. __STATIC_INLINE void LL_PWR_ClearFlag_WU4(void)
  1276. {
  1277. WRITE_REG(PWR->SCR, PWR_SCR_CWUF4);
  1278. }
  1279. #if defined(PWR_CR3_EWUP3)
  1280. /**
  1281. * @brief Clear Wake-up Flag 3
  1282. * @rmtoll SCR CWUF3 LL_PWR_ClearFlag_WU3
  1283. * @retval None
  1284. */
  1285. __STATIC_INLINE void LL_PWR_ClearFlag_WU3(void)
  1286. {
  1287. WRITE_REG(PWR->SCR, PWR_SCR_CWUF3);
  1288. }
  1289. #endif /* PWR_CR3_EWUP3 */
  1290. /**
  1291. * @brief Clear Wake-up Flag 2
  1292. * @rmtoll SCR CWUF2 LL_PWR_ClearFlag_WU2
  1293. * @retval None
  1294. */
  1295. __STATIC_INLINE void LL_PWR_ClearFlag_WU2(void)
  1296. {
  1297. WRITE_REG(PWR->SCR, PWR_SCR_CWUF2);
  1298. }
  1299. /**
  1300. * @brief Clear Wake-up Flag 1
  1301. * @rmtoll SCR CWUF1 LL_PWR_ClearFlag_WU1
  1302. * @retval None
  1303. */
  1304. __STATIC_INLINE void LL_PWR_ClearFlag_WU1(void)
  1305. {
  1306. WRITE_REG(PWR->SCR, PWR_SCR_CWUF1);
  1307. }
  1308. #if defined (PWR_PVM_SUPPORT)
  1309. /**
  1310. * @brief Indicate whether VDD voltage is below or above the selected PVD
  1311. * threshold
  1312. * @rmtoll SR2 PVDMO_USB LL_PWR_IsActiveFlag_PVMOUSB
  1313. * @retval State of bit (1 or 0).
  1314. */
  1315. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_PVMOUSB(void)
  1316. {
  1317. return ((READ_BIT(PWR->SR2, PWR_SR2_PVMO_USB) == (PWR_SR2_PVMO_USB)) ? 1UL : 0UL);
  1318. }
  1319. #endif /* PWR_PVM_SUPPORT */
  1320. #if defined(PWR_SR2_PVDO)
  1321. /**
  1322. * @brief Indicate whether VDD voltage is below or above the selected PVD
  1323. * threshold
  1324. * @rmtoll SR2 PVDO LL_PWR_IsActiveFlag_PVDO
  1325. * @retval State of bit (1 or 0).
  1326. */
  1327. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_PVDO(void)
  1328. {
  1329. return ((READ_BIT(PWR->SR2, PWR_SR2_PVDO) == (PWR_SR2_PVDO)) ? 1UL : 0UL);
  1330. }
  1331. #endif /* PWR_SR2_PVDO */
  1332. /**
  1333. * @brief Indicate whether the regulator is ready in the selected voltage
  1334. * range or if its output voltage is still changing to the required
  1335. * voltage level
  1336. * @note: Take care, return value "0" means the regulator is ready.
  1337. * Return value "1" means the output voltage range is still changing.
  1338. * @rmtoll SR2 VOSF LL_PWR_IsActiveFlag_VOS
  1339. * @retval State of bit (1 or 0).
  1340. */
  1341. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_VOS(void)
  1342. {
  1343. return ((READ_BIT(PWR->SR2, PWR_SR2_VOSF) == (PWR_SR2_VOSF)) ? 1UL : 0UL);
  1344. }
  1345. /**
  1346. * @brief Indicate whether the regulator is ready in main mode or is in
  1347. * low-power mode
  1348. * @note: Take care, return value "0" means regulator is ready in main mode
  1349. * Return value "1" means regulator is in low-power mode (LPR)
  1350. * @rmtoll SR2 REGLPF LL_PWR_IsActiveFlag_REGLPF
  1351. * @retval State of bit (1 or 0).
  1352. */
  1353. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_REGLPF(void)
  1354. {
  1355. return ((READ_BIT(PWR->SR2, PWR_SR2_REGLPF) == (PWR_SR2_REGLPF)) ? 1UL : 0UL);
  1356. }
  1357. /**
  1358. * @brief Indicate whether or not the low-power regulator is ready
  1359. * @rmtoll SR2 REGLPS LL_PWR_IsActiveFlag_REGLPS
  1360. * @retval State of bit (1 or 0).
  1361. */
  1362. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_REGLPS(void)
  1363. {
  1364. return ((READ_BIT(PWR->SR2, PWR_SR2_REGLPS) == (PWR_SR2_REGLPS)) ? 1UL : 0UL);
  1365. }
  1366. /**
  1367. * @brief Indicate whether or not the flash is ready to be accessed
  1368. * @rmtoll SR2 FLASH_RDY LL_PWR_IsActiveFlag_FLASH_RDY
  1369. * @retval State of bit (1 or 0).
  1370. */
  1371. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_FLASH_RDY(void)
  1372. {
  1373. return ((READ_BIT(PWR->SR2, PWR_SR2_FLASH_RDY) == (PWR_SR2_FLASH_RDY)) ? 1UL : 0UL);
  1374. }
  1375. /**
  1376. * @}
  1377. */
  1378. #if defined(USE_FULL_LL_DRIVER)
  1379. /** @defgroup PWR_LL_EF_Init De-initialization function
  1380. * @{
  1381. */
  1382. ErrorStatus LL_PWR_DeInit(void);
  1383. /**
  1384. * @}
  1385. */
  1386. #endif /* USE_FULL_LL_DRIVER */
  1387. /**
  1388. * @}
  1389. */
  1390. /**
  1391. * @}
  1392. */
  1393. #endif /* defined(PWR) */
  1394. /**
  1395. * @}
  1396. */
  1397. #ifdef __cplusplus
  1398. }
  1399. #endif
  1400. #endif /* STM32G0xx_LL_PWR_H */
  1401. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/