py32f0xx_hal_pwr.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585
  1. /**
  2. ******************************************************************************
  3. * @file py32f0xx_hal_pwr.c
  4. * @author MCU Application Team
  5. * @brief PWR HAL module driver.
  6. * This file provides firmware functions to manage the following
  7. * functionalities of the Power Controller (PWR) peripheral:
  8. * + Initialization/de-initialization functions
  9. * + Peripheral Control functions
  10. *
  11. ******************************************************************************
  12. * @attention
  13. *
  14. * <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co.
  15. * All rights reserved.</center></h2>
  16. *
  17. * This software component is licensed by Puya under BSD 3-Clause license,
  18. * the "License"; You may not use this file except in compliance with the
  19. * License. You may obtain a copy of the License at:
  20. * opensource.org/licenses/BSD-3-Clause
  21. *
  22. ******************************************************************************
  23. * @attention
  24. *
  25. * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics.
  26. * All rights reserved.</center></h2>
  27. *
  28. * This software component is licensed by ST under BSD 3-Clause license,
  29. * the "License"; You may not use this file except in compliance with the
  30. * License. You may obtain a copy of the License at:
  31. * opensource.org/licenses/BSD-3-Clause
  32. *
  33. ******************************************************************************
  34. */
  35. /* Includes ------------------------------------------------------------------*/
  36. #include "py32f0xx_hal.h"
  37. /** @addtogroup PY32F0xx_HAL_Driver
  38. * @{
  39. */
  40. /** @addtogroup PWR
  41. * @{
  42. */
  43. #ifdef HAL_PWR_MODULE_ENABLED
  44. /* Private typedef -----------------------------------------------------------*/
  45. /* Private define ------------------------------------------------------------*/
  46. /** @defgroup PWR_Private_Defines PWR Private Defines
  47. * @{
  48. */
  49. #if defined(PWR_PVD_SUPPORT)
  50. /** @defgroup PWR_PVD_Mode_Mask PWR PVD Mode Mask
  51. * @{
  52. */
  53. #define PVD_MODE_IT 0x00010000U /*!< Mask for interruption yielded
  54. by PVD threshold crossing */
  55. #define PVD_MODE_EVT 0x00020000U /*!< Mask for event yielded
  56. by PVD threshold crossing */
  57. #define PVD_RISING_EDGE 0x00000001U /*!< Mask for rising edge set as
  58. PVD trigger */
  59. #define PVD_FALLING_EDGE 0x00000002U /*!< Mask for falling edge set as
  60. PVD trigger */
  61. /**
  62. * @}
  63. */
  64. #endif
  65. /**
  66. * @}
  67. */
  68. /* Private macro -------------------------------------------------------------*/
  69. /* Private variables ---------------------------------------------------------*/
  70. /* Private function prototypes -----------------------------------------------*/
  71. /* Exported functions --------------------------------------------------------*/
  72. /** @addtogroup PWR_Exported_Functions PWR Exported Functions
  73. * @{
  74. */
  75. /** @addtogroup PWR_Exported_Functions_Group1 Initialization and de-initialization functions
  76. * @brief Initialization and de-initialization functions
  77. *
  78. @verbatim
  79. ===============================================================================
  80. ##### Initialization and de-initialization functions #####
  81. ===============================================================================
  82. [..]
  83. @endverbatim
  84. * @{
  85. */
  86. /**
  87. * @brief Deinitialize the HAL PWR peripheral registers to their default reset
  88. values.
  89. * @retval None
  90. */
  91. void HAL_PWR_DeInit(void)
  92. {
  93. __HAL_RCC_PWR_FORCE_RESET();
  94. __HAL_RCC_PWR_RELEASE_RESET();
  95. }
  96. /**
  97. * @}
  98. */
  99. /** @addtogroup PWR_Exported_Functions_Group2 Peripheral Control functions
  100. * @brief Low Power modes configuration functions
  101. *
  102. @verbatim
  103. ===============================================================================
  104. ##### Peripheral Control functions #####
  105. ===============================================================================
  106. [..]
  107. *** PVD configuration ***
  108. =========================
  109. [..]
  110. (+) The PVD is used to monitor the VDD power supply by comparing it to a
  111. threshold selected by the PVD Level (PVDT[2:0]bits in PWR CR2 register).
  112. (+) PVDO flag is available to indicate if VDD/VDDA is higher or lower
  113. than the PVD threshold. This event is internally connected to the EXTI
  114. line 16 and can generate an interrupt if enabled.
  115. (+) The PVD is stopped in Standby mode.
  116. *** WakeUp pin configuration ***
  117. ================================
  118. [..]
  119. (+) WakeUp pins are used to wakeup the system from Standby mode or
  120. Shutdown mode. WakeUp pins polarity can be set to configure event
  121. detection on high level (rising edge) or low level (falling edge).
  122. *** Low Power mode configuration ***
  123. =====================================
  124. [..]
  125. The devices feature 7 low-power modes:
  126. (+) Low-power run mode: core and peripherals are running at low frequency.
  127. Regulator is in low power mode.
  128. (+) Sleep mode: Cortex-M0+ core stopped, peripherals kept running,
  129. regulator is main mode.
  130. (+) Low-power Sleep mode: Cortex-M0+ core stopped, peripherals kept running
  131. and regulator in low power mode.
  132. (+) Stop 0 mode: all clocks are stopped except LSI and LSE, regulator is
  133. main mode.
  134. (+) Stop 1 mode: all clocks are stopped except LSI and LSE, main regulator
  135. off, low power regulator on.
  136. *** Low-power run mode ***
  137. ==========================
  138. [..]
  139. (+) Entry: (from main run mode)
  140. (++) set LPR bit with HAL_PWREx_EnableLowPowerRunMode() API after
  141. having decreased the system clock below 2 MHz.
  142. (+) Exit:
  143. (++) clear LPR bit then wait for REGLPF bit to be reset with
  144. HAL_PWREx_DisableLowPowerRunMode() API. Only then can the
  145. system clock frequency be increased above 2 MHz.
  146. *** Sleep mode / Low-power sleep mode ***
  147. =========================================
  148. [..]
  149. (+) Entry:
  150. The Sleep & Low-power Sleep modes are entered through
  151. HAL_PWR_EnterSLEEPMode() API specifying whether or not the regulator
  152. is forced to low-power mode and if exit is interrupt or event
  153. triggered.
  154. (++) PWR_MAINREGULATOR_ON: Sleep mode (regulator in main mode).
  155. (++) PWR_LOWPOWERREGULATOR_ON: Low-power Sleep mode (regulator in low
  156. power mode). In this case, the system clock frequency must have
  157. been decreased below 2 MHz beforehand.
  158. (++) PWR_SLEEPENTRY_WFI: Core enters sleep mode with WFI instruction
  159. (++) PWR_SLEEPENTRY_WFE: Core enters sleep mode with WFE instruction
  160. (+) WFI Exit:
  161. (++) Any interrupt enabled in nested vectored interrupt controller (NVIC)
  162. (+) WFE Exit:
  163. (++) Any wakeup event if cortex is configured with SEVONPEND = 0
  164. (++) Interrupt even when disabled in NVIC if cortex is configured with
  165. SEVONPEND = 1
  166. [..] When exiting the Low-power Sleep mode by issuing an interrupt or a wakeup event,
  167. the MCU is in Low-power Run mode.
  168. *** Stop 0 & Stop 1 modes ***
  169. =============================
  170. [..]
  171. (+) Entry:
  172. The Stop modes are entered through the following APIs:
  173. (++) HAL_PWR_EnterSTOPMode() with following settings:
  174. (+++) PWR_MAINREGULATOR_ON to enter STOP0 mode.
  175. (+++) PWR_LOWPOWERREGULATOR_ON to enter STOP1 mode.
  176. (+) Exit (interrupt or event-triggered, specified when entering STOP mode):
  177. (++) PWR_STOPENTRY_WFI: enter Stop mode with WFI instruction
  178. (++) PWR_STOPENTRY_WFE: enter Stop mode with WFE instruction
  179. (+) WFI Exit:
  180. (++) Any EXTI line (internal or external) configured in interrupt mode
  181. with corresponding interrupt enable in NVIC
  182. (+) WFE Exit:
  183. (++) Any EXTI line (internal or external) configured in event mode if
  184. cortex is configured with SEVONPEND = 0
  185. (++) Any EXTI line configured in interrupt mode (even if the
  186. corresponding EXTI Interrupt vector is disabled in the NVIC) if
  187. cortex is configured with SEVONPEND = 0. The interrupt source can
  188. be external interrupts or peripherals with wakeup capability.
  189. [..] When exiting Stop, the MCU is either in Run mode or in Low-power Run mode
  190. depending on the LPR bit setting.
  191. @endverbatim
  192. * @{
  193. */
  194. /**
  195. * @brief Enable access to the backup domain
  196. * (RTC & TAMP registers, backup registers, RCC BDCR register).
  197. * @note After reset, the backup domain is protected against
  198. * possible unwanted write accesses. All RTC & TAMP registers (backup
  199. * registers included) and RCC BDCR register are concerned.
  200. * @retval None
  201. */
  202. void HAL_PWR_EnableBkUpAccess(void)
  203. {
  204. SET_BIT(PWR->CR1, PWR_CR1_DBP);
  205. }
  206. /**
  207. * @brief Disable access to the backup domain
  208. * @retval None
  209. */
  210. void HAL_PWR_DisableBkUpAccess(void)
  211. {
  212. CLEAR_BIT(PWR->CR1, PWR_CR1_DBP);
  213. }
  214. #if defined(PWR_PVD_SUPPORT)
  215. /**
  216. * @brief Configure the Power Voltage Detector (PVD).
  217. * @param sConfigPVD pointer to a PWR_PVDTypeDef structure that contains the
  218. PVD configuration information: threshold levels, operating mode.
  219. * @note Refer to the electrical characteristics of your device datasheet for
  220. * more details about the voltage thresholds corresponding to each
  221. * detection level.
  222. * @note User should take care that rising threshold is higher than falling
  223. * one in order to avoid having always PVDO output set.
  224. * @retval HAL_OK
  225. */
  226. HAL_StatusTypeDef HAL_PWR_ConfigPVD(PWR_PVDTypeDef *sConfigPVD)
  227. {
  228. /* Check the parameters */
  229. assert_param(IS_PWR_PVD_LEVEL(sConfigPVD->PVDLevel));
  230. assert_param(IS_PWR_PVD_MODE(sConfigPVD->Mode));
  231. /* Set PVD level bits only according to PVDLevel value */
  232. MODIFY_REG(PWR->CR2, (PWR_CR2_PVDT | PWR_CR2_FLTEN | PWR_CR2_FLT_TIME | PWR_CR2_SRCSEL), \
  233. (sConfigPVD->PVDLevel | sConfigPVD->PVDFilter | sConfigPVD->PVDSource));
  234. /* Clear any previous config, in case no event or IT mode is selected */
  235. __HAL_PWR_PVD_EXTI_DISABLE_EVENT();
  236. __HAL_PWR_PVD_EXTI_DISABLE_IT();
  237. __HAL_PWR_PVD_EXTI_DISABLE_FALLING_EDGE();
  238. __HAL_PWR_PVD_EXTI_DISABLE_RISING_EDGE();
  239. /* Configure interrupt mode */
  240. if((sConfigPVD->Mode & PVD_MODE_IT) == PVD_MODE_IT)
  241. {
  242. __HAL_PWR_PVD_EXTI_ENABLE_IT();
  243. }
  244. /* Configure event mode */
  245. if((sConfigPVD->Mode & PVD_MODE_EVT) == PVD_MODE_EVT)
  246. {
  247. __HAL_PWR_PVD_EXTI_ENABLE_EVENT();
  248. }
  249. /* Configure the edge */
  250. if((sConfigPVD->Mode & PVD_RISING_EDGE) == PVD_RISING_EDGE)
  251. {
  252. __HAL_PWR_PVD_EXTI_ENABLE_RISING_EDGE();
  253. }
  254. if((sConfigPVD->Mode & PVD_FALLING_EDGE) == PVD_FALLING_EDGE)
  255. {
  256. __HAL_PWR_PVD_EXTI_ENABLE_FALLING_EDGE();
  257. }
  258. return HAL_OK;
  259. }
  260. /**
  261. * @brief Enable the Power Voltage Detector (PVD).
  262. * @retval None
  263. */
  264. void HAL_PWR_EnablePVD(void)
  265. {
  266. SET_BIT(PWR->CR2, PWR_CR2_PVDE);
  267. }
  268. /**
  269. * @brief Disable the Power Voltage Detector (PVD).
  270. * @retval None
  271. */
  272. void HAL_PWR_DisablePVD(void)
  273. {
  274. CLEAR_BIT(PWR->CR2, PWR_CR2_PVDE);
  275. }
  276. #endif
  277. /**
  278. * @brief Configure LPR voltage,sram retention voltage,and wakeup correlation
  279. timing in Stop mode.
  280. * @param sStopModeConfig pointer to a PWR_StopModeConfigTypeDef structure that
  281. contains the Stop mode configuration information.
  282. * @retval HAL_OK
  283. */
  284. HAL_StatusTypeDef HAL_PWR_ConfigStopMode(PWR_StopModeConfigTypeDef *sStopModeConfig)
  285. {
  286. /* Check the parameters */
  287. assert_param(IS_PWR_STOP_LPR_VOLT(sStopModeConfig->LPVoltSelection));
  288. assert_param(IS_PWR_REGULATOR_SWTICH_DELAY(sStopModeConfig->RegulatorSwitchDelay));
  289. assert_param(IS_PWR_WAKEUP_HSIEN_TIMING(sStopModeConfig->WakeUpHsiEnableTime));
  290. assert_param(IS_PWR_SRAM_RETENTION_VOLT(sStopModeConfig->SramRetentionVolt));
  291. assert_param(IS_PWR_WAKEUP_FLASH_DELAY(sStopModeConfig->FlashDelay));
  292. /* Set the STOP mode and STOP wake-up timing related configurations */
  293. MODIFY_REG(PWR->CR1, (PWR_CR1_VOS | PWR_CR1_MRRDY_TIME | PWR_CR1_HSION_CTRL | PWR_CR1_SRAM_RETV | PWR_CR1_FLS_SLPTIME),
  294. (sStopModeConfig->LPVoltSelection) | \
  295. (sStopModeConfig->WakeUpHsiEnableTime) | \
  296. (sStopModeConfig->RegulatorSwitchDelay) | \
  297. (sStopModeConfig->SramRetentionVolt) | \
  298. (sStopModeConfig->FlashDelay));
  299. return HAL_OK;
  300. }
  301. /**
  302. * @brief Configure the bias current load source and bias current values.
  303. * @param sBIASConfig pointer to a PWR_BIASConfigTypeDef structure that
  304. contains the bias current configuration information.
  305. * @retval HAL_OK
  306. */
  307. HAL_StatusTypeDef HAL_PWR_ConfigBIAS(PWR_BIASConfigTypeDef *sBIASConfig)
  308. {
  309. /* Check the parameters */
  310. assert_param(IS_BIAS_CURRENTS_SOURCE(sBIASConfig->BiasCurrentSource));
  311. if(((sBIASConfig->BiasCurrentSource) & PWR_BIAS_CURRENTS_FROM_BIAS_CR) == PWR_BIAS_CURRENTS_FROM_BIAS_CR)
  312. {
  313. /* Set the bias currents load source and bias currents value*/
  314. MODIFY_REG(PWR->CR1, (PWR_CR1_BIAS_CR_SEL) | (PWR_CR1_BIAS_CR), (sBIASConfig->BiasCurrentSource) | \
  315. (sBIASConfig->BiasCurrentValue));
  316. }
  317. else
  318. {
  319. /* Set the bias currents load source */
  320. MODIFY_REG(PWR->CR1, PWR_CR1_BIAS_CR_SEL, (sBIASConfig->BiasCurrentSource));
  321. }
  322. return HAL_OK;
  323. }
  324. /**
  325. * @brief Enter Sleep or Low-power Sleep mode.
  326. * @note In Sleep/Low-power Sleep mode, all I/O pins keep the same state as
  327. * in Run mode.
  328. * @param SLEEPEntry Specifies if Sleep mode is entered with WFI or WFE
  329. * instruction. This parameter can be one of the following values:
  330. * @arg @ref PWR_SLEEPENTRY_WFI enter Sleep or Low-power Sleep
  331. * mode with WFI instruction
  332. * @arg @ref PWR_SLEEPENTRY_WFE enter Sleep or Low-power Sleep
  333. * mode with WFE instruction
  334. * @note When WFI entry is used, tick interrupt have to be disabled if not
  335. * desired as the interrupt wake up source.
  336. * @retval None
  337. */
  338. void HAL_PWR_EnterSLEEPMode(uint8_t SLEEPEntry)
  339. {
  340. /* Check the parameters */
  341. assert_param(IS_PWR_SLEEP_ENTRY(SLEEPEntry));
  342. /* Clear SLEEPDEEP bit of Cortex System Control Register */
  343. CLEAR_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPDEEP_Msk));
  344. /* Select SLEEP mode entry -------------------------------------------------*/
  345. if(SLEEPEntry == PWR_SLEEPENTRY_WFI)
  346. {
  347. /* Request Wait For Interrupt */
  348. __WFI();
  349. }
  350. else
  351. {
  352. /* Request Wait For Event */
  353. __SEV();
  354. __WFE();
  355. __WFE();
  356. }
  357. }
  358. /**
  359. * @brief Enter Stop mode
  360. * @note This API is named HAL_PWR_EnterSTOPMode to ensure compatibility with
  361. * legacy code running on devices where only "Stop mode" is mentioned
  362. * with main or low power regulator ON.
  363. * @note In Stop mode, all I/O pins keep the same state as in Run mode.
  364. * @note All clocks in the VCORE domain are stopped; the PLL, the HSI and the
  365. * HSE oscillators are disabled. Some peripherals with the wakeup
  366. * capability can switch on the HSI to receive a frame, and switch off
  367. * the HSI after receiving the frame if it is not a wakeup frame.
  368. * SRAM and register contents are preserved.
  369. * The BOR is available.
  370. * The voltage regulator can be configured either in normal (Stop 0) or
  371. * low-power mode (Stop 1).
  372. * @note When exiting Stop 0 or Stop 1 mode by issuing an interrupt or a
  373. * wakeup event, the HSI RC oscillator is selected as system clock
  374. * @note When the voltage regulator operates in low power mode (Stop 1),
  375. * an additional startup delay is incurred when waking up. By keeping
  376. * the internal regulator ON during Stop mode (Stop 0), the consumption
  377. * is higher although the startup time is reduced.
  378. * @param Regulator Specifies the regulator state in Stop mode
  379. * This parameter can be one of the following values:
  380. * @arg @ref PWR_MAINREGULATOR_ON Stop 0 mode (main regulator ON)
  381. * @arg @ref PWR_LOWPOWERREGULATOR_ON Stop 1 mode (low power
  382. * regulator ON)
  383. * @param STOPEntry Specifies Stop 0 or Stop 1 mode is entered with WFI or
  384. * WFE instruction. This parameter can be one of the following values:
  385. * @arg @ref PWR_STOPENTRY_WFI Enter Stop 0 or Stop 1 mode with WFI
  386. * instruction.
  387. * @arg @ref PWR_STOPENTRY_WFE Enter Stop 0 or Stop 1 mode with WFE
  388. * instruction.
  389. * @retval None
  390. */
  391. void HAL_PWR_EnterSTOPMode(uint32_t Regulator, uint8_t STOPEntry)
  392. {
  393. /* Check the parameters */
  394. assert_param(IS_PWR_REGULATOR(Regulator));
  395. assert_param(IS_PWR_STOP_ENTRY(STOPEntry));
  396. if (Regulator != PWR_MAINREGULATOR_ON)
  397. {
  398. /* Stop mode with Low-Power Regulator */
  399. SET_BIT(PWR->CR1,PWR_CR1_LPR);
  400. }
  401. else
  402. {
  403. /* Stop mode with Main Regulator */
  404. CLEAR_BIT(PWR->CR1,PWR_CR1_LPR);
  405. }
  406. /* Set SLEEPDEEP bit of Cortex System Control Register */
  407. SET_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPDEEP_Msk));
  408. /* Select Stop mode entry --------------------------------------------------*/
  409. if(STOPEntry == PWR_STOPENTRY_WFI)
  410. {
  411. /* Request Wait For Interrupt */
  412. __WFI();
  413. }
  414. else
  415. {
  416. /* Request Wait For Event */
  417. __SEV();
  418. __WFE();
  419. __WFE();
  420. }
  421. /* Reset SLEEPDEEP bit of Cortex System Control Register */
  422. CLEAR_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPDEEP_Msk));
  423. }
  424. /**
  425. * @brief Enable Sleep-On-Exit Cortex feature
  426. * @note Set SLEEPONEXIT bit of SCR register. When this bit is set, the
  427. * processor enters SLEEP or DEEPSLEEP mode when an interruption
  428. * handling is over returning to thread mode. Setting this bit is
  429. * useful when the processor is expected to run only on interruptions
  430. * handling.
  431. * @retval None
  432. */
  433. void HAL_PWR_EnableSleepOnExit(void)
  434. {
  435. /* Set SLEEPONEXIT bit of Cortex System Control Register */
  436. SET_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPONEXIT_Msk));
  437. }
  438. /**
  439. * @brief Disable Sleep-On-Exit Cortex feature
  440. * @note Clear SLEEPONEXIT bit of SCR register. When this bit is set, the
  441. * processor enters SLEEP or DEEPSLEEP mode when an interruption
  442. * handling is over.
  443. * @retval None
  444. */
  445. void HAL_PWR_DisableSleepOnExit(void)
  446. {
  447. /* Clear SLEEPONEXIT bit of Cortex System Control Register */
  448. CLEAR_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPONEXIT_Msk));
  449. }
  450. /**
  451. * @brief Enable Cortex Sev On Pending feature.
  452. * @note Set SEVONPEND bit of SCR register. When this bit is set, enabled
  453. * events and all interrupts, including disabled ones can wakeup
  454. * processor from WFE.
  455. * @retval None
  456. */
  457. void HAL_PWR_EnableSEVOnPend(void)
  458. {
  459. /* Set SEVONPEND bit of Cortex System Control Register */
  460. SET_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SEVONPEND_Msk));
  461. }
  462. /**
  463. * @brief Disable Cortex Sev On Pending feature.
  464. * @note Clear SEVONPEND bit of SCR register. When this bit is clear, only
  465. * enable interrupts or events can wakeup processor from WFE
  466. * @retval None
  467. */
  468. void HAL_PWR_DisableSEVOnPend(void)
  469. {
  470. /* Clear SEVONPEND bit of Cortex System Control Register */
  471. CLEAR_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SEVONPEND_Msk));
  472. }
  473. #if defined(PWR_PVD_SUPPORT)
  474. /**
  475. * @brief This function handles the PWR PVD interrupt request.
  476. * @note This API should be called under the PVD_IRQHandler().
  477. * @retval None
  478. */
  479. void HAL_PWR_PVD_IRQHandler(void)
  480. {
  481. /* Check PWR exti Rising flag */
  482. if(__HAL_PWR_PVD_EXTI_GET_FLAG() != 0x0U)
  483. {
  484. /* Clear PVD exti pending bit */
  485. __HAL_PWR_PVD_EXTI_CLEAR_FLAG();
  486. /* PWR PVD interrupt rising user callback */
  487. HAL_PWR_PVD_Callback();
  488. }
  489. }
  490. /**
  491. * @brief PWR PVD interrupt callback
  492. * @retval None
  493. */
  494. __weak void HAL_PWR_PVD_Callback(void)
  495. {
  496. /* NOTE : This function should not be modified; when the callback is needed,
  497. the HAL_PWR_PVD_Callback can be implemented in the user file
  498. */
  499. }
  500. #endif
  501. /**
  502. * @}
  503. */
  504. /**
  505. * @}
  506. */
  507. #endif /* HAL_PWR_MODULE_ENABLED */
  508. /**
  509. * @}
  510. */
  511. /**
  512. * @}
  513. */
  514. /************************ (C) COPYRIGHT Puya *****END OF FILE****/