stm32l4xx_hal_pwr_ex.h 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930
  1. /**
  2. ******************************************************************************
  3. * @file stm32l4xx_hal_pwr_ex.h
  4. * @author MCD Application Team
  5. * @brief Header file of PWR HAL Extended module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * Copyright (c) 2017 STMicroelectronics.
  10. * All rights reserved.
  11. *
  12. * This software is licensed under terms that can be found in the LICENSE file
  13. * in the root directory of this software component.
  14. * If no LICENSE file comes with this software, it is provided AS-IS.
  15. *
  16. ******************************************************************************
  17. */
  18. /* Define to prevent recursive inclusion -------------------------------------*/
  19. #ifndef STM32L4xx_HAL_PWR_EX_H
  20. #define STM32L4xx_HAL_PWR_EX_H
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. /* Includes ------------------------------------------------------------------*/
  25. #include "stm32l4xx_hal_def.h"
  26. /** @addtogroup STM32L4xx_HAL_Driver
  27. * @{
  28. */
  29. /** @addtogroup PWREx
  30. * @{
  31. */
  32. /* Exported types ------------------------------------------------------------*/
  33. /** @defgroup PWREx_Exported_Types PWR Extended Exported Types
  34. * @{
  35. */
  36. /**
  37. * @brief PWR PVM configuration structure definition
  38. */
  39. typedef struct
  40. {
  41. uint32_t PVMType; /*!< PVMType: Specifies which voltage is monitored and against which threshold.
  42. This parameter can be a value of @ref PWREx_PVM_Type.
  43. @arg @ref PWR_PVM_1 Peripheral Voltage Monitoring 1 enable: VDDUSB versus 1.2 V (applicable when USB feature is supported).
  44. @if STM32L486xx
  45. @arg @ref PWR_PVM_2 Peripheral Voltage Monitoring 2 enable: VDDIO2 versus 0.9 V (applicable when VDDIO2 is present on device).
  46. @endif
  47. @arg @ref PWR_PVM_3 Peripheral Voltage Monitoring 3 enable: VDDA versus 1.62 V.
  48. @arg @ref PWR_PVM_4 Peripheral Voltage Monitoring 4 enable: VDDA versus 2.2 V. */
  49. uint32_t Mode; /*!< Mode: Specifies the operating mode for the selected pins.
  50. This parameter can be a value of @ref PWREx_PVM_Mode. */
  51. }PWR_PVMTypeDef;
  52. /**
  53. * @}
  54. */
  55. /* Exported constants --------------------------------------------------------*/
  56. /** @defgroup PWREx_Exported_Constants PWR Extended Exported Constants
  57. * @{
  58. */
  59. /** @defgroup PWREx_WUP_Polarity Shift to apply to retrieve polarity information from PWR_WAKEUP_PINy_xxx constants
  60. * @{
  61. */
  62. #define PWR_WUP_POLARITY_SHIFT 0x05 /*!< Internal constant used to retrieve wakeup pin polariry */
  63. /**
  64. * @}
  65. */
  66. /** @defgroup PWREx_WakeUp_Pins PWR wake-up pins
  67. * @{
  68. */
  69. #define PWR_WAKEUP_PIN1 PWR_CR3_EWUP1 /*!< Wakeup pin 1 (with high level polarity) */
  70. #define PWR_WAKEUP_PIN2 PWR_CR3_EWUP2 /*!< Wakeup pin 2 (with high level polarity) */
  71. #define PWR_WAKEUP_PIN3 PWR_CR3_EWUP3 /*!< Wakeup pin 3 (with high level polarity) */
  72. #define PWR_WAKEUP_PIN4 PWR_CR3_EWUP4 /*!< Wakeup pin 4 (with high level polarity) */
  73. #define PWR_WAKEUP_PIN5 PWR_CR3_EWUP5 /*!< Wakeup pin 5 (with high level polarity) */
  74. #define PWR_WAKEUP_PIN1_HIGH PWR_CR3_EWUP1 /*!< Wakeup pin 1 (with high level polarity) */
  75. #define PWR_WAKEUP_PIN2_HIGH PWR_CR3_EWUP2 /*!< Wakeup pin 2 (with high level polarity) */
  76. #define PWR_WAKEUP_PIN3_HIGH PWR_CR3_EWUP3 /*!< Wakeup pin 3 (with high level polarity) */
  77. #define PWR_WAKEUP_PIN4_HIGH PWR_CR3_EWUP4 /*!< Wakeup pin 4 (with high level polarity) */
  78. #define PWR_WAKEUP_PIN5_HIGH PWR_CR3_EWUP5 /*!< Wakeup pin 5 (with high level polarity) */
  79. #define PWR_WAKEUP_PIN1_LOW (uint32_t)((PWR_CR4_WP1<<PWR_WUP_POLARITY_SHIFT) | PWR_CR3_EWUP1) /*!< Wakeup pin 1 (with low level polarity) */
  80. #define PWR_WAKEUP_PIN2_LOW (uint32_t)((PWR_CR4_WP2<<PWR_WUP_POLARITY_SHIFT) | PWR_CR3_EWUP2) /*!< Wakeup pin 2 (with low level polarity) */
  81. #define PWR_WAKEUP_PIN3_LOW (uint32_t)((PWR_CR4_WP3<<PWR_WUP_POLARITY_SHIFT) | PWR_CR3_EWUP3) /*!< Wakeup pin 3 (with low level polarity) */
  82. #define PWR_WAKEUP_PIN4_LOW (uint32_t)((PWR_CR4_WP4<<PWR_WUP_POLARITY_SHIFT) | PWR_CR3_EWUP4) /*!< Wakeup pin 4 (with low level polarity) */
  83. #define PWR_WAKEUP_PIN5_LOW (uint32_t)((PWR_CR4_WP5<<PWR_WUP_POLARITY_SHIFT) | PWR_CR3_EWUP5) /*!< Wakeup pin 5 (with low level polarity) */
  84. /**
  85. * @}
  86. */
  87. /** @defgroup PWREx_PVM_Type Peripheral Voltage Monitoring type
  88. * @{
  89. */
  90. #if defined(PWR_CR2_PVME1)
  91. #define PWR_PVM_1 PWR_CR2_PVME1 /*!< Peripheral Voltage Monitoring 1 enable: VDDUSB versus 1.2 V (applicable when USB feature is supported) */
  92. #endif /* PWR_CR2_PVME1 */
  93. #if defined(PWR_CR2_PVME2)
  94. #define PWR_PVM_2 PWR_CR2_PVME2 /*!< Peripheral Voltage Monitoring 2 enable: VDDIO2 versus 0.9 V (applicable when VDDIO2 is present on device) */
  95. #endif /* PWR_CR2_PVME2 */
  96. #define PWR_PVM_3 PWR_CR2_PVME3 /*!< Peripheral Voltage Monitoring 3 enable: VDDA versus 1.62 V */
  97. #define PWR_PVM_4 PWR_CR2_PVME4 /*!< Peripheral Voltage Monitoring 4 enable: VDDA versus 2.2 V */
  98. /**
  99. * @}
  100. */
  101. /** @defgroup PWREx_PVM_Mode PWR PVM interrupt and event mode
  102. * @{
  103. */
  104. #define PWR_PVM_MODE_NORMAL ((uint32_t)0x00000000) /*!< basic mode is used */
  105. #define PWR_PVM_MODE_IT_RISING ((uint32_t)0x00010001) /*!< External Interrupt Mode with Rising edge trigger detection */
  106. #define PWR_PVM_MODE_IT_FALLING ((uint32_t)0x00010002) /*!< External Interrupt Mode with Falling edge trigger detection */
  107. #define PWR_PVM_MODE_IT_RISING_FALLING ((uint32_t)0x00010003) /*!< External Interrupt Mode with Rising/Falling edge trigger detection */
  108. #define PWR_PVM_MODE_EVENT_RISING ((uint32_t)0x00020001) /*!< Event Mode with Rising edge trigger detection */
  109. #define PWR_PVM_MODE_EVENT_FALLING ((uint32_t)0x00020002) /*!< Event Mode with Falling edge trigger detection */
  110. #define PWR_PVM_MODE_EVENT_RISING_FALLING ((uint32_t)0x00020003) /*!< Event Mode with Rising/Falling edge trigger detection */
  111. /**
  112. * @}
  113. */
  114. /** @defgroup PWREx_Regulator_Voltage_Scale PWR Regulator voltage scale
  115. * @{
  116. */
  117. #if defined(PWR_CR5_R1MODE)
  118. #define PWR_REGULATOR_VOLTAGE_SCALE1_BOOST ((uint32_t)0x00000000) /*!< Voltage scaling range 1 boost mode */
  119. #endif
  120. #define PWR_REGULATOR_VOLTAGE_SCALE1 PWR_CR1_VOS_0 /*!< Voltage scaling range 1 normal mode */
  121. #define PWR_REGULATOR_VOLTAGE_SCALE2 PWR_CR1_VOS_1 /*!< Voltage scaling range 2 */
  122. /**
  123. * @}
  124. */
  125. /** @defgroup PWREx_VBAT_Battery_Charging_Selection PWR battery charging resistor selection
  126. * @{
  127. */
  128. #define PWR_BATTERY_CHARGING_RESISTOR_5 ((uint32_t)0x00000000) /*!< VBAT charging through a 5 kOhms resistor */
  129. #define PWR_BATTERY_CHARGING_RESISTOR_1_5 PWR_CR4_VBRS /*!< VBAT charging through a 1.5 kOhms resistor */
  130. /**
  131. * @}
  132. */
  133. /** @defgroup PWREx_VBAT_Battery_Charging PWR battery charging
  134. * @{
  135. */
  136. #define PWR_BATTERY_CHARGING_DISABLE ((uint32_t)0x00000000)
  137. #define PWR_BATTERY_CHARGING_ENABLE PWR_CR4_VBE
  138. /**
  139. * @}
  140. */
  141. /** @defgroup PWREx_GPIO_Bit_Number GPIO bit number for I/O setting in standby/shutdown mode
  142. * @{
  143. */
  144. #define PWR_GPIO_BIT_0 PWR_PUCRA_PA0 /*!< GPIO port I/O pin 0 */
  145. #define PWR_GPIO_BIT_1 PWR_PUCRA_PA1 /*!< GPIO port I/O pin 1 */
  146. #define PWR_GPIO_BIT_2 PWR_PUCRA_PA2 /*!< GPIO port I/O pin 2 */
  147. #define PWR_GPIO_BIT_3 PWR_PUCRA_PA3 /*!< GPIO port I/O pin 3 */
  148. #define PWR_GPIO_BIT_4 PWR_PUCRA_PA4 /*!< GPIO port I/O pin 4 */
  149. #define PWR_GPIO_BIT_5 PWR_PUCRA_PA5 /*!< GPIO port I/O pin 5 */
  150. #define PWR_GPIO_BIT_6 PWR_PUCRA_PA6 /*!< GPIO port I/O pin 6 */
  151. #define PWR_GPIO_BIT_7 PWR_PUCRA_PA7 /*!< GPIO port I/O pin 7 */
  152. #define PWR_GPIO_BIT_8 PWR_PUCRA_PA8 /*!< GPIO port I/O pin 8 */
  153. #define PWR_GPIO_BIT_9 PWR_PUCRA_PA9 /*!< GPIO port I/O pin 9 */
  154. #define PWR_GPIO_BIT_10 PWR_PUCRA_PA10 /*!< GPIO port I/O pin 10 */
  155. #define PWR_GPIO_BIT_11 PWR_PUCRA_PA11 /*!< GPIO port I/O pin 11 */
  156. #define PWR_GPIO_BIT_12 PWR_PUCRA_PA12 /*!< GPIO port I/O pin 12 */
  157. #define PWR_GPIO_BIT_13 PWR_PUCRA_PA13 /*!< GPIO port I/O pin 13 */
  158. #define PWR_GPIO_BIT_14 PWR_PDCRA_PA14 /*!< GPIO port I/O pin 14 */
  159. #define PWR_GPIO_BIT_15 PWR_PUCRA_PA15 /*!< GPIO port I/O pin 15 */
  160. /**
  161. * @}
  162. */
  163. /** @defgroup PWREx_GPIO GPIO port
  164. * @{
  165. */
  166. #define PWR_GPIO_A 0x00000000U /*!< GPIO port A */
  167. #define PWR_GPIO_B 0x00000001U /*!< GPIO port B */
  168. #define PWR_GPIO_C 0x00000002U /*!< GPIO port C */
  169. #if defined(GPIOD_BASE)
  170. #define PWR_GPIO_D 0x00000003U /*!< GPIO port D */
  171. #endif
  172. #if defined(GPIOE_BASE)
  173. #define PWR_GPIO_E 0x00000004U /*!< GPIO port E */
  174. #endif
  175. #if defined(GPIOF_BASE)
  176. #define PWR_GPIO_F 0x00000005U /*!< GPIO port F */
  177. #endif
  178. #if defined(GPIOG_BASE)
  179. #define PWR_GPIO_G 0x00000006U /*!< GPIO port G */
  180. #endif
  181. #define PWR_GPIO_H 0x00000007U /*!< GPIO port H */
  182. #if defined(GPIOI_BASE)
  183. #define PWR_GPIO_I 0x00000008U /*!< GPIO port I */
  184. #endif
  185. /**
  186. * @}
  187. */
  188. /** @defgroup PWREx_PVM_EXTI_LINE PWR PVM external interrupts lines
  189. * @{
  190. */
  191. #if defined(PWR_CR2_PVME1)
  192. #define PWR_EXTI_LINE_PVM1 ((uint32_t)0x00000008) /*!< External interrupt line 35 Connected to the PVM1 EXTI Line */
  193. #endif /* PWR_CR2_PVME1 */
  194. #if defined(PWR_CR2_PVME2)
  195. #define PWR_EXTI_LINE_PVM2 ((uint32_t)0x00000010) /*!< External interrupt line 36 Connected to the PVM2 EXTI Line */
  196. #endif /* PWR_CR2_PVME2 */
  197. #define PWR_EXTI_LINE_PVM3 ((uint32_t)0x00000020) /*!< External interrupt line 37 Connected to the PVM3 EXTI Line */
  198. #define PWR_EXTI_LINE_PVM4 ((uint32_t)0x00000040) /*!< External interrupt line 38 Connected to the PVM4 EXTI Line */
  199. /**
  200. * @}
  201. */
  202. /** @defgroup PWREx_PVM_EVENT_LINE PWR PVM event lines
  203. * @{
  204. */
  205. #if defined(PWR_CR2_PVME1)
  206. #define PWR_EVENT_LINE_PVM1 ((uint32_t)0x00000008) /*!< Event line 35 Connected to the PVM1 EXTI Line */
  207. #endif /* PWR_CR2_PVME1 */
  208. #if defined(PWR_CR2_PVME2)
  209. #define PWR_EVENT_LINE_PVM2 ((uint32_t)0x00000010) /*!< Event line 36 Connected to the PVM2 EXTI Line */
  210. #endif /* PWR_CR2_PVME2 */
  211. #define PWR_EVENT_LINE_PVM3 ((uint32_t)0x00000020) /*!< Event line 37 Connected to the PVM3 EXTI Line */
  212. #define PWR_EVENT_LINE_PVM4 ((uint32_t)0x00000040) /*!< Event line 38 Connected to the PVM4 EXTI Line */
  213. /**
  214. * @}
  215. */
  216. /** @defgroup PWREx_Flag PWR Status Flags
  217. * Elements values convention: 0000 0000 0XXY YYYYb
  218. * - Y YYYY : Flag position in the XX register (5 bits)
  219. * - XX : Status register (2 bits)
  220. * - 01: SR1 register
  221. * - 10: SR2 register
  222. * The only exception is PWR_FLAG_WU, encompassing all
  223. * wake-up flags and set to PWR_SR1_WUF.
  224. * @{
  225. */
  226. #define PWR_FLAG_WUF1 ((uint32_t)0x0020) /*!< Wakeup event on wakeup pin 1 */
  227. #define PWR_FLAG_WUF2 ((uint32_t)0x0021) /*!< Wakeup event on wakeup pin 2 */
  228. #define PWR_FLAG_WUF3 ((uint32_t)0x0022) /*!< Wakeup event on wakeup pin 3 */
  229. #define PWR_FLAG_WUF4 ((uint32_t)0x0023) /*!< Wakeup event on wakeup pin 4 */
  230. #define PWR_FLAG_WUF5 ((uint32_t)0x0024) /*!< Wakeup event on wakeup pin 5 */
  231. #define PWR_FLAG_WU PWR_SR1_WUF /*!< Encompass wakeup event on all wakeup pins */
  232. #define PWR_FLAG_SB ((uint32_t)0x0028) /*!< Standby flag */
  233. #if defined(PWR_SR1_EXT_SMPS_RDY)
  234. #define PWR_FLAG_EXT_SMPS ((uint32_t)0x002D) /*!< Switching to external SMPS ready flag */
  235. #endif /* PWR_SR1_EXT_SMPS_RDY */
  236. #define PWR_FLAG_WUFI ((uint32_t)0x002F) /*!< Wakeup on internal wakeup line */
  237. #define PWR_FLAG_REGLPS ((uint32_t)0x0048) /*!< Low-power regulator start flag */
  238. #define PWR_FLAG_REGLPF ((uint32_t)0x0049) /*!< Low-power regulator flag */
  239. #define PWR_FLAG_VOSF ((uint32_t)0x004A) /*!< Voltage scaling flag */
  240. #define PWR_FLAG_PVDO ((uint32_t)0x004B) /*!< Power Voltage Detector output flag */
  241. #if defined(PWR_CR2_PVME1)
  242. #define PWR_FLAG_PVMO1 ((uint32_t)0x004C) /*!< Power Voltage Monitoring 1 output flag */
  243. #endif /* PWR_CR2_PVME1 */
  244. #if defined(PWR_CR2_PVME2)
  245. #define PWR_FLAG_PVMO2 ((uint32_t)0x004D) /*!< Power Voltage Monitoring 2 output flag */
  246. #endif /* PWR_CR2_PVME2 */
  247. #define PWR_FLAG_PVMO3 ((uint32_t)0x004E) /*!< Power Voltage Monitoring 3 output flag */
  248. #define PWR_FLAG_PVMO4 ((uint32_t)0x004F) /*!< Power Voltage Monitoring 4 output flag */
  249. /**
  250. * @}
  251. */
  252. /** @defgroup PWREx_SRAM2_Retention PWR SRAM2 Retention in Standby mode
  253. * @{
  254. */
  255. #define PWR_NO_SRAM2_RETENTION ((uint32_t)0x00000000) /*!< SRAM2 is powered off in Standby mode (SRAM2 content is lost) */
  256. #if defined(PWR_CR3_RRS_1)
  257. #define PWR_FULL_SRAM2_RETENTION PWR_CR3_RRS_0 /*!< Full SRAM2 is powered by the low-power regulator in Standby mode */
  258. #define PWR_4KBYTES_SRAM2_RETENTION PWR_CR3_RRS_1 /*!< Only 4 Kbytes of SRAM2 is powered by the low-power regulator in Standby mode */
  259. #else
  260. #define PWR_FULL_SRAM2_RETENTION PWR_CR3_RRS /*!< Full SRAM2 is powered by the low-power regulator in Standby mode */
  261. #endif /* PWR_CR3_RRS_1 */
  262. /**
  263. * @}
  264. */
  265. /**
  266. * @}
  267. */
  268. /* Exported macros -----------------------------------------------------------*/
  269. /** @defgroup PWREx_Exported_Macros PWR Extended Exported Macros
  270. * @{
  271. */
  272. #if defined(PWR_CR2_PVME1)
  273. /**
  274. * @brief Enable the PVM1 Extended Interrupt Line.
  275. * @retval None
  276. */
  277. #define __HAL_PWR_PVM1_EXTI_ENABLE_IT() SET_BIT(EXTI->IMR2, PWR_EXTI_LINE_PVM1)
  278. /**
  279. * @brief Disable the PVM1 Extended Interrupt Line.
  280. * @retval None
  281. */
  282. #define __HAL_PWR_PVM1_EXTI_DISABLE_IT() CLEAR_BIT(EXTI->IMR2, PWR_EXTI_LINE_PVM1)
  283. /**
  284. * @brief Enable the PVM1 Event Line.
  285. * @retval None
  286. */
  287. #define __HAL_PWR_PVM1_EXTI_ENABLE_EVENT() SET_BIT(EXTI->EMR2, PWR_EVENT_LINE_PVM1)
  288. /**
  289. * @brief Disable the PVM1 Event Line.
  290. * @retval None
  291. */
  292. #define __HAL_PWR_PVM1_EXTI_DISABLE_EVENT() CLEAR_BIT(EXTI->EMR2, PWR_EVENT_LINE_PVM1)
  293. /**
  294. * @brief Enable the PVM1 Extended Interrupt Rising Trigger.
  295. * @retval None
  296. */
  297. #define __HAL_PWR_PVM1_EXTI_ENABLE_RISING_EDGE() SET_BIT(EXTI->RTSR2, PWR_EXTI_LINE_PVM1)
  298. /**
  299. * @brief Disable the PVM1 Extended Interrupt Rising Trigger.
  300. * @retval None
  301. */
  302. #define __HAL_PWR_PVM1_EXTI_DISABLE_RISING_EDGE() CLEAR_BIT(EXTI->RTSR2, PWR_EXTI_LINE_PVM1)
  303. /**
  304. * @brief Enable the PVM1 Extended Interrupt Falling Trigger.
  305. * @retval None
  306. */
  307. #define __HAL_PWR_PVM1_EXTI_ENABLE_FALLING_EDGE() SET_BIT(EXTI->FTSR2, PWR_EXTI_LINE_PVM1)
  308. /**
  309. * @brief Disable the PVM1 Extended Interrupt Falling Trigger.
  310. * @retval None
  311. */
  312. #define __HAL_PWR_PVM1_EXTI_DISABLE_FALLING_EDGE() CLEAR_BIT(EXTI->FTSR2, PWR_EXTI_LINE_PVM1)
  313. /**
  314. * @brief PVM1 EXTI line configuration: set rising & falling edge trigger.
  315. * @retval None
  316. */
  317. #define __HAL_PWR_PVM1_EXTI_ENABLE_RISING_FALLING_EDGE() \
  318. do { \
  319. __HAL_PWR_PVM1_EXTI_ENABLE_RISING_EDGE(); \
  320. __HAL_PWR_PVM1_EXTI_ENABLE_FALLING_EDGE(); \
  321. } while(0)
  322. /**
  323. * @brief Disable the PVM1 Extended Interrupt Rising & Falling Trigger.
  324. * @retval None
  325. */
  326. #define __HAL_PWR_PVM1_EXTI_DISABLE_RISING_FALLING_EDGE() \
  327. do { \
  328. __HAL_PWR_PVM1_EXTI_DISABLE_RISING_EDGE(); \
  329. __HAL_PWR_PVM1_EXTI_DISABLE_FALLING_EDGE(); \
  330. } while(0)
  331. /**
  332. * @brief Generate a Software interrupt on selected EXTI line.
  333. * @retval None
  334. */
  335. #define __HAL_PWR_PVM1_EXTI_GENERATE_SWIT() SET_BIT(EXTI->SWIER2, PWR_EXTI_LINE_PVM1)
  336. /**
  337. * @brief Check whether the specified PVM1 EXTI interrupt flag is set or not.
  338. * @retval EXTI PVM1 Line Status.
  339. */
  340. #define __HAL_PWR_PVM1_EXTI_GET_FLAG() (EXTI->PR2 & PWR_EXTI_LINE_PVM1)
  341. /**
  342. * @brief Clear the PVM1 EXTI flag.
  343. * @retval None
  344. */
  345. #define __HAL_PWR_PVM1_EXTI_CLEAR_FLAG() WRITE_REG(EXTI->PR2, PWR_EXTI_LINE_PVM1)
  346. #endif /* PWR_CR2_PVME1 */
  347. #if defined(PWR_CR2_PVME2)
  348. /**
  349. * @brief Enable the PVM2 Extended Interrupt Line.
  350. * @retval None
  351. */
  352. #define __HAL_PWR_PVM2_EXTI_ENABLE_IT() SET_BIT(EXTI->IMR2, PWR_EXTI_LINE_PVM2)
  353. /**
  354. * @brief Disable the PVM2 Extended Interrupt Line.
  355. * @retval None
  356. */
  357. #define __HAL_PWR_PVM2_EXTI_DISABLE_IT() CLEAR_BIT(EXTI->IMR2, PWR_EXTI_LINE_PVM2)
  358. /**
  359. * @brief Enable the PVM2 Event Line.
  360. * @retval None
  361. */
  362. #define __HAL_PWR_PVM2_EXTI_ENABLE_EVENT() SET_BIT(EXTI->EMR2, PWR_EVENT_LINE_PVM2)
  363. /**
  364. * @brief Disable the PVM2 Event Line.
  365. * @retval None
  366. */
  367. #define __HAL_PWR_PVM2_EXTI_DISABLE_EVENT() CLEAR_BIT(EXTI->EMR2, PWR_EVENT_LINE_PVM2)
  368. /**
  369. * @brief Enable the PVM2 Extended Interrupt Rising Trigger.
  370. * @retval None
  371. */
  372. #define __HAL_PWR_PVM2_EXTI_ENABLE_RISING_EDGE() SET_BIT(EXTI->RTSR2, PWR_EXTI_LINE_PVM2)
  373. /**
  374. * @brief Disable the PVM2 Extended Interrupt Rising Trigger.
  375. * @retval None
  376. */
  377. #define __HAL_PWR_PVM2_EXTI_DISABLE_RISING_EDGE() CLEAR_BIT(EXTI->RTSR2, PWR_EXTI_LINE_PVM2)
  378. /**
  379. * @brief Enable the PVM2 Extended Interrupt Falling Trigger.
  380. * @retval None
  381. */
  382. #define __HAL_PWR_PVM2_EXTI_ENABLE_FALLING_EDGE() SET_BIT(EXTI->FTSR2, PWR_EXTI_LINE_PVM2)
  383. /**
  384. * @brief Disable the PVM2 Extended Interrupt Falling Trigger.
  385. * @retval None
  386. */
  387. #define __HAL_PWR_PVM2_EXTI_DISABLE_FALLING_EDGE() CLEAR_BIT(EXTI->FTSR2, PWR_EXTI_LINE_PVM2)
  388. /**
  389. * @brief PVM2 EXTI line configuration: set rising & falling edge trigger.
  390. * @retval None
  391. */
  392. #define __HAL_PWR_PVM2_EXTI_ENABLE_RISING_FALLING_EDGE() \
  393. do { \
  394. __HAL_PWR_PVM2_EXTI_ENABLE_RISING_EDGE(); \
  395. __HAL_PWR_PVM2_EXTI_ENABLE_FALLING_EDGE(); \
  396. } while(0)
  397. /**
  398. * @brief Disable the PVM2 Extended Interrupt Rising & Falling Trigger.
  399. * @retval None
  400. */
  401. #define __HAL_PWR_PVM2_EXTI_DISABLE_RISING_FALLING_EDGE() \
  402. do { \
  403. __HAL_PWR_PVM2_EXTI_DISABLE_RISING_EDGE(); \
  404. __HAL_PWR_PVM2_EXTI_DISABLE_FALLING_EDGE(); \
  405. } while(0)
  406. /**
  407. * @brief Generate a Software interrupt on selected EXTI line.
  408. * @retval None
  409. */
  410. #define __HAL_PWR_PVM2_EXTI_GENERATE_SWIT() SET_BIT(EXTI->SWIER2, PWR_EXTI_LINE_PVM2)
  411. /**
  412. * @brief Check whether the specified PVM2 EXTI interrupt flag is set or not.
  413. * @retval EXTI PVM2 Line Status.
  414. */
  415. #define __HAL_PWR_PVM2_EXTI_GET_FLAG() (EXTI->PR2 & PWR_EXTI_LINE_PVM2)
  416. /**
  417. * @brief Clear the PVM2 EXTI flag.
  418. * @retval None
  419. */
  420. #define __HAL_PWR_PVM2_EXTI_CLEAR_FLAG() WRITE_REG(EXTI->PR2, PWR_EXTI_LINE_PVM2)
  421. #endif /* PWR_CR2_PVME2 */
  422. /**
  423. * @brief Enable the PVM3 Extended Interrupt Line.
  424. * @retval None
  425. */
  426. #define __HAL_PWR_PVM3_EXTI_ENABLE_IT() SET_BIT(EXTI->IMR2, PWR_EXTI_LINE_PVM3)
  427. /**
  428. * @brief Disable the PVM3 Extended Interrupt Line.
  429. * @retval None
  430. */
  431. #define __HAL_PWR_PVM3_EXTI_DISABLE_IT() CLEAR_BIT(EXTI->IMR2, PWR_EXTI_LINE_PVM3)
  432. /**
  433. * @brief Enable the PVM3 Event Line.
  434. * @retval None
  435. */
  436. #define __HAL_PWR_PVM3_EXTI_ENABLE_EVENT() SET_BIT(EXTI->EMR2, PWR_EVENT_LINE_PVM3)
  437. /**
  438. * @brief Disable the PVM3 Event Line.
  439. * @retval None
  440. */
  441. #define __HAL_PWR_PVM3_EXTI_DISABLE_EVENT() CLEAR_BIT(EXTI->EMR2, PWR_EVENT_LINE_PVM3)
  442. /**
  443. * @brief Enable the PVM3 Extended Interrupt Rising Trigger.
  444. * @retval None
  445. */
  446. #define __HAL_PWR_PVM3_EXTI_ENABLE_RISING_EDGE() SET_BIT(EXTI->RTSR2, PWR_EXTI_LINE_PVM3)
  447. /**
  448. * @brief Disable the PVM3 Extended Interrupt Rising Trigger.
  449. * @retval None
  450. */
  451. #define __HAL_PWR_PVM3_EXTI_DISABLE_RISING_EDGE() CLEAR_BIT(EXTI->RTSR2, PWR_EXTI_LINE_PVM3)
  452. /**
  453. * @brief Enable the PVM3 Extended Interrupt Falling Trigger.
  454. * @retval None
  455. */
  456. #define __HAL_PWR_PVM3_EXTI_ENABLE_FALLING_EDGE() SET_BIT(EXTI->FTSR2, PWR_EXTI_LINE_PVM3)
  457. /**
  458. * @brief Disable the PVM3 Extended Interrupt Falling Trigger.
  459. * @retval None
  460. */
  461. #define __HAL_PWR_PVM3_EXTI_DISABLE_FALLING_EDGE() CLEAR_BIT(EXTI->FTSR2, PWR_EXTI_LINE_PVM3)
  462. /**
  463. * @brief PVM3 EXTI line configuration: set rising & falling edge trigger.
  464. * @retval None
  465. */
  466. #define __HAL_PWR_PVM3_EXTI_ENABLE_RISING_FALLING_EDGE() \
  467. do { \
  468. __HAL_PWR_PVM3_EXTI_ENABLE_RISING_EDGE(); \
  469. __HAL_PWR_PVM3_EXTI_ENABLE_FALLING_EDGE(); \
  470. } while(0)
  471. /**
  472. * @brief Disable the PVM3 Extended Interrupt Rising & Falling Trigger.
  473. * @retval None
  474. */
  475. #define __HAL_PWR_PVM3_EXTI_DISABLE_RISING_FALLING_EDGE() \
  476. do { \
  477. __HAL_PWR_PVM3_EXTI_DISABLE_RISING_EDGE(); \
  478. __HAL_PWR_PVM3_EXTI_DISABLE_FALLING_EDGE(); \
  479. } while(0)
  480. /**
  481. * @brief Generate a Software interrupt on selected EXTI line.
  482. * @retval None
  483. */
  484. #define __HAL_PWR_PVM3_EXTI_GENERATE_SWIT() SET_BIT(EXTI->SWIER2, PWR_EXTI_LINE_PVM3)
  485. /**
  486. * @brief Check whether the specified PVM3 EXTI interrupt flag is set or not.
  487. * @retval EXTI PVM3 Line Status.
  488. */
  489. #define __HAL_PWR_PVM3_EXTI_GET_FLAG() (EXTI->PR2 & PWR_EXTI_LINE_PVM3)
  490. /**
  491. * @brief Clear the PVM3 EXTI flag.
  492. * @retval None
  493. */
  494. #define __HAL_PWR_PVM3_EXTI_CLEAR_FLAG() WRITE_REG(EXTI->PR2, PWR_EXTI_LINE_PVM3)
  495. /**
  496. * @brief Enable the PVM4 Extended Interrupt Line.
  497. * @retval None
  498. */
  499. #define __HAL_PWR_PVM4_EXTI_ENABLE_IT() SET_BIT(EXTI->IMR2, PWR_EXTI_LINE_PVM4)
  500. /**
  501. * @brief Disable the PVM4 Extended Interrupt Line.
  502. * @retval None
  503. */
  504. #define __HAL_PWR_PVM4_EXTI_DISABLE_IT() CLEAR_BIT(EXTI->IMR2, PWR_EXTI_LINE_PVM4)
  505. /**
  506. * @brief Enable the PVM4 Event Line.
  507. * @retval None
  508. */
  509. #define __HAL_PWR_PVM4_EXTI_ENABLE_EVENT() SET_BIT(EXTI->EMR2, PWR_EVENT_LINE_PVM4)
  510. /**
  511. * @brief Disable the PVM4 Event Line.
  512. * @retval None
  513. */
  514. #define __HAL_PWR_PVM4_EXTI_DISABLE_EVENT() CLEAR_BIT(EXTI->EMR2, PWR_EVENT_LINE_PVM4)
  515. /**
  516. * @brief Enable the PVM4 Extended Interrupt Rising Trigger.
  517. * @retval None
  518. */
  519. #define __HAL_PWR_PVM4_EXTI_ENABLE_RISING_EDGE() SET_BIT(EXTI->RTSR2, PWR_EXTI_LINE_PVM4)
  520. /**
  521. * @brief Disable the PVM4 Extended Interrupt Rising Trigger.
  522. * @retval None
  523. */
  524. #define __HAL_PWR_PVM4_EXTI_DISABLE_RISING_EDGE() CLEAR_BIT(EXTI->RTSR2, PWR_EXTI_LINE_PVM4)
  525. /**
  526. * @brief Enable the PVM4 Extended Interrupt Falling Trigger.
  527. * @retval None
  528. */
  529. #define __HAL_PWR_PVM4_EXTI_ENABLE_FALLING_EDGE() SET_BIT(EXTI->FTSR2, PWR_EXTI_LINE_PVM4)
  530. /**
  531. * @brief Disable the PVM4 Extended Interrupt Falling Trigger.
  532. * @retval None
  533. */
  534. #define __HAL_PWR_PVM4_EXTI_DISABLE_FALLING_EDGE() CLEAR_BIT(EXTI->FTSR2, PWR_EXTI_LINE_PVM4)
  535. /**
  536. * @brief PVM4 EXTI line configuration: set rising & falling edge trigger.
  537. * @retval None
  538. */
  539. #define __HAL_PWR_PVM4_EXTI_ENABLE_RISING_FALLING_EDGE() \
  540. do { \
  541. __HAL_PWR_PVM4_EXTI_ENABLE_RISING_EDGE(); \
  542. __HAL_PWR_PVM4_EXTI_ENABLE_FALLING_EDGE(); \
  543. } while(0)
  544. /**
  545. * @brief Disable the PVM4 Extended Interrupt Rising & Falling Trigger.
  546. * @retval None
  547. */
  548. #define __HAL_PWR_PVM4_EXTI_DISABLE_RISING_FALLING_EDGE() \
  549. do { \
  550. __HAL_PWR_PVM4_EXTI_DISABLE_RISING_EDGE(); \
  551. __HAL_PWR_PVM4_EXTI_DISABLE_FALLING_EDGE(); \
  552. } while(0)
  553. /**
  554. * @brief Generate a Software interrupt on selected EXTI line.
  555. * @retval None
  556. */
  557. #define __HAL_PWR_PVM4_EXTI_GENERATE_SWIT() SET_BIT(EXTI->SWIER2, PWR_EXTI_LINE_PVM4)
  558. /**
  559. * @brief Check whether or not the specified PVM4 EXTI interrupt flag is set.
  560. * @retval EXTI PVM4 Line Status.
  561. */
  562. #define __HAL_PWR_PVM4_EXTI_GET_FLAG() (EXTI->PR2 & PWR_EXTI_LINE_PVM4)
  563. /**
  564. * @brief Clear the PVM4 EXTI flag.
  565. * @retval None
  566. */
  567. #define __HAL_PWR_PVM4_EXTI_CLEAR_FLAG() WRITE_REG(EXTI->PR2, PWR_EXTI_LINE_PVM4)
  568. /**
  569. * @brief Configure the main internal regulator output voltage.
  570. * @param __REGULATOR__ specifies the regulator output voltage to achieve
  571. * a tradeoff between performance and power consumption.
  572. * This parameter can be one of the following values:
  573. * @arg @ref PWR_REGULATOR_VOLTAGE_SCALE1 Regulator voltage output range 1 mode,
  574. * typical output voltage at 1.2 V,
  575. * system frequency up to 80 MHz.
  576. * @arg @ref PWR_REGULATOR_VOLTAGE_SCALE2 Regulator voltage output range 2 mode,
  577. * typical output voltage at 1.0 V,
  578. * system frequency up to 26 MHz.
  579. * @note This macro is similar to HAL_PWREx_ControlVoltageScaling() API but doesn't check
  580. * whether or not VOSF flag is cleared when moving from range 2 to range 1. User
  581. * may resort to __HAL_PWR_GET_FLAG() macro to check VOSF bit resetting.
  582. * @retval None
  583. */
  584. #define __HAL_PWR_VOLTAGESCALING_CONFIG(__REGULATOR__) do { \
  585. __IO uint32_t tmpreg; \
  586. MODIFY_REG(PWR->CR1, PWR_CR1_VOS, (__REGULATOR__)); \
  587. /* Delay after an RCC peripheral clock enabling */ \
  588. tmpreg = READ_BIT(PWR->CR1, PWR_CR1_VOS); \
  589. UNUSED(tmpreg); \
  590. } while(0)
  591. /**
  592. * @}
  593. */
  594. /* Private macros --------------------------------------------------------*/
  595. /** @addtogroup PWREx_Private_Macros PWR Extended Private Macros
  596. * @{
  597. */
  598. #define IS_PWR_WAKEUP_PIN(PIN) (((PIN) == PWR_WAKEUP_PIN1) || \
  599. ((PIN) == PWR_WAKEUP_PIN2) || \
  600. ((PIN) == PWR_WAKEUP_PIN3) || \
  601. ((PIN) == PWR_WAKEUP_PIN4) || \
  602. ((PIN) == PWR_WAKEUP_PIN5) || \
  603. ((PIN) == PWR_WAKEUP_PIN1_HIGH) || \
  604. ((PIN) == PWR_WAKEUP_PIN2_HIGH) || \
  605. ((PIN) == PWR_WAKEUP_PIN3_HIGH) || \
  606. ((PIN) == PWR_WAKEUP_PIN4_HIGH) || \
  607. ((PIN) == PWR_WAKEUP_PIN5_HIGH) || \
  608. ((PIN) == PWR_WAKEUP_PIN1_LOW) || \
  609. ((PIN) == PWR_WAKEUP_PIN2_LOW) || \
  610. ((PIN) == PWR_WAKEUP_PIN3_LOW) || \
  611. ((PIN) == PWR_WAKEUP_PIN4_LOW) || \
  612. ((PIN) == PWR_WAKEUP_PIN5_LOW))
  613. #if defined (STM32L475xx) || defined (STM32L476xx) || defined (STM32L485xx) || defined (STM32L486xx) || \
  614. defined (STM32L496xx) || defined (STM32L4A6xx) || \
  615. defined (STM32L4P5xx) || defined (STM32L4Q5xx) || \
  616. defined (STM32L4R5xx) || defined (STM32L4R7xx) || defined (STM32L4R9xx) || defined (STM32L4S5xx) || defined (STM32L4S7xx) || defined (STM32L4S9xx)
  617. #define IS_PWR_PVM_TYPE(TYPE) (((TYPE) == PWR_PVM_1) ||\
  618. ((TYPE) == PWR_PVM_2) ||\
  619. ((TYPE) == PWR_PVM_3) ||\
  620. ((TYPE) == PWR_PVM_4))
  621. #elif defined (STM32L471xx)
  622. #define IS_PWR_PVM_TYPE(TYPE) (((TYPE) == PWR_PVM_2) ||\
  623. ((TYPE) == PWR_PVM_3) ||\
  624. ((TYPE) == PWR_PVM_4))
  625. #endif
  626. #if defined (STM32L412xx) || defined (STM32L422xx) || defined (STM32L433xx) || defined (STM32L443xx) || defined (STM32L452xx) || defined (STM32L462xx)
  627. #define IS_PWR_PVM_TYPE(TYPE) (((TYPE) == PWR_PVM_1) ||\
  628. ((TYPE) == PWR_PVM_3) ||\
  629. ((TYPE) == PWR_PVM_4))
  630. #elif defined (STM32L431xx) || defined (STM32L432xx) || defined (STM32L442xx) || defined (STM32L451xx)
  631. #define IS_PWR_PVM_TYPE(TYPE) (((TYPE) == PWR_PVM_3) ||\
  632. ((TYPE) == PWR_PVM_4))
  633. #endif
  634. #define IS_PWR_PVM_MODE(MODE) (((MODE) == PWR_PVM_MODE_NORMAL) ||\
  635. ((MODE) == PWR_PVM_MODE_IT_RISING) ||\
  636. ((MODE) == PWR_PVM_MODE_IT_FALLING) ||\
  637. ((MODE) == PWR_PVM_MODE_IT_RISING_FALLING) ||\
  638. ((MODE) == PWR_PVM_MODE_EVENT_RISING) ||\
  639. ((MODE) == PWR_PVM_MODE_EVENT_FALLING) ||\
  640. ((MODE) == PWR_PVM_MODE_EVENT_RISING_FALLING))
  641. #if defined(PWR_CR5_R1MODE)
  642. #define IS_PWR_VOLTAGE_SCALING_RANGE(RANGE) (((RANGE) == PWR_REGULATOR_VOLTAGE_SCALE1_BOOST) || \
  643. ((RANGE) == PWR_REGULATOR_VOLTAGE_SCALE1) || \
  644. ((RANGE) == PWR_REGULATOR_VOLTAGE_SCALE2))
  645. #else
  646. #define IS_PWR_VOLTAGE_SCALING_RANGE(RANGE) (((RANGE) == PWR_REGULATOR_VOLTAGE_SCALE1) || \
  647. ((RANGE) == PWR_REGULATOR_VOLTAGE_SCALE2))
  648. #endif
  649. #define IS_PWR_BATTERY_RESISTOR_SELECT(RESISTOR) (((RESISTOR) == PWR_BATTERY_CHARGING_RESISTOR_5) ||\
  650. ((RESISTOR) == PWR_BATTERY_CHARGING_RESISTOR_1_5))
  651. #define IS_PWR_BATTERY_CHARGING(CHARGING) (((CHARGING) == PWR_BATTERY_CHARGING_DISABLE) ||\
  652. ((CHARGING) == PWR_BATTERY_CHARGING_ENABLE))
  653. #define IS_PWR_GPIO_BIT_NUMBER(BIT_NUMBER) (((BIT_NUMBER) & GPIO_PIN_MASK) != (uint32_t)0x00)
  654. #if defined (STM32L412xx) || defined (STM32L422xx)
  655. #define IS_PWR_GPIO(GPIO) (((GPIO) == PWR_GPIO_A) ||\
  656. ((GPIO) == PWR_GPIO_B) ||\
  657. ((GPIO) == PWR_GPIO_C) ||\
  658. ((GPIO) == PWR_GPIO_D) ||\
  659. ((GPIO) == PWR_GPIO_H))
  660. #elif defined (STM32L431xx) || defined (STM32L433xx) || defined (STM32L443xx) || \
  661. defined (STM32L451xx) || defined (STM32L452xx) || defined (STM32L462xx)
  662. #define IS_PWR_GPIO(GPIO) (((GPIO) == PWR_GPIO_A) ||\
  663. ((GPIO) == PWR_GPIO_B) ||\
  664. ((GPIO) == PWR_GPIO_C) ||\
  665. ((GPIO) == PWR_GPIO_D) ||\
  666. ((GPIO) == PWR_GPIO_E) ||\
  667. ((GPIO) == PWR_GPIO_H))
  668. #elif defined (STM32L432xx) || defined (STM32L442xx)
  669. #define IS_PWR_GPIO(GPIO) (((GPIO) == PWR_GPIO_A) ||\
  670. ((GPIO) == PWR_GPIO_B) ||\
  671. ((GPIO) == PWR_GPIO_C) ||\
  672. ((GPIO) == PWR_GPIO_H))
  673. #elif defined (STM32L471xx) || defined (STM32L475xx) || defined (STM32L476xx) || defined (STM32L485xx) || defined (STM32L486xx)
  674. #define IS_PWR_GPIO(GPIO) (((GPIO) == PWR_GPIO_A) ||\
  675. ((GPIO) == PWR_GPIO_B) ||\
  676. ((GPIO) == PWR_GPIO_C) ||\
  677. ((GPIO) == PWR_GPIO_D) ||\
  678. ((GPIO) == PWR_GPIO_E) ||\
  679. ((GPIO) == PWR_GPIO_F) ||\
  680. ((GPIO) == PWR_GPIO_G) ||\
  681. ((GPIO) == PWR_GPIO_H))
  682. #elif defined (STM32L496xx) || defined (STM32L4A6xx) || \
  683. defined (STM32L4P5xx) || defined (STM32L4Q5xx) || \
  684. defined (STM32L4R5xx) || defined (STM32L4R7xx) || defined (STM32L4R9xx) || defined (STM32L4S5xx) || defined (STM32L4S7xx) || defined (STM32L4S9xx)
  685. #define IS_PWR_GPIO(GPIO) (((GPIO) == PWR_GPIO_A) ||\
  686. ((GPIO) == PWR_GPIO_B) ||\
  687. ((GPIO) == PWR_GPIO_C) ||\
  688. ((GPIO) == PWR_GPIO_D) ||\
  689. ((GPIO) == PWR_GPIO_E) ||\
  690. ((GPIO) == PWR_GPIO_F) ||\
  691. ((GPIO) == PWR_GPIO_G) ||\
  692. ((GPIO) == PWR_GPIO_H) ||\
  693. ((GPIO) == PWR_GPIO_I))
  694. #endif
  695. #if defined (STM32L4P5xx) || defined (STM32L4Q5xx)
  696. #define IS_PWR_SRAM2_RETENTION(SRAM2) (((SRAM2) == PWR_NO_SRAM2_RETENTION) ||\
  697. ((SRAM2) == PWR_FULL_SRAM2_RETENTION) ||\
  698. ((SRAM2) == PWR_4KBYTES_SRAM2_RETENTION))
  699. #else
  700. #define IS_PWR_SRAM2_RETENTION(SRAM2) (((SRAM2) == PWR_NO_SRAM2_RETENTION) ||\
  701. ((SRAM2) == PWR_FULL_SRAM2_RETENTION))
  702. #endif
  703. /**
  704. * @}
  705. */
  706. /** @addtogroup PWREx_Exported_Functions PWR Extended Exported Functions
  707. * @{
  708. */
  709. /** @addtogroup PWREx_Exported_Functions_Group1 Extended Peripheral Control functions
  710. * @{
  711. */
  712. /* Peripheral Control functions **********************************************/
  713. uint32_t HAL_PWREx_GetVoltageRange(void);
  714. HAL_StatusTypeDef HAL_PWREx_ControlVoltageScaling(uint32_t VoltageScaling);
  715. void HAL_PWREx_EnableBatteryCharging(uint32_t ResistorSelection);
  716. void HAL_PWREx_DisableBatteryCharging(void);
  717. #if defined(PWR_CR2_USV)
  718. void HAL_PWREx_EnableVddUSB(void);
  719. void HAL_PWREx_DisableVddUSB(void);
  720. #endif /* PWR_CR2_USV */
  721. #if defined(PWR_CR2_IOSV)
  722. void HAL_PWREx_EnableVddIO2(void);
  723. void HAL_PWREx_DisableVddIO2(void);
  724. #endif /* PWR_CR2_IOSV */
  725. void HAL_PWREx_EnableInternalWakeUpLine(void);
  726. void HAL_PWREx_DisableInternalWakeUpLine(void);
  727. HAL_StatusTypeDef HAL_PWREx_EnableGPIOPullUp(uint32_t GPIO, uint32_t GPIONumber);
  728. HAL_StatusTypeDef HAL_PWREx_DisableGPIOPullUp(uint32_t GPIO, uint32_t GPIONumber);
  729. HAL_StatusTypeDef HAL_PWREx_EnableGPIOPullDown(uint32_t GPIO, uint32_t GPIONumber);
  730. HAL_StatusTypeDef HAL_PWREx_DisableGPIOPullDown(uint32_t GPIO, uint32_t GPIONumber);
  731. void HAL_PWREx_EnablePullUpPullDownConfig(void);
  732. void HAL_PWREx_DisablePullUpPullDownConfig(void);
  733. void HAL_PWREx_EnableSRAM2ContentRetention(void);
  734. void HAL_PWREx_DisableSRAM2ContentRetention(void);
  735. HAL_StatusTypeDef HAL_PWREx_SetSRAM2ContentRetention(uint32_t SRAM2Size);
  736. #if defined(PWR_CR1_RRSTP)
  737. void HAL_PWREx_EnableSRAM3ContentRetention(void);
  738. void HAL_PWREx_DisableSRAM3ContentRetention(void);
  739. #endif /* PWR_CR1_RRSTP */
  740. #if defined(PWR_CR3_DSIPDEN)
  741. void HAL_PWREx_EnableDSIPinsPDActivation(void);
  742. void HAL_PWREx_DisableDSIPinsPDActivation(void);
  743. #endif /* PWR_CR3_DSIPDEN */
  744. #if defined(PWR_CR2_PVME1)
  745. void HAL_PWREx_EnablePVM1(void);
  746. void HAL_PWREx_DisablePVM1(void);
  747. #endif /* PWR_CR2_PVME1 */
  748. #if defined(PWR_CR2_PVME2)
  749. void HAL_PWREx_EnablePVM2(void);
  750. void HAL_PWREx_DisablePVM2(void);
  751. #endif /* PWR_CR2_PVME2 */
  752. void HAL_PWREx_EnablePVM3(void);
  753. void HAL_PWREx_DisablePVM3(void);
  754. void HAL_PWREx_EnablePVM4(void);
  755. void HAL_PWREx_DisablePVM4(void);
  756. HAL_StatusTypeDef HAL_PWREx_ConfigPVM(PWR_PVMTypeDef *sConfigPVM);
  757. #if defined(PWR_CR3_ENULP)
  758. void HAL_PWREx_EnableBORPVD_ULP(void);
  759. void HAL_PWREx_DisableBORPVD_ULP(void);
  760. #endif /* PWR_CR3_ENULP */
  761. #if defined(PWR_CR4_EXT_SMPS_ON)
  762. void HAL_PWREx_EnableExtSMPS_0V95(void);
  763. void HAL_PWREx_DisableExtSMPS_0V95(void);
  764. #endif /* PWR_CR4_EXT_SMPS_ON */
  765. /* Low Power modes configuration functions ************************************/
  766. void HAL_PWREx_EnableLowPowerRunMode(void);
  767. HAL_StatusTypeDef HAL_PWREx_DisableLowPowerRunMode(void);
  768. void HAL_PWREx_EnterSTOP0Mode(uint8_t STOPEntry);
  769. void HAL_PWREx_EnterSTOP1Mode(uint8_t STOPEntry);
  770. void HAL_PWREx_EnterSTOP2Mode(uint8_t STOPEntry);
  771. void HAL_PWREx_EnterSHUTDOWNMode(void);
  772. void HAL_PWREx_PVD_PVM_IRQHandler(void);
  773. #if defined(PWR_CR2_PVME1)
  774. void HAL_PWREx_PVM1Callback(void);
  775. #endif /* PWR_CR2_PVME1 */
  776. #if defined(PWR_CR2_PVME2)
  777. void HAL_PWREx_PVM2Callback(void);
  778. #endif /* PWR_CR2_PVME2 */
  779. void HAL_PWREx_PVM3Callback(void);
  780. void HAL_PWREx_PVM4Callback(void);
  781. /**
  782. * @}
  783. */
  784. /**
  785. * @}
  786. */
  787. /**
  788. * @}
  789. */
  790. /**
  791. * @}
  792. */
  793. #ifdef __cplusplus
  794. }
  795. #endif
  796. #endif /* STM32L4xx_HAL_PWR_EX_H */