You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

2686 lines
92 KiB

  1. /**
  2. ******************************************************************************
  3. * @file stm32wbxx_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) 2019 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 STM32WBxx_LL_PWR_H
  21. #define STM32WBxx_LL_PWR_H
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. /* Includes ------------------------------------------------------------------*/
  26. #include "stm32wbxx.h"
  27. /** @addtogroup STM32WBxx_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. /** @defgroup PWR_LL_Private_Constants PWR Private Constants
  38. * @{
  39. */
  40. #if defined(PWR_CR5_SMPSEN)
  41. /** @defgroup PWR_SMPS_Calibration PWR SMPS calibration
  42. * @{
  43. */
  44. #define SMPS_VOLTAGE_CAL_ADDR ((uint32_t*) (0x1FFF7558UL)) /* SMPS output voltage calibration level corresponding to voltage "SMPS_VOLTAGE_CAL_VOLTAGE_MV" */
  45. #define SMPS_VOLTAGE_CAL_POS (8UL) /* SMPS output voltage calibration level bitfield position */
  46. #define SMPS_VOLTAGE_CAL (0xFUL << SMPS_VOLTAGE_CAL_POS) /* SMPS output voltage calibration level bitfield mask */
  47. #define SMPS_VOLTAGE_CAL_VOLTAGE_MV (1500UL) /* SMPS output voltage calibration value (unit: mV) */
  48. #define SMPS_VOLTAGE_BASE_MV (1200UL) /* SMPS output voltage base value (unit: mV) */
  49. #define SMPS_VOLTAGE_STEP_MV ( 50UL) /* SMPS output voltage step (unit: mV) */
  50. /**
  51. * @}
  52. */
  53. #endif
  54. /**
  55. * @}
  56. */
  57. /* Private macros ------------------------------------------------------------*/
  58. /* Exported types ------------------------------------------------------------*/
  59. /* Exported constants --------------------------------------------------------*/
  60. /** @defgroup PWR_LL_Exported_Constants PWR Exported Constants
  61. * @{
  62. */
  63. /** @defgroup PWR_LL_EC_CLEAR_FLAG Clear Flags Defines
  64. * @brief Flags defines which can be used with LL_PWR_WriteReg function
  65. * @{
  66. */
  67. #define LL_PWR_SCR_CWUF PWR_SCR_CWUF
  68. #if defined(PWR_CR3_EWUP2)
  69. #define LL_PWR_SCR_CWUF5 PWR_SCR_CWUF5
  70. #endif
  71. #define LL_PWR_SCR_CWUF4 PWR_SCR_CWUF4
  72. #if defined(PWR_CR3_EWUP3)
  73. #define LL_PWR_SCR_CWUF3 PWR_SCR_CWUF3
  74. #endif
  75. #if defined(PWR_CR3_EWUP2)
  76. #define LL_PWR_SCR_CWUF2 PWR_SCR_CWUF2
  77. #endif
  78. #define LL_PWR_SCR_CWUF1 PWR_SCR_CWUF1
  79. #define LL_PWR_SCR_CC2HF PWR_SCR_CC2HF
  80. #define LL_PWR_SCR_C802AF PWR_SCR_C802AF
  81. #define LL_PWR_SCR_CBLEAF PWR_SCR_CBLEAF
  82. #define LL_PWR_SCR_CCRPEF PWR_SCR_CCRPEF
  83. #define LL_PWR_SCR_C802WUF PWR_SCR_C802WUF
  84. #define LL_PWR_SCR_CBLEWUF PWR_SCR_CBLEWUF
  85. #if defined(PWR_CR5_SMPSEN)
  86. #define LL_PWR_SCR_CBORHF PWR_SCR_CBORHF
  87. #define LL_PWR_SCR_CSMPSFBF PWR_SCR_CSMPSFBF
  88. #endif
  89. #define LL_PWR_EXTSCR_CCRPF PWR_EXTSCR_CCRPF
  90. #define LL_PWR_EXTSCR_C2CSSF PWR_EXTSCR_C2CSSF
  91. #define LL_PWR_EXTSCR_C1CSSF PWR_EXTSCR_C1CSSF
  92. /**
  93. * @}
  94. */
  95. /** @defgroup PWR_LL_EC_GET_FLAG Get Flags Defines
  96. * @brief Flags defines which can be used with LL_PWR_ReadReg function
  97. * @{
  98. */
  99. #define LL_PWR_SR1_WUFI PWR_SR1_WUFI
  100. #if defined(PWR_CR3_EWUP5)
  101. #define LL_PWR_SR1_WUF5 PWR_SR1_WUF5
  102. #endif
  103. #define LL_PWR_SR1_WUF4 PWR_SR1_WUF4
  104. #if defined(PWR_CR3_EWUP3)
  105. #define LL_PWR_SR1_WUF3 PWR_SR1_WUF3
  106. #endif
  107. #if defined(PWR_CR3_EWUP2)
  108. #define LL_PWR_SR1_WUF2 PWR_SR1_WUF2
  109. #endif
  110. #define LL_PWR_SR1_WUF1 PWR_SR1_WUF1
  111. #define LL_PWR_SR2_PVMO3 PWR_SR2_PVMO3
  112. #if defined(PWR_CR2_PVME1)
  113. #define LL_PWR_SR2_PVMO1 PWR_SR2_PVMO1
  114. #endif
  115. #define LL_PWR_SR2_PVDO PWR_SR2_PVDO
  116. #if defined(PWR_CR1_VOS)
  117. #define LL_PWR_SR2_VOSF PWR_SR2_VOSF
  118. #endif
  119. #define LL_PWR_SR2_REGLPF PWR_SR2_REGLPF
  120. #define LL_PWR_SR2_REGLPS PWR_SR2_REGLPS
  121. /* BOR flags */
  122. #define LL_PWR_FLAG_BORH PWR_SR1_BORHF /* BORH interrupt flag */
  123. #if defined(PWR_CR5_SMPSEN)
  124. /* SMPS flags */
  125. #define LL_PWR_FLAG_SMPS PWR_SR2_SMPSF /* SMPS step down converter ready flag */
  126. #define LL_PWR_FLAG_SMPSB PWR_SR2_SMPSBF /* SMPS step down converter in bypass mode flag */
  127. #define LL_PWR_FLAG_SMPSFB PWR_SR1_SMPSFB /* SMPS step down converter forced in bypass mode interrupt flag */
  128. #endif
  129. /* Radio (BLE or 802.15.4) flags */
  130. #define LL_PWR_FLAG_BLEWU PWR_SR1_BLEWUF /* BLE wakeup interrupt flag */
  131. #define LL_PWR_FLAG_802WU PWR_SR1_802WUF /* 802.15.4 wakeup interrupt flag */
  132. #define LL_PWR_FLAG_BLEA PWR_SR1_BLEAF /* BLE end of activity interrupt flag */
  133. #define LL_PWR_FLAG_802A PWR_SR1_802AF /* 802.15.4 end of activity interrupt flag */
  134. #define LL_PWR_FLAG_CRPE PWR_SR1_CRPEF /* Critical radio phase end of activity interrupt flag */
  135. #define LL_PWR_FLAG_CRP PWR_EXTSCR_CRPF /* Critical radio system phase */
  136. /* Multicore flags */
  137. #define LL_PWR_EXTSCR_C1SBF PWR_EXTSCR_C1SBF /* System standby flag for CPU1 */
  138. #define LL_PWR_EXTSCR_C1STOPF PWR_EXTSCR_C1STOPF /* System stop flag for CPU1 */
  139. #define LL_PWR_EXTSCR_C1DS PWR_EXTSCR_C1DS /* CPU1 deepsleep mode */
  140. #define LL_PWR_EXTSCR_C2SBF PWR_EXTSCR_C2SBF /* System standby flag for CPU2 */
  141. #define LL_PWR_EXTSCR_C2STOPF PWR_EXTSCR_C2STOPF /* System stop flag for CPU2 */
  142. #define LL_PWR_EXTSCR_C2DS PWR_EXTSCR_C2DS /* CPU2 deepsleep mode */
  143. #define LL_PWR_SR1_C2HF PWR_SR1_C2HF /* CPU2 hold interrupt flag */
  144. /**
  145. * @}
  146. */
  147. #if defined(PWR_CR1_VOS)
  148. /** @defgroup PWR_LL_EC_REGU_VOLTAGE REGU VOLTAGE
  149. * @{
  150. */
  151. #define LL_PWR_REGU_VOLTAGE_SCALE1 (PWR_CR1_VOS_0) /* Regulator voltage output range 1 mode, typical output voltage at 1.2 V, system frequency up to 64 MHz. */
  152. #define LL_PWR_REGU_VOLTAGE_SCALE2 (PWR_CR1_VOS_1) /* Regulator voltage output range 2 mode, typical output voltage at 1.0 V, system frequency up to 16 MHz. */
  153. /**
  154. * @}
  155. */
  156. #endif
  157. /** @defgroup PWR_LL_EC_MODE_PWR MODE PWR
  158. * @{
  159. */
  160. #define LL_PWR_MODE_STOP0 (0x000000000U)
  161. #define LL_PWR_MODE_STOP1 (PWR_CR1_LPMS_0)
  162. #define LL_PWR_MODE_STOP2 (PWR_CR1_LPMS_1)
  163. #define LL_PWR_MODE_STANDBY (PWR_CR1_LPMS_1 | PWR_CR1_LPMS_0)
  164. #define LL_PWR_MODE_SHUTDOWN (PWR_CR1_LPMS_2)
  165. /**
  166. * @}
  167. */
  168. /** @defgroup PWR_LL_EC_FLASH_LPRUN_POWER_DOWN_MODE Flash power-down mode during low-power run mode
  169. * @{
  170. */
  171. #define LL_PWR_FLASH_LPRUN_MODE_IDLE (0x000000000U)
  172. #define LL_PWR_FLASH_LPRUN_MODE_POWER_DOWN (PWR_CR1_FPDR)
  173. /**
  174. * @}
  175. */
  176. /** @defgroup PWR_LL_EC_FLASH_SLEEP_POWER_DOWN_MODE Flash power-down mode during sleep mode
  177. * @{
  178. */
  179. #define LL_PWR_FLASH_SLEEP_MODE_IDLE (0x000000000U)
  180. #define LL_PWR_FLASH_SLEEP_MODE_POWER_DOWN (PWR_CR1_FPDS)
  181. /**
  182. * @}
  183. */
  184. /** @defgroup PWR_LL_EC_PVM Peripheral voltage monitoring
  185. * @{
  186. */
  187. #if defined(PWR_CR2_PVME1)
  188. #define LL_PWR_PVM_VDDUSB_1_2V (PWR_CR2_PVME1) /* Monitoring VDDUSB vs. 1.2V */
  189. #endif
  190. #define LL_PWR_PVM_VDDA_1_62V (PWR_CR2_PVME3) /* Monitoring VDDA vs. 1.62V */
  191. /**
  192. * @}
  193. */
  194. /** @defgroup PWR_LL_EC_PVDLEVEL PVDLEVEL
  195. * @{
  196. */
  197. #define LL_PWR_PVDLEVEL_0 (0x00000000U) /* VPVD0 around 2.0 V */
  198. #define LL_PWR_PVDLEVEL_1 (PWR_CR2_PLS_0) /* VPVD1 around 2.2 V */
  199. #define LL_PWR_PVDLEVEL_2 (PWR_CR2_PLS_1) /* VPVD2 around 2.4 V */
  200. #define LL_PWR_PVDLEVEL_3 (PWR_CR2_PLS_1 | PWR_CR2_PLS_0) /* VPVD3 around 2.5 V */
  201. #define LL_PWR_PVDLEVEL_4 (PWR_CR2_PLS_2) /* VPVD4 around 2.6 V */
  202. #define LL_PWR_PVDLEVEL_5 (PWR_CR2_PLS_2 | PWR_CR2_PLS_0) /* VPVD5 around 2.8 V */
  203. #define LL_PWR_PVDLEVEL_6 (PWR_CR2_PLS_2 | PWR_CR2_PLS_1) /* VPVD6 around 2.9 V */
  204. #define LL_PWR_PVDLEVEL_7 (PWR_CR2_PLS_2 | PWR_CR2_PLS_1 | PWR_CR2_PLS_0) /* External input analog voltage (Compare internally to VREFINT) */
  205. /**
  206. * @}
  207. */
  208. /** @defgroup PWR_LL_EC_WAKEUP WAKEUP
  209. * @{
  210. */
  211. #define LL_PWR_WAKEUP_PIN1 (PWR_CR3_EWUP1)
  212. #if defined(PWR_CR3_EWUP2)
  213. #define LL_PWR_WAKEUP_PIN2 (PWR_CR3_EWUP2)
  214. #endif
  215. #if defined(PWR_CR3_EWUP3)
  216. #define LL_PWR_WAKEUP_PIN3 (PWR_CR3_EWUP3)
  217. #endif
  218. #define LL_PWR_WAKEUP_PIN4 (PWR_CR3_EWUP4)
  219. #if defined(PWR_CR3_EWUP5)
  220. #define LL_PWR_WAKEUP_PIN5 (PWR_CR3_EWUP5)
  221. #endif
  222. /**
  223. * @}
  224. */
  225. /** @defgroup PWR_LL_EC_BATT_CHARG_RESISTOR BATT CHARG RESISTOR
  226. * @{
  227. */
  228. #define LL_PWR_BATT_CHARG_RESISTOR_5K (0x00000000U)
  229. #define LL_PWR_BATT_CHARGRESISTOR_1_5K (PWR_CR4_VBRS)
  230. /**
  231. * @}
  232. */
  233. /** @defgroup PWR_LL_EC_GPIO GPIO
  234. * @{
  235. */
  236. #define LL_PWR_GPIO_A ((uint32_t)(&(PWR->PUCRA)))
  237. #define LL_PWR_GPIO_B ((uint32_t)(&(PWR->PUCRB)))
  238. #define LL_PWR_GPIO_C ((uint32_t)(&(PWR->PUCRC)))
  239. #define LL_PWR_GPIO_D ((uint32_t)(&(PWR->PUCRD)))
  240. #define LL_PWR_GPIO_E ((uint32_t)(&(PWR->PUCRE)))
  241. #define LL_PWR_GPIO_H ((uint32_t)(&(PWR->PUCRH)))
  242. /**
  243. * @}
  244. */
  245. /** @defgroup PWR_LL_EC_GPIO_BIT GPIO BIT
  246. * @{
  247. */
  248. #if defined(PWR_PUCRC_PC0)
  249. /* Note: LL_PWR_GPIO_BIT_x defined from port C because all pins are available */
  250. /* for PWR pull-up and pull-down. */
  251. #define LL_PWR_GPIO_BIT_0 (PWR_PUCRC_PC0)
  252. #define LL_PWR_GPIO_BIT_1 (PWR_PUCRC_PC1)
  253. #define LL_PWR_GPIO_BIT_2 (PWR_PUCRC_PC2)
  254. #define LL_PWR_GPIO_BIT_3 (PWR_PUCRC_PC3)
  255. #define LL_PWR_GPIO_BIT_4 (PWR_PUCRC_PC4)
  256. #define LL_PWR_GPIO_BIT_5 (PWR_PUCRC_PC5)
  257. #define LL_PWR_GPIO_BIT_6 (PWR_PUCRC_PC6)
  258. #define LL_PWR_GPIO_BIT_7 (PWR_PUCRC_PC7)
  259. #define LL_PWR_GPIO_BIT_8 (PWR_PUCRC_PC8)
  260. #define LL_PWR_GPIO_BIT_9 (PWR_PUCRC_PC9)
  261. #define LL_PWR_GPIO_BIT_10 (PWR_PUCRC_PC10)
  262. #define LL_PWR_GPIO_BIT_11 (PWR_PUCRC_PC11)
  263. #define LL_PWR_GPIO_BIT_12 (PWR_PUCRC_PC12)
  264. #define LL_PWR_GPIO_BIT_13 (PWR_PUCRC_PC13)
  265. #define LL_PWR_GPIO_BIT_14 (PWR_PUCRC_PC14)
  266. #define LL_PWR_GPIO_BIT_15 (PWR_PUCRC_PC15)
  267. #else
  268. #define LL_PWR_GPIO_BIT_0 (PWR_PUCRA_PA0)
  269. #define LL_PWR_GPIO_BIT_1 (PWR_PUCRA_PA1)
  270. #define LL_PWR_GPIO_BIT_2 (PWR_PUCRA_PA2)
  271. #define LL_PWR_GPIO_BIT_3 (PWR_PUCRA_PA3)
  272. #define LL_PWR_GPIO_BIT_4 (PWR_PUCRA_PA4)
  273. #define LL_PWR_GPIO_BIT_5 (PWR_PUCRA_PA5)
  274. #define LL_PWR_GPIO_BIT_6 (PWR_PUCRA_PA6)
  275. #define LL_PWR_GPIO_BIT_7 (PWR_PUCRA_PA7)
  276. #define LL_PWR_GPIO_BIT_8 (PWR_PUCRA_PA8)
  277. #define LL_PWR_GPIO_BIT_9 (PWR_PUCRA_PA9)
  278. #define LL_PWR_GPIO_BIT_10 (PWR_PUCRA_PA10)
  279. #define LL_PWR_GPIO_BIT_11 (PWR_PUCRA_PA11)
  280. #define LL_PWR_GPIO_BIT_12 (PWR_PUCRA_PA12)
  281. #define LL_PWR_GPIO_BIT_13 (PWR_PUCRA_PA13)
  282. #define LL_PWR_GPIO_BIT_14 (PWR_PUCRC_PC14)
  283. #define LL_PWR_GPIO_BIT_15 (PWR_PUCRC_PC15)
  284. #endif
  285. /**
  286. * @}
  287. */
  288. #if defined(PWR_CR5_SMPSEN)
  289. /** @defgroup PWR_LL_EC_BOR_CONFIGURATION BOR configuration
  290. * @{
  291. */
  292. #define LL_PWR_BOR_SYSTEM_RESET (0x00000000U) /*!< BOR will generate a system reset */
  293. #define LL_PWR_BOR_SMPS_FORCE_BYPASS (PWR_CR5_BORHC) /*!< BOR will for SMPS step down converter in bypass mode */
  294. /**
  295. * @}
  296. */
  297. /** @defgroup PWR_LL_EC_SMPS_OPERATING_MODES SMPS step down converter operating modes
  298. * @{
  299. */
  300. /* Note: Literals values are defined from register SR2 bits SMPSF and SMPSBF */
  301. /* but they are also used as register CR5 bits SMPSEN and SMPSBEN, */
  302. /* as used by all SMPS operating mode functions targetting different */
  303. /* registers: */
  304. /* "LL_PWR_SMPS_SetMode()", "LL_PWR_SMPS_GetMode()" */
  305. /* and "LL_PWR_SMPS_GetEffectiveMode()". */
  306. #define LL_PWR_SMPS_BYPASS (PWR_SR2_SMPSBF) /*!< SMPS step down in bypass mode. */
  307. #define LL_PWR_SMPS_STEP_DOWN (PWR_SR2_SMPSF) /*!< SMPS step down in step down mode if system low power mode is run, LP run or stop0. If system low power mode is stop1, stop2, standby, shutdown, then SMPS is forced in mode open to preserve energy stored in decoupling capacitor as long as possible. */
  308. /**
  309. * @}
  310. */
  311. /** @defgroup PWR_LL_EC_SMPS_STARTUP_CURRENT SMPS step down converter supply startup current selection
  312. * @{
  313. */
  314. #define LL_PWR_SMPS_STARTUP_CURRENT_80MA (0x00000000U) /*!< SMPS step down converter supply startup current 80mA */
  315. #define LL_PWR_SMPS_STARTUP_CURRENT_100MA ( PWR_CR5_SMPSSC_0) /*!< SMPS step down converter supply startup current 100mA */
  316. #define LL_PWR_SMPS_STARTUP_CURRENT_120MA ( PWR_CR5_SMPSSC_1 ) /*!< SMPS step down converter supply startup current 120mA */
  317. #define LL_PWR_SMPS_STARTUP_CURRENT_140MA ( PWR_CR5_SMPSSC_1 | PWR_CR5_SMPSSC_0) /*!< SMPS step down converter supply startup current 140mA */
  318. #define LL_PWR_SMPS_STARTUP_CURRENT_160MA (PWR_CR5_SMPSSC_2 ) /*!< SMPS step down converter supply startup current 160mA */
  319. #define LL_PWR_SMPS_STARTUP_CURRENT_180MA (PWR_CR5_SMPSSC_2 | PWR_CR5_SMPSSC_0) /*!< SMPS step down converter supply startup current 180mA */
  320. #define LL_PWR_SMPS_STARTUP_CURRENT_200MA (PWR_CR5_SMPSSC_2 | PWR_CR5_SMPSSC_1 ) /*!< SMPS step down converter supply startup current 200mA */
  321. #define LL_PWR_SMPS_STARTUP_CURRENT_220MA (PWR_CR5_SMPSSC_2 | PWR_CR5_SMPSSC_1 | PWR_CR5_SMPSSC_0) /*!< SMPS step down converter supply startup current 220mA */
  322. /**
  323. * @}
  324. */
  325. /** @defgroup PWR_LL_EC_SMPS_OUTPUT_VOLTAGE_LEVEL SMPS step down converter output voltage scaling voltage level
  326. * @{
  327. */
  328. /* Note: SMPS voltage is trimmed during device production to control
  329. the actual voltage level variation from device to device. */
  330. #define LL_PWR_SMPS_OUTPUT_VOLTAGE_1V20 (0x00000000U) /*!< SMPS step down converter supply output voltage 1.20V */
  331. #define LL_PWR_SMPS_OUTPUT_VOLTAGE_1V25 ( PWR_CR5_SMPSVOS_0) /*!< SMPS step down converter supply output voltage 1.25V */
  332. #define LL_PWR_SMPS_OUTPUT_VOLTAGE_1V30 ( PWR_CR5_SMPSVOS_1 ) /*!< SMPS step down converter supply output voltage 1.30V */
  333. #define LL_PWR_SMPS_OUTPUT_VOLTAGE_1V35 ( PWR_CR5_SMPSVOS_1 | PWR_CR5_SMPSVOS_0) /*!< SMPS step down converter supply output voltage 1.35V */
  334. #define LL_PWR_SMPS_OUTPUT_VOLTAGE_1V40 ( PWR_CR5_SMPSVOS_2 ) /*!< SMPS step down converter supply output voltage 1.40V */
  335. #define LL_PWR_SMPS_OUTPUT_VOLTAGE_1V45 ( PWR_CR5_SMPSVOS_2 | PWR_CR5_SMPSVOS_0) /*!< SMPS step down converter supply output voltage 1.45V */
  336. #define LL_PWR_SMPS_OUTPUT_VOLTAGE_1V50 ( PWR_CR5_SMPSVOS_2 | PWR_CR5_SMPSVOS_1 ) /*!< SMPS step down converter supply output voltage 1.50V */
  337. #define LL_PWR_SMPS_OUTPUT_VOLTAGE_1V55 ( PWR_CR5_SMPSVOS_2 | PWR_CR5_SMPSVOS_1 | PWR_CR5_SMPSVOS_0) /*!< SMPS step down converter supply output voltage 1.55V */
  338. #define LL_PWR_SMPS_OUTPUT_VOLTAGE_1V60 (PWR_CR5_SMPSVOS_3 ) /*!< SMPS step down converter supply output voltage 1.60V */
  339. #define LL_PWR_SMPS_OUTPUT_VOLTAGE_1V65 (PWR_CR5_SMPSVOS_3 | PWR_CR5_SMPSVOS_0) /*!< SMPS step down converter supply output voltage 1.65V */
  340. #define LL_PWR_SMPS_OUTPUT_VOLTAGE_1V70 (PWR_CR5_SMPSVOS_3 | PWR_CR5_SMPSVOS_1 ) /*!< SMPS step down converter supply output voltage 1.70V */
  341. #define LL_PWR_SMPS_OUTPUT_VOLTAGE_1V75 (PWR_CR5_SMPSVOS_3 | PWR_CR5_SMPSVOS_1 | PWR_CR5_SMPSVOS_0) /*!< SMPS step down converter supply output voltage 1.75V */
  342. #define LL_PWR_SMPS_OUTPUT_VOLTAGE_1V80 (PWR_CR5_SMPSVOS_3 | PWR_CR5_SMPSVOS_2 ) /*!< SMPS step down converter supply output voltage 1.80V */
  343. #define LL_PWR_SMPS_OUTPUT_VOLTAGE_1V85 (PWR_CR5_SMPSVOS_3 | PWR_CR5_SMPSVOS_2 | PWR_CR5_SMPSVOS_0) /*!< SMPS step down converter supply output voltage 1.85V */
  344. #define LL_PWR_SMPS_OUTPUT_VOLTAGE_1V90 (PWR_CR5_SMPSVOS_3 | PWR_CR5_SMPSVOS_2 | PWR_CR5_SMPSVOS_1 ) /*!< SMPS step down converter supply output voltage 1.90V */
  345. /**
  346. * @}
  347. */
  348. #endif
  349. /**
  350. * @}
  351. */
  352. /* Exported macro ------------------------------------------------------------*/
  353. /** @defgroup PWR_LL_Exported_Macros PWR Exported Macros
  354. * @{
  355. */
  356. /** @defgroup PWR_LL_EM_WRITE_READ Common Write and read registers Macros
  357. * @{
  358. */
  359. /**
  360. * @brief Write a value in PWR register
  361. * @param __REG__ Register to be written
  362. * @param __VALUE__ Value to be written in the register
  363. * @retval None
  364. */
  365. #define LL_PWR_WriteReg(__REG__, __VALUE__) WRITE_REG(PWR->__REG__, (__VALUE__))
  366. /**
  367. * @brief Read a value in PWR register
  368. * @param __REG__ Register to be read
  369. * @retval Register value
  370. */
  371. #define LL_PWR_ReadReg(__REG__) READ_REG(PWR->__REG__)
  372. /**
  373. * @}
  374. */
  375. /**
  376. * @}
  377. */
  378. /* Exported functions --------------------------------------------------------*/
  379. /** @defgroup PWR_LL_Exported_Functions PWR Exported Functions
  380. * @{
  381. */
  382. /** @defgroup PWR_LL_EF_Configuration Configuration
  383. * @{
  384. */
  385. /**
  386. * @brief Switch from run main mode to run low-power mode.
  387. * @rmtoll CR1 LPR LL_PWR_EnterLowPowerRunMode
  388. * @retval None
  389. */
  390. __STATIC_INLINE void LL_PWR_EnterLowPowerRunMode(void)
  391. {
  392. SET_BIT(PWR->CR1, PWR_CR1_LPR);
  393. }
  394. /**
  395. * @brief Switch from run main mode to low-power mode.
  396. * @rmtoll CR1 LPR LL_PWR_ExitLowPowerRunMode
  397. * @retval None
  398. */
  399. __STATIC_INLINE void LL_PWR_ExitLowPowerRunMode(void)
  400. {
  401. CLEAR_BIT(PWR->CR1, PWR_CR1_LPR);
  402. }
  403. /**
  404. * @brief Check if the regulator is in low-power mode
  405. * @rmtoll CR1 LPR LL_PWR_IsEnabledLowPowerRunMode
  406. * @retval State of bit (1 or 0).
  407. */
  408. __STATIC_INLINE uint32_t LL_PWR_IsEnabledLowPowerRunMode(void)
  409. {
  410. return ((READ_BIT(PWR->CR1, PWR_CR1_LPR) == (PWR_CR1_LPR)) ? 1UL : 0UL);
  411. }
  412. #if defined(PWR_CR1_VOS)
  413. /**
  414. * @brief Set the main internal regulator output voltage
  415. * @note A delay is required for the internal regulator to be ready
  416. * after the voltage scaling has been changed.
  417. * Check whether regulator reached the selected voltage level
  418. * can be done using function @ref LL_PWR_IsActiveFlag_VOS().
  419. * @rmtoll CR1 VOS LL_PWR_SetRegulVoltageScaling
  420. * @param VoltageScaling This parameter can be one of the following values:
  421. * @arg @ref LL_PWR_REGU_VOLTAGE_SCALE1
  422. * @arg @ref LL_PWR_REGU_VOLTAGE_SCALE2
  423. * @retval None
  424. */
  425. __STATIC_INLINE void LL_PWR_SetRegulVoltageScaling(uint32_t VoltageScaling)
  426. {
  427. MODIFY_REG(PWR->CR1, PWR_CR1_VOS, VoltageScaling);
  428. }
  429. /**
  430. * @brief Get the main internal regulator output voltage
  431. * @rmtoll CR1 VOS LL_PWR_GetRegulVoltageScaling
  432. * @retval Returned value can be one of the following values:
  433. * @arg @ref LL_PWR_REGU_VOLTAGE_SCALE1
  434. * @arg @ref LL_PWR_REGU_VOLTAGE_SCALE2
  435. */
  436. __STATIC_INLINE uint32_t LL_PWR_GetRegulVoltageScaling(void)
  437. {
  438. return (uint32_t)(READ_BIT(PWR->CR1, PWR_CR1_VOS));
  439. }
  440. #endif
  441. /**
  442. * @brief Enable access to the backup domain
  443. * @rmtoll CR1 DBP LL_PWR_EnableBkUpAccess
  444. * @retval None
  445. */
  446. __STATIC_INLINE void LL_PWR_EnableBkUpAccess(void)
  447. {
  448. SET_BIT(PWR->CR1, PWR_CR1_DBP);
  449. }
  450. /**
  451. * @brief Disable access to the backup domain
  452. * @rmtoll CR1 DBP LL_PWR_DisableBkUpAccess
  453. * @retval None
  454. */
  455. __STATIC_INLINE void LL_PWR_DisableBkUpAccess(void)
  456. {
  457. CLEAR_BIT(PWR->CR1, PWR_CR1_DBP);
  458. }
  459. /**
  460. * @brief Check if the backup domain is enabled
  461. * @rmtoll CR1 DBP LL_PWR_IsEnabledBkUpAccess
  462. * @retval State of bit (1 or 0).
  463. */
  464. __STATIC_INLINE uint32_t LL_PWR_IsEnabledBkUpAccess(void)
  465. {
  466. return ((READ_BIT(PWR->CR1, PWR_CR1_DBP) == (PWR_CR1_DBP)) ? 1UL : 0UL);
  467. }
  468. /**
  469. * @brief Set Low-Power mode
  470. * @rmtoll CR1 LPMS LL_PWR_SetPowerMode
  471. * @param LowPowerMode This parameter can be one of the following values:
  472. * @arg @ref LL_PWR_MODE_STOP0
  473. * @arg @ref LL_PWR_MODE_STOP1
  474. * @arg @ref LL_PWR_MODE_STOP2
  475. * @arg @ref LL_PWR_MODE_STANDBY
  476. * @arg @ref LL_PWR_MODE_SHUTDOWN
  477. * @retval None
  478. */
  479. __STATIC_INLINE void LL_PWR_SetPowerMode(uint32_t LowPowerMode)
  480. {
  481. MODIFY_REG(PWR->CR1, PWR_CR1_LPMS, LowPowerMode);
  482. }
  483. /**
  484. * @brief Get Low-Power mode
  485. * @rmtoll CR1 LPMS LL_PWR_GetPowerMode
  486. * @retval Returned value can be one of the following values:
  487. * @arg @ref LL_PWR_MODE_STOP0
  488. * @arg @ref LL_PWR_MODE_STOP1
  489. * @arg @ref LL_PWR_MODE_STOP2
  490. * @arg @ref LL_PWR_MODE_STANDBY
  491. * @arg @ref LL_PWR_MODE_SHUTDOWN
  492. */
  493. __STATIC_INLINE uint32_t LL_PWR_GetPowerMode(void)
  494. {
  495. return (uint32_t)(READ_BIT(PWR->CR1, PWR_CR1_LPMS));
  496. }
  497. /**
  498. * @brief Set flash power-down mode during low-power run mode
  499. * @rmtoll CR1 FPDR LL_PWR_SetFlashPowerModeLPRun
  500. * @param FlashLowPowerMode This parameter can be one of the following values:
  501. * @arg @ref LL_PWR_FLASH_LPRUN_MODE_IDLE
  502. * @arg @ref LL_PWR_FLASH_LPRUN_MODE_POWER_DOWN
  503. * @retval None
  504. */
  505. __STATIC_INLINE void LL_PWR_SetFlashPowerModeLPRun(uint32_t FlashLowPowerMode)
  506. {
  507. /* Unlock bit FPDR */
  508. WRITE_REG(PWR->CR1, 0x0000C1B0U);
  509. /* Update bit FPDR */
  510. MODIFY_REG(PWR->CR1, PWR_CR1_FPDR, FlashLowPowerMode);
  511. }
  512. /**
  513. * @brief Get flash power-down mode during low-power run mode
  514. * @rmtoll CR1 FPDR LL_PWR_GetFlashPowerModeLPRun
  515. * @retval Returned value can be one of the following values:
  516. * @arg @ref LL_PWR_FLASH_LPRUN_MODE_IDLE
  517. * @arg @ref LL_PWR_FLASH_LPRUN_MODE_POWER_DOWN
  518. */
  519. __STATIC_INLINE uint32_t LL_PWR_GetFlashPowerModeLPRun(void)
  520. {
  521. return (uint32_t)(READ_BIT(PWR->CR1, PWR_CR1_FPDR));
  522. }
  523. /**
  524. * @brief Set flash power-down mode during sleep mode
  525. * @rmtoll CR1 FPDS LL_PWR_SetFlashPowerModeSleep
  526. * @param FlashLowPowerMode This parameter can be one of the following values:
  527. * @arg @ref LL_PWR_FLASH_SLEEP_MODE_IDLE
  528. * @arg @ref LL_PWR_FLASH_SLEEP_MODE_POWER_DOWN
  529. * @retval None
  530. */
  531. __STATIC_INLINE void LL_PWR_SetFlashPowerModeSleep(uint32_t FlashLowPowerMode)
  532. {
  533. MODIFY_REG(PWR->CR1, PWR_CR1_FPDS, FlashLowPowerMode);
  534. }
  535. /**
  536. * @brief Get flash power-down mode during sleep mode
  537. * @rmtoll CR1 FPDS LL_PWR_GetFlashPowerModeSleep
  538. * @retval Returned value can be one of the following values:
  539. * @arg @ref LL_PWR_FLASH_SLEEP_MODE_IDLE
  540. * @arg @ref LL_PWR_FLASH_SLEEP_MODE_POWER_DOWN
  541. */
  542. __STATIC_INLINE uint32_t LL_PWR_GetFlashPowerModeSleep(void)
  543. {
  544. return (uint32_t)(READ_BIT(PWR->CR1, PWR_CR1_FPDS));
  545. }
  546. #if defined(PWR_CR2_PVME1)
  547. /**
  548. * @brief Enable VDDUSB supply
  549. * @rmtoll CR2 USV LL_PWR_EnableVddUSB
  550. * @retval None
  551. */
  552. __STATIC_INLINE void LL_PWR_EnableVddUSB(void)
  553. {
  554. SET_BIT(PWR->CR2, PWR_CR2_USV);
  555. }
  556. /**
  557. * @brief Disable VDDUSB supply
  558. * @rmtoll CR2 USV LL_PWR_DisableVddUSB
  559. * @retval None
  560. */
  561. __STATIC_INLINE void LL_PWR_DisableVddUSB(void)
  562. {
  563. CLEAR_BIT(PWR->CR2, PWR_CR2_USV);
  564. }
  565. /**
  566. * @brief Check if VDDUSB supply is enabled
  567. * @rmtoll CR2 USV LL_PWR_IsEnabledVddUSB
  568. * @retval State of bit (1 or 0).
  569. */
  570. __STATIC_INLINE uint32_t LL_PWR_IsEnabledVddUSB(void)
  571. {
  572. return ((READ_BIT(PWR->CR2, PWR_CR2_USV) == (PWR_CR2_USV)) ? 1UL : 0UL);
  573. }
  574. #endif
  575. /**
  576. * @brief Enable the Power Voltage Monitoring on a peripheral
  577. * @rmtoll CR2 PVME1 LL_PWR_EnablePVM\n
  578. * CR2 PVME3 LL_PWR_EnablePVM
  579. * @param PeriphVoltage This parameter can be one of the following values:
  580. * @arg @ref LL_PWR_PVM_VDDUSB_1_2V (*)
  581. * @arg @ref LL_PWR_PVM_VDDA_1_62V
  582. *
  583. * (*) Not available on devices STM32WB50xx
  584. * @retval None
  585. */
  586. __STATIC_INLINE void LL_PWR_EnablePVM(uint32_t PeriphVoltage)
  587. {
  588. SET_BIT(PWR->CR2, PeriphVoltage);
  589. }
  590. /**
  591. * @brief Disable the Power Voltage Monitoring on a peripheral
  592. * @rmtoll CR2 PVME1 LL_PWR_DisablePVM\n
  593. * CR2 PVME3 LL_PWR_DisablePVM
  594. * @param PeriphVoltage This parameter can be one of the following values:
  595. * @arg @ref LL_PWR_PVM_VDDUSB_1_2V (*)
  596. * @arg @ref LL_PWR_PVM_VDDA_1_62V
  597. *
  598. * (*) Not available on devices STM32WB50xx
  599. * @retval None
  600. */
  601. __STATIC_INLINE void LL_PWR_DisablePVM(uint32_t PeriphVoltage)
  602. {
  603. CLEAR_BIT(PWR->CR2, PeriphVoltage);
  604. }
  605. /**
  606. * @brief Check if Power Voltage Monitoring is enabled on a peripheral
  607. * @rmtoll CR2 PVME1 LL_PWR_IsEnabledPVM\n
  608. * CR2 PVME3 LL_PWR_IsEnabledPVM
  609. * @param PeriphVoltage This parameter can be one of the following values:
  610. * @arg @ref LL_PWR_PVM_VDDUSB_1_2V (*)
  611. * @arg @ref LL_PWR_PVM_VDDA_1_62V
  612. *
  613. * (*) Not available on devices STM32WB50xx
  614. * @retval State of bit (1 or 0).
  615. */
  616. __STATIC_INLINE uint32_t LL_PWR_IsEnabledPVM(uint32_t PeriphVoltage)
  617. {
  618. return ((READ_BIT(PWR->CR2, PeriphVoltage) == (PeriphVoltage)) ? 1UL : 0UL);
  619. }
  620. /**
  621. * @brief Configure the voltage threshold detected by the Power Voltage Detector
  622. * @rmtoll CR2 PLS LL_PWR_SetPVDLevel
  623. * @param PVDLevel This parameter can be one of the following values:
  624. * @arg @ref LL_PWR_PVDLEVEL_0
  625. * @arg @ref LL_PWR_PVDLEVEL_1
  626. * @arg @ref LL_PWR_PVDLEVEL_2
  627. * @arg @ref LL_PWR_PVDLEVEL_3
  628. * @arg @ref LL_PWR_PVDLEVEL_4
  629. * @arg @ref LL_PWR_PVDLEVEL_5
  630. * @arg @ref LL_PWR_PVDLEVEL_6
  631. * @arg @ref LL_PWR_PVDLEVEL_7
  632. * @retval None
  633. */
  634. __STATIC_INLINE void LL_PWR_SetPVDLevel(uint32_t PVDLevel)
  635. {
  636. MODIFY_REG(PWR->CR2, PWR_CR2_PLS, PVDLevel);
  637. }
  638. /**
  639. * @brief Get the voltage threshold detection
  640. * @rmtoll CR2 PLS LL_PWR_GetPVDLevel
  641. * @retval Returned value can be one of the following values:
  642. * @arg @ref LL_PWR_PVDLEVEL_0
  643. * @arg @ref LL_PWR_PVDLEVEL_1
  644. * @arg @ref LL_PWR_PVDLEVEL_2
  645. * @arg @ref LL_PWR_PVDLEVEL_3
  646. * @arg @ref LL_PWR_PVDLEVEL_4
  647. * @arg @ref LL_PWR_PVDLEVEL_5
  648. * @arg @ref LL_PWR_PVDLEVEL_6
  649. * @arg @ref LL_PWR_PVDLEVEL_7
  650. */
  651. __STATIC_INLINE uint32_t LL_PWR_GetPVDLevel(void)
  652. {
  653. return (uint32_t)(READ_BIT(PWR->CR2, PWR_CR2_PLS));
  654. }
  655. /**
  656. * @brief Enable Power Voltage Detector
  657. * @rmtoll CR2 PVDE LL_PWR_EnablePVD
  658. * @retval None
  659. */
  660. __STATIC_INLINE void LL_PWR_EnablePVD(void)
  661. {
  662. SET_BIT(PWR->CR2, PWR_CR2_PVDE);
  663. }
  664. /**
  665. * @brief Disable Power Voltage Detector
  666. * @rmtoll CR2 PVDE LL_PWR_DisablePVD
  667. * @retval None
  668. */
  669. __STATIC_INLINE void LL_PWR_DisablePVD(void)
  670. {
  671. CLEAR_BIT(PWR->CR2, PWR_CR2_PVDE);
  672. }
  673. /**
  674. * @brief Check if Power Voltage Detector is enabled
  675. * @rmtoll CR2 PVDE LL_PWR_IsEnabledPVD
  676. * @retval State of bit (1 or 0).
  677. */
  678. __STATIC_INLINE uint32_t LL_PWR_IsEnabledPVD(void)
  679. {
  680. return ((READ_BIT(PWR->CR2, PWR_CR2_PVDE) == (PWR_CR2_PVDE)) ? 1UL : 0UL);
  681. }
  682. /**
  683. * @brief Enable Internal Wake-up line
  684. * @rmtoll CR3 EIWF LL_PWR_EnableInternWU
  685. * @retval None
  686. */
  687. __STATIC_INLINE void LL_PWR_EnableInternWU(void)
  688. {
  689. SET_BIT(PWR->CR3, PWR_CR3_EIWUL);
  690. }
  691. /**
  692. * @brief Disable Internal Wake-up line
  693. * @rmtoll CR3 EIWF LL_PWR_DisableInternWU
  694. * @retval None
  695. */
  696. __STATIC_INLINE void LL_PWR_DisableInternWU(void)
  697. {
  698. CLEAR_BIT(PWR->CR3, PWR_CR3_EIWUL);
  699. }
  700. /**
  701. * @brief Check if Internal Wake-up line is enabled
  702. * @rmtoll CR3 EIWF LL_PWR_IsEnabledInternWU
  703. * @retval State of bit (1 or 0).
  704. */
  705. __STATIC_INLINE uint32_t LL_PWR_IsEnabledInternWU(void)
  706. {
  707. return ((READ_BIT(PWR->CR3, PWR_CR3_EIWUL) == (PWR_CR3_EIWUL)) ? 1UL : 0UL);
  708. }
  709. /**
  710. * @brief Enable pull-up and pull-down configuration
  711. * @rmtoll CR3 APC LL_PWR_EnablePUPDCfg
  712. * @retval None
  713. */
  714. __STATIC_INLINE void LL_PWR_EnablePUPDCfg(void)
  715. {
  716. SET_BIT(PWR->CR3, PWR_CR3_APC);
  717. }
  718. /**
  719. * @brief Disable pull-up and pull-down configuration
  720. * @rmtoll CR3 APC LL_PWR_DisablePUPDCfg
  721. * @retval None
  722. */
  723. __STATIC_INLINE void LL_PWR_DisablePUPDCfg(void)
  724. {
  725. CLEAR_BIT(PWR->CR3, PWR_CR3_APC);
  726. }
  727. /**
  728. * @brief Check if pull-up and pull-down configuration is enabled
  729. * @rmtoll CR3 APC LL_PWR_IsEnabledPUPDCfg
  730. * @retval State of bit (1 or 0).
  731. */
  732. __STATIC_INLINE uint32_t LL_PWR_IsEnabledPUPDCfg(void)
  733. {
  734. return ((READ_BIT(PWR->CR3, PWR_CR3_APC) == (PWR_CR3_APC)) ? 1UL : 0UL);
  735. }
  736. /**
  737. * @brief Enable SRAM2 content retention in Standby mode
  738. * @rmtoll CR3 RRS LL_PWR_EnableSRAM2Retention
  739. * @retval None
  740. */
  741. __STATIC_INLINE void LL_PWR_EnableSRAM2Retention(void)
  742. {
  743. SET_BIT(PWR->CR3, PWR_CR3_RRS);
  744. }
  745. /**
  746. * @brief Disable SRAM2 content retention in Standby mode
  747. * @rmtoll CR3 RRS LL_PWR_DisableSRAM2Retention
  748. * @retval None
  749. */
  750. __STATIC_INLINE void LL_PWR_DisableSRAM2Retention(void)
  751. {
  752. CLEAR_BIT(PWR->CR3, PWR_CR3_RRS);
  753. }
  754. /**
  755. * @brief Check if SRAM2 content retention in Standby mode is enabled
  756. * @rmtoll CR3 RRS LL_PWR_IsEnabledSRAM2Retention
  757. * @retval State of bit (1 or 0).
  758. */
  759. __STATIC_INLINE uint32_t LL_PWR_IsEnabledSRAM2Retention(void)
  760. {
  761. return ((READ_BIT(PWR->CR3, PWR_CR3_RRS) == (PWR_CR3_RRS)) ? 1UL : 0UL);
  762. }
  763. /**
  764. * @brief Enable the WakeUp PINx functionality
  765. * @rmtoll CR3 EWUP1 LL_PWR_EnableWakeUpPin\n
  766. * CR3 EWUP2 LL_PWR_EnableWakeUpPin\n
  767. * CR3 EWUP3 LL_PWR_EnableWakeUpPin\n
  768. * CR3 EWUP4 LL_PWR_EnableWakeUpPin\n
  769. * CR3 EWUP5 LL_PWR_EnableWakeUpPin\n
  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. *
  777. * (*) Not available on devices STM32WB50xx
  778. * @retval None
  779. */
  780. __STATIC_INLINE void LL_PWR_EnableWakeUpPin(uint32_t WakeUpPin)
  781. {
  782. SET_BIT(PWR->CR3, WakeUpPin);
  783. }
  784. /**
  785. * @brief Disable the WakeUp PINx functionality
  786. * @rmtoll CR3 EWUP1 LL_PWR_DisableWakeUpPin\n
  787. * CR3 EWUP2 LL_PWR_DisableWakeUpPin\n
  788. * CR3 EWUP3 LL_PWR_DisableWakeUpPin\n
  789. * CR3 EWUP4 LL_PWR_DisableWakeUpPin\n
  790. * CR3 EWUP5 LL_PWR_DisableWakeUpPin\n
  791. * @param WakeUpPin This parameter can be one of the following values:
  792. * @arg @ref LL_PWR_WAKEUP_PIN1
  793. * @arg @ref LL_PWR_WAKEUP_PIN2 (*)
  794. * @arg @ref LL_PWR_WAKEUP_PIN3 (*)
  795. * @arg @ref LL_PWR_WAKEUP_PIN4
  796. * @arg @ref LL_PWR_WAKEUP_PIN5 (*)
  797. *
  798. * (*) Not available on devices STM32WB50xx
  799. * @retval None
  800. */
  801. __STATIC_INLINE void LL_PWR_DisableWakeUpPin(uint32_t WakeUpPin)
  802. {
  803. CLEAR_BIT(PWR->CR3, WakeUpPin);
  804. }
  805. /**
  806. * @brief Check if the WakeUp PINx functionality is enabled
  807. * @rmtoll CR3 EWUP1 LL_PWR_IsEnabledWakeUpPin\n
  808. * CR3 EWUP2 LL_PWR_IsEnabledWakeUpPin\n
  809. * CR3 EWUP3 LL_PWR_IsEnabledWakeUpPin\n
  810. * CR3 EWUP4 LL_PWR_IsEnabledWakeUpPin\n
  811. * CR3 EWUP5 LL_PWR_IsEnabledWakeUpPin\n
  812. * @param WakeUpPin This parameter can be one of the following values:
  813. * @arg @ref LL_PWR_WAKEUP_PIN1
  814. * @arg @ref LL_PWR_WAKEUP_PIN2 (*)
  815. * @arg @ref LL_PWR_WAKEUP_PIN3 (*)
  816. * @arg @ref LL_PWR_WAKEUP_PIN4
  817. * @arg @ref LL_PWR_WAKEUP_PIN5 (*)
  818. *
  819. * (*) Not available on devices STM32WB50xx
  820. * @retval State of bit (1 or 0).
  821. */
  822. __STATIC_INLINE uint32_t LL_PWR_IsEnabledWakeUpPin(uint32_t WakeUpPin)
  823. {
  824. return ((READ_BIT(PWR->CR3, WakeUpPin) == (WakeUpPin)) ? 1UL : 0UL);
  825. }
  826. /**
  827. * @brief Set the resistor impedance
  828. * @rmtoll CR4 VBRS LL_PWR_SetBattChargResistor
  829. * @param Resistor This parameter can be one of the following values:
  830. * @arg @ref LL_PWR_BATT_CHARG_RESISTOR_5K
  831. * @arg @ref LL_PWR_BATT_CHARGRESISTOR_1_5K
  832. * @retval None
  833. */
  834. __STATIC_INLINE void LL_PWR_SetBattChargResistor(uint32_t Resistor)
  835. {
  836. MODIFY_REG(PWR->CR4, PWR_CR4_VBRS, Resistor);
  837. }
  838. /**
  839. * @brief Get the resistor impedance
  840. * @rmtoll CR4 VBRS LL_PWR_GetBattChargResistor
  841. * @retval Returned value can be one of the following values:
  842. * @arg @ref LL_PWR_BATT_CHARG_RESISTOR_5K
  843. * @arg @ref LL_PWR_BATT_CHARGRESISTOR_1_5K
  844. */
  845. __STATIC_INLINE uint32_t LL_PWR_GetBattChargResistor(void)
  846. {
  847. return (uint32_t)(READ_BIT(PWR->CR4, PWR_CR4_VBRS));
  848. }
  849. /**
  850. * @brief Enable battery charging
  851. * @rmtoll CR4 VBE LL_PWR_EnableBatteryCharging
  852. * @retval None
  853. */
  854. __STATIC_INLINE void LL_PWR_EnableBatteryCharging(void)
  855. {
  856. SET_BIT(PWR->CR4, PWR_CR4_VBE);
  857. }
  858. /**
  859. * @brief Disable battery charging
  860. * @rmtoll CR4 VBE LL_PWR_DisableBatteryCharging
  861. * @retval None
  862. */
  863. __STATIC_INLINE void LL_PWR_DisableBatteryCharging(void)
  864. {
  865. CLEAR_BIT(PWR->CR4, PWR_CR4_VBE);
  866. }
  867. /**
  868. * @brief Check if battery charging is enabled
  869. * @rmtoll CR4 VBE LL_PWR_IsEnabledBatteryCharging
  870. * @retval State of bit (1 or 0).
  871. */
  872. __STATIC_INLINE uint32_t LL_PWR_IsEnabledBatteryCharging(void)
  873. {
  874. return ((READ_BIT(PWR->CR4, PWR_CR4_VBE) == (PWR_CR4_VBE)) ? 1UL : 0UL);
  875. }
  876. /**
  877. * @brief Set the Wake-Up pin polarity low for the event detection
  878. * @rmtoll CR4 WP1 LL_PWR_SetWakeUpPinPolarityLow\n
  879. * CR4 WP2 LL_PWR_SetWakeUpPinPolarityLow\n
  880. * CR4 WP3 LL_PWR_SetWakeUpPinPolarityLow\n
  881. * CR4 WP4 LL_PWR_SetWakeUpPinPolarityLow\n
  882. * CR4 WP5 LL_PWR_SetWakeUpPinPolarityLow
  883. * @param WakeUpPin This parameter can be one of the following values:
  884. * @arg @ref LL_PWR_WAKEUP_PIN1
  885. * @arg @ref LL_PWR_WAKEUP_PIN2 (*)
  886. * @arg @ref LL_PWR_WAKEUP_PIN3 (*)
  887. * @arg @ref LL_PWR_WAKEUP_PIN4
  888. * @arg @ref LL_PWR_WAKEUP_PIN5 (*)
  889. *
  890. * (*) Not available on devices STM32WB50xx
  891. * @retval None
  892. */
  893. __STATIC_INLINE void LL_PWR_SetWakeUpPinPolarityLow(uint32_t WakeUpPin)
  894. {
  895. SET_BIT(PWR->CR4, WakeUpPin);
  896. }
  897. /**
  898. * @brief Set the Wake-Up pin polarity high for the event detection
  899. * @rmtoll CR4 WP1 LL_PWR_SetWakeUpPinPolarityHigh\n
  900. * CR4 WP2 LL_PWR_SetWakeUpPinPolarityHigh\n
  901. * CR4 WP3 LL_PWR_SetWakeUpPinPolarityHigh\n
  902. * CR4 WP4 LL_PWR_SetWakeUpPinPolarityHigh\n
  903. * CR4 WP5 LL_PWR_SetWakeUpPinPolarityHigh
  904. * @param WakeUpPin This parameter can be one of the following values:
  905. * @arg @ref LL_PWR_WAKEUP_PIN1
  906. * @arg @ref LL_PWR_WAKEUP_PIN2 (*)
  907. * @arg @ref LL_PWR_WAKEUP_PIN3 (*)
  908. * @arg @ref LL_PWR_WAKEUP_PIN4
  909. * @arg @ref LL_PWR_WAKEUP_PIN5 (*)
  910. *
  911. * (*) Not available on devices STM32WB50xx
  912. * @retval None
  913. */
  914. __STATIC_INLINE void LL_PWR_SetWakeUpPinPolarityHigh(uint32_t WakeUpPin)
  915. {
  916. CLEAR_BIT(PWR->CR4, WakeUpPin);
  917. }
  918. /**
  919. * @brief Get the Wake-Up pin polarity for the event detection
  920. * @rmtoll CR4 WP1 LL_PWR_IsWakeUpPinPolarityLow\n
  921. * CR4 WP2 LL_PWR_IsWakeUpPinPolarityLow\n
  922. * CR4 WP3 LL_PWR_IsWakeUpPinPolarityLow\n
  923. * CR4 WP4 LL_PWR_IsWakeUpPinPolarityLow\n
  924. * CR4 WP5 LL_PWR_IsWakeUpPinPolarityLow
  925. * @param WakeUpPin This parameter can be one of the following values:
  926. * @arg @ref LL_PWR_WAKEUP_PIN1
  927. * @arg @ref LL_PWR_WAKEUP_PIN2 (*)
  928. * @arg @ref LL_PWR_WAKEUP_PIN3 (*)
  929. * @arg @ref LL_PWR_WAKEUP_PIN4
  930. * @arg @ref LL_PWR_WAKEUP_PIN5 (*)
  931. *
  932. * (*) Not available on devices STM32WB50xx
  933. * @retval State of bit (1 or 0).
  934. */
  935. __STATIC_INLINE uint32_t LL_PWR_IsWakeUpPinPolarityLow(uint32_t WakeUpPin)
  936. {
  937. return ((READ_BIT(PWR->CR4, WakeUpPin) == (WakeUpPin)) ? 1UL : 0UL);
  938. }
  939. /**
  940. * @brief Enable GPIO pull-up state in Standby and Shutdown modes
  941. * @note Some pins are not configurable for pulling in Standby and Shutdown
  942. * modes. Refer to reference manual for available pins and ports.
  943. * @rmtoll PUCRA PU0-15 LL_PWR_EnableGPIOPullUp\n
  944. * PUCRB PU0-15 LL_PWR_EnableGPIOPullUp\n
  945. * PUCRC PU0-15 LL_PWR_EnableGPIOPullUp\n
  946. * PUCRD PU0-15 LL_PWR_EnableGPIOPullUp\n
  947. * PUCRE PU0-15 LL_PWR_EnableGPIOPullUp\n
  948. * PUCRH PU0-15 LL_PWR_EnableGPIOPullUp
  949. * @param GPIO This parameter can be one of the following values:
  950. * @arg @ref LL_PWR_GPIO_A
  951. * @arg @ref LL_PWR_GPIO_B
  952. * @arg @ref LL_PWR_GPIO_C
  953. * @arg @ref LL_PWR_GPIO_D
  954. * @arg @ref LL_PWR_GPIO_E
  955. * @arg @ref LL_PWR_GPIO_H
  956. * @param GPIONumber This parameter can be one of the following values:
  957. * @arg @ref LL_PWR_GPIO_BIT_0
  958. * @arg @ref LL_PWR_GPIO_BIT_1
  959. * @arg @ref LL_PWR_GPIO_BIT_2
  960. * @arg @ref LL_PWR_GPIO_BIT_3
  961. * @arg @ref LL_PWR_GPIO_BIT_4
  962. * @arg @ref LL_PWR_GPIO_BIT_5
  963. * @arg @ref LL_PWR_GPIO_BIT_6
  964. * @arg @ref LL_PWR_GPIO_BIT_7
  965. * @arg @ref LL_PWR_GPIO_BIT_8
  966. * @arg @ref LL_PWR_GPIO_BIT_9
  967. * @arg @ref LL_PWR_GPIO_BIT_10
  968. * @arg @ref LL_PWR_GPIO_BIT_11
  969. * @arg @ref LL_PWR_GPIO_BIT_12
  970. * @arg @ref LL_PWR_GPIO_BIT_13
  971. * @arg @ref LL_PWR_GPIO_BIT_14
  972. * @arg @ref LL_PWR_GPIO_BIT_15
  973. * @retval None
  974. */
  975. __STATIC_INLINE void LL_PWR_EnableGPIOPullUp(uint32_t GPIO, uint32_t GPIONumber)
  976. {
  977. SET_BIT(*((__IO uint32_t *)GPIO), GPIONumber);
  978. }
  979. /**
  980. * @brief Disable GPIO pull-up state in Standby and Shutdown modes
  981. * @note Some pins are not configurable for pulling in Standby and Shutdown
  982. * modes. Refer to reference manual for available pins and ports.
  983. * @rmtoll PUCRA PU0-15 LL_PWR_DisableGPIOPullUp\n
  984. * PUCRB PU0-15 LL_PWR_DisableGPIOPullUp\n
  985. * PUCRC PU0-15 LL_PWR_DisableGPIOPullUp\n
  986. * PUCRD PU0-15 LL_PWR_DisableGPIOPullUp\n
  987. * PUCRE PU0-15 LL_PWR_DisableGPIOPullUp\n
  988. * PUCRH PU0-15 LL_PWR_DisableGPIOPullUp
  989. * @param GPIO This parameter can be one of the following values:
  990. * @arg @ref LL_PWR_GPIO_A
  991. * @arg @ref LL_PWR_GPIO_B
  992. * @arg @ref LL_PWR_GPIO_C
  993. * @arg @ref LL_PWR_GPIO_D
  994. * @arg @ref LL_PWR_GPIO_E
  995. * @arg @ref LL_PWR_GPIO_H
  996. * @param GPIONumber This parameter can be one of the following values:
  997. * @arg @ref LL_PWR_GPIO_BIT_0
  998. * @arg @ref LL_PWR_GPIO_BIT_1
  999. * @arg @ref LL_PWR_GPIO_BIT_2
  1000. * @arg @ref LL_PWR_GPIO_BIT_3
  1001. * @arg @ref LL_PWR_GPIO_BIT_4
  1002. * @arg @ref LL_PWR_GPIO_BIT_5
  1003. * @arg @ref LL_PWR_GPIO_BIT_6
  1004. * @arg @ref LL_PWR_GPIO_BIT_7
  1005. * @arg @ref LL_PWR_GPIO_BIT_8
  1006. * @arg @ref LL_PWR_GPIO_BIT_9
  1007. * @arg @ref LL_PWR_GPIO_BIT_10
  1008. * @arg @ref LL_PWR_GPIO_BIT_11
  1009. * @arg @ref LL_PWR_GPIO_BIT_12
  1010. * @arg @ref LL_PWR_GPIO_BIT_13
  1011. * @arg @ref LL_PWR_GPIO_BIT_14
  1012. * @arg @ref LL_PWR_GPIO_BIT_15
  1013. * @retval None
  1014. */
  1015. __STATIC_INLINE void LL_PWR_DisableGPIOPullUp(uint32_t GPIO, uint32_t GPIONumber)
  1016. {
  1017. CLEAR_BIT(*((__IO uint32_t *)GPIO), GPIONumber);
  1018. }
  1019. /**
  1020. * @brief Check if GPIO pull-up state is enabled
  1021. * @rmtoll PUCRA PU0-15 LL_PWR_IsEnabledGPIOPullUp\n
  1022. * PUCRB PU0-15 LL_PWR_IsEnabledGPIOPullUp\n
  1023. * PUCRC PU0-15 LL_PWR_IsEnabledGPIOPullUp\n
  1024. * PUCRD PU0-15 LL_PWR_IsEnabledGPIOPullUp\n
  1025. * PUCRE PU0-15 LL_PWR_IsEnabledGPIOPullUp\n
  1026. * PUCRH PU0-15 LL_PWR_IsEnabledGPIOPullUp
  1027. * @param GPIO This parameter can be one of the following values:
  1028. * @arg @ref LL_PWR_GPIO_A
  1029. * @arg @ref LL_PWR_GPIO_B
  1030. * @arg @ref LL_PWR_GPIO_C
  1031. * @arg @ref LL_PWR_GPIO_D
  1032. * @arg @ref LL_PWR_GPIO_E
  1033. * @arg @ref LL_PWR_GPIO_H
  1034. * @param GPIONumber This parameter can be one of the following values:
  1035. * @arg @ref LL_PWR_GPIO_BIT_0
  1036. * @arg @ref LL_PWR_GPIO_BIT_1
  1037. * @arg @ref LL_PWR_GPIO_BIT_2
  1038. * @arg @ref LL_PWR_GPIO_BIT_3
  1039. * @arg @ref LL_PWR_GPIO_BIT_4
  1040. * @arg @ref LL_PWR_GPIO_BIT_5
  1041. * @arg @ref LL_PWR_GPIO_BIT_6
  1042. * @arg @ref LL_PWR_GPIO_BIT_7
  1043. * @arg @ref LL_PWR_GPIO_BIT_8
  1044. * @arg @ref LL_PWR_GPIO_BIT_9
  1045. * @arg @ref LL_PWR_GPIO_BIT_10
  1046. * @arg @ref LL_PWR_GPIO_BIT_11
  1047. * @arg @ref LL_PWR_GPIO_BIT_12
  1048. * @arg @ref LL_PWR_GPIO_BIT_13
  1049. * @arg @ref LL_PWR_GPIO_BIT_14
  1050. * @arg @ref LL_PWR_GPIO_BIT_15
  1051. * @retval State of bit (1 or 0).
  1052. */
  1053. __STATIC_INLINE uint32_t LL_PWR_IsEnabledGPIOPullUp(uint32_t GPIO, uint32_t GPIONumber)
  1054. {
  1055. return ((READ_BIT(*((__IO uint32_t *)GPIO), GPIONumber) == (GPIONumber)) ? 1UL : 0UL);
  1056. }
  1057. /**
  1058. * @brief Enable GPIO pull-down state in Standby and Shutdown modes
  1059. * @note Some pins are not configurable for pulling in Standby and Shutdown
  1060. * modes. Refer to reference manual for available pins and ports.
  1061. * @rmtoll PDCRA PD0-15 LL_PWR_EnableGPIOPullDown\n
  1062. * PDCRB PD0-15 LL_PWR_EnableGPIOPullDown\n
  1063. * PDCRC PD0-15 LL_PWR_EnableGPIOPullDown\n
  1064. * PDCRD PD0-15 LL_PWR_EnableGPIOPullDown\n
  1065. * PDCRE PD0-15 LL_PWR_EnableGPIOPullDown\n
  1066. * PDCRH PD0-15 LL_PWR_EnableGPIOPullDown
  1067. * @param GPIO This parameter can be one of the following values:
  1068. * @arg @ref LL_PWR_GPIO_A
  1069. * @arg @ref LL_PWR_GPIO_B
  1070. * @arg @ref LL_PWR_GPIO_C
  1071. * @arg @ref LL_PWR_GPIO_D
  1072. * @arg @ref LL_PWR_GPIO_E
  1073. * @arg @ref LL_PWR_GPIO_H
  1074. * @param GPIONumber This parameter can be one of the following values:
  1075. * @arg @ref LL_PWR_GPIO_BIT_0
  1076. * @arg @ref LL_PWR_GPIO_BIT_1
  1077. * @arg @ref LL_PWR_GPIO_BIT_2
  1078. * @arg @ref LL_PWR_GPIO_BIT_3
  1079. * @arg @ref LL_PWR_GPIO_BIT_4
  1080. * @arg @ref LL_PWR_GPIO_BIT_5
  1081. * @arg @ref LL_PWR_GPIO_BIT_6
  1082. * @arg @ref LL_PWR_GPIO_BIT_7
  1083. * @arg @ref LL_PWR_GPIO_BIT_8
  1084. * @arg @ref LL_PWR_GPIO_BIT_9
  1085. * @arg @ref LL_PWR_GPIO_BIT_10
  1086. * @arg @ref LL_PWR_GPIO_BIT_11
  1087. * @arg @ref LL_PWR_GPIO_BIT_12
  1088. * @arg @ref LL_PWR_GPIO_BIT_13
  1089. * @arg @ref LL_PWR_GPIO_BIT_14
  1090. * @arg @ref LL_PWR_GPIO_BIT_15
  1091. * @retval None
  1092. */
  1093. __STATIC_INLINE void LL_PWR_EnableGPIOPullDown(uint32_t GPIO, uint32_t GPIONumber)
  1094. {
  1095. SET_BIT(*((__IO uint32_t *)(GPIO + 4UL)), GPIONumber);
  1096. }
  1097. /**
  1098. * @brief Disable GPIO pull-down state in Standby and Shutdown modes
  1099. * @note Some pins are not configurable for pulling in Standby and Shutdown
  1100. * modes. Refer to reference manual for available pins and ports.
  1101. * @rmtoll PDCRA PD0-15 LL_PWR_DisableGPIOPullDown\n
  1102. * PDCRB PD0-15 LL_PWR_DisableGPIOPullDown\n
  1103. * PDCRC PD0-15 LL_PWR_DisableGPIOPullDown\n
  1104. * PDCRD PD0-15 LL_PWR_DisableGPIOPullDown\n
  1105. * PDCRE PD0-15 LL_PWR_DisableGPIOPullDown\n
  1106. * PDCRH PD0-15 LL_PWR_DisableGPIOPullDown
  1107. * @param GPIO This parameter can be one of the following values:
  1108. * @arg @ref LL_PWR_GPIO_A
  1109. * @arg @ref LL_PWR_GPIO_B
  1110. * @arg @ref LL_PWR_GPIO_C
  1111. * @arg @ref LL_PWR_GPIO_D
  1112. * @arg @ref LL_PWR_GPIO_E
  1113. * @arg @ref LL_PWR_GPIO_H
  1114. * @param GPIONumber This parameter can be one of the following values:
  1115. * @arg @ref LL_PWR_GPIO_BIT_0
  1116. * @arg @ref LL_PWR_GPIO_BIT_1
  1117. * @arg @ref LL_PWR_GPIO_BIT_2
  1118. * @arg @ref LL_PWR_GPIO_BIT_3
  1119. * @arg @ref LL_PWR_GPIO_BIT_4
  1120. * @arg @ref LL_PWR_GPIO_BIT_5
  1121. * @arg @ref LL_PWR_GPIO_BIT_6
  1122. * @arg @ref LL_PWR_GPIO_BIT_7
  1123. * @arg @ref LL_PWR_GPIO_BIT_8
  1124. * @arg @ref LL_PWR_GPIO_BIT_9
  1125. * @arg @ref LL_PWR_GPIO_BIT_10
  1126. * @arg @ref LL_PWR_GPIO_BIT_11
  1127. * @arg @ref LL_PWR_GPIO_BIT_12
  1128. * @arg @ref LL_PWR_GPIO_BIT_13
  1129. * @arg @ref LL_PWR_GPIO_BIT_14
  1130. * @arg @ref LL_PWR_GPIO_BIT_15
  1131. * @retval None
  1132. */
  1133. __STATIC_INLINE void LL_PWR_DisableGPIOPullDown(uint32_t GPIO, uint32_t GPIONumber)
  1134. {
  1135. CLEAR_BIT(*((__IO uint32_t *)(GPIO + 4UL)), GPIONumber);
  1136. }
  1137. /**
  1138. * @brief Check if GPIO pull-down state is enabled
  1139. * @rmtoll PDCRA PD0-15 LL_PWR_IsEnabledGPIOPullDown\n
  1140. * PDCRB PD0-15 LL_PWR_IsEnabledGPIOPullDown\n
  1141. * PDCRC PD0-15 LL_PWR_IsEnabledGPIOPullDown\n
  1142. * PDCRD PD0-15 LL_PWR_IsEnabledGPIOPullDown\n
  1143. * PDCRE PD0-15 LL_PWR_IsEnabledGPIOPullDown\n
  1144. * PDCRH PD0-15 LL_PWR_IsEnabledGPIOPullDown
  1145. * @param GPIO This parameter can be one of the following values:
  1146. * @arg @ref LL_PWR_GPIO_A
  1147. * @arg @ref LL_PWR_GPIO_B
  1148. * @arg @ref LL_PWR_GPIO_C
  1149. * @arg @ref LL_PWR_GPIO_D
  1150. * @arg @ref LL_PWR_GPIO_E
  1151. * @arg @ref LL_PWR_GPIO_H
  1152. * @param GPIONumber This parameter can be one of the following values:
  1153. * @arg @ref LL_PWR_GPIO_BIT_0
  1154. * @arg @ref LL_PWR_GPIO_BIT_1
  1155. * @arg @ref LL_PWR_GPIO_BIT_2
  1156. * @arg @ref LL_PWR_GPIO_BIT_3
  1157. * @arg @ref LL_PWR_GPIO_BIT_4
  1158. * @arg @ref LL_PWR_GPIO_BIT_5
  1159. * @arg @ref LL_PWR_GPIO_BIT_6
  1160. * @arg @ref LL_PWR_GPIO_BIT_7
  1161. * @arg @ref LL_PWR_GPIO_BIT_8
  1162. * @arg @ref LL_PWR_GPIO_BIT_9
  1163. * @arg @ref LL_PWR_GPIO_BIT_10
  1164. * @arg @ref LL_PWR_GPIO_BIT_11
  1165. * @arg @ref LL_PWR_GPIO_BIT_12
  1166. * @arg @ref LL_PWR_GPIO_BIT_13
  1167. * @arg @ref LL_PWR_GPIO_BIT_14
  1168. * @arg @ref LL_PWR_GPIO_BIT_15
  1169. * @retval State of bit (1 or 0).
  1170. */
  1171. __STATIC_INLINE uint32_t LL_PWR_IsEnabledGPIOPullDown(uint32_t GPIO, uint32_t GPIONumber)
  1172. {
  1173. return ((READ_BIT(*((__IO uint32_t *)(GPIO + 4UL)), GPIONumber) == (GPIONumber)) ? 1UL : 0UL);
  1174. }
  1175. #if defined(PWR_CR5_SMPSEN)
  1176. /**
  1177. * @brief Set BOR configuration
  1178. * @rmtoll CR5 BORHC LL_PWR_SetBORConfig
  1179. * @param BORConfiguration This parameter can be one of the following values:
  1180. * @arg @ref LL_PWR_BOR_SYSTEM_RESET
  1181. * @arg @ref LL_PWR_BOR_SMPS_FORCE_BYPASS
  1182. */
  1183. __STATIC_INLINE void LL_PWR_SetBORConfig(uint32_t BORConfiguration)
  1184. {
  1185. MODIFY_REG(PWR->CR5, PWR_CR5_BORHC, BORConfiguration);
  1186. }
  1187. /**
  1188. * @brief Get BOR configuration
  1189. * @rmtoll CR5 BORHC LL_PWR_GetBORConfig
  1190. * @retval Returned value can be one of the following values:
  1191. * @arg @ref LL_PWR_BOR_SYSTEM_RESET
  1192. * @arg @ref LL_PWR_BOR_SMPS_FORCE_BYPASS
  1193. */
  1194. __STATIC_INLINE uint32_t LL_PWR_GetBORConfig(void)
  1195. {
  1196. return (uint32_t)(READ_BIT(PWR->CR5, PWR_CR5_BORHC));
  1197. }
  1198. #endif
  1199. /**
  1200. * @}
  1201. */
  1202. #if defined(PWR_CR5_SMPSEN)
  1203. /** @defgroup PWR_LL_EF_Configuration_SMPS Configuration of SMPS
  1204. * @{
  1205. */
  1206. /**
  1207. * @brief Set SMPS operating mode
  1208. * @note When SMPS step down converter SMPS mode is enabled,
  1209. * it is good practice to enable the BORH to monitor the supply:
  1210. * in this case, when the supply drops below the SMPS step down
  1211. * converter SMPS mode operating supply level,
  1212. * switching on the fly is performed automaticcaly
  1213. * and interruption is generated.
  1214. * Refer to function @ref LL_PWR_SetBORConfig().
  1215. * @note Occurence of SMPS step down converter forced in bypass mode
  1216. * can be monitored by flag and interruption.
  1217. * Refer to functions
  1218. * @ref LL_PWR_IsActiveFlag_SMPSFB(), @ref LL_PWR_ClearFlag_SMPSFB(),
  1219. * @ref LL_PWR_EnableIT_BORH_SMPSFB().
  1220. * @rmtoll CR5 SMPSEN LL_PWR_SMPS_SetMode \n
  1221. * CR5 SMPSBEN LL_PWR_SMPS_SetMode
  1222. * @param OperatingMode This parameter can be one of the following values:
  1223. * @arg @ref LL_PWR_SMPS_BYPASS
  1224. * @arg @ref LL_PWR_SMPS_STEP_DOWN (1)
  1225. *
  1226. * (1) SMPS operating mode step down or open depends on system low-power mode:
  1227. * - step down mode if system low power mode is run, LP run or stop0,
  1228. * - open mode if system low power mode is stop1, stop2, standby or shutdown
  1229. * @retval None
  1230. */
  1231. __STATIC_INLINE void LL_PWR_SMPS_SetMode(uint32_t OperatingMode)
  1232. {
  1233. /* Note: Operation on bits performed to keep compatibility of literals */
  1234. /* for all SMPS operating mode functions: */
  1235. /* "LL_PWR_SMPS_SetMode()", "LL_PWR_SMPS_GetMode()" */
  1236. /* and "LL_PWR_SMPS_GetEffectiveMode()". */
  1237. MODIFY_REG(PWR->CR5, PWR_CR5_SMPSEN, (OperatingMode & PWR_SR2_SMPSF) << (PWR_CR5_SMPSEN_Pos - PWR_SR2_SMPSF_Pos));
  1238. }
  1239. /**
  1240. * @brief Get SMPS operating mode
  1241. * @rmtoll CR5 SMPSEN LL_PWR_SMPS_GetMode \n
  1242. * CR5 SMPSBEN LL_PWR_SMPS_GetMode
  1243. * @retval Returned value can be one of the following values:
  1244. * @arg @ref LL_PWR_SMPS_BYPASS
  1245. * @arg @ref LL_PWR_SMPS_STEP_DOWN (1)
  1246. *
  1247. * (1) SMPS operating mode step down or open depends on system low-power mode:
  1248. * - step down mode if system low power mode is run, LP run or stop0,
  1249. * - open mode if system low power mode is stop1, stop2, standby or shutdown
  1250. */
  1251. __STATIC_INLINE uint32_t LL_PWR_SMPS_GetMode(void)
  1252. {
  1253. /* Note: Operation on bits performed to keep compatibility of literals */
  1254. /* for all SMPS operating mode functions: */
  1255. /* "LL_PWR_SMPS_SetMode()", "LL_PWR_SMPS_GetMode()" */
  1256. /* and "LL_PWR_SMPS_GetEffectiveMode()". */
  1257. register uint32_t OperatingMode = (READ_BIT(PWR->CR5, PWR_CR5_SMPSEN) >> (PWR_CR5_SMPSEN_Pos - PWR_SR2_SMPSF_Pos));
  1258. OperatingMode = (OperatingMode | ((~OperatingMode >> 1U) & PWR_SR2_SMPSBF));
  1259. return OperatingMode;
  1260. }
  1261. /**
  1262. * @brief Get SMPS effective operating mode
  1263. * @note SMPS operating mode can be changed by hardware, therefore
  1264. * requested operating mode can differ from effective low power mode.
  1265. * - dependency on system low-power mode:
  1266. * - step down mode if system low power mode is run, LP run or stop0,
  1267. * - open mode if system low power mode is stop1, stop2, standby or shutdown
  1268. * - dependency on BOR level:
  1269. * - bypass mode if supply voltage drops below BOR level
  1270. * @note This functions check flags of SMPS operating modes step down
  1271. * and bypass. If the SMPS is not among these 2 operating modes,
  1272. * then it can be in mode off or open.
  1273. * @rmtoll SR2 SMPSF LL_PWR_SMPS_GetEffectiveMode \n
  1274. * SR2 SMPSBF LL_PWR_SMPS_GetEffectiveMode
  1275. * @retval Returned value can be one of the following values:
  1276. * @arg @ref LL_PWR_SMPS_BYPASS
  1277. * @arg @ref LL_PWR_SMPS_STEP_DOWN (1)
  1278. *
  1279. * (1) SMPS operating mode step down or open depends on system low-power mode:
  1280. * - step down mode if system low power mode is run, LP run or stop0,
  1281. * - open mode if system low power mode is stop1, stop2, standby or shutdown
  1282. */
  1283. __STATIC_INLINE uint32_t LL_PWR_SMPS_GetEffectiveMode(void)
  1284. {
  1285. return (uint32_t)(READ_BIT(PWR->SR2, (PWR_SR2_SMPSF | PWR_SR2_SMPSBF)));
  1286. }
  1287. /**
  1288. * @brief SMPS step down converter enable
  1289. * @note This function can be used for specific usage of the SMPS,
  1290. * for general usage of the SMPS the function
  1291. * @ref LL_PWR_SMPS_SetMode() should be used instead.
  1292. * @rmtoll CR5 SMPSEN LL_PWR_SMPS_Enable
  1293. * @retval None
  1294. */
  1295. __STATIC_INLINE void LL_PWR_SMPS_Enable(void)
  1296. {
  1297. SET_BIT(PWR->CR5, PWR_CR5_SMPSEN);
  1298. }
  1299. /**
  1300. * @brief SMPS step down converter enable
  1301. * @note This function can be used for specific usage of the SMPS,
  1302. * for general usage of the SMPS the function
  1303. * @ref LL_PWR_SMPS_SetMode() should be used instead.
  1304. * @rmtoll CR5 SMPSEN LL_PWR_SMPS_Disable
  1305. * @retval None
  1306. */
  1307. __STATIC_INLINE void LL_PWR_SMPS_Disable(void)
  1308. {
  1309. CLEAR_BIT(PWR->CR5, PWR_CR5_SMPSEN);
  1310. }
  1311. /**
  1312. * @brief Check if the SMPS step down converter is enabled
  1313. * @rmtoll CR5 SMPSEN LL_PWR_SMPS_IsEnabled
  1314. * @retval State of bit (1 or 0).
  1315. */
  1316. __STATIC_INLINE uint32_t LL_PWR_SMPS_IsEnabled(void)
  1317. {
  1318. return ((READ_BIT(PWR->CR5, PWR_CR5_SMPSEN) == (PWR_CR5_SMPSEN)) ? 1UL : 0UL);
  1319. }
  1320. /**
  1321. * @brief Set SMPS step down converter supply startup current selection
  1322. * @rmtoll CR5 SMPSSC LL_PWR_SMPS_SetStartupCurrent
  1323. * @param StartupCurrent This parameter can be one of the following values:
  1324. * @arg @ref LL_PWR_SMPS_STARTUP_CURRENT_80MA
  1325. * @arg @ref LL_PWR_SMPS_STARTUP_CURRENT_100MA
  1326. * @arg @ref LL_PWR_SMPS_STARTUP_CURRENT_120MA
  1327. * @arg @ref LL_PWR_SMPS_STARTUP_CURRENT_140MA
  1328. * @arg @ref LL_PWR_SMPS_STARTUP_CURRENT_160MA
  1329. * @arg @ref LL_PWR_SMPS_STARTUP_CURRENT_180MA
  1330. * @arg @ref LL_PWR_SMPS_STARTUP_CURRENT_200MA
  1331. * @arg @ref LL_PWR_SMPS_STARTUP_CURRENT_220MA
  1332. * @retval None
  1333. */
  1334. __STATIC_INLINE void LL_PWR_SMPS_SetStartupCurrent(uint32_t StartupCurrent)
  1335. {
  1336. MODIFY_REG(PWR->CR5, PWR_CR5_SMPSSC, StartupCurrent);
  1337. }
  1338. /**
  1339. * @brief Get SMPS step down converter supply startup current selection
  1340. * @rmtoll CR5 SMPSSC LL_PWR_SMPS_GetStartupCurrent
  1341. * @retval Returned value can be one of the following values:
  1342. * @arg @ref LL_PWR_SMPS_STARTUP_CURRENT_80MA
  1343. * @arg @ref LL_PWR_SMPS_STARTUP_CURRENT_100MA
  1344. * @arg @ref LL_PWR_SMPS_STARTUP_CURRENT_120MA
  1345. * @arg @ref LL_PWR_SMPS_STARTUP_CURRENT_140MA
  1346. * @arg @ref LL_PWR_SMPS_STARTUP_CURRENT_160MA
  1347. * @arg @ref LL_PWR_SMPS_STARTUP_CURRENT_180MA
  1348. * @arg @ref LL_PWR_SMPS_STARTUP_CURRENT_200MA
  1349. * @arg @ref LL_PWR_SMPS_STARTUP_CURRENT_220MA
  1350. */
  1351. __STATIC_INLINE uint32_t LL_PWR_SMPS_GetStartupCurrent(void)
  1352. {
  1353. return (uint32_t)(READ_BIT(PWR->CR5, PWR_CR5_SMPSSC));
  1354. }
  1355. /**
  1356. * @brief Set SMPS step down converter output voltage scaling
  1357. * @note SMPS output voltage is calibrated in production,
  1358. * calibration parameters are applied to the voltage level parameter
  1359. * to reach the requested voltage value.
  1360. * @rmtoll CR5 SMPSVOS LL_PWR_SMPS_SetOutputVoltageLevel
  1361. * @param OutputVoltageLevel This parameter can be one of the following values:
  1362. * @arg @ref LL_PWR_SMPS_OUTPUT_VOLTAGE_1V20
  1363. * @arg @ref LL_PWR_SMPS_OUTPUT_VOLTAGE_1V25
  1364. * @arg @ref LL_PWR_SMPS_OUTPUT_VOLTAGE_1V30
  1365. * @arg @ref LL_PWR_SMPS_OUTPUT_VOLTAGE_1V35
  1366. * @arg @ref LL_PWR_SMPS_OUTPUT_VOLTAGE_1V40
  1367. * @arg @ref LL_PWR_SMPS_OUTPUT_VOLTAGE_1V45
  1368. * @arg @ref LL_PWR_SMPS_OUTPUT_VOLTAGE_1V50
  1369. * @arg @ref LL_PWR_SMPS_OUTPUT_VOLTAGE_1V55
  1370. * @arg @ref LL_PWR_SMPS_OUTPUT_VOLTAGE_1V60
  1371. * @arg @ref LL_PWR_SMPS_OUTPUT_VOLTAGE_1V65
  1372. * @arg @ref LL_PWR_SMPS_OUTPUT_VOLTAGE_1V70
  1373. * @arg @ref LL_PWR_SMPS_OUTPUT_VOLTAGE_1V75
  1374. * @arg @ref LL_PWR_SMPS_OUTPUT_VOLTAGE_1V80
  1375. * @arg @ref LL_PWR_SMPS_OUTPUT_VOLTAGE_1V85
  1376. * @arg @ref LL_PWR_SMPS_OUTPUT_VOLTAGE_1V90
  1377. * @retval None
  1378. */
  1379. __STATIC_INLINE void LL_PWR_SMPS_SetOutputVoltageLevel(uint32_t OutputVoltageLevel)
  1380. {
  1381. register __IO const uint32_t OutputVoltageLevel_calibration = (((*SMPS_VOLTAGE_CAL_ADDR) & SMPS_VOLTAGE_CAL) >> SMPS_VOLTAGE_CAL_POS); /* SMPS output voltage level calibrated in production */
  1382. register int32_t TrimmingSteps; /* Trimming steps between theorical output voltage and calibrated output voltage */
  1383. register int32_t OutputVoltageLevelTrimmed; /* SMPS output voltage level after calibration: trimming value added to required level */
  1384. if(OutputVoltageLevel_calibration == 0UL)
  1385. {
  1386. /* Device with SMPS output voltage not calibrated in production: Apply output voltage value directly */
  1387. /* Update register */
  1388. MODIFY_REG(PWR->CR5, PWR_CR5_SMPSVOS, OutputVoltageLevel);
  1389. }
  1390. else
  1391. {
  1392. /* Device with SMPS output voltage calibrated in production: Apply output voltage value after correction by calibration value */
  1393. TrimmingSteps = ((int32_t)OutputVoltageLevel_calibration - (int32_t)(LL_PWR_SMPS_OUTPUT_VOLTAGE_1V50 >> PWR_CR5_SMPSVOS_Pos));
  1394. OutputVoltageLevelTrimmed = ((int32_t)((uint32_t)(OutputVoltageLevel >> PWR_CR5_SMPSVOS_Pos)) + (int32_t)TrimmingSteps);
  1395. /* Clamp value to voltage trimming bitfield range */
  1396. if(OutputVoltageLevelTrimmed < 0)
  1397. {
  1398. OutputVoltageLevelTrimmed = 0;
  1399. }
  1400. else
  1401. {
  1402. if(OutputVoltageLevelTrimmed > (int32_t)PWR_CR5_SMPSVOS)
  1403. {
  1404. OutputVoltageLevelTrimmed = (int32_t)PWR_CR5_SMPSVOS;
  1405. }
  1406. }
  1407. /* Update register */
  1408. MODIFY_REG(PWR->CR5, PWR_CR5_SMPSVOS, (uint32_t)OutputVoltageLevelTrimmed);
  1409. }
  1410. }
  1411. /**
  1412. * @brief Get SMPS step down converter output voltage scaling
  1413. * @note SMPS output voltage is calibrated in production,
  1414. * calibration parameters are applied to the voltage level parameter
  1415. * to return the effective voltage value.
  1416. * @rmtoll CR5 SMPSVOS LL_PWR_SMPS_GetOutputVoltageLevel
  1417. * @retval Returned value can be one of the following values:
  1418. * @arg @ref LL_PWR_SMPS_OUTPUT_VOLTAGE_1V20
  1419. * @arg @ref LL_PWR_SMPS_OUTPUT_VOLTAGE_1V25
  1420. * @arg @ref LL_PWR_SMPS_OUTPUT_VOLTAGE_1V30
  1421. * @arg @ref LL_PWR_SMPS_OUTPUT_VOLTAGE_1V35
  1422. * @arg @ref LL_PWR_SMPS_OUTPUT_VOLTAGE_1V40
  1423. * @arg @ref LL_PWR_SMPS_OUTPUT_VOLTAGE_1V45
  1424. * @arg @ref LL_PWR_SMPS_OUTPUT_VOLTAGE_1V50
  1425. * @arg @ref LL_PWR_SMPS_OUTPUT_VOLTAGE_1V55
  1426. * @arg @ref LL_PWR_SMPS_OUTPUT_VOLTAGE_1V60
  1427. * @arg @ref LL_PWR_SMPS_OUTPUT_VOLTAGE_1V65
  1428. * @arg @ref LL_PWR_SMPS_OUTPUT_VOLTAGE_1V70
  1429. * @arg @ref LL_PWR_SMPS_OUTPUT_VOLTAGE_1V75
  1430. * @arg @ref LL_PWR_SMPS_OUTPUT_VOLTAGE_1V80
  1431. * @arg @ref LL_PWR_SMPS_OUTPUT_VOLTAGE_1V85
  1432. * @arg @ref LL_PWR_SMPS_OUTPUT_VOLTAGE_1V90
  1433. */
  1434. __STATIC_INLINE uint32_t LL_PWR_SMPS_GetOutputVoltageLevel(void)
  1435. {
  1436. register __IO const uint32_t OutputVoltageLevel_calibration = (((*SMPS_VOLTAGE_CAL_ADDR) & SMPS_VOLTAGE_CAL) >> SMPS_VOLTAGE_CAL_POS); /* SMPS output voltage level calibrated in production */
  1437. register int32_t TrimmingSteps; /* Trimming steps between theorical output voltage and calibrated output voltage */
  1438. register int32_t OutputVoltageLevelTrimmed; /* SMPS output voltage level after calibration: trimming value added to required level */
  1439. if(OutputVoltageLevel_calibration == 0UL)
  1440. {
  1441. /* Device with SMPS output voltage not calibrated in production: Return output voltage value directly */
  1442. return (uint32_t)(READ_BIT(PWR->CR5, PWR_CR5_SMPSVOS));
  1443. }
  1444. else
  1445. {
  1446. /* Device with SMPS output voltage calibrated in production: Return output voltage value after correction by calibration value */
  1447. TrimmingSteps = ((int32_t)OutputVoltageLevel_calibration - (int32_t)(LL_PWR_SMPS_OUTPUT_VOLTAGE_1V50 >> PWR_CR5_SMPSVOS_Pos)); /* Trimming steps between theorical output voltage and calibrated output voltage */
  1448. OutputVoltageLevelTrimmed = ((int32_t)((uint32_t)READ_BIT(PWR->CR5, PWR_CR5_SMPSVOS)) - TrimmingSteps);
  1449. /* Clamp value to voltage range */
  1450. if(OutputVoltageLevelTrimmed < 0)
  1451. {
  1452. OutputVoltageLevelTrimmed = (int32_t)LL_PWR_SMPS_OUTPUT_VOLTAGE_1V20;
  1453. }
  1454. else
  1455. {
  1456. if(OutputVoltageLevelTrimmed > (int32_t)PWR_CR5_SMPSVOS)
  1457. {
  1458. OutputVoltageLevelTrimmed = (int32_t)LL_PWR_SMPS_OUTPUT_VOLTAGE_1V90;
  1459. }
  1460. }
  1461. return (uint32_t)OutputVoltageLevelTrimmed;
  1462. }
  1463. }
  1464. /**
  1465. * @}
  1466. */
  1467. #endif
  1468. /** @defgroup PWR_LL_EF_Configuration_Multicore Configuration of multicore, intended to be executed by CPU1
  1469. * @{
  1470. */
  1471. /**
  1472. * @brief Boot CPU2 after reset or wakeup from stop or standby modes
  1473. * @rmtoll CR4 C2BOOT LL_PWR_EnableBootC2
  1474. * @retval None
  1475. */
  1476. __STATIC_INLINE void LL_PWR_EnableBootC2(void)
  1477. {
  1478. SET_BIT(PWR->CR4, PWR_CR4_C2BOOT);
  1479. }
  1480. /**
  1481. * @brief Release bit to boot CPU2 after reset or wakeup from stop or standby
  1482. * modes
  1483. * @rmtoll CR4 C2BOOT LL_PWR_DisableBootC2
  1484. * @retval None
  1485. */
  1486. __STATIC_INLINE void LL_PWR_DisableBootC2(void)
  1487. {
  1488. CLEAR_BIT(PWR->CR4, PWR_CR4_C2BOOT);
  1489. }
  1490. /**
  1491. * @brief Check if bit to boot CPU2 after reset or wakeup from stop or standby
  1492. * modes is set
  1493. * @rmtoll CR4 C2BOOT LL_PWR_IsEnabledBootC2
  1494. * @retval State of bit (1 or 0)
  1495. */
  1496. __STATIC_INLINE uint32_t LL_PWR_IsEnabledBootC2(void)
  1497. {
  1498. return ((READ_BIT(PWR->CR4, PWR_CR4_C2BOOT) == (PWR_CR4_C2BOOT)) ? 1UL : 0UL);
  1499. }
  1500. /**
  1501. * @}
  1502. */
  1503. /** @defgroup PWR_LL_EF_Configuration_CPU2 Configuration of CPU2, intended to be executed by CPU2
  1504. * @{
  1505. */
  1506. /**
  1507. * @brief Set Low-Power mode for CPU2
  1508. * @rmtoll C2CR1 LPMS LL_C2_PWR_SetPowerMode
  1509. * @param LowPowerMode This parameter can be one of the following values:
  1510. * @arg @ref LL_PWR_MODE_STOP0
  1511. * @arg @ref LL_PWR_MODE_STOP1
  1512. * @arg @ref LL_PWR_MODE_STOP2
  1513. * @arg @ref LL_PWR_MODE_STANDBY
  1514. * @arg @ref LL_PWR_MODE_SHUTDOWN
  1515. * @retval None
  1516. */
  1517. __STATIC_INLINE void LL_C2_PWR_SetPowerMode(uint32_t LowPowerMode)
  1518. {
  1519. MODIFY_REG(PWR->C2CR1, PWR_C2CR1_LPMS, LowPowerMode);
  1520. }
  1521. /**
  1522. * @brief Get Low-Power mode for CPU2
  1523. * @rmtoll C2CR1 LPMS LL_C2_PWR_GetPowerMode
  1524. * @retval Returned value can be one of the following values:
  1525. * @arg @ref LL_PWR_MODE_STOP0
  1526. * @arg @ref LL_PWR_MODE_STOP1
  1527. * @arg @ref LL_PWR_MODE_STOP2
  1528. * @arg @ref LL_PWR_MODE_STANDBY
  1529. * @arg @ref LL_PWR_MODE_SHUTDOWN
  1530. */
  1531. __STATIC_INLINE uint32_t LL_C2_PWR_GetPowerMode(void)
  1532. {
  1533. return (uint32_t)(READ_BIT(PWR->C2CR1, PWR_C2CR1_LPMS));
  1534. }
  1535. /**
  1536. * @brief Set flash power-down mode during low-power run mode for CPU2
  1537. * @rmtoll C2CR1 FPDR LL_C2_PWR_SetFlashPowerModeLPRun
  1538. * @param FlashLowPowerMode This parameter can be one of the following values:
  1539. * @arg @ref LL_PWR_FLASH_LPRUN_MODE_IDLE
  1540. * @arg @ref LL_PWR_FLASH_LPRUN_MODE_POWER_DOWN
  1541. * @retval None
  1542. */
  1543. __STATIC_INLINE void LL_C2_PWR_SetFlashPowerModeLPRun(uint32_t FlashLowPowerMode)
  1544. {
  1545. /* Unlock bit FPDR */
  1546. WRITE_REG(PWR->C2CR1, 0x0000C1B0U);
  1547. /* Update bit FPDR */
  1548. MODIFY_REG(PWR->C2CR1, PWR_C2CR1_FPDR, FlashLowPowerMode);
  1549. }
  1550. /**
  1551. * @brief Get flash power-down mode during low-power run mode for CPU2
  1552. * @rmtoll C2CR1 FPDR LL_C2_PWR_GetFlashPowerModeLPRun
  1553. * @retval Returned value can be one of the following values:
  1554. * @arg @ref LL_PWR_FLASH_LPRUN_MODE_IDLE
  1555. * @arg @ref LL_PWR_FLASH_LPRUN_MODE_POWER_DOWN
  1556. */
  1557. __STATIC_INLINE uint32_t LL_C2_PWR_GetFlashPowerModeLPRun(void)
  1558. {
  1559. return (uint32_t)(READ_BIT(PWR->C2CR1, PWR_C2CR1_FPDR));
  1560. }
  1561. /**
  1562. * @brief Set flash power-down mode during sleep mode for CPU2
  1563. * @rmtoll C2CR1 FPDS LL_C2_PWR_SetFlashPowerModeSleep
  1564. * @param FlashLowPowerMode This parameter can be one of the following values:
  1565. * @arg @ref LL_PWR_FLASH_SLEEP_MODE_IDLE
  1566. * @arg @ref LL_PWR_FLASH_SLEEP_MODE_POWER_DOWN
  1567. * @retval None
  1568. */
  1569. __STATIC_INLINE void LL_C2_PWR_SetFlashPowerModeSleep(uint32_t FlashLowPowerMode)
  1570. {
  1571. MODIFY_REG(PWR->C2CR1, PWR_C2CR1_FPDS, FlashLowPowerMode);
  1572. }
  1573. /**
  1574. * @brief Get flash power-down mode during sleep mode for CPU2
  1575. * @rmtoll C2CR1 FPDS LL_C2_PWR_GetFlashPowerModeSleep
  1576. * @retval Returned value can be one of the following values:
  1577. * @arg @ref LL_PWR_FLASH_SLEEP_MODE_IDLE
  1578. * @arg @ref LL_PWR_FLASH_SLEEP_MODE_POWER_DOWN
  1579. */
  1580. __STATIC_INLINE uint32_t LL_C2_PWR_GetFlashPowerModeSleep(void)
  1581. {
  1582. return (uint32_t)(READ_BIT(PWR->C2CR1, PWR_C2CR1_FPDS));
  1583. }
  1584. /**
  1585. * @brief Enable Internal Wake-up line for CPU2
  1586. * @rmtoll C2CR3 EIWUL LL_C2_PWR_EnableInternWU
  1587. * @retval None
  1588. */
  1589. __STATIC_INLINE void LL_C2_PWR_EnableInternWU(void)
  1590. {
  1591. SET_BIT(PWR->C2CR3, PWR_C2CR3_EIWUL);
  1592. }
  1593. /**
  1594. * @brief Disable Internal Wake-up line for CPU2
  1595. * @rmtoll C2CR3 EIWUL LL_C2_PWR_DisableInternWU
  1596. * @retval None
  1597. */
  1598. __STATIC_INLINE void LL_C2_PWR_DisableInternWU(void)
  1599. {
  1600. CLEAR_BIT(PWR->C2CR3, PWR_C2CR3_EIWUL);
  1601. }
  1602. /**
  1603. * @brief Check if Internal Wake-up line is enabled for CPU2
  1604. * @rmtoll C2CR3 EIWUL LL_C2_PWR_IsEnabledInternWU
  1605. * @retval State of bit (1 or 0).
  1606. */
  1607. __STATIC_INLINE uint32_t LL_C2_PWR_IsEnabledInternWU(void)
  1608. {
  1609. return ((READ_BIT(PWR->C2CR3, PWR_C2CR3_EIWUL) == (PWR_C2CR3_EIWUL)) ? 1UL : 0UL);
  1610. }
  1611. /**
  1612. * @brief Enable the WakeUp PINx functionality
  1613. * @rmtoll C2CR3 EWUP1 LL_C2_PWR_EnableWakeUpPin\n
  1614. * C2CR3 EWUP2 LL_C2_PWR_EnableWakeUpPin\n
  1615. * C2CR3 EWUP3 LL_C2_PWR_EnableWakeUpPin\n
  1616. * C2CR3 EWUP4 LL_C2_PWR_EnableWakeUpPin\n
  1617. * C2CR3 EWUP5 LL_C2_PWR_EnableWakeUpPin
  1618. * @param WakeUpPin This parameter can be one of the following values:
  1619. * @arg @ref LL_PWR_WAKEUP_PIN1
  1620. * @arg @ref LL_PWR_WAKEUP_PIN2 (*)
  1621. * @arg @ref LL_PWR_WAKEUP_PIN3 (*)
  1622. * @arg @ref LL_PWR_WAKEUP_PIN4
  1623. * @arg @ref LL_PWR_WAKEUP_PIN5 (*)
  1624. *
  1625. * (*) Not available on devices STM32WB50xx
  1626. * @retval None
  1627. */
  1628. __STATIC_INLINE void LL_C2_PWR_EnableWakeUpPin(uint32_t WakeUpPin)
  1629. {
  1630. SET_BIT(PWR->C2CR3, WakeUpPin);
  1631. }
  1632. /**
  1633. * @brief Disable the WakeUp PINx functionality
  1634. * @rmtoll C2CR3 EWUP1 LL_C2_PWR_DisableWakeUpPin\n
  1635. * C2CR3 EWUP2 LL_C2_PWR_DisableWakeUpPin\n
  1636. * C2CR3 EWUP3 LL_C2_PWR_DisableWakeUpPin\n
  1637. * C2CR3 EWUP4 LL_C2_PWR_DisableWakeUpPin\n
  1638. * C2CR3 EWUP5 LL_C2_PWR_DisableWakeUpPin
  1639. * @param WakeUpPin This parameter can be one of the following values:
  1640. * @arg @ref LL_PWR_WAKEUP_PIN1
  1641. * @arg @ref LL_PWR_WAKEUP_PIN2 (*)
  1642. * @arg @ref LL_PWR_WAKEUP_PIN3 (*)
  1643. * @arg @ref LL_PWR_WAKEUP_PIN4
  1644. * @arg @ref LL_PWR_WAKEUP_PIN5 (*)
  1645. *
  1646. * (*) Not available on devices STM32WB50xx
  1647. * @retval None
  1648. */
  1649. __STATIC_INLINE void LL_C2_PWR_DisableWakeUpPin(uint32_t WakeUpPin)
  1650. {
  1651. CLEAR_BIT(PWR->C2CR3, WakeUpPin);
  1652. }
  1653. /**
  1654. * @brief Check if the WakeUp PINx functionality is enabled
  1655. * @rmtoll C2CR3 EWUP1 LL_C2_PWR_IsEnabledWakeUpPin\n
  1656. * C2CR3 EWUP2 LL_C2_PWR_IsEnabledWakeUpPin\n
  1657. * C2CR3 EWUP3 LL_C2_PWR_IsEnabledWakeUpPin\n
  1658. * C2CR3 EWUP4 LL_C2_PWR_IsEnabledWakeUpPin\n
  1659. * C2CR3 EWUP5 LL_C2_PWR_IsEnabledWakeUpPin
  1660. * @param WakeUpPin This parameter can be one of the following values:
  1661. * @arg @ref LL_PWR_WAKEUP_PIN1
  1662. * @arg @ref LL_PWR_WAKEUP_PIN2 (*)
  1663. * @arg @ref LL_PWR_WAKEUP_PIN3 (*)
  1664. * @arg @ref LL_PWR_WAKEUP_PIN4
  1665. * @arg @ref LL_PWR_WAKEUP_PIN5 (*)
  1666. *
  1667. * (*) Not available on devices STM32WB50xx
  1668. * @retval None
  1669. */
  1670. __STATIC_INLINE uint32_t LL_C2_PWR_IsEnabledWakeUpPin(uint32_t WakeUpPin)
  1671. {
  1672. return ((READ_BIT(PWR->C2CR3, WakeUpPin) == (WakeUpPin)) ? 1UL : 0UL);
  1673. }
  1674. /**
  1675. * @brief Enable pull-up and pull-down configuration for CPU2
  1676. * @rmtoll C2CR3 APC LL_C2_PWR_EnablePUPDCfg
  1677. * @retval None
  1678. */
  1679. __STATIC_INLINE void LL_C2_PWR_EnablePUPDCfg(void)
  1680. {
  1681. SET_BIT(PWR->C2CR3, PWR_C2CR3_APC);
  1682. }
  1683. /**
  1684. * @brief Disable pull-up and pull-down configuration for CPU2
  1685. * @rmtoll C2CR3 APC LL_C2_PWR_DisablePUPDCfg
  1686. * @retval None
  1687. */
  1688. __STATIC_INLINE void LL_C2_PWR_DisablePUPDCfg(void)
  1689. {
  1690. CLEAR_BIT(PWR->C2CR3, PWR_C2CR3_APC);
  1691. }
  1692. /**
  1693. * @brief Check if pull-up and pull-down configuration is enabled for CPU2
  1694. * @rmtoll C2CR3 APC LL_C2_PWR_IsEnabledPUPDCfg
  1695. * @retval State of bit (1 or 0).
  1696. */
  1697. __STATIC_INLINE uint32_t LL_C2_PWR_IsEnabledPUPDCfg(void)
  1698. {
  1699. return ((READ_BIT(PWR->C2CR3, PWR_C2CR3_APC) == (PWR_C2CR3_APC)) ? 1UL : 0UL);
  1700. }
  1701. /**
  1702. * @}
  1703. */
  1704. /** @defgroup PWR_LL_EF_Configuration_CPU2_Radio Configuration of radio (BLE or 802.15.4) of CPU2, intended to be executed by CPU2
  1705. * @{
  1706. */
  1707. /**
  1708. * @brief Wakeup BLE controller from its sleep mode
  1709. * @note This bit is automatically reset when BLE controller
  1710. * exit its sleep mode.
  1711. * @rmtoll C2CR1 BLEEWKUP LL_C2_PWR_WakeUp_BLE
  1712. * @retval None
  1713. */
  1714. __STATIC_INLINE void LL_C2_PWR_WakeUp_BLE(void)
  1715. {
  1716. SET_BIT(PWR->C2CR1, PWR_C2CR1_BLEEWKUP);
  1717. }
  1718. /**
  1719. * @brief Check if the BLE controller is woken-up from
  1720. * low-power mode.
  1721. * @rmtoll C2CR1 BLEEWKUP LL_C2_PWR_IsWokenUp_BLE
  1722. * @retval State of bit (1 or 0) (value "0": BLE is not woken-up)
  1723. */
  1724. __STATIC_INLINE uint32_t LL_C2_PWR_IsWokenUp_BLE(void)
  1725. {
  1726. return ((READ_BIT(PWR->C2CR1, PWR_C2CR1_BLEEWKUP) == (PWR_C2CR1_BLEEWKUP)) ? 1UL : 0UL);
  1727. }
  1728. /**
  1729. * @brief Wakeup 802.15.4 controller from its sleep mode
  1730. * @note This bit is automatically reset when 802.15.4 controller
  1731. * exit its sleep mode.
  1732. * @rmtoll C2CR1 802EWKUP LL_C2_PWR_WakeUp_802_15_4
  1733. * @retval None
  1734. */
  1735. __STATIC_INLINE void LL_C2_PWR_WakeUp_802_15_4(void)
  1736. {
  1737. SET_BIT(PWR->C2CR1, PWR_C2CR1_802EWKUP);
  1738. }
  1739. /**
  1740. * @brief Check if the 802.15.4 controller is woken-up from
  1741. * low-power mode.
  1742. * @rmtoll C2CR1 802EWKUP LL_C2_PWR_IsWokenUp_802_15_4
  1743. * @retval State of bit (1 or 0) (value "0": 802.15.4 is not woken-up)
  1744. */
  1745. __STATIC_INLINE uint32_t LL_C2_PWR_IsWokenUp_802_15_4(void)
  1746. {
  1747. return ((READ_BIT(PWR->C2CR1, PWR_C2CR1_802EWKUP) == (PWR_C2CR1_802EWKUP)) ? 1UL : 0UL);
  1748. }
  1749. /**
  1750. * @}
  1751. */
  1752. /** @defgroup PWR_LL_EF_FLAG_Management FLAG_Management
  1753. * @{
  1754. */
  1755. /**
  1756. * @brief Get Internal Wake-up line Flag
  1757. * @rmtoll SR1 WUFI LL_PWR_IsActiveFlag_InternWU
  1758. * @retval State of bit (1 or 0).
  1759. */
  1760. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_InternWU(void)
  1761. {
  1762. return ((READ_BIT(PWR->SR1, PWR_SR1_WUFI) == (PWR_SR1_WUFI)) ? 1UL : 0UL);
  1763. }
  1764. #if defined(PWR_CR3_EWUP5)
  1765. /**
  1766. * @brief Get Wake-up Flag 5
  1767. * @rmtoll SR1 WUF5 LL_PWR_IsActiveFlag_WU5
  1768. * @retval State of bit (1 or 0).
  1769. */
  1770. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_WU5(void)
  1771. {
  1772. return ((READ_BIT(PWR->SR1, PWR_SR1_WUF5) == (PWR_SR1_WUF5)) ? 1UL : 0UL);
  1773. }
  1774. #endif
  1775. /**
  1776. * @brief Get Wake-up Flag 4
  1777. * @rmtoll SR1 WUF4 LL_PWR_IsActiveFlag_WU4
  1778. * @retval State of bit (1 or 0).
  1779. */
  1780. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_WU4(void)
  1781. {
  1782. return ((READ_BIT(PWR->SR1, PWR_SR1_WUF4) == (PWR_SR1_WUF4)) ? 1UL : 0UL);
  1783. }
  1784. #if defined(PWR_CR3_EWUP3)
  1785. /**
  1786. * @brief Get Wake-up Flag 3
  1787. * @rmtoll SR1 WUF3 LL_PWR_IsActiveFlag_WU3
  1788. * @retval State of bit (1 or 0).
  1789. */
  1790. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_WU3(void)
  1791. {
  1792. return ((READ_BIT(PWR->SR1, PWR_SR1_WUF3) == (PWR_SR1_WUF3)) ? 1UL : 0UL);
  1793. }
  1794. #endif
  1795. #if defined(PWR_CR3_EWUP2)
  1796. /**
  1797. * @brief Get Wake-up Flag 2
  1798. * @rmtoll SR1 WUF2 LL_PWR_IsActiveFlag_WU2
  1799. * @retval State of bit (1 or 0).
  1800. */
  1801. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_WU2(void)
  1802. {
  1803. return ((READ_BIT(PWR->SR1, PWR_SR1_WUF2) == (PWR_SR1_WUF2)) ? 1UL : 0UL);
  1804. }
  1805. #endif
  1806. /**
  1807. * @brief Get Wake-up Flag 1
  1808. * @rmtoll SR1 WUF1 LL_PWR_IsActiveFlag_WU1
  1809. * @retval State of bit (1 or 0).
  1810. */
  1811. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_WU1(void)
  1812. {
  1813. return ((READ_BIT(PWR->SR1, PWR_SR1_WUF1) == (PWR_SR1_WUF1)) ? 1UL : 0UL);
  1814. }
  1815. /**
  1816. * @brief Clear Wake-up Flags
  1817. * @rmtoll SCR CWUF LL_PWR_ClearFlag_WU
  1818. * @retval None
  1819. */
  1820. __STATIC_INLINE void LL_PWR_ClearFlag_WU(void)
  1821. {
  1822. WRITE_REG(PWR->SCR, PWR_SCR_CWUF);
  1823. }
  1824. #if defined(PWR_CR3_EWUP5)
  1825. /**
  1826. * @brief Clear Wake-up Flag 5
  1827. * @rmtoll SCR CWUF5 LL_PWR_ClearFlag_WU5
  1828. * @retval None
  1829. */
  1830. __STATIC_INLINE void LL_PWR_ClearFlag_WU5(void)
  1831. {
  1832. WRITE_REG(PWR->SCR, PWR_SCR_CWUF5);
  1833. }
  1834. #endif
  1835. /**
  1836. * @brief Clear Wake-up Flag 4
  1837. * @rmtoll SCR CWUF4 LL_PWR_ClearFlag_WU4
  1838. * @retval None
  1839. */
  1840. __STATIC_INLINE void LL_PWR_ClearFlag_WU4(void)
  1841. {
  1842. WRITE_REG(PWR->SCR, PWR_SCR_CWUF4);
  1843. }
  1844. #if defined(PWR_CR3_EWUP3)
  1845. /**
  1846. * @brief Clear Wake-up Flag 3
  1847. * @rmtoll SCR CWUF3 LL_PWR_ClearFlag_WU3
  1848. * @retval None
  1849. */
  1850. __STATIC_INLINE void LL_PWR_ClearFlag_WU3(void)
  1851. {
  1852. WRITE_REG(PWR->SCR, PWR_SCR_CWUF3);
  1853. }
  1854. #endif
  1855. #if defined(PWR_CR3_EWUP2)
  1856. /**
  1857. * @brief Clear Wake-up Flag 2
  1858. * @rmtoll SCR CWUF2 LL_PWR_ClearFlag_WU2
  1859. * @retval None
  1860. */
  1861. __STATIC_INLINE void LL_PWR_ClearFlag_WU2(void)
  1862. {
  1863. WRITE_REG(PWR->SCR, PWR_SCR_CWUF2);
  1864. }
  1865. #endif
  1866. /**
  1867. * @brief Clear Wake-up Flag 1
  1868. * @rmtoll SCR CWUF1 LL_PWR_ClearFlag_WU1
  1869. * @retval None
  1870. */
  1871. __STATIC_INLINE void LL_PWR_ClearFlag_WU1(void)
  1872. {
  1873. WRITE_REG(PWR->SCR, PWR_SCR_CWUF1);
  1874. }
  1875. /**
  1876. * @brief Indicate whether VDDA voltage is below or above PVM3 threshold
  1877. * @rmtoll SR2 PVMO3 LL_PWR_IsActiveFlag_PVMO3
  1878. * @retval State of bit (1 or 0).
  1879. */
  1880. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_PVMO3(void)
  1881. {
  1882. return ((READ_BIT(PWR->SR2, PWR_SR2_PVMO3) == (PWR_SR2_PVMO3)) ? 1UL : 0UL);
  1883. }
  1884. #if defined(PWR_CR2_PVME1)
  1885. /**
  1886. * @brief Indicate whether VDDUSB voltage is below or above PVM1 threshold
  1887. * @rmtoll SR2 PVMO1 LL_PWR_IsActiveFlag_PVMO1
  1888. * @retval State of bit (1 or 0).
  1889. */
  1890. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_PVMO1(void)
  1891. {
  1892. return ((READ_BIT(PWR->SR2, PWR_SR2_PVMO1) == (PWR_SR2_PVMO1)) ? 1UL : 0UL);
  1893. }
  1894. #endif
  1895. /**
  1896. * @brief Indicate whether VDD voltage is below or above the selected PVD threshold
  1897. * @rmtoll SR2 PVDO LL_PWR_IsActiveFlag_PVDO
  1898. * @retval State of bit (1 or 0).
  1899. */
  1900. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_PVDO(void)
  1901. {
  1902. return ((READ_BIT(PWR->SR2, PWR_SR2_PVDO) == (PWR_SR2_PVDO)) ? 1UL : 0UL);
  1903. }
  1904. #if defined(PWR_CR1_VOS)
  1905. /**
  1906. * @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
  1907. * @rmtoll SR2 VOSF LL_PWR_IsActiveFlag_VOS
  1908. * @retval State of bit (1 or 0).
  1909. */
  1910. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_VOS(void)
  1911. {
  1912. return ((READ_BIT(PWR->SR2, PWR_SR2_VOSF) == (PWR_SR2_VOSF)) ? 1UL : 0UL);
  1913. }
  1914. #endif
  1915. /**
  1916. * @brief Indicate whether the regulator is ready in main mode or is in low-power mode
  1917. * @note Take care, return value "0" means the regulator is ready. Return value "1" means the output voltage range is still changing.
  1918. * @rmtoll SR2 REGLPF LL_PWR_IsActiveFlag_REGLPF
  1919. * @retval State of bit (1 or 0).
  1920. */
  1921. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_REGLPF(void)
  1922. {
  1923. return ((READ_BIT(PWR->SR2, PWR_SR2_REGLPF) == (PWR_SR2_REGLPF)) ? 1UL : 0UL);
  1924. }
  1925. /**
  1926. * @brief Indicate whether or not the low-power regulator is ready
  1927. * @rmtoll SR2 REGLPS LL_PWR_IsActiveFlag_REGLPS
  1928. * @retval State of bit (1 or 0).
  1929. */
  1930. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_REGLPS(void)
  1931. {
  1932. return ((READ_BIT(PWR->SR2, PWR_SR2_REGLPS) == (PWR_SR2_REGLPS)) ? 1UL : 0UL);
  1933. }
  1934. /**
  1935. * @brief Get BORH interrupt flag
  1936. * @rmtoll SR1 BORHF LL_PWR_IsActiveFlag_BORH
  1937. * @retval State of bit (1 or 0).
  1938. */
  1939. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_BORH(void)
  1940. {
  1941. return ((READ_BIT(PWR->SR1, PWR_SR1_BORHF) == (PWR_SR1_BORHF)) ? 1UL : 0UL);
  1942. }
  1943. /**
  1944. * @brief Clear BORH interrupt flag
  1945. * @rmtoll SCR CBORHF LL_PWR_ClearFlag_BORH
  1946. * @retval None
  1947. */
  1948. __STATIC_INLINE void LL_PWR_ClearFlag_BORH(void)
  1949. {
  1950. WRITE_REG(PWR->SCR, PWR_SCR_CBORHF);
  1951. }
  1952. /**
  1953. * @}
  1954. */
  1955. #if defined(PWR_CR5_SMPSEN)
  1956. /** @defgroup PWR_LL_EF_FLAG_Management_SMPS FLAG management for SMPS
  1957. * @{
  1958. */
  1959. /**
  1960. * @brief Get SMPS step down converter forced in bypass mode interrupt flag
  1961. * @note To activate flag of SMPS step down converter forced in bypass mode
  1962. * by BORH, BOR must be preliminarily configured to control SMPS
  1963. * operating mode.
  1964. * Refer to function @ref LL_PWR_SetBORConfig().
  1965. * @rmtoll SR1 SMPSFBF LL_PWR_IsActiveFlag_SMPSFB
  1966. * @retval State of bit (1 or 0).
  1967. */
  1968. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_SMPSFB(void)
  1969. {
  1970. return ((READ_BIT(PWR->SR1, PWR_SR1_SMPSFBF) == (PWR_SR1_SMPSFBF)) ? 1UL : 0UL);
  1971. }
  1972. /**
  1973. * @brief Clear SMPS step down converter forced in bypass mode interrupt flag
  1974. * @note To activate flag of SMPS step down converter forced in bypass mode
  1975. * by BORH, BOR must be preliminarily configured to control SMPS
  1976. * operating mode.
  1977. * Refer to function @ref LL_PWR_SetBORConfig().
  1978. * @rmtoll SCR CSMPSFBF LL_PWR_ClearFlag_SMPSFB
  1979. * @retval None
  1980. */
  1981. __STATIC_INLINE void LL_PWR_ClearFlag_SMPSFB(void)
  1982. {
  1983. WRITE_REG(PWR->SCR, PWR_SCR_CSMPSFBF);
  1984. }
  1985. /**
  1986. * @}
  1987. */
  1988. #endif
  1989. /** @defgroup PWR_LL_EF_FLAG_Management_Radio FLAG management for radio (BLE or 802.15.4)
  1990. * @{
  1991. */
  1992. /**
  1993. * @brief Get BLE wakeup interrupt flag
  1994. * @rmtoll SR1 BLEWUF LL_PWR_IsActiveFlag_BLEWU
  1995. * @retval State of bit (1 or 0).
  1996. */
  1997. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_BLEWU(void)
  1998. {
  1999. return ((READ_BIT(PWR->SR1, PWR_SR1_BLEWUF) == (PWR_SR1_BLEWUF)) ? 1UL : 0UL);
  2000. }
  2001. /**
  2002. * @brief Get 802.15.4 wakeup interrupt flag
  2003. * @rmtoll SR1 802WUF LL_PWR_IsActiveFlag_802WU
  2004. * @retval State of bit (1 or 0).
  2005. */
  2006. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_802WU(void)
  2007. {
  2008. return ((READ_BIT(PWR->SR1, PWR_SR1_802WUF) == (PWR_SR1_802WUF)) ? 1UL : 0UL);
  2009. }
  2010. /**
  2011. * @brief Get BLE end of activity interrupt flag
  2012. * @rmtoll SR1 BLEAF LL_PWR_IsActiveFlag_BLEA
  2013. * @retval State of bit (1 or 0).
  2014. */
  2015. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_BLEA(void)
  2016. {
  2017. return ((READ_BIT(PWR->SR1, PWR_SR1_BLEAF) == (PWR_SR1_BLEAF)) ? 1UL : 0UL);
  2018. }
  2019. /**
  2020. * @brief Get 802.15.4 end of activity interrupt flag
  2021. * @rmtoll SR1 802AF LL_PWR_IsActiveFlag_802A
  2022. * @retval State of bit (1 or 0).
  2023. */
  2024. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_802A(void)
  2025. {
  2026. return ((READ_BIT(PWR->SR1, PWR_SR1_802AF) == (PWR_SR1_802AF)) ? 1UL : 0UL);
  2027. }
  2028. /**
  2029. * @brief Get critical radio phase end of activity interrupt flag
  2030. * @rmtoll SR1 CRPEF LL_PWR_IsActiveFlag_CRPE
  2031. * @retval State of bit (1 or 0).
  2032. */
  2033. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_CRPE(void)
  2034. {
  2035. return ((READ_BIT(PWR->SR1, PWR_SR1_CRPEF) == (PWR_SR1_CRPEF)) ? 1UL : 0UL);
  2036. }
  2037. /**
  2038. * @brief Get critical radio system phase flag
  2039. * @rmtoll EXTSCR CRPF LL_PWR_IsActiveFlag_CRP
  2040. * @retval State of bit (1 or 0).
  2041. */
  2042. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_CRP(void)
  2043. {
  2044. return ((READ_BIT(PWR->EXTSCR, PWR_EXTSCR_CRPF) == (PWR_EXTSCR_CRPF)) ? 1UL : 0UL);
  2045. }
  2046. /**
  2047. * @brief Clear BLE wakeup interrupt flag
  2048. * @rmtoll SCR BLEWU LL_PWR_ClearFlag_BLEWU
  2049. * @retval None
  2050. */
  2051. __STATIC_INLINE void LL_PWR_ClearFlag_BLEWU(void)
  2052. {
  2053. WRITE_REG(PWR->SCR, PWR_SCR_CBLEWUF);
  2054. }
  2055. /**
  2056. * @brief Clear 802.15.4 wakeup interrupt flag
  2057. * @rmtoll SCR 802WU LL_PWR_ClearFlag_802WU
  2058. * @retval None
  2059. */
  2060. __STATIC_INLINE void LL_PWR_ClearFlag_802WU(void)
  2061. {
  2062. WRITE_REG(PWR->SCR, PWR_SCR_C802WUF);
  2063. }
  2064. /**
  2065. * @brief Clear BLE end of activity interrupt flag
  2066. * @rmtoll SCR BLEAF LL_PWR_ClearFlag_BLEA
  2067. * @retval None
  2068. */
  2069. __STATIC_INLINE void LL_PWR_ClearFlag_BLEA(void)
  2070. {
  2071. WRITE_REG(PWR->SCR, PWR_SCR_CBLEAF);
  2072. }
  2073. /**
  2074. * @brief Clear 802.15.4 end of activity interrupt flag
  2075. * @rmtoll SCR 802AF LL_PWR_ClearFlag_802A
  2076. * @retval None
  2077. */
  2078. __STATIC_INLINE void LL_PWR_ClearFlag_802A(void)
  2079. {
  2080. WRITE_REG(PWR->SCR, PWR_SCR_C802AF);
  2081. }
  2082. /**
  2083. * @brief Clear critical radio phase end of activity interrupt flag
  2084. * @rmtoll SCR CCRPEF LL_PWR_ClearFlag_CRPE
  2085. * @retval None
  2086. */
  2087. __STATIC_INLINE void LL_PWR_ClearFlag_CRPE(void)
  2088. {
  2089. WRITE_REG(PWR->SCR, PWR_SCR_CCRPEF);
  2090. }
  2091. /**
  2092. * @brief Clear critical radio system phase flag
  2093. * @rmtoll EXTSCR CCRP LL_PWR_ClearFlag_CRP
  2094. * @retval None
  2095. */
  2096. __STATIC_INLINE void LL_PWR_ClearFlag_CRP(void)
  2097. {
  2098. WRITE_REG(PWR->EXTSCR, PWR_EXTSCR_CCRPF);
  2099. }
  2100. /**
  2101. * @}
  2102. */
  2103. /** @defgroup PWR_LL_EF_FLAG_Management_Multicore FLAG management for multicore
  2104. * @{
  2105. */
  2106. /**
  2107. * @brief Get CPU2 hold interrupt flag
  2108. * @rmtoll SCR CC2HF LL_PWR_IsActiveFlag_C2H
  2109. * @retval State of bit (1 or 0).
  2110. */
  2111. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_C2H(void)
  2112. {
  2113. return ((READ_BIT(PWR->SR1, PWR_SR1_C2HF) == (PWR_SR1_C2HF)) ? 1UL : 0UL);
  2114. }
  2115. /**
  2116. * @brief Get system stop flag for CPU1
  2117. * @rmtoll EXTSCR C1STOPF LL_PWR_IsActiveFlag_C1STOP
  2118. * @retval State of bit (1 or 0).
  2119. */
  2120. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_C1STOP(void)
  2121. {
  2122. return ((READ_BIT(PWR->EXTSCR, PWR_EXTSCR_C1STOPF) == (PWR_EXTSCR_C1STOPF)) ? 1UL : 0UL);
  2123. }
  2124. /**
  2125. * @brief Get system standby flag for CPU1
  2126. * @rmtoll EXTSCR C1SBF LL_PWR_IsActiveFlag_C1SB
  2127. * @retval State of bit (1 or 0).
  2128. */
  2129. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_C1SB(void)
  2130. {
  2131. return ((READ_BIT(PWR->EXTSCR, PWR_EXTSCR_C1SBF) == (PWR_EXTSCR_C1SBF)) ? 1UL : 0UL);
  2132. }
  2133. /**
  2134. * @brief Get deepsleep mode for CPU1
  2135. * @rmtoll EXTSCR C1DS LL_PWR_IsActiveFlag_C1DS
  2136. * @retval State of bit (1 or 0).
  2137. */
  2138. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_C1DS(void)
  2139. {
  2140. return ((READ_BIT(PWR->EXTSCR, PWR_EXTSCR_C1DS) == (PWR_EXTSCR_C1DS)) ? 1UL : 0UL);
  2141. }
  2142. /**
  2143. * @brief System stop flag for CPU2
  2144. * @rmtoll EXTSCR C2STOPF LL_PWR_IsActiveFlag_C2STOP
  2145. * @retval State of bit (1 or 0).
  2146. */
  2147. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_C2STOP(void)
  2148. {
  2149. return ((READ_BIT(PWR->EXTSCR, PWR_EXTSCR_C2STOPF) == (PWR_EXTSCR_C2STOPF)) ? 1UL : 0UL);
  2150. }
  2151. /**
  2152. * @brief System standby flag for CPU2
  2153. * @rmtoll EXTSCR C2SBF LL_PWR_IsActiveFlag_C2SB
  2154. * @retval State of bit (1 or 0).
  2155. */
  2156. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_C2SB(void)
  2157. {
  2158. return ((READ_BIT(PWR->EXTSCR, PWR_EXTSCR_C2SBF) == (PWR_EXTSCR_C2SBF)) ? 1UL : 0UL);
  2159. }
  2160. /**
  2161. * @brief Get deepsleep mode for CPU2
  2162. * @rmtoll EXTSCR C2DS LL_PWR_IsActiveFlag_C2DS
  2163. * @retval State of bit (1 or 0).
  2164. */
  2165. __STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_C2DS(void)
  2166. {
  2167. return ((READ_BIT(PWR->EXTSCR, PWR_EXTSCR_C2DS) == (PWR_EXTSCR_C2DS)) ? 1UL : 0UL);
  2168. }
  2169. /**
  2170. * @brief Clear CPU2 hold interrupt flag
  2171. * @rmtoll SCR CC2HF LL_PWR_ClearFlag_C2H
  2172. * @retval None
  2173. */
  2174. __STATIC_INLINE void LL_PWR_ClearFlag_C2H(void)
  2175. {
  2176. WRITE_REG(PWR->SCR, PWR_SCR_CC2HF);
  2177. }
  2178. /**
  2179. * @brief Clear standby and stop flags for CPU1
  2180. * @rmtoll EXTSCR C1CSSF LL_PWR_ClearFlag_C1STOP_C1STB
  2181. * @retval None
  2182. */
  2183. __STATIC_INLINE void LL_PWR_ClearFlag_C1STOP_C1STB(void)
  2184. {
  2185. WRITE_REG(PWR->EXTSCR, PWR_EXTSCR_C1CSSF);
  2186. }
  2187. /**
  2188. * @brief Clear standby and stop flags for CPU2
  2189. * @rmtoll EXTSCR C2CSSF LL_PWR_ClearFlag_C2STOP_C2STB
  2190. * @retval None
  2191. */
  2192. __STATIC_INLINE void LL_PWR_ClearFlag_C2STOP_C2STB(void)
  2193. {
  2194. WRITE_REG(PWR->EXTSCR, PWR_EXTSCR_C2CSSF);
  2195. }
  2196. /**
  2197. * @}
  2198. */
  2199. #if defined(PWR_CR5_SMPSEN)
  2200. /** @defgroup PWR_LL_EF_IT_Management_SMPS PWR IT management for SMPS
  2201. * @{
  2202. */
  2203. /**
  2204. * @brief Enable SMPS step down converter forced in bypass mode by BORH
  2205. * interrupt for CPU1
  2206. * @note To activate flag of SMPS step down converter forced in bypass mode
  2207. * by BORH, BOR must be preliminarily configured to control SMPS
  2208. * operating mode.
  2209. * Refer to function @ref LL_PWR_SetBORConfig().
  2210. * @rmtoll CR3 EBORHSMPSFB LL_PWR_EnableIT_BORH_SMPSFB
  2211. * @retval None
  2212. */
  2213. __STATIC_INLINE void LL_PWR_EnableIT_BORH_SMPSFB(void)
  2214. {
  2215. SET_BIT(PWR->CR3, PWR_CR3_EBORHSMPSFB);
  2216. }
  2217. /**
  2218. * @brief Disable SMPS step down converter forced in bypass mode by BORH
  2219. * interrupt for CPU1
  2220. * @rmtoll CR3 EBORHSMPSFB LL_PWR_DisableIT_BORH_SMPSFB
  2221. * @retval None
  2222. */
  2223. __STATIC_INLINE void LL_PWR_DisableIT_BORH_SMPSFB(void)
  2224. {
  2225. CLEAR_BIT(PWR->CR3, PWR_CR3_EBORHSMPSFB);
  2226. }
  2227. /**
  2228. * @brief Check if SMPS step down converter forced in bypass mode by BORH
  2229. * interrupt is enabled for CPU1
  2230. * @rmtoll CR3 EBORHSMPSFB LL_PWR_IsEnabledIT_BORH_SMPSFB
  2231. * @retval State of bit (1 or 0).
  2232. */
  2233. __STATIC_INLINE uint32_t LL_PWR_IsEnabledIT_BORH_SMPSFB(void)
  2234. {
  2235. return ((READ_BIT(PWR->CR3, PWR_CR3_EBORHSMPSFB) == (PWR_CR3_EBORHSMPSFB)) ? 1UL : 0UL);
  2236. }
  2237. /**
  2238. * @}
  2239. */
  2240. #endif
  2241. /** @defgroup PWR_LL_EF_IT_Management_Radio PWR IT management for radio (BLE or 802.15.4)
  2242. * @{
  2243. */
  2244. /**
  2245. * @brief Enable BLE end of activity interrupt for CPU1
  2246. * @rmtoll CR3 EBLEA LL_PWR_EnableIT_BLEA
  2247. * @retval None
  2248. */
  2249. __STATIC_INLINE void LL_PWR_EnableIT_BLEA(void)
  2250. {
  2251. SET_BIT(PWR->CR3, PWR_CR3_EBLEA);
  2252. }
  2253. /**
  2254. * @brief Enable 802.15.4 end of activity interrupt for CPU1
  2255. * @rmtoll CR3 E802A LL_PWR_EnableIT_802A
  2256. * @retval None
  2257. */
  2258. __STATIC_INLINE void LL_PWR_EnableIT_802A(void)
  2259. {
  2260. SET_BIT(PWR->CR3, PWR_CR3_E802A);
  2261. }
  2262. /**
  2263. * @brief Disable BLE end of activity interrupt for CPU1
  2264. * @rmtoll CR3 EBLEA LL_PWR_DisableIT_BLEA
  2265. * @retval None
  2266. */
  2267. __STATIC_INLINE void LL_PWR_DisableIT_BLEA(void)
  2268. {
  2269. CLEAR_BIT(PWR->CR3, PWR_CR3_EBLEA);
  2270. }
  2271. /**
  2272. * @brief Disable 802.15.4 end of activity interrupt for CPU1
  2273. * @rmtoll CR3 E802A LL_PWR_DisableIT_802A
  2274. * @retval None
  2275. */
  2276. __STATIC_INLINE void LL_PWR_DisableIT_802A(void)
  2277. {
  2278. CLEAR_BIT(PWR->CR3, PWR_CR3_E802A);
  2279. }
  2280. /**
  2281. * @brief Check if BLE end of activity interrupt is enabled for CPU1
  2282. * @rmtoll CR3 EBLEA LL_PWR_IsEnabledIT_BLEA
  2283. * @retval State of bit (1 or 0).
  2284. */
  2285. __STATIC_INLINE uint32_t LL_PWR_IsEnabledIT_BLEA(void)
  2286. {
  2287. return ((READ_BIT(PWR->CR3, PWR_CR3_EBLEA) == (PWR_CR3_EBLEA)) ? 1UL : 0UL);
  2288. }
  2289. /**
  2290. * @brief Check if 802.15.4 end of activity interrupt is enabled for CPU1
  2291. * @rmtoll CR3 E802A LL_PWR_IsEnabledIT_802A
  2292. * @retval State of bit (1 or 0).
  2293. */
  2294. __STATIC_INLINE uint32_t LL_PWR_IsEnabledIT_802A(void)
  2295. {
  2296. return ((READ_BIT(PWR->CR3, PWR_CR3_E802A) == (PWR_CR3_E802A)) ? 1UL : 0UL);
  2297. }
  2298. /**
  2299. * @brief Enable critical radio phase end of activity interrupt for CPU1
  2300. * @rmtoll CR3 ECRPE LL_PWR_EnableIT_802A
  2301. * @retval None
  2302. */
  2303. __STATIC_INLINE void LL_PWR_EnableIT_CRPE(void)
  2304. {
  2305. SET_BIT(PWR->CR3, PWR_CR3_ECRPE);
  2306. }
  2307. /**
  2308. * @brief Disable critical radio phase end of activity interrupt for CPU1
  2309. * @rmtoll CR3 ECRPE LL_PWR_DisableIT_802A
  2310. * @retval None
  2311. */
  2312. __STATIC_INLINE void LL_PWR_DisableIT_CRPE(void)
  2313. {
  2314. CLEAR_BIT(PWR->CR3, PWR_CR3_ECRPE);
  2315. }
  2316. /**
  2317. * @brief Check if critical radio phase end of activity interrupt is enabled for CPU1
  2318. * @rmtoll CR3 ECRPE LL_PWR_IsEnabledIT_802A
  2319. * @retval State of bit (1 or 0).
  2320. */
  2321. __STATIC_INLINE uint32_t LL_PWR_IsEnabledIT_CRPE(void)
  2322. {
  2323. return ((READ_BIT(PWR->CR3, PWR_CR3_ECRPE) == (PWR_CR3_ECRPE)) ? 1UL : 0UL);
  2324. }
  2325. /**
  2326. * @}
  2327. */
  2328. /** @defgroup PWR_LL_EF_IT_Management_Multicore PWR IT management for multicore
  2329. * @{
  2330. */
  2331. /**
  2332. * @brief Enable CPU2 hold interrupt for CPU1
  2333. * @rmtoll CR3 EC2H LL_PWR_EnableIT_HoldCPU2
  2334. * @retval None
  2335. */
  2336. __STATIC_INLINE void LL_PWR_EnableIT_HoldCPU2(void)
  2337. {
  2338. SET_BIT(PWR->CR3, PWR_CR3_EC2H);
  2339. }
  2340. /**
  2341. * @brief Disable 802.15.4 host wakeup interrupt for CPU2
  2342. * @rmtoll CR3 EC2H LL_PWR_DisableIT_HoldCPU2
  2343. * @retval None
  2344. */
  2345. __STATIC_INLINE void LL_PWR_DisableIT_HoldCPU2(void)
  2346. {
  2347. CLEAR_BIT(PWR->CR3, PWR_CR3_EC2H);
  2348. }
  2349. /**
  2350. * @brief Check if BLE host wakeup interrupt is enabled for CPU2
  2351. * @rmtoll CR3 EC2H LL_PWR_IsEnabledIT_HoldCPU2
  2352. * @retval State of bit (1 or 0).
  2353. */
  2354. __STATIC_INLINE uint32_t LL_PWR_IsEnabledIT_HoldCPU2(void)
  2355. {
  2356. return ((READ_BIT(PWR->CR3, PWR_CR3_EC2H) == (PWR_CR3_EC2H)) ? 1UL : 0UL);
  2357. }
  2358. /**
  2359. * @}
  2360. */
  2361. /** @defgroup PWR_LL_EF_IT_Management_CPU2 PWR IT management of CPU2, intended to be executed by CPU2
  2362. * @{
  2363. */
  2364. /**
  2365. * @brief Enable BLE host wakeup interrupt for CPU2
  2366. * @rmtoll C2CR3 EBLEWUP LL_C2_PWR_EnableIT_BLEWU
  2367. * @retval None
  2368. */
  2369. __STATIC_INLINE void LL_C2_PWR_EnableIT_BLEWU(void)
  2370. {
  2371. SET_BIT(PWR->C2CR3, PWR_C2CR3_EBLEWUP);
  2372. }
  2373. /**
  2374. * @brief Enable 802.15.4 host wakeup interrupt for CPU2
  2375. * @rmtoll C2CR3 E802WUP LL_C2_PWR_EnableIT_802WU
  2376. * @retval None
  2377. */
  2378. __STATIC_INLINE void LL_C2_PWR_EnableIT_802WU(void)
  2379. {
  2380. SET_BIT(PWR->C2CR3, PWR_C2CR3_E802WUP);
  2381. }
  2382. /**
  2383. * @brief Disable BLE host wakeup interrupt for CPU2
  2384. * @rmtoll C2CR3 EBLEWUP LL_C2_PWR_DisableIT_BLEWU
  2385. * @retval None
  2386. */
  2387. __STATIC_INLINE void LL_C2_PWR_DisableIT_BLEWU(void)
  2388. {
  2389. CLEAR_BIT(PWR->C2CR3, PWR_C2CR3_EBLEWUP);
  2390. }
  2391. /**
  2392. * @brief Disable 802.15.4 host wakeup interrupt for CPU2
  2393. * @rmtoll C2CR3 E802WUP LL_C2_PWR_DisableIT_802WU
  2394. * @retval None
  2395. */
  2396. __STATIC_INLINE void LL_C2_PWR_DisableIT_802WU(void)
  2397. {
  2398. CLEAR_BIT(PWR->C2CR3, PWR_C2CR3_E802WUP);
  2399. }
  2400. /**
  2401. * @brief Check if BLE host wakeup interrupt is enabled for CPU2
  2402. * @rmtoll C2CR3 EBLEWUP LL_C2_PWR_IsEnabledIT_BLEWU
  2403. * @retval State of bit (1 or 0).
  2404. */
  2405. __STATIC_INLINE uint32_t LL_C2_PWR_IsEnabledIT_BLEWU(void)
  2406. {
  2407. return ((READ_BIT(PWR->C2CR3, PWR_C2CR3_EBLEWUP) == (PWR_C2CR3_EBLEWUP)) ? 1UL : 0UL);
  2408. }
  2409. /**
  2410. * @brief Check if 802.15.4 host wakeup interrupt is enabled for CPU2
  2411. * @rmtoll C2CR3 E802WUP LL_C2_PWR_IsEnabledIT_802WU
  2412. * @retval State of bit (1 or 0).
  2413. */
  2414. __STATIC_INLINE uint32_t LL_C2_PWR_IsEnabledIT_802WU(void)
  2415. {
  2416. return ((READ_BIT(PWR->C2CR3, PWR_C2CR3_E802WUP) == (PWR_C2CR3_E802WUP)) ? 1UL : 0UL);
  2417. }
  2418. /**
  2419. * @}
  2420. */
  2421. #if defined(USE_FULL_LL_DRIVER)
  2422. /** @defgroup PWR_LL_EF_Init De-initialization function
  2423. * @{
  2424. */
  2425. ErrorStatus LL_PWR_DeInit(void);
  2426. /**
  2427. * @}
  2428. */
  2429. #endif /* USE_FULL_LL_DRIVER */
  2430. /**
  2431. * @}
  2432. */
  2433. /**
  2434. * @}
  2435. */
  2436. #endif /* defined(PWR) */
  2437. /**
  2438. * @}
  2439. */
  2440. #ifdef __cplusplus
  2441. }
  2442. #endif
  2443. #endif /* STM32WBxx_LL_PWR_H */
  2444. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/