stm32l4xx_hal_pwr_ex.h 35 KB

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