stm32l4xx_hal_pwr_ex.h 36 KB

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