stm32l4xx_ll_pwr.h 52 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567
  1. /**
  2. ******************************************************************************
  3. * @file stm32l4xx_ll_pwr.h
  4. * @author MCD Application Team
  5. * @brief Header file of PWR LL module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
  10. *
  11. * Redistribution and use in source and binary forms, with or without modification,
  12. * are permitted provided that the following conditions are met:
  13. * 1. Redistributions of source code must retain the above copyright notice,
  14. * this list of conditions and the following disclaimer.
  15. * 2. Redistributions in binary form must reproduce the above copyright notice,
  16. * this list of conditions and the following disclaimer in the documentation
  17. * and/or other materials provided with the distribution.
  18. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  19. * may be used to endorse or promote products derived from this software
  20. * without specific prior written permission.
  21. *
  22. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  23. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  24. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  25. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  26. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  27. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  28. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  29. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  30. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  31. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. *
  33. ******************************************************************************
  34. */
  35. /* Define to prevent recursive inclusion -------------------------------------*/
  36. #ifndef __STM32L4xx_LL_PWR_H
  37. #define __STM32L4xx_LL_PWR_H
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif
  41. /* Includes ------------------------------------------------------------------*/
  42. #include "stm32l4xx.h"
  43. /** @addtogroup STM32L4xx_LL_Driver
  44. * @{
  45. */
  46. #if defined(PWR)
  47. /** @defgroup PWR_LL PWR
  48. * @{
  49. */
  50. /* Private types -------------------------------------------------------------*/
  51. /* Private variables ---------------------------------------------------------*/
  52. /* Private constants ---------------------------------------------------------*/
  53. /* Private macros ------------------------------------------------------------*/
  54. /* Exported types ------------------------------------------------------------*/
  55. /* Exported constants --------------------------------------------------------*/
  56. /** @defgroup PWR_LL_Exported_Constants PWR Exported Constants
  57. * @{
  58. */
  59. /** @defgroup PWR_LL_EC_CLEAR_FLAG Clear Flags Defines
  60. * @brief Flags defines which can be used with LL_PWR_WriteReg function
  61. * @{
  62. */
  63. #define LL_PWR_SCR_CSBF PWR_SCR_CSBF
  64. #define LL_PWR_SCR_CWUF PWR_SCR_CWUF
  65. #define LL_PWR_SCR_CWUF5 PWR_SCR_CWUF5
  66. #define LL_PWR_SCR_CWUF4 PWR_SCR_CWUF4
  67. #define LL_PWR_SCR_CWUF3 PWR_SCR_CWUF3
  68. #define LL_PWR_SCR_CWUF2 PWR_SCR_CWUF2
  69. #define LL_PWR_SCR_CWUF1 PWR_SCR_CWUF1
  70. /**
  71. * @}
  72. */
  73. /** @defgroup PWR_LL_EC_GET_FLAG Get Flags Defines
  74. * @brief Flags defines which can be used with LL_PWR_ReadReg function
  75. * @{
  76. */
  77. #define LL_PWR_SR1_WUFI PWR_SR1_WUFI
  78. #define LL_PWR_SR1_SBF PWR_SR1_SBF
  79. #define LL_PWR_SR1_WUF5 PWR_SR1_WUF5
  80. #define LL_PWR_SR1_WUF4 PWR_SR1_WUF4
  81. #define LL_PWR_SR1_WUF3 PWR_SR1_WUF3
  82. #define LL_PWR_SR1_WUF2 PWR_SR1_WUF2
  83. #define LL_PWR_SR1_WUF1 PWR_SR1_WUF1
  84. #if defined(PWR_SR2_PVMO4)
  85. #define LL_PWR_SR2_PVMO4 PWR_SR2_PVMO4
  86. #endif /* PWR_SR2_PVMO4 */
  87. #if defined(PWR_SR2_PVMO3)
  88. #define LL_PWR_SR2_PVMO3 PWR_SR2_PVMO3
  89. #endif /* PWR_SR2_PVMO3 */
  90. #if defined(PWR_SR2_PVMO2)
  91. #define LL_PWR_SR2_PVMO2 PWR_SR2_PVMO2
  92. #endif /* PWR_SR2_PVMO2 */
  93. #if defined(PWR_SR2_PVMO1)
  94. #define LL_PWR_SR2_PVMO1 PWR_SR2_PVMO1
  95. #endif /* PWR_SR2_PVMO1 */
  96. #define LL_PWR_SR2_PVDO PWR_SR2_PVDO
  97. #define LL_PWR_SR2_VOSF PWR_SR2_VOSF
  98. #define LL_PWR_SR2_REGLPF PWR_SR2_REGLPF
  99. #define LL_PWR_SR2_REGLPS PWR_SR2_REGLPS
  100. /**
  101. * @}
  102. */
  103. /** @defgroup PWR_LL_EC_REGU_VOLTAGE REGU VOLTAGE
  104. * @{
  105. */
  106. #define LL_PWR_REGU_VOLTAGE_SCALE1 (PWR_CR1_VOS_0)
  107. #define LL_PWR_REGU_VOLTAGE_SCALE2 (PWR_CR1_VOS_1)
  108. /**
  109. * @}
  110. */
  111. /** @defgroup PWR_LL_EC_MODE_PWR MODE PWR
  112. * @{
  113. */
  114. #define LL_PWR_MODE_STOP0 (PWR_CR1_LPMS_STOP0)
  115. #define LL_PWR_MODE_STOP1 (PWR_CR1_LPMS_STOP1)
  116. #define LL_PWR_MODE_STOP2 (PWR_CR1_LPMS_STOP2)
  117. #define LL_PWR_MODE_STANDBY (PWR_CR1_LPMS_STANDBY)
  118. #define LL_PWR_MODE_SHUTDOWN (PWR_CR1_LPMS_SHUTDOWN)
  119. /**
  120. * @}
  121. */
  122. /** @defgroup PWR_LL_EC_PVM_VDDUSB_1 Peripheral voltage monitoring
  123. * @{
  124. */
  125. #if defined(PWR_CR2_PVME1)
  126. #define LL_PWR_PVM_VDDUSB_1_2V (PWR_CR2_PVME1) /* Monitoring VDDUSB vs. 1.2V */
  127. #endif
  128. #if defined(PWR_CR2_PVME2)
  129. #define LL_PWR_PVM_VDDIO2_0_9V (PWR_CR2_PVME2) /* Monitoring VDDIO2 vs. 0.9V */
  130. #endif
  131. #if defined(PWR_CR2_PVME3)
  132. #define LL_PWR_PVM_VDDA_1_62V (PWR_CR2_PVME3) /* Monitoring VDDA vs. 1.62V */
  133. #endif
  134. #if defined(PWR_CR2_PVME4)
  135. #define LL_PWR_PVM_VDDA_2_2V (PWR_CR2_PVME4) /* Monitoring VDDA vs. 2.2V */
  136. #endif
  137. /**
  138. * @}
  139. */
  140. /** @defgroup PWR_LL_EC_PVDLEVEL PVDLEVEL
  141. * @{
  142. */
  143. #define LL_PWR_PVDLEVEL_0 (PWR_CR2_PLS_LEV0) /* VPVD0 around 2.0 V */
  144. #define LL_PWR_PVDLEVEL_1 (PWR_CR2_PLS_LEV1) /* VPVD1 around 2.2 V */
  145. #define LL_PWR_PVDLEVEL_2 (PWR_CR2_PLS_LEV2) /* VPVD2 around 2.4 V */
  146. #define LL_PWR_PVDLEVEL_3 (PWR_CR2_PLS_LEV3) /* VPVD3 around 2.5 V */
  147. #define LL_PWR_PVDLEVEL_4 (PWR_CR2_PLS_LEV4) /* VPVD4 around 2.6 V */
  148. #define LL_PWR_PVDLEVEL_5 (PWR_CR2_PLS_LEV5) /* VPVD5 around 2.8 V */
  149. #define LL_PWR_PVDLEVEL_6 (PWR_CR2_PLS_LEV6) /* VPVD6 around 2.9 V */
  150. #define LL_PWR_PVDLEVEL_7 (PWR_CR2_PLS_LEV7) /* External input analog voltage (Compare internally to VREFINT) */
  151. /**
  152. * @}
  153. */
  154. /** @defgroup PWR_LL_EC_WAKEUP WAKEUP
  155. * @{
  156. */
  157. #define LL_PWR_WAKEUP_PIN1 (PWR_CR3_EWUP1)
  158. #define LL_PWR_WAKEUP_PIN2 (PWR_CR3_EWUP2)
  159. #define LL_PWR_WAKEUP_PIN3 (PWR_CR3_EWUP3)
  160. #define LL_PWR_WAKEUP_PIN4 (PWR_CR3_EWUP4)
  161. #define LL_PWR_WAKEUP_PIN5 (PWR_CR3_EWUP5)
  162. /**
  163. * @}
  164. */
  165. /** @defgroup PWR_LL_EC_BATT_CHARG_RESISTOR BATT CHARG RESISTOR
  166. * @{
  167. */
  168. #define LL_PWR_BATT_CHARG_RESISTOR_5K (0x00000000U)
  169. #define LL_PWR_BATT_CHARGRESISTOR_1_5K (PWR_CR4_VBRS)
  170. /**
  171. * @}
  172. */
  173. /** @defgroup PWR_LL_EC_GPIO GPIO
  174. * @{
  175. */
  176. #define LL_PWR_GPIO_A ((uint32_t)(&(PWR->PUCRA)))
  177. #define LL_PWR_GPIO_B ((uint32_t)(&(PWR->PUCRB)))
  178. #define LL_PWR_GPIO_C ((uint32_t)(&(PWR->PUCRC)))
  179. #define LL_PWR_GPIO_D ((uint32_t)(&(PWR->PUCRD)))
  180. #define LL_PWR_GPIO_E ((uint32_t)(&(PWR->PUCRE)))
  181. #if defined(GPIOF)
  182. #define LL_PWR_GPIO_F ((uint32_t)(&(PWR->PUCRF)))
  183. #endif
  184. #if defined(GPIOG)
  185. #define LL_PWR_GPIO_G ((uint32_t)(&(PWR->PUCRG)))
  186. #endif
  187. #if defined(GPIOH)
  188. #define LL_PWR_GPIO_H ((uint32_t)(&(PWR->PUCRH)))
  189. #endif
  190. #if defined(GPIOI)
  191. #define LL_PWR_GPIO_I ((uint32_t)(&(PWR->PUCRI)))
  192. #endif
  193. /**
  194. * @}
  195. */
  196. /** @defgroup PWR_LL_EC_GPIO_BIT GPIO BIT
  197. * @{
  198. */
  199. #define LL_PWR_GPIO_BIT_0 (0x00000001U)
  200. #define LL_PWR_GPIO_BIT_1 (0x00000002U)
  201. #define LL_PWR_GPIO_BIT_2 (0x00000004U)
  202. #define LL_PWR_GPIO_BIT_3 (0x00000008U)
  203. #define LL_PWR_GPIO_BIT_4 (0x00000010U)
  204. #define LL_PWR_GPIO_BIT_5 (0x00000020U)
  205. #define LL_PWR_GPIO_BIT_6 (0x00000040U)
  206. #define LL_PWR_GPIO_BIT_7 (0x00000080U)
  207. #define LL_PWR_GPIO_BIT_8 (0x00000100U)
  208. #define LL_PWR_GPIO_BIT_9 (0x00000200U)
  209. #define LL_PWR_GPIO_BIT_10 (0x00000400U)
  210. #define LL_PWR_GPIO_BIT_11 (0x00000800U)
  211. #define LL_PWR_GPIO_BIT_12 (0x00001000U)
  212. #define LL_PWR_GPIO_BIT_13 (0x00002000U)
  213. #define LL_PWR_GPIO_BIT_14 (0x00004000U)
  214. #define LL_PWR_GPIO_BIT_15 (0x00008000U)
  215. /**
  216. * @}
  217. */
  218. /**
  219. * @}
  220. */
  221. /* Exported macro ------------------------------------------------------------*/
  222. /** @defgroup PWR_LL_Exported_Macros PWR Exported Macros
  223. * @{
  224. */
  225. /** @defgroup PWR_LL_EM_WRITE_READ Common Write and read registers Macros
  226. * @{
  227. */
  228. /**
  229. * @brief Write a value in PWR register
  230. * @param __REG__ Register to be written
  231. * @param __VALUE__ Value to be written in the register
  232. * @retval None
  233. */
  234. #define LL_PWR_WriteReg(__REG__, __VALUE__) WRITE_REG(PWR->__REG__, (__VALUE__))
  235. /**
  236. * @brief Read a value in PWR register
  237. * @param __REG__ Register to be read
  238. * @retval Register value
  239. */
  240. #define LL_PWR_ReadReg(__REG__) READ_REG(PWR->__REG__)
  241. /**
  242. * @}
  243. */
  244. /**
  245. * @}
  246. */
  247. /* Exported functions --------------------------------------------------------*/
  248. /** @defgroup PWR_LL_Exported_Functions PWR Exported Functions
  249. * @{
  250. */
  251. /** @defgroup PWR_LL_EF_Configuration Configuration
  252. * @{
  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 Switch from run main mode to run low-power mode.
  274. * @rmtoll CR1 LPR LL_PWR_EnterLowPowerRunMode
  275. * @retval None
  276. */
  277. __STATIC_INLINE void LL_PWR_EnterLowPowerRunMode(void)
  278. {
  279. LL_PWR_EnableLowPowerRunMode();
  280. }
  281. /**
  282. * @brief Switch from run main mode to low-power mode.
  283. * @rmtoll CR1 LPR LL_PWR_ExitLowPowerRunMode
  284. * @retval None
  285. */
  286. __STATIC_INLINE void LL_PWR_ExitLowPowerRunMode(void)
  287. {
  288. LL_PWR_DisableLowPowerRunMode();
  289. }
  290. /**
  291. * @brief Check if the regulator is in low-power mode
  292. * @rmtoll CR1 LPR LL_PWR_IsEnabledLowPowerRunMode
  293. * @retval State of bit (1 or 0).
  294. */
  295. __STATIC_INLINE uint32_t LL_PWR_IsEnabledLowPowerRunMode(void)
  296. {
  297. return (READ_BIT(PWR->CR1, PWR_CR1_LPR) == (PWR_CR1_LPR));
  298. }
  299. /**
  300. * @brief Set the main internal regulator output voltage
  301. * @note This configuration may be completed with LL_PWR_EnableRange1BoostMode() on STM32L4Rx/STM32L4Sx devices.
  302. * @rmtoll CR1 VOS LL_PWR_SetRegulVoltageScaling
  303. * @param VoltageScaling This parameter can be one of the following values:
  304. * @arg @ref LL_PWR_REGU_VOLTAGE_SCALE1
  305. * @arg @ref LL_PWR_REGU_VOLTAGE_SCALE2
  306. * @retval None
  307. */
  308. __STATIC_INLINE void LL_PWR_SetRegulVoltageScaling(uint32_t VoltageScaling)
  309. {
  310. MODIFY_REG(PWR->CR1, PWR_CR1_VOS, VoltageScaling);
  311. }
  312. /**
  313. * @brief Get the main internal regulator output voltage
  314. * @rmtoll CR1 VOS LL_PWR_GetRegulVoltageScaling
  315. * @retval Returned value can be one of the following values:
  316. * @arg @ref LL_PWR_REGU_VOLTAGE_SCALE1
  317. * @arg @ref LL_PWR_REGU_VOLTAGE_SCALE2
  318. */
  319. __STATIC_INLINE uint32_t LL_PWR_GetRegulVoltageScaling(void)
  320. {
  321. return (uint32_t)(READ_BIT(PWR->CR1, PWR_CR1_VOS));
  322. }
  323. #if defined(PWR_CR5_R1MODE)
  324. /**
  325. * @brief Enable main regulator voltage range 1 boost mode
  326. * @rmtoll CR5 R1MODE LL_PWR_EnableRange1BoostMode
  327. * @retval None
  328. */
  329. __STATIC_INLINE void LL_PWR_EnableRange1BoostMode(void)
  330. {
  331. CLEAR_BIT(PWR->CR5, PWR_CR5_R1MODE);
  332. }
  333. /**
  334. * @brief Disable main regulator voltage range 1 boost mode
  335. * @rmtoll CR5 R1MODE LL_PWR_DisableRange1BoostMode
  336. * @retval None
  337. */
  338. __STATIC_INLINE void LL_PWR_DisableRange1BoostMode(void)
  339. {
  340. SET_BIT(PWR->CR5, PWR_CR5_R1MODE);
  341. }
  342. /**
  343. * @brief Check if the main regulator voltage range 1 boost mode is enabled
  344. * @rmtoll CR5 R1MODE LL_PWR_IsEnabledRange1BoostMode
  345. * @retval Inverted state of bit (0 or 1).
  346. */
  347. __STATIC_INLINE uint32_t LL_PWR_IsEnabledRange1BoostMode(void)
  348. {
  349. return (READ_BIT(PWR->CR5, PWR_CR5_R1MODE) == RESET);
  350. }
  351. #endif /* PWR_CR5_R1MODE */
  352. /**
  353. * @brief Enable access to the backup domain
  354. * @rmtoll CR1 DBP LL_PWR_EnableBkUpAccess
  355. * @retval None
  356. */
  357. __STATIC_INLINE void LL_PWR_EnableBkUpAccess(void)
  358. {
  359. SET_BIT(PWR->CR1, PWR_CR1_DBP);
  360. }
  361. /**
  362. * @brief Disable access to the backup domain
  363. * @rmtoll CR1 DBP LL_PWR_DisableBkUpAccess
  364. * @retval None
  365. */
  366. __STATIC_INLINE void LL_PWR_DisableBkUpAccess(void)
  367. {
  368. CLEAR_BIT(PWR->CR1, PWR_CR1_DBP);
  369. }
  370. /**
  371. * @brief Check if the backup domain is enabled
  372. * @rmtoll CR1 DBP LL_PWR_IsEnabledBkUpAccess
  373. * @retval State of bit (1 or 0).
  374. */
  375. __STATIC_INLINE uint32_t LL_PWR_IsEnabledBkUpAccess(void)
  376. {
  377. return (READ_BIT(PWR->CR1, PWR_CR1_DBP) == (PWR_CR1_DBP));
  378. }
  379. /**
  380. * @brief Set Low-Power mode
  381. * @rmtoll CR1 LPMS LL_PWR_SetPowerMode
  382. * @param LowPowerMode This parameter can be one of the following values:
  383. * @arg @ref LL_PWR_MODE_STOP0
  384. * @arg @ref LL_PWR_MODE_STOP1
  385. * @arg @ref LL_PWR_MODE_STOP2
  386. * @arg @ref LL_PWR_MODE_STANDBY
  387. * @arg @ref LL_PWR_MODE_SHUTDOWN
  388. * @retval None
  389. */
  390. __STATIC_INLINE void LL_PWR_SetPowerMode(uint32_t LowPowerMode)
  391. {
  392. MODIFY_REG(PWR->CR1, PWR_CR1_LPMS, LowPowerMode);
  393. }
  394. /**
  395. * @brief Get Low-Power mode
  396. * @rmtoll CR1 LPMS LL_PWR_GetPowerMode
  397. * @retval Returned value can be one of the following values:
  398. * @arg @ref LL_PWR_MODE_STOP0
  399. * @arg @ref LL_PWR_MODE_STOP1
  400. * @arg @ref LL_PWR_MODE_STOP2
  401. * @arg @ref LL_PWR_MODE_STANDBY
  402. * @arg @ref LL_PWR_MODE_SHUTDOWN
  403. */
  404. __STATIC_INLINE uint32_t LL_PWR_GetPowerMode(void)
  405. {
  406. return (uint32_t)(READ_BIT(PWR->CR1, PWR_CR1_LPMS));
  407. }
  408. #if defined(PWR_CR1_RRSTP)
  409. /**
  410. * @brief Enable SRAM3 content retention in Stop mode
  411. * @rmtoll CR1 RRSTP LL_PWR_EnableSRAM3Retention
  412. * @retval None
  413. */
  414. __STATIC_INLINE void LL_PWR_EnableSRAM3Retention(void)
  415. {
  416. SET_BIT(PWR->CR1, PWR_CR1_RRSTP);
  417. }
  418. /**
  419. * @brief Disable SRAM3 content retention in Stop mode
  420. * @rmtoll CR1 RRSTP LL_PWR_DisableSRAM3Retention
  421. * @retval None
  422. */
  423. __STATIC_INLINE void LL_PWR_DisableSRAM3Retention(void)
  424. {
  425. CLEAR_BIT(PWR->CR1, PWR_CR1_RRSTP);
  426. }
  427. /**
  428. * @brief Check if SRAM3 content retention in Stop mode is enabled
  429. * @rmtoll CR1 RRSTP LL_PWR_IsEnabledSRAM3Retention
  430. * @retval State of bit (1 or 0).
  431. */
  432. __STATIC_INLINE uint32_t LL_PWR_IsEnabledSRAM3Retention(void)
  433. {
  434. return (READ_BIT(PWR->CR1, PWR_CR1_RRSTP) == (PWR_CR1_RRSTP));
  435. }
  436. #endif /* PWR_CR1_RRSTP */
  437. #if defined(PWR_CR3_DSIPDEN)
  438. /**
  439. * @brief Enable pull-down activation on DSI pins
  440. * @rmtoll CR3 DSIPDEN LL_PWR_EnableDSIPinsPDActivation
  441. * @retval None
  442. */
  443. __STATIC_INLINE void LL_PWR_EnableDSIPinsPDActivation(void)
  444. {
  445. SET_BIT(PWR->CR3, PWR_CR3_DSIPDEN);
  446. }
  447. /**
  448. * @brief Disable pull-down activation on DSI pins
  449. * @rmtoll CR3 DSIPDEN LL_PWR_DisableDSIPinsPDActivation
  450. * @retval None
  451. */
  452. __STATIC_INLINE void LL_PWR_DisableDSIPinsPDActivation(void)
  453. {
  454. CLEAR_BIT(PWR->CR3, PWR_CR3_DSIPDEN);
  455. }
  456. /**
  457. * @brief Check if pull-down activation on DSI pins is enabled
  458. * @rmtoll CR3 DSIPDEN LL_PWR_IsEnabledDSIPinsPDActivation
  459. * @retval State of bit (1 or 0).
  460. */
  461. __STATIC_INLINE uint32_t LL_PWR_IsEnabledDSIPinsPDActivation(void)
  462. {
  463. return (READ_BIT(PWR->CR3, PWR_CR3_DSIPDEN) == (PWR_CR3_DSIPDEN));
  464. }
  465. #endif /* PWR_CR3_DSIPDEN */
  466. #if defined(PWR_CR2_PVME1)
  467. /**
  468. * @brief Enable VDDUSB supply
  469. * @rmtoll CR2 USV LL_PWR_EnableVddUSB
  470. * @retval None
  471. */
  472. __STATIC_INLINE void LL_PWR_EnableVddUSB(void)
  473. {
  474. SET_BIT(PWR->CR2, PWR_CR2_USV);
  475. }
  476. /**
  477. * @brief Disable VDDUSB supply
  478. * @rmtoll CR2 USV LL_PWR_DisableVddUSB
  479. * @retval None
  480. */
  481. __STATIC_INLINE void LL_PWR_DisableVddUSB(void)
  482. {
  483. CLEAR_BIT(PWR->CR2, PWR_CR2_USV);
  484. }
  485. /**
  486. * @brief Check if VDDUSB supply is enabled
  487. * @rmtoll CR2 USV LL_PWR_IsEnabledVddUSB
  488. * @retval State of bit (1 or 0).
  489. */
  490. __STATIC_INLINE uint32_t LL_PWR_IsEnabledVddUSB(void)
  491. {
  492. return (READ_BIT(PWR->CR2, PWR_CR2_USV) == (PWR_CR2_USV));
  493. }
  494. #endif
  495. #if defined(PWR_CR2_IOSV)
  496. /**
  497. * @brief Enable VDDIO2 supply
  498. * @rmtoll CR2 IOSV LL_PWR_EnableVddIO2
  499. * @retval None
  500. */
  501. __STATIC_INLINE void LL_PWR_EnableVddIO2(void)
  502. {
  503. SET_BIT(PWR->CR2, PWR_CR2_IOSV);
  504. }
  505. /**
  506. * @brief Disable VDDIO2 supply
  507. * @rmtoll CR2 IOSV LL_PWR_DisableVddIO2
  508. * @retval None
  509. */
  510. __STATIC_INLINE void LL_PWR_DisableVddIO2(void)
  511. {
  512. CLEAR_BIT(PWR->CR2, PWR_CR2_IOSV);
  513. }
  514. /**
  515. * @brief Check if VDDIO2 supply is enabled
  516. * @rmtoll CR2 IOSV LL_PWR_IsEnabledVddIO2
  517. * @retval State of bit (1 or 0).
  518. */
  519. __STATIC_INLINE uint32_t LL_PWR_IsEnabledVddIO2(void)
  520. {
  521. return (READ_BIT(PWR->CR2, PWR_CR2_IOSV) == (PWR_CR2_IOSV));
  522. }
  523. #endif
  524. /**
  525. * @brief Enable the Power Voltage Monitoring on a peripheral
  526. * @rmtoll CR2 PVME1 LL_PWR_EnablePVM\n
  527. * CR2 PVME2 LL_PWR_EnablePVM\n
  528. * CR2 PVME3 LL_PWR_EnablePVM\n
  529. * CR2 PVME4 LL_PWR_EnablePVM
  530. * @param PeriphVoltage This parameter can be one of the following values:
  531. * @arg @ref LL_PWR_PVM_VDDUSB_1_2V (*)
  532. * @arg @ref LL_PWR_PVM_VDDIO2_0_9V (*)
  533. * @arg @ref LL_PWR_PVM_VDDA_1_62V
  534. * @arg @ref LL_PWR_PVM_VDDA_2_2V
  535. *
  536. * (*) value not defined in all devices
  537. * @retval None
  538. */
  539. __STATIC_INLINE void LL_PWR_EnablePVM(uint32_t PeriphVoltage)
  540. {
  541. SET_BIT(PWR->CR2, PeriphVoltage);
  542. }
  543. /**
  544. * @brief Disable the Power Voltage Monitoring on a peripheral
  545. * @rmtoll CR2 PVME1 LL_PWR_DisablePVM\n
  546. * CR2 PVME2 LL_PWR_DisablePVM\n
  547. * CR2 PVME3 LL_PWR_DisablePVM\n
  548. * CR2 PVME4 LL_PWR_DisablePVM
  549. * @param PeriphVoltage This parameter can be one of the following values:
  550. * @arg @ref LL_PWR_PVM_VDDUSB_1_2V (*)
  551. * @arg @ref LL_PWR_PVM_VDDIO2_0_9V (*)
  552. * @arg @ref LL_PWR_PVM_VDDA_1_62V
  553. * @arg @ref LL_PWR_PVM_VDDA_2_2V
  554. *
  555. * (*) value not defined in all devices
  556. * @retval None
  557. */
  558. __STATIC_INLINE void LL_PWR_DisablePVM(uint32_t PeriphVoltage)
  559. {
  560. CLEAR_BIT(PWR->CR2, PeriphVoltage);
  561. }
  562. /**
  563. * @brief Check if Power Voltage Monitoring is enabled on a peripheral
  564. * @rmtoll CR2 PVME1 LL_PWR_IsEnabledPVM\n
  565. * CR2 PVME2 LL_PWR_IsEnabledPVM\n
  566. * CR2 PVME3 LL_PWR_IsEnabledPVM\n
  567. * CR2 PVME4 LL_PWR_IsEnabledPVM
  568. * @param PeriphVoltage This parameter can be one of the following values:
  569. * @arg @ref LL_PWR_PVM_VDDUSB_1_2V (*)
  570. * @arg @ref LL_PWR_PVM_VDDIO2_0_9V (*)
  571. * @arg @ref LL_PWR_PVM_VDDA_1_62V
  572. * @arg @ref LL_PWR_PVM_VDDA_2_2V
  573. *
  574. * (*) value not defined in all devices
  575. * @retval State of bit (1 or 0).
  576. */
  577. __STATIC_INLINE uint32_t LL_PWR_IsEnabledPVM(uint32_t PeriphVoltage)
  578. {
  579. return (READ_BIT(PWR->CR2, PeriphVoltage) == (PeriphVoltage));
  580. }
  581. /**
  582. * @brief Configure the voltage threshold detected by the Power Voltage Detector
  583. * @rmtoll CR2 PLS LL_PWR_SetPVDLevel
  584. * @param PVDLevel This parameter can be one of the following values:
  585. * @arg @ref LL_PWR_PVDLEVEL_0
  586. * @arg @ref LL_PWR_PVDLEVEL_1
  587. * @arg @ref LL_PWR_PVDLEVEL_2
  588. * @arg @ref LL_PWR_PVDLEVEL_3
  589. * @arg @ref LL_PWR_PVDLEVEL_4
  590. * @arg @ref LL_PWR_PVDLEVEL_5
  591. * @arg @ref LL_PWR_PVDLEVEL_6
  592. * @arg @ref LL_PWR_PVDLEVEL_7
  593. * @retval None
  594. */
  595. __STATIC_INLINE void LL_PWR_SetPVDLevel(uint32_t PVDLevel)
  596. {
  597. MODIFY_REG(PWR->CR2, PWR_CR2_PLS, PVDLevel);
  598. }
  599. /**
  600. * @brief Get the voltage threshold detection
  601. * @rmtoll CR2 PLS LL_PWR_GetPVDLevel
  602. * @retval Returned value can be one of the following values:
  603. * @arg @ref LL_PWR_PVDLEVEL_0
  604. * @arg @ref LL_PWR_PVDLEVEL_1
  605. * @arg @ref LL_PWR_PVDLEVEL_2
  606. * @arg @ref LL_PWR_PVDLEVEL_3
  607. * @arg @ref LL_PWR_PVDLEVEL_4
  608. * @arg @ref LL_PWR_PVDLEVEL_5
  609. * @arg @ref LL_PWR_PVDLEVEL_6
  610. * @arg @ref LL_PWR_PVDLEVEL_7
  611. */
  612. __STATIC_INLINE uint32_t LL_PWR_GetPVDLevel(void)
  613. {
  614. return (uint32_t)(READ_BIT(PWR->CR2, PWR_CR2_PLS));
  615. }
  616. /**
  617. * @brief Enable Power Voltage Detector
  618. * @rmtoll CR2 PVDE LL_PWR_EnablePVD
  619. * @retval None
  620. */
  621. __STATIC_INLINE void LL_PWR_EnablePVD(void)
  622. {
  623. SET_BIT(PWR->CR2, PWR_CR2_PVDE);
  624. }
  625. /**
  626. * @brief Disable Power Voltage Detector
  627. * @rmtoll CR2 PVDE LL_PWR_DisablePVD
  628. * @retval None
  629. */
  630. __STATIC_INLINE void LL_PWR_DisablePVD(void)
  631. {
  632. CLEAR_BIT(PWR->CR2, PWR_CR2_PVDE);
  633. }
  634. /**
  635. * @brief Check if Power Voltage Detector is enabled
  636. * @rmtoll CR2 PVDE LL_PWR_IsEnabledPVD
  637. * @retval State of bit (1 or 0).
  638. */
  639. __STATIC_INLINE uint32_t LL_PWR_IsEnabledPVD(void)
  640. {
  641. return (READ_BIT(PWR->CR2, PWR_CR2_PVDE) == (PWR_CR2_PVDE));
  642. }
  643. /**
  644. * @brief Enable Internal Wake-up line
  645. * @rmtoll CR3 EIWF LL_PWR_EnableInternWU
  646. * @retval None
  647. */
  648. __STATIC_INLINE void LL_PWR_EnableInternWU(void)
  649. {
  650. SET_BIT(PWR->CR3, PWR_CR3_EIWF);
  651. }
  652. /**
  653. * @brief Disable Internal Wake-up line
  654. * @rmtoll CR3 EIWF LL_PWR_DisableInternWU
  655. * @retval None
  656. */
  657. __STATIC_INLINE void LL_PWR_DisableInternWU(void)
  658. {
  659. CLEAR_BIT(PWR->CR3, PWR_CR3_EIWF);
  660. }
  661. /**
  662. * @brief Check if Internal Wake-up line is enabled
  663. * @rmtoll CR3 EIWF LL_PWR_IsEnabledInternWU
  664. * @retval State of bit (1 or 0).
  665. */
  666. __STATIC_INLINE uint32_t LL_PWR_IsEnabledInternWU(void)
  667. {
  668. return (READ_BIT(PWR->CR3, PWR_CR3_EIWF) == (PWR_CR3_EIWF));
  669. }
  670. /**
  671. * @brief Enable pull-up and pull-down configuration
  672. * @rmtoll CR3 APC LL_PWR_EnablePUPDCfg
  673. * @retval None
  674. */
  675. __STATIC_INLINE void LL_PWR_EnablePUPDCfg(void)
  676. {
  677. SET_BIT(PWR->CR3, PWR_CR3_APC);
  678. }
  679. /**
  680. * @brief Disable pull-up and pull-down configuration
  681. * @rmtoll CR3 APC LL_PWR_DisablePUPDCfg
  682. * @retval None
  683. */
  684. __STATIC_INLINE void LL_PWR_DisablePUPDCfg(void)
  685. {
  686. CLEAR_BIT(PWR->CR3, PWR_CR3_APC);
  687. }
  688. /**
  689. * @brief Check if pull-up and pull-down configuration is enabled
  690. * @rmtoll CR3 APC LL_PWR_IsEnabledPUPDCfg
  691. * @retval State of bit (1 or 0).
  692. */
  693. __STATIC_INLINE uint32_t LL_PWR_IsEnabledPUPDCfg(void)
  694. {
  695. return (READ_BIT(PWR->CR3, PWR_CR3_APC) == (PWR_CR3_APC));
  696. }
  697. #if defined(PWR_CR3_DSIPDEN)
  698. /**
  699. * @brief Enable pull-down activation on DSI pins
  700. * @rmtoll CR3 DSIPDEN LL_PWR_EnableDSIPullDown
  701. * @retval None
  702. */
  703. __STATIC_INLINE void LL_PWR_EnableDSIPullDown(void)
  704. {
  705. SET_BIT(PWR->CR3, PWR_CR3_DSIPDEN);
  706. }
  707. /**
  708. * @brief Disable pull-down activation on DSI pins
  709. * @rmtoll CR3 DSIPDEN LL_PWR_DisableDSIPullDown
  710. * @retval None
  711. */
  712. __STATIC_INLINE void LL_PWR_DisableDSIPullDown(void)
  713. {
  714. CLEAR_BIT(PWR->CR3, PWR_CR3_DSIPDEN);
  715. }
  716. /**
  717. * @brief Check if pull-down activation on DSI pins is enabled
  718. * @rmtoll CR3 DSIPDEN LL_PWR_IsEnabledDSIPullDown
  719. * @retval State of bit (1 or 0).
  720. */
  721. __STATIC_INLINE uint32_t LL_PWR_IsEnabledDSIPullDown(void)
  722. {
  723. return (READ_BIT(PWR->CR3, PWR_CR3_DSIPDEN) == (PWR_CR3_DSIPDEN));
  724. }
  725. #endif /* PWR_CR3_DSIPDEN */
  726. /**
  727. * @brief Enable SRAM2 content retention in Standby mode
  728. * @rmtoll CR3 RRS LL_PWR_EnableSRAM2Retention
  729. * @retval None
  730. */
  731. __STATIC_INLINE void LL_PWR_EnableSRAM2Retention(void)
  732. {
  733. SET_BIT(PWR->CR3, PWR_CR3_RRS);
  734. }
  735. /**
  736. * @brief Disable SRAM2 content retention in Standby mode
  737. * @rmtoll CR3 RRS LL_PWR_DisableSRAM2Retention
  738. * @retval None
  739. */
  740. __STATIC_INLINE void LL_PWR_DisableSRAM2Retention(void)
  741. {
  742. CLEAR_BIT(PWR->CR3, PWR_CR3_RRS);
  743. }
  744. /**
  745. * @brief Check if SRAM2 content retention in Standby mode is enabled
  746. * @rmtoll CR3 RRS LL_PWR_IsEnabledSRAM2Retention
  747. * @retval State of bit (1 or 0).
  748. */
  749. __STATIC_INLINE uint32_t LL_PWR_IsEnabledSRAM2Retention(void)
  750. {
  751. return (READ_BIT(PWR->CR3, PWR_CR3_RRS) == (PWR_CR3_RRS));
  752. }
  753. /**
  754. * @brief Enable the WakeUp PINx functionality
  755. * @rmtoll CR3 EWUP1 LL_PWR_EnableWakeUpPin\n
  756. * CR3 EWUP2 LL_PWR_EnableWakeUpPin\n
  757. * CR3 EWUP3 LL_PWR_EnableWakeUpPin\n
  758. * CR3 EWUP4 LL_PWR_EnableWakeUpPin\n
  759. * CR3 EWUP5 LL_PWR_EnableWakeUpPin\n
  760. * @param WakeUpPin This parameter can be one of the following values:
  761. * @arg @ref LL_PWR_WAKEUP_PIN1
  762. * @arg @ref LL_PWR_WAKEUP_PIN2
  763. * @arg @ref LL_PWR_WAKEUP_PIN3
  764. * @arg @ref LL_PWR_WAKEUP_PIN4
  765. * @arg @ref LL_PWR_WAKEUP_PIN5
  766. * @retval None
  767. */
  768. __STATIC_INLINE void LL_PWR_EnableWakeUpPin(uint32_t WakeUpPin)
  769. {
  770. SET_BIT(PWR->CR3, WakeUpPin);
  771. }
  772. /**
  773. * @brief Disable the WakeUp PINx functionality
  774. * @rmtoll CR3 EWUP1 LL_PWR_DisableWakeUpPin\n
  775. * CR3 EWUP2 LL_PWR_DisableWakeUpPin\n
  776. * CR3 EWUP3 LL_PWR_DisableWakeUpPin\n
  777. * CR3 EWUP4 LL_PWR_DisableWakeUpPin\n
  778. * CR3 EWUP5 LL_PWR_DisableWakeUpPin\n
  779. * @param WakeUpPin This parameter can be one of the following values:
  780. * @arg @ref LL_PWR_WAKEUP_PIN1
  781. * @arg @ref LL_PWR_WAKEUP_PIN2
  782. * @arg @ref LL_PWR_WAKEUP_PIN3
  783. * @arg @ref LL_PWR_WAKEUP_PIN4
  784. * @arg @ref LL_PWR_WAKEUP_PIN5
  785. * @retval None
  786. */
  787. __STATIC_INLINE void LL_PWR_DisableWakeUpPin(uint32_t WakeUpPin)
  788. {
  789. CLEAR_BIT(PWR->CR3, WakeUpPin);
  790. }
  791. /**
  792. * @brief Check if the WakeUp PINx functionality is enabled
  793. * @rmtoll CR3 EWUP1 LL_PWR_IsEnabledWakeUpPin\n
  794. * CR3 EWUP2 LL_PWR_IsEnabledWakeUpPin\n
  795. * CR3 EWUP3 LL_PWR_IsEnabledWakeUpPin\n
  796. * CR3 EWUP4 LL_PWR_IsEnabledWakeUpPin\n
  797. * CR3 EWUP5 LL_PWR_IsEnabledWakeUpPin\n
  798. * @param WakeUpPin This parameter can be one of the following values:
  799. * @arg @ref LL_PWR_WAKEUP_PIN1
  800. * @arg @ref LL_PWR_WAKEUP_PIN2
  801. * @arg @ref LL_PWR_WAKEUP_PIN3
  802. * @arg @ref LL_PWR_WAKEUP_PIN4
  803. * @arg @ref LL_PWR_WAKEUP_PIN5
  804. * @retval State of bit (1 or 0).
  805. */
  806. __STATIC_INLINE uint32_t LL_PWR_IsEnabledWakeUpPin(uint32_t WakeUpPin)
  807. {
  808. return (READ_BIT(PWR->CR3, WakeUpPin) == (WakeUpPin));
  809. }
  810. /**
  811. * @brief Set the resistor impedance
  812. * @rmtoll CR4 VBRS LL_PWR_SetBattChargResistor
  813. * @param Resistor This parameter can be one of the following values:
  814. * @arg @ref LL_PWR_BATT_CHARG_RESISTOR_5K
  815. * @arg @ref LL_PWR_BATT_CHARGRESISTOR_1_5K
  816. * @retval None
  817. */
  818. __STATIC_INLINE void LL_PWR_SetBattChargResistor(uint32_t Resistor)
  819. {
  820. MODIFY_REG(PWR->CR4, PWR_CR4_VBRS, Resistor);
  821. }
  822. /**
  823. * @brief Get the resistor impedance
  824. * @rmtoll CR4 VBRS LL_PWR_GetBattChargResistor
  825. * @retval Returned value can be one of the following values:
  826. * @arg @ref LL_PWR_BATT_CHARG_RESISTOR_5K
  827. * @arg @ref LL_PWR_BATT_CHARGRESISTOR_1_5K
  828. */
  829. __STATIC_INLINE uint32_t LL_PWR_GetBattChargResistor(void)
  830. {
  831. return (uint32_t)(READ_BIT(PWR->CR4, PWR_CR4_VBRS));
  832. }
  833. /**
  834. * @brief Enable battery charging
  835. * @rmtoll CR4 VBE LL_PWR_EnableBatteryCharging
  836. * @retval None
  837. */
  838. __STATIC_INLINE void LL_PWR_EnableBatteryCharging(void)
  839. {
  840. SET_BIT(PWR->CR4, PWR_CR4_VBE);
  841. }
  842. /**
  843. * @brief Disable battery charging
  844. * @rmtoll CR4 VBE LL_PWR_DisableBatteryCharging
  845. * @retval None
  846. */
  847. __STATIC_INLINE void LL_PWR_DisableBatteryCharging(void)
  848. {
  849. CLEAR_BIT(PWR->CR4, PWR_CR4_VBE);
  850. }
  851. /**
  852. * @brief Check if battery charging is enabled
  853. * @rmtoll CR4 VBE LL_PWR_IsEnabledBatteryCharging
  854. * @retval State of bit (1 or 0).
  855. */
  856. __STATIC_INLINE uint32_t LL_PWR_IsEnabledBatteryCharging(void)
  857. {
  858. return (READ_BIT(PWR->CR4, PWR_CR4_VBE) == (PWR_CR4_VBE));
  859. }
  860. /**
  861. * @brief Set the Wake-Up pin polarity low for the event detection
  862. * @rmtoll CR4 WP1 LL_PWR_SetWakeUpPinPolarityLow\n
  863. * CR4 WP2 LL_PWR_SetWakeUpPinPolarityLow\n
  864. * CR4 WP3 LL_PWR_SetWakeUpPinPolarityLow\n
  865. * CR4 WP4 LL_PWR_SetWakeUpPinPolarityLow\n
  866. * CR4 WP5 LL_PWR_SetWakeUpPinPolarityLow
  867. * @param WakeUpPin This parameter can be one of the following values:
  868. * @arg @ref LL_PWR_WAKEUP_PIN1
  869. * @arg @ref LL_PWR_WAKEUP_PIN2
  870. * @arg @ref LL_PWR_WAKEUP_PIN3
  871. * @arg @ref LL_PWR_WAKEUP_PIN4
  872. * @arg @ref LL_PWR_WAKEUP_PIN5
  873. * @retval None
  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
  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. * @retval None
  893. */
  894. __STATIC_INLINE void LL_PWR_SetWakeUpPinPolarityHigh(uint32_t WakeUpPin)
  895. {
  896. CLEAR_BIT(PWR->CR4, WakeUpPin);
  897. }
  898. /**
  899. * @brief Get the Wake-Up pin polarity for the event detection
  900. * @rmtoll CR4 WP1 LL_PWR_IsWakeUpPinPolarityLow\n
  901. * CR4 WP2 LL_PWR_IsWakeUpPinPolarityLow\n
  902. * CR4 WP3 LL_PWR_IsWakeUpPinPolarityLow\n
  903. * CR4 WP4 LL_PWR_IsWakeUpPinPolarityLow\n
  904. * CR4 WP5 LL_PWR_IsWakeUpPinPolarityLow
  905. * @param WakeUpPin This parameter can be one of the following values:
  906. * @arg @ref LL_PWR_WAKEUP_PIN1
  907. * @arg @ref LL_PWR_WAKEUP_PIN2
  908. * @arg @ref LL_PWR_WAKEUP_PIN3
  909. * @arg @ref LL_PWR_WAKEUP_PIN4
  910. * @arg @ref LL_PWR_WAKEUP_PIN5
  911. * @retval State of bit (1 or 0).
  912. */
  913. __STATIC_INLINE uint32_t LL_PWR_IsWakeUpPinPolarityLow(uint32_t WakeUpPin)
  914. {
  915. return (READ_BIT(PWR->CR4, WakeUpPin) == (WakeUpPin));
  916. }
  917. /**
  918. * @brief Enable GPIO pull-up state in Standby and Shutdown modes
  919. * @rmtoll PUCRA PU0-15 LL_PWR_EnableGPIOPullUp\n
  920. * PUCRB PU0-15 LL_PWR_EnableGPIOPullUp\n
  921. * PUCRC PU0-15 LL_PWR_EnableGPIOPullUp\n
  922. * PUCRD PU0-15 LL_PWR_EnableGPIOPullUp\n
  923. * PUCRE PU0-15 LL_PWR_EnableGPIOPullUp\n
  924. * PUCRF PU0-15 LL_PWR_EnableGPIOPullUp\n
  925. * PUCRG PU0-15 LL_PWR_EnableGPIOPullUp\n
  926. * PUCRH PU0-15 LL_PWR_EnableGPIOPullUp\n
  927. * PUCRI PU0-11 LL_PWR_EnableGPIOPullUp
  928. * @param GPIO This parameter can be one of the following values:
  929. * @arg @ref LL_PWR_GPIO_A
  930. * @arg @ref LL_PWR_GPIO_B
  931. * @arg @ref LL_PWR_GPIO_C
  932. * @arg @ref LL_PWR_GPIO_D
  933. * @arg @ref LL_PWR_GPIO_E
  934. * @arg @ref LL_PWR_GPIO_F (*)
  935. * @arg @ref LL_PWR_GPIO_G (*)
  936. * @arg @ref LL_PWR_GPIO_H
  937. * @arg @ref LL_PWR_GPIO_I (*)
  938. *
  939. * (*) value not defined in all devices
  940. * @param GPIONumber This parameter can be one of the following values:
  941. * @arg @ref LL_PWR_GPIO_BIT_0
  942. * @arg @ref LL_PWR_GPIO_BIT_1
  943. * @arg @ref LL_PWR_GPIO_BIT_2
  944. * @arg @ref LL_PWR_GPIO_BIT_3
  945. * @arg @ref LL_PWR_GPIO_BIT_4
  946. * @arg @ref LL_PWR_GPIO_BIT_5
  947. * @arg @ref LL_PWR_GPIO_BIT_6
  948. * @arg @ref LL_PWR_GPIO_BIT_7
  949. * @arg @ref LL_PWR_GPIO_BIT_8
  950. * @arg @ref LL_PWR_GPIO_BIT_9
  951. * @arg @ref LL_PWR_GPIO_BIT_10
  952. * @arg @ref LL_PWR_GPIO_BIT_11
  953. * @arg @ref LL_PWR_GPIO_BIT_12
  954. * @arg @ref LL_PWR_GPIO_BIT_13
  955. * @arg @ref LL_PWR_GPIO_BIT_14
  956. * @arg @ref LL_PWR_GPIO_BIT_15
  957. * @retval None
  958. */
  959. __STATIC_INLINE void LL_PWR_EnableGPIOPullUp(uint32_t GPIO, uint32_t GPIONumber)
  960. {
  961. SET_BIT(*((uint32_t *)GPIO), GPIONumber);
  962. }
  963. /**
  964. * @brief Disable GPIO pull-up state in Standby and Shutdown modes
  965. * @rmtoll PUCRA PU0-15 LL_PWR_DisableGPIOPullUp\n
  966. * PUCRB PU0-15 LL_PWR_DisableGPIOPullUp\n
  967. * PUCRC PU0-15 LL_PWR_DisableGPIOPullUp\n
  968. * PUCRD PU0-15 LL_PWR_DisableGPIOPullUp\n
  969. * PUCRE PU0-15 LL_PWR_DisableGPIOPullUp\n
  970. * PUCRF PU0-15 LL_PWR_DisableGPIOPullUp\n
  971. * PUCRG PU0-15 LL_PWR_DisableGPIOPullUp\n
  972. * PUCRH PU0-15 LL_PWR_DisableGPIOPullUp\n
  973. * PUCRI PU0-11 LL_PWR_DisableGPIOPullUp
  974. * @param GPIO This parameter can be one of the following values:
  975. * @arg @ref LL_PWR_GPIO_A
  976. * @arg @ref LL_PWR_GPIO_B
  977. * @arg @ref LL_PWR_GPIO_C
  978. * @arg @ref LL_PWR_GPIO_D
  979. * @arg @ref LL_PWR_GPIO_E
  980. * @arg @ref LL_PWR_GPIO_F (*)
  981. * @arg @ref LL_PWR_GPIO_G (*)
  982. * @arg @ref LL_PWR_GPIO_H
  983. * @arg @ref LL_PWR_GPIO_I (*)
  984. *
  985. * (*) value not defined in all devices
  986. * @param GPIONumber This parameter can be one of the following values:
  987. * @arg @ref LL_PWR_GPIO_BIT_0
  988. * @arg @ref LL_PWR_GPIO_BIT_1
  989. * @arg @ref LL_PWR_GPIO_BIT_2
  990. * @arg @ref LL_PWR_GPIO_BIT_3
  991. * @arg @ref LL_PWR_GPIO_BIT_4
  992. * @arg @ref LL_PWR_GPIO_BIT_5
  993. * @arg @ref LL_PWR_GPIO_BIT_6
  994. * @arg @ref LL_PWR_GPIO_BIT_7
  995. * @arg @ref LL_PWR_GPIO_BIT_8
  996. * @arg @ref LL_PWR_GPIO_BIT_9
  997. * @arg @ref LL_PWR_GPIO_BIT_10
  998. * @arg @ref LL_PWR_GPIO_BIT_11
  999. * @arg @ref LL_PWR_GPIO_BIT_12
  1000. * @arg @ref LL_PWR_GPIO_BIT_13
  1001. * @arg @ref LL_PWR_GPIO_BIT_14
  1002. * @arg @ref LL_PWR_GPIO_BIT_15
  1003. * @retval None
  1004. */
  1005. __STATIC_INLINE void LL_PWR_DisableGPIOPullUp(uint32_t GPIO, uint32_t GPIONumber)
  1006. {
  1007. CLEAR_BIT(*((uint32_t *)GPIO), GPIONumber);
  1008. }
  1009. /**
  1010. * @brief Check if GPIO pull-up state is enabled
  1011. * @rmtoll PUCRA PU0-15 LL_PWR_IsEnabledGPIOPullUp\n
  1012. * PUCRB PU0-15 LL_PWR_IsEnabledGPIOPullUp\n
  1013. * PUCRC PU0-15 LL_PWR_IsEnabledGPIOPullUp\n
  1014. * PUCRD PU0-15 LL_PWR_IsEnabledGPIOPullUp\n
  1015. * PUCRE PU0-15 LL_PWR_IsEnabledGPIOPullUp\n
  1016. * PUCRF PU0-15 LL_PWR_IsEnabledGPIOPullUp\n
  1017. * PUCRG PU0-15 LL_PWR_IsEnabledGPIOPullUp\n
  1018. * PUCRH PU0-15 LL_PWR_IsEnabledGPIOPullUp\n
  1019. * PUCRI PU0-11 LL_PWR_IsEnabledGPIOPullUp
  1020. * @param GPIO This parameter can be one of the following values:
  1021. * @arg @ref LL_PWR_GPIO_A
  1022. * @arg @ref LL_PWR_GPIO_B
  1023. * @arg @ref LL_PWR_GPIO_C
  1024. * @arg @ref LL_PWR_GPIO_D
  1025. * @arg @ref LL_PWR_GPIO_E
  1026. * @arg @ref LL_PWR_GPIO_F (*)
  1027. * @arg @ref LL_PWR_GPIO_G (*)
  1028. * @arg @ref LL_PWR_GPIO_H
  1029. * @arg @ref LL_PWR_GPIO_I (*)
  1030. *
  1031. * (*) value not defined in all devices
  1032. * @param GPIONumber This parameter can be one of the following values:
  1033. * @arg @ref LL_PWR_GPIO_BIT_0
  1034. * @arg @ref LL_PWR_GPIO_BIT_1
  1035. * @arg @ref LL_PWR_GPIO_BIT_2
  1036. * @arg @ref LL_PWR_GPIO_BIT_3
  1037. * @arg @ref LL_PWR_GPIO_BIT_4
  1038. * @arg @ref LL_PWR_GPIO_BIT_5
  1039. * @arg @ref LL_PWR_GPIO_BIT_6
  1040. * @arg @ref LL_PWR_GPIO_BIT_7
  1041. * @arg @ref LL_PWR_GPIO_BIT_8
  1042. * @arg @ref LL_PWR_GPIO_BIT_9
  1043. * @arg @ref LL_PWR_GPIO_BIT_10
  1044. * @arg @ref LL_PWR_GPIO_BIT_11
  1045. * @arg @ref LL_PWR_GPIO_BIT_12
  1046. * @arg @ref LL_PWR_GPIO_BIT_13
  1047. * @arg @ref LL_PWR_GPIO_BIT_14
  1048. * @arg @ref LL_PWR_GPIO_BIT_15
  1049. * @retval State of bit (1 or 0).
  1050. */
  1051. __STATIC_INLINE uint32_t LL_PWR_IsEnabledGPIOPullUp(uint32_t GPIO, uint32_t GPIONumber)
  1052. {
  1053. return (READ_BIT(*((uint32_t *)(GPIO)), GPIONumber) == (GPIONumber));
  1054. }
  1055. /**
  1056. * @brief Enable GPIO pull-down state in Standby and Shutdown modes
  1057. * @rmtoll PDCRA PD0-15 LL_PWR_EnableGPIOPullDown\n
  1058. * PDCRB PD0-15 LL_PWR_EnableGPIOPullDown\n
  1059. * PDCRC PD0-15 LL_PWR_EnableGPIOPullDown\n
  1060. * PDCRD PD0-15 LL_PWR_EnableGPIOPullDown\n
  1061. * PDCRE PD0-15 LL_PWR_EnableGPIOPullDown\n
  1062. * PDCRF PD0-15 LL_PWR_EnableGPIOPullDown\n
  1063. * PDCRG PD0-15 LL_PWR_EnableGPIOPullDown\n
  1064. * PDCRH PD0-15 LL_PWR_EnableGPIOPullDown\n
  1065. * PDCRI PD0-11 LL_PWR_EnableGPIOPullDown
  1066. * @param GPIO This parameter can be one of the following values:
  1067. * @arg @ref LL_PWR_GPIO_A
  1068. * @arg @ref LL_PWR_GPIO_B
  1069. * @arg @ref LL_PWR_GPIO_C
  1070. * @arg @ref LL_PWR_GPIO_D
  1071. * @arg @ref LL_PWR_GPIO_E
  1072. * @arg @ref LL_PWR_GPIO_F (*)
  1073. * @arg @ref LL_PWR_GPIO_G (*)
  1074. * @arg @ref LL_PWR_GPIO_H
  1075. * @arg @ref LL_PWR_GPIO_I (*)
  1076. *
  1077. * (*) value not defined in all devices
  1078. * @param GPIONumber This parameter can be one of the following values:
  1079. * @arg @ref LL_PWR_GPIO_BIT_0
  1080. * @arg @ref LL_PWR_GPIO_BIT_1
  1081. * @arg @ref LL_PWR_GPIO_BIT_2
  1082. * @arg @ref LL_PWR_GPIO_BIT_3
  1083. * @arg @ref LL_PWR_GPIO_BIT_4
  1084. * @arg @ref LL_PWR_GPIO_BIT_5
  1085. * @arg @ref LL_PWR_GPIO_BIT_6
  1086. * @arg @ref LL_PWR_GPIO_BIT_7
  1087. * @arg @ref LL_PWR_GPIO_BIT_8
  1088. * @arg @ref LL_PWR_GPIO_BIT_9
  1089. * @arg @ref LL_PWR_GPIO_BIT_10
  1090. * @arg @ref LL_PWR_GPIO_BIT_11
  1091. * @arg @ref LL_PWR_GPIO_BIT_12
  1092. * @arg @ref LL_PWR_GPIO_BIT_13
  1093. * @arg @ref LL_PWR_GPIO_BIT_14
  1094. * @arg @ref LL_PWR_GPIO_BIT_15
  1095. * @retval None
  1096. */
  1097. __STATIC_INLINE void LL_PWR_EnableGPIOPullDown(uint32_t GPIO, uint32_t GPIONumber)
  1098. {
  1099. register uint32_t temp = (uint32_t)(GPIO) + 4;
  1100. SET_BIT(*((uint32_t *)(temp)), GPIONumber);
  1101. }
  1102. /**
  1103. * @brief Disable GPIO pull-down state in Standby and Shutdown modes
  1104. * @rmtoll PDCRA PD0-15 LL_PWR_DisableGPIOPullDown\n
  1105. * PDCRB PD0-15 LL_PWR_DisableGPIOPullDown\n
  1106. * PDCRC PD0-15 LL_PWR_DisableGPIOPullDown\n
  1107. * PDCRD PD0-15 LL_PWR_DisableGPIOPullDown\n
  1108. * PDCRE PD0-15 LL_PWR_DisableGPIOPullDown\n
  1109. * PDCRF PD0-15 LL_PWR_DisableGPIOPullDown\n
  1110. * PDCRG PD0-15 LL_PWR_DisableGPIOPullDown\n
  1111. * PDCRH PD0-15 LL_PWR_DisableGPIOPullDown\n
  1112. * PDCRI PD0-11 LL_PWR_DisableGPIOPullDown
  1113. * @param GPIO This parameter can be one of the following values:
  1114. * @arg @ref LL_PWR_GPIO_A
  1115. * @arg @ref LL_PWR_GPIO_B
  1116. * @arg @ref LL_PWR_GPIO_C
  1117. * @arg @ref LL_PWR_GPIO_D
  1118. * @arg @ref LL_PWR_GPIO_E
  1119. * @arg @ref LL_PWR_GPIO_F (*)
  1120. * @arg @ref LL_PWR_GPIO_G (*)
  1121. * @arg @ref LL_PWR_GPIO_H
  1122. * @arg @ref LL_PWR_GPIO_I (*)
  1123. *
  1124. * (*) value not defined in all devices
  1125. * @param GPIONumber This parameter can be one of the following values:
  1126. * @arg @ref LL_PWR_GPIO_BIT_0
  1127. * @arg @ref LL_PWR_GPIO_BIT_1
  1128. * @arg @ref LL_PWR_GPIO_BIT_2
  1129. * @arg @ref LL_PWR_GPIO_BIT_3
  1130. * @arg @ref LL_PWR_GPIO_BIT_4
  1131. * @arg @ref LL_PWR_GPIO_BIT_5
  1132. * @arg @ref LL_PWR_GPIO_BIT_6
  1133. * @arg @ref LL_PWR_GPIO_BIT_7
  1134. * @arg @ref LL_PWR_GPIO_BIT_8
  1135. * @arg @ref LL_PWR_GPIO_BIT_9
  1136. * @arg @ref LL_PWR_GPIO_BIT_10
  1137. * @arg @ref LL_PWR_GPIO_BIT_11
  1138. * @arg @ref LL_PWR_GPIO_BIT_12
  1139. * @arg @ref LL_PWR_GPIO_BIT_13
  1140. * @arg @ref LL_PWR_GPIO_BIT_14
  1141. * @arg @ref LL_PWR_GPIO_BIT_15
  1142. * @retval None
  1143. */
  1144. __STATIC_INLINE void LL_PWR_DisableGPIOPullDown(uint32_t GPIO, uint32_t GPIONumber)
  1145. {
  1146. register uint32_t temp = (uint32_t)(GPIO) + 4;
  1147. CLEAR_BIT(*((uint32_t *)(temp)), GPIONumber);
  1148. }
  1149. /**
  1150. * @brief Check if GPIO pull-down state is enabled
  1151. * @rmtoll PDCRA PD0-15 LL_PWR_IsEnabledGPIOPullDown\n
  1152. * PDCRB PD0-15 LL_PWR_IsEnabledGPIOPullDown\n
  1153. * PDCRC PD0-15 LL_PWR_IsEnabledGPIOPullDown\n
  1154. * PDCRD PD0-15 LL_PWR_IsEnabledGPIOPullDown\n
  1155. * PDCRE PD0-15 LL_PWR_IsEnabledGPIOPullDown\n
  1156. * PDCRF PD0-15 LL_PWR_IsEnabledGPIOPullDown\n
  1157. * PDCRG PD0-15 LL_PWR_IsEnabledGPIOPullDown\n
  1158. * PDCRH PD0-15 LL_PWR_IsEnabledGPIOPullDown\n
  1159. * PDCRI PD0-11 LL_PWR_IsEnabledGPIOPullDown
  1160. * @param GPIO This parameter can be one of the following values:
  1161. * @arg @ref LL_PWR_GPIO_A
  1162. * @arg @ref LL_PWR_GPIO_B
  1163. * @arg @ref LL_PWR_GPIO_C
  1164. * @arg @ref LL_PWR_GPIO_D
  1165. * @arg @ref LL_PWR_GPIO_E
  1166. * @arg @ref LL_PWR_GPIO_F (*)
  1167. * @arg @ref LL_PWR_GPIO_G (*)
  1168. * @arg @ref LL_PWR_GPIO_H
  1169. * @arg @ref LL_PWR_GPIO_I (*)
  1170. *
  1171. * (*) value not defined in all devices
  1172. * @param GPIONumber This parameter can be one of the following values:
  1173. * @arg @ref LL_PWR_GPIO_BIT_0
  1174. * @arg @ref LL_PWR_GPIO_BIT_1
  1175. * @arg @ref LL_PWR_GPIO_BIT_2
  1176. * @arg @ref LL_PWR_GPIO_BIT_3
  1177. * @arg @ref LL_PWR_GPIO_BIT_4
  1178. * @arg @ref LL_PWR_GPIO_BIT_5
  1179. * @arg @ref LL_PWR_GPIO_BIT_6
  1180. * @arg @ref LL_PWR_GPIO_BIT_7
  1181. * @arg @ref LL_PWR_GPIO_BIT_8
  1182. * @arg @ref LL_PWR_GPIO_BIT_9
  1183. * @arg @ref LL_PWR_GPIO_BIT_10
  1184. * @arg @ref LL_PWR_GPIO_BIT_11
  1185. * @arg @ref LL_PWR_GPIO_BIT_12
  1186. * @arg @ref LL_PWR_GPIO_BIT_13
  1187. * @arg @ref LL_PWR_GPIO_BIT_14
  1188. * @arg @ref LL_PWR_GPIO_BIT_15
  1189. * @retval State of bit (1 or 0).
  1190. */
  1191. __STATIC_INLINE uint32_t LL_PWR_IsEnabledGPIOPullDown(uint32_t GPIO, uint32_t GPIONumber)
  1192. {
  1193. register uint32_t temp = (uint32_t)(GPIO) + 4;
  1194. return (READ_BIT(*((uint32_t *)(temp)), GPIONumber) == (GPIONumber));
  1195. }
  1196. /**
  1197. * @}
  1198. */
  1199. /** @defgroup PWR_LL_EF_FLAG_Management FLAG_Management
  1200. * @{
  1201. */
  1202. /**
  1203. * @brief Get Internal Wake-up line Flag
  1204. * @rmtoll SR1 WUFI LL_PWR_IsActiveFlag_InternWU
  1205. * @retval State of bit (1 or 0).
  1206. */
  1207. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_InternWU(void)
  1208. {
  1209. return (READ_BIT(PWR->SR1, PWR_SR1_WUFI) == (PWR_SR1_WUFI));
  1210. }
  1211. /**
  1212. * @brief Get Stand-By Flag
  1213. * @rmtoll SR1 SBF LL_PWR_IsActiveFlag_SB
  1214. * @retval State of bit (1 or 0).
  1215. */
  1216. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_SB(void)
  1217. {
  1218. return (READ_BIT(PWR->SR1, PWR_SR1_SBF) == (PWR_SR1_SBF));
  1219. }
  1220. /**
  1221. * @brief Get Wake-up Flag 5
  1222. * @rmtoll SR1 WUF5 LL_PWR_IsActiveFlag_WU5
  1223. * @retval State of bit (1 or 0).
  1224. */
  1225. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_WU5(void)
  1226. {
  1227. return (READ_BIT(PWR->SR1, PWR_SR1_WUF5) == (PWR_SR1_WUF5));
  1228. }
  1229. /**
  1230. * @brief Get Wake-up Flag 4
  1231. * @rmtoll SR1 WUF4 LL_PWR_IsActiveFlag_WU4
  1232. * @retval State of bit (1 or 0).
  1233. */
  1234. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_WU4(void)
  1235. {
  1236. return (READ_BIT(PWR->SR1, PWR_SR1_WUF4) == (PWR_SR1_WUF4));
  1237. }
  1238. /**
  1239. * @brief Get Wake-up Flag 3
  1240. * @rmtoll SR1 WUF3 LL_PWR_IsActiveFlag_WU3
  1241. * @retval State of bit (1 or 0).
  1242. */
  1243. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_WU3(void)
  1244. {
  1245. return (READ_BIT(PWR->SR1, PWR_SR1_WUF3) == (PWR_SR1_WUF3));
  1246. }
  1247. /**
  1248. * @brief Get Wake-up Flag 2
  1249. * @rmtoll SR1 WUF2 LL_PWR_IsActiveFlag_WU2
  1250. * @retval State of bit (1 or 0).
  1251. */
  1252. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_WU2(void)
  1253. {
  1254. return (READ_BIT(PWR->SR1, PWR_SR1_WUF2) == (PWR_SR1_WUF2));
  1255. }
  1256. /**
  1257. * @brief Get Wake-up Flag 1
  1258. * @rmtoll SR1 WUF1 LL_PWR_IsActiveFlag_WU1
  1259. * @retval State of bit (1 or 0).
  1260. */
  1261. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_WU1(void)
  1262. {
  1263. return (READ_BIT(PWR->SR1, PWR_SR1_WUF1) == (PWR_SR1_WUF1));
  1264. }
  1265. /**
  1266. * @brief Clear Stand-By Flag
  1267. * @rmtoll SCR CSBF LL_PWR_ClearFlag_SB
  1268. * @retval None
  1269. */
  1270. __STATIC_INLINE void LL_PWR_ClearFlag_SB(void)
  1271. {
  1272. WRITE_REG(PWR->SCR, PWR_SCR_CSBF);
  1273. }
  1274. /**
  1275. * @brief Clear Wake-up Flags
  1276. * @rmtoll SCR CWUF LL_PWR_ClearFlag_WU
  1277. * @retval None
  1278. */
  1279. __STATIC_INLINE void LL_PWR_ClearFlag_WU(void)
  1280. {
  1281. WRITE_REG(PWR->SCR, PWR_SCR_CWUF);
  1282. }
  1283. /**
  1284. * @brief Clear Wake-up Flag 5
  1285. * @rmtoll SCR CWUF5 LL_PWR_ClearFlag_WU5
  1286. * @retval None
  1287. */
  1288. __STATIC_INLINE void LL_PWR_ClearFlag_WU5(void)
  1289. {
  1290. WRITE_REG(PWR->SCR, PWR_SCR_CWUF5);
  1291. }
  1292. /**
  1293. * @brief Clear Wake-up Flag 4
  1294. * @rmtoll SCR CWUF4 LL_PWR_ClearFlag_WU4
  1295. * @retval None
  1296. */
  1297. __STATIC_INLINE void LL_PWR_ClearFlag_WU4(void)
  1298. {
  1299. WRITE_REG(PWR->SCR, PWR_SCR_CWUF4);
  1300. }
  1301. /**
  1302. * @brief Clear Wake-up Flag 3
  1303. * @rmtoll SCR CWUF3 LL_PWR_ClearFlag_WU3
  1304. * @retval None
  1305. */
  1306. __STATIC_INLINE void LL_PWR_ClearFlag_WU3(void)
  1307. {
  1308. WRITE_REG(PWR->SCR, PWR_SCR_CWUF3);
  1309. }
  1310. /**
  1311. * @brief Clear Wake-up Flag 2
  1312. * @rmtoll SCR CWUF2 LL_PWR_ClearFlag_WU2
  1313. * @retval None
  1314. */
  1315. __STATIC_INLINE void LL_PWR_ClearFlag_WU2(void)
  1316. {
  1317. WRITE_REG(PWR->SCR, PWR_SCR_CWUF2);
  1318. }
  1319. /**
  1320. * @brief Clear Wake-up Flag 1
  1321. * @rmtoll SCR CWUF1 LL_PWR_ClearFlag_WU1
  1322. * @retval None
  1323. */
  1324. __STATIC_INLINE void LL_PWR_ClearFlag_WU1(void)
  1325. {
  1326. WRITE_REG(PWR->SCR, PWR_SCR_CWUF1);
  1327. }
  1328. /**
  1329. * @brief Indicate whether VDDA voltage is below or above PVM4 threshold
  1330. * @rmtoll SR2 PVMO4 LL_PWR_IsActiveFlag_PVMO4
  1331. * @retval State of bit (1 or 0).
  1332. */
  1333. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_PVMO4(void)
  1334. {
  1335. return (READ_BIT(PWR->SR2, PWR_SR2_PVMO4) == (PWR_SR2_PVMO4));
  1336. }
  1337. /**
  1338. * @brief Indicate whether VDDA voltage is below or above PVM3 threshold
  1339. * @rmtoll SR2 PVMO3 LL_PWR_IsActiveFlag_PVMO3
  1340. * @retval State of bit (1 or 0).
  1341. */
  1342. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_PVMO3(void)
  1343. {
  1344. return (READ_BIT(PWR->SR2, PWR_SR2_PVMO3) == (PWR_SR2_PVMO3));
  1345. }
  1346. #if defined(PWR_SR2_PVMO2)
  1347. /**
  1348. * @brief Indicate whether VDDIO2 voltage is below or above PVM2 threshold
  1349. * @rmtoll SR2 PVMO2 LL_PWR_IsActiveFlag_PVMO2
  1350. * @retval State of bit (1 or 0).
  1351. */
  1352. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_PVMO2(void)
  1353. {
  1354. return (READ_BIT(PWR->SR2, PWR_SR2_PVMO2) == (PWR_SR2_PVMO2));
  1355. }
  1356. #endif /* PWR_SR2_PVMO2 */
  1357. #if defined(PWR_SR2_PVMO1)
  1358. /**
  1359. * @brief Indicate whether VDDUSB voltage is below or above PVM1 threshold
  1360. * @rmtoll SR2 PVMO1 LL_PWR_IsActiveFlag_PVMO1
  1361. * @retval State of bit (1 or 0).
  1362. */
  1363. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_PVMO1(void)
  1364. {
  1365. return (READ_BIT(PWR->SR2, PWR_SR2_PVMO1) == (PWR_SR2_PVMO1));
  1366. }
  1367. #endif /* PWR_SR2_PVMO1 */
  1368. /**
  1369. * @brief Indicate whether VDD voltage is below or above the selected PVD threshold
  1370. * @rmtoll SR2 PVDO LL_PWR_IsActiveFlag_PVDO
  1371. * @retval State of bit (1 or 0).
  1372. */
  1373. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_PVDO(void)
  1374. {
  1375. return (READ_BIT(PWR->SR2, PWR_SR2_PVDO) == (PWR_SR2_PVDO));
  1376. }
  1377. /**
  1378. * @brief Indicate whether the regulator is ready in the selected voltage range or if its output voltage is still changing to the required voltage level
  1379. * @rmtoll SR2 VOSF LL_PWR_IsActiveFlag_VOS
  1380. * @retval State of bit (1 or 0).
  1381. */
  1382. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_VOS(void)
  1383. {
  1384. return (READ_BIT(PWR->SR2, PWR_SR2_VOSF) == (PWR_SR2_VOSF));
  1385. }
  1386. /**
  1387. * @brief Indicate whether the regulator is ready in main mode or is in low-power mode
  1388. * @note Take care, return value "0" means the regulator is ready. Return value "1" means the output voltage range is still changing.
  1389. * @rmtoll SR2 REGLPF LL_PWR_IsActiveFlag_REGLPF
  1390. * @retval State of bit (1 or 0).
  1391. */
  1392. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_REGLPF(void)
  1393. {
  1394. return (READ_BIT(PWR->SR2, PWR_SR2_REGLPF) == (PWR_SR2_REGLPF));
  1395. }
  1396. /**
  1397. * @brief Indicate whether or not the low-power regulator is ready
  1398. * @rmtoll SR2 REGLPS LL_PWR_IsActiveFlag_REGLPS
  1399. * @retval State of bit (1 or 0).
  1400. */
  1401. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_REGLPS(void)
  1402. {
  1403. return (READ_BIT(PWR->SR2, PWR_SR2_REGLPS) == (PWR_SR2_REGLPS));
  1404. }
  1405. /**
  1406. * @}
  1407. */
  1408. #if defined(USE_FULL_LL_DRIVER)
  1409. /** @defgroup PWR_LL_EF_Init De-initialization function
  1410. * @{
  1411. */
  1412. ErrorStatus LL_PWR_DeInit(void);
  1413. /**
  1414. * @}
  1415. */
  1416. #endif /* USE_FULL_LL_DRIVER */
  1417. /** @defgroup PWR_LL_EF_Legacy_Functions Legacy functions name
  1418. * @{
  1419. */
  1420. /* Old functions name kept for legacy purpose, to be replaced by the */
  1421. /* current functions name. */
  1422. #define LL_PWR_IsActiveFlag_VOSF LL_PWR_IsActiveFlag_VOS
  1423. /**
  1424. * @}
  1425. */
  1426. /**
  1427. * @}
  1428. */
  1429. /**
  1430. * @}
  1431. */
  1432. #endif /* defined(PWR) */
  1433. /**
  1434. * @}
  1435. */
  1436. #ifdef __cplusplus
  1437. }
  1438. #endif
  1439. #endif /* __STM32L4xx_LL_PWR_H */
  1440. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/