STM32F103xB HAL User Manual
|
00001 /** 00002 ****************************************************************************** 00003 * @file stm32f1xx_hal_pwr.c 00004 * @author MCD Application Team 00005 * @brief PWR HAL module driver. 00006 * 00007 * This file provides firmware functions to manage the following 00008 * functionalities of the Power Controller (PWR) peripheral: 00009 * + Initialization/de-initialization functions 00010 * + Peripheral Control functions 00011 * 00012 ****************************************************************************** 00013 * @attention 00014 * 00015 * <h2><center>© Copyright (c) 2016 STMicroelectronics. 00016 * All rights reserved.</center></h2> 00017 * 00018 * This software component is licensed by ST under BSD 3-Clause license, 00019 * the "License"; You may not use this file except in compliance with the 00020 * License. You may obtain a copy of the License at: 00021 * opensource.org/licenses/BSD-3-Clause 00022 * 00023 ****************************************************************************** 00024 */ 00025 00026 /* Includes ------------------------------------------------------------------*/ 00027 #include "stm32f1xx_hal.h" 00028 00029 /** @addtogroup STM32F1xx_HAL_Driver 00030 * @{ 00031 */ 00032 00033 /** @defgroup PWR PWR 00034 * @brief PWR HAL module driver 00035 * @{ 00036 */ 00037 00038 #ifdef HAL_PWR_MODULE_ENABLED 00039 00040 /* Private typedef -----------------------------------------------------------*/ 00041 /* Private define ------------------------------------------------------------*/ 00042 00043 /** @defgroup PWR_Private_Constants PWR Private Constants 00044 * @{ 00045 */ 00046 00047 /** @defgroup PWR_PVD_Mode_Mask PWR PVD Mode Mask 00048 * @{ 00049 */ 00050 #define PVD_MODE_IT 0x00010000U 00051 #define PVD_MODE_EVT 0x00020000U 00052 #define PVD_RISING_EDGE 0x00000001U 00053 #define PVD_FALLING_EDGE 0x00000002U 00054 /** 00055 * @} 00056 */ 00057 00058 00059 /** @defgroup PWR_register_alias_address PWR Register alias address 00060 * @{ 00061 */ 00062 /* ------------- PWR registers bit address in the alias region ---------------*/ 00063 #define PWR_OFFSET (PWR_BASE - PERIPH_BASE) 00064 #define PWR_CR_OFFSET 0x00U 00065 #define PWR_CSR_OFFSET 0x04U 00066 #define PWR_CR_OFFSET_BB (PWR_OFFSET + PWR_CR_OFFSET) 00067 #define PWR_CSR_OFFSET_BB (PWR_OFFSET + PWR_CSR_OFFSET) 00068 /** 00069 * @} 00070 */ 00071 00072 /** @defgroup PWR_CR_register_alias PWR CR Register alias address 00073 * @{ 00074 */ 00075 /* --- CR Register ---*/ 00076 /* Alias word address of LPSDSR bit */ 00077 #define LPSDSR_BIT_NUMBER PWR_CR_LPDS_Pos 00078 #define CR_LPSDSR_BB ((uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32U) + (LPSDSR_BIT_NUMBER * 4U))) 00079 00080 /* Alias word address of DBP bit */ 00081 #define DBP_BIT_NUMBER PWR_CR_DBP_Pos 00082 #define CR_DBP_BB ((uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32U) + (DBP_BIT_NUMBER * 4U))) 00083 00084 /* Alias word address of PVDE bit */ 00085 #define PVDE_BIT_NUMBER PWR_CR_PVDE_Pos 00086 #define CR_PVDE_BB ((uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32U) + (PVDE_BIT_NUMBER * 4U))) 00087 00088 /** 00089 * @} 00090 */ 00091 00092 /** @defgroup PWR_CSR_register_alias PWR CSR Register alias address 00093 * @{ 00094 */ 00095 00096 /* --- CSR Register ---*/ 00097 /* Alias word address of EWUP1 bit */ 00098 #define CSR_EWUP_BB(VAL) ((uint32_t)(PERIPH_BB_BASE + (PWR_CSR_OFFSET_BB * 32U) + (POSITION_VAL(VAL) * 4U))) 00099 /** 00100 * @} 00101 */ 00102 00103 /** 00104 * @} 00105 */ 00106 00107 /* Private variables ---------------------------------------------------------*/ 00108 /* Private function prototypes -----------------------------------------------*/ 00109 /** @defgroup PWR_Private_Functions PWR Private Functions 00110 * brief WFE cortex command overloaded for HAL_PWR_EnterSTOPMode usage only (see Workaround section) 00111 * @{ 00112 */ 00113 static void PWR_OverloadWfe(void); 00114 00115 /* Private functions ---------------------------------------------------------*/ 00116 __NOINLINE 00117 static void PWR_OverloadWfe(void) 00118 { 00119 __asm volatile( "wfe" ); 00120 __asm volatile( "nop" ); 00121 } 00122 00123 /** 00124 * @} 00125 */ 00126 00127 00128 /** @defgroup PWR_Exported_Functions PWR Exported Functions 00129 * @{ 00130 */ 00131 00132 /** @defgroup PWR_Exported_Functions_Group1 Initialization and de-initialization functions 00133 * @brief Initialization and de-initialization functions 00134 * 00135 @verbatim 00136 =============================================================================== 00137 ##### Initialization and de-initialization functions ##### 00138 =============================================================================== 00139 [..] 00140 After reset, the backup domain (RTC registers, RTC backup data 00141 registers) is protected against possible unwanted 00142 write accesses. 00143 To enable access to the RTC Domain and RTC registers, proceed as follows: 00144 (+) Enable the Power Controller (PWR) APB1 interface clock using the 00145 __HAL_RCC_PWR_CLK_ENABLE() macro. 00146 (+) Enable access to RTC domain using the HAL_PWR_EnableBkUpAccess() function. 00147 00148 @endverbatim 00149 * @{ 00150 */ 00151 00152 /** 00153 * @brief Deinitializes the PWR peripheral registers to their default reset values. 00154 * @retval None 00155 */ 00156 void HAL_PWR_DeInit(void) 00157 { 00158 __HAL_RCC_PWR_FORCE_RESET(); 00159 __HAL_RCC_PWR_RELEASE_RESET(); 00160 } 00161 00162 /** 00163 * @brief Enables access to the backup domain (RTC registers, RTC 00164 * backup data registers ). 00165 * @note If the HSE divided by 128 is used as the RTC clock, the 00166 * Backup Domain Access should be kept enabled. 00167 * @retval None 00168 */ 00169 void HAL_PWR_EnableBkUpAccess(void) 00170 { 00171 /* Enable access to RTC and backup registers */ 00172 *(__IO uint32_t *) CR_DBP_BB = (uint32_t)ENABLE; 00173 } 00174 00175 /** 00176 * @brief Disables access to the backup domain (RTC registers, RTC 00177 * backup data registers). 00178 * @note If the HSE divided by 128 is used as the RTC clock, the 00179 * Backup Domain Access should be kept enabled. 00180 * @retval None 00181 */ 00182 void HAL_PWR_DisableBkUpAccess(void) 00183 { 00184 /* Disable access to RTC and backup registers */ 00185 *(__IO uint32_t *) CR_DBP_BB = (uint32_t)DISABLE; 00186 } 00187 00188 /** 00189 * @} 00190 */ 00191 00192 /** @defgroup PWR_Exported_Functions_Group2 Peripheral Control functions 00193 * @brief Low Power modes configuration functions 00194 * 00195 @verbatim 00196 =============================================================================== 00197 ##### Peripheral Control functions ##### 00198 =============================================================================== 00199 00200 *** PVD configuration *** 00201 ========================= 00202 [..] 00203 (+) The PVD is used to monitor the VDD power supply by comparing it to a 00204 threshold selected by the PVD Level (PLS[2:0] bits in the PWR_CR). 00205 00206 (+) A PVDO flag is available to indicate if VDD/VDDA is higher or lower 00207 than the PVD threshold. This event is internally connected to the EXTI 00208 line16 and can generate an interrupt if enabled. This is done through 00209 __HAL_PVD_EXTI_ENABLE_IT() macro. 00210 (+) The PVD is stopped in Standby mode. 00211 00212 *** WakeUp pin configuration *** 00213 ================================ 00214 [..] 00215 (+) WakeUp pin is used to wake up the system from Standby mode. This pin is 00216 forced in input pull-down configuration and is active on rising edges. 00217 (+) There is one WakeUp pin: 00218 WakeUp Pin 1 on PA.00. 00219 00220 [..] 00221 00222 *** Low Power modes configuration *** 00223 ===================================== 00224 [..] 00225 The device features 3 low-power modes: 00226 (+) Sleep mode: CPU clock off, all peripherals including Cortex-M3 core peripherals like 00227 NVIC, SysTick, etc. are kept running 00228 (+) Stop mode: All clocks are stopped 00229 (+) Standby mode: 1.8V domain powered off 00230 00231 00232 *** Sleep mode *** 00233 ================== 00234 [..] 00235 (+) Entry: 00236 The Sleep mode is entered by using the HAL_PWR_EnterSLEEPMode(PWR_MAINREGULATOR_ON, PWR_SLEEPENTRY_WFx) 00237 functions with 00238 (++) PWR_SLEEPENTRY_WFI: enter SLEEP mode with WFI instruction 00239 (++) PWR_SLEEPENTRY_WFE: enter SLEEP mode with WFE instruction 00240 00241 (+) Exit: 00242 (++) WFI entry mode, Any peripheral interrupt acknowledged by the nested vectored interrupt 00243 controller (NVIC) can wake up the device from Sleep mode. 00244 (++) WFE entry mode, Any wakeup event can wake up the device from Sleep mode. 00245 (+++) Any peripheral interrupt w/o NVIC configuration & SEVONPEND bit set in the Cortex (HAL_PWR_EnableSEVOnPend) 00246 (+++) Any EXTI Line (Internal or External) configured in Event mode 00247 00248 *** Stop mode *** 00249 ================= 00250 [..] 00251 The Stop mode is based on the Cortex-M3 deepsleep mode combined with peripheral 00252 clock gating. The voltage regulator can be configured either in normal or low-power mode. 00253 In Stop mode, all clocks in the 1.8 V domain are stopped, the PLL, the HSI and the HSE RC 00254 oscillators are disabled. SRAM and register contents are preserved. 00255 In Stop mode, all I/O pins keep the same state as in Run mode. 00256 00257 (+) Entry: 00258 The Stop mode is entered using the HAL_PWR_EnterSTOPMode(PWR_REGULATOR_VALUE, PWR_SLEEPENTRY_WFx ) 00259 function with: 00260 (++) PWR_REGULATOR_VALUE= PWR_MAINREGULATOR_ON: Main regulator ON. 00261 (++) PWR_REGULATOR_VALUE= PWR_LOWPOWERREGULATOR_ON: Low Power regulator ON. 00262 (++) PWR_SLEEPENTRY_WFx= PWR_SLEEPENTRY_WFI: enter STOP mode with WFI instruction 00263 (++) PWR_SLEEPENTRY_WFx= PWR_SLEEPENTRY_WFE: enter STOP mode with WFE instruction 00264 (+) Exit: 00265 (++) WFI entry mode, Any EXTI Line (Internal or External) configured in Interrupt mode with NVIC configured 00266 (++) WFE entry mode, Any EXTI Line (Internal or External) configured in Event mode. 00267 00268 *** Standby mode *** 00269 ==================== 00270 [..] 00271 The Standby mode allows to achieve the lowest power consumption. It is based on the 00272 Cortex-M3 deepsleep mode, with the voltage regulator disabled. The 1.8 V domain is 00273 consequently powered off. The PLL, the HSI oscillator and the HSE oscillator are also 00274 switched off. SRAM and register contents are lost except for registers in the Backup domain 00275 and Standby circuitry 00276 00277 (+) Entry: 00278 (++) The Standby mode is entered using the HAL_PWR_EnterSTANDBYMode() function. 00279 (+) Exit: 00280 (++) WKUP pin rising edge, RTC alarm event rising edge, external Reset in 00281 NRSTpin, IWDG Reset 00282 00283 *** Auto-wakeup (AWU) from low-power mode *** 00284 ============================================= 00285 [..] 00286 00287 (+) The MCU can be woken up from low-power mode by an RTC Alarm event, 00288 without depending on an external interrupt (Auto-wakeup mode). 00289 00290 (+) RTC auto-wakeup (AWU) from the Stop and Standby modes 00291 00292 (++) To wake up from the Stop mode with an RTC alarm event, it is necessary to 00293 configure the RTC to generate the RTC alarm using the HAL_RTC_SetAlarm_IT() function. 00294 00295 *** PWR Workarounds linked to Silicon Limitation *** 00296 ==================================================== 00297 [..] 00298 Below the list of all silicon limitations known on STM32F1xx prouct. 00299 00300 (#)Workarounds Implemented inside PWR HAL Driver 00301 (##)Debugging Stop mode with WFE entry - overloaded the WFE by an internal function 00302 00303 @endverbatim 00304 * @{ 00305 */ 00306 00307 /** 00308 * @brief Configures the voltage threshold detected by the Power Voltage Detector(PVD). 00309 * @param sConfigPVD: pointer to an PWR_PVDTypeDef structure that contains the configuration 00310 * information for the PVD. 00311 * @note Refer to the electrical characteristics of your device datasheet for 00312 * more details about the voltage threshold corresponding to each 00313 * detection level. 00314 * @retval None 00315 */ 00316 void HAL_PWR_ConfigPVD(PWR_PVDTypeDef *sConfigPVD) 00317 { 00318 /* Check the parameters */ 00319 assert_param(IS_PWR_PVD_LEVEL(sConfigPVD->PVDLevel)); 00320 assert_param(IS_PWR_PVD_MODE(sConfigPVD->Mode)); 00321 00322 /* Set PLS[7:5] bits according to PVDLevel value */ 00323 MODIFY_REG(PWR->CR, PWR_CR_PLS, sConfigPVD->PVDLevel); 00324 00325 /* Clear any previous config. Keep it clear if no event or IT mode is selected */ 00326 __HAL_PWR_PVD_EXTI_DISABLE_EVENT(); 00327 __HAL_PWR_PVD_EXTI_DISABLE_IT(); 00328 __HAL_PWR_PVD_EXTI_DISABLE_FALLING_EDGE(); 00329 __HAL_PWR_PVD_EXTI_DISABLE_RISING_EDGE(); 00330 00331 /* Configure interrupt mode */ 00332 if((sConfigPVD->Mode & PVD_MODE_IT) == PVD_MODE_IT) 00333 { 00334 __HAL_PWR_PVD_EXTI_ENABLE_IT(); 00335 } 00336 00337 /* Configure event mode */ 00338 if((sConfigPVD->Mode & PVD_MODE_EVT) == PVD_MODE_EVT) 00339 { 00340 __HAL_PWR_PVD_EXTI_ENABLE_EVENT(); 00341 } 00342 00343 /* Configure the edge */ 00344 if((sConfigPVD->Mode & PVD_RISING_EDGE) == PVD_RISING_EDGE) 00345 { 00346 __HAL_PWR_PVD_EXTI_ENABLE_RISING_EDGE(); 00347 } 00348 00349 if((sConfigPVD->Mode & PVD_FALLING_EDGE) == PVD_FALLING_EDGE) 00350 { 00351 __HAL_PWR_PVD_EXTI_ENABLE_FALLING_EDGE(); 00352 } 00353 } 00354 00355 /** 00356 * @brief Enables the Power Voltage Detector(PVD). 00357 * @retval None 00358 */ 00359 void HAL_PWR_EnablePVD(void) 00360 { 00361 /* Enable the power voltage detector */ 00362 *(__IO uint32_t *) CR_PVDE_BB = (uint32_t)ENABLE; 00363 } 00364 00365 /** 00366 * @brief Disables the Power Voltage Detector(PVD). 00367 * @retval None 00368 */ 00369 void HAL_PWR_DisablePVD(void) 00370 { 00371 /* Disable the power voltage detector */ 00372 *(__IO uint32_t *) CR_PVDE_BB = (uint32_t)DISABLE; 00373 } 00374 00375 /** 00376 * @brief Enables the WakeUp PINx functionality. 00377 * @param WakeUpPinx: Specifies the Power Wake-Up pin to enable. 00378 * This parameter can be one of the following values: 00379 * @arg PWR_WAKEUP_PIN1 00380 * @retval None 00381 */ 00382 void HAL_PWR_EnableWakeUpPin(uint32_t WakeUpPinx) 00383 { 00384 /* Check the parameter */ 00385 assert_param(IS_PWR_WAKEUP_PIN(WakeUpPinx)); 00386 /* Enable the EWUPx pin */ 00387 *(__IO uint32_t *) CSR_EWUP_BB(WakeUpPinx) = (uint32_t)ENABLE; 00388 } 00389 00390 /** 00391 * @brief Disables the WakeUp PINx functionality. 00392 * @param WakeUpPinx: Specifies the Power Wake-Up pin to disable. 00393 * This parameter can be one of the following values: 00394 * @arg PWR_WAKEUP_PIN1 00395 * @retval None 00396 */ 00397 void HAL_PWR_DisableWakeUpPin(uint32_t WakeUpPinx) 00398 { 00399 /* Check the parameter */ 00400 assert_param(IS_PWR_WAKEUP_PIN(WakeUpPinx)); 00401 /* Disable the EWUPx pin */ 00402 *(__IO uint32_t *) CSR_EWUP_BB(WakeUpPinx) = (uint32_t)DISABLE; 00403 } 00404 00405 /** 00406 * @brief Enters Sleep mode. 00407 * @note In Sleep mode, all I/O pins keep the same state as in Run mode. 00408 * @param Regulator: Regulator state as no effect in SLEEP mode - allows to support portability from legacy software 00409 * @param SLEEPEntry: Specifies if SLEEP mode is entered with WFI or WFE instruction. 00410 * When WFI entry is used, tick interrupt have to be disabled if not desired as 00411 * the interrupt wake up source. 00412 * This parameter can be one of the following values: 00413 * @arg PWR_SLEEPENTRY_WFI: enter SLEEP mode with WFI instruction 00414 * @arg PWR_SLEEPENTRY_WFE: enter SLEEP mode with WFE instruction 00415 * @retval None 00416 */ 00417 void HAL_PWR_EnterSLEEPMode(uint32_t Regulator, uint8_t SLEEPEntry) 00418 { 00419 /* Check the parameters */ 00420 /* No check on Regulator because parameter not used in SLEEP mode */ 00421 /* Prevent unused argument(s) compilation warning */ 00422 UNUSED(Regulator); 00423 00424 assert_param(IS_PWR_SLEEP_ENTRY(SLEEPEntry)); 00425 00426 /* Clear SLEEPDEEP bit of Cortex System Control Register */ 00427 CLEAR_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPDEEP_Msk)); 00428 00429 /* Select SLEEP mode entry -------------------------------------------------*/ 00430 if(SLEEPEntry == PWR_SLEEPENTRY_WFI) 00431 { 00432 /* Request Wait For Interrupt */ 00433 __WFI(); 00434 } 00435 else 00436 { 00437 /* Request Wait For Event */ 00438 __SEV(); 00439 __WFE(); 00440 __WFE(); 00441 } 00442 } 00443 00444 /** 00445 * @brief Enters Stop mode. 00446 * @note In Stop mode, all I/O pins keep the same state as in Run mode. 00447 * @note When exiting Stop mode by using an interrupt or a wakeup event, 00448 * HSI RC oscillator is selected as system clock. 00449 * @note When the voltage regulator operates in low power mode, an additional 00450 * startup delay is incurred when waking up from Stop mode. 00451 * By keeping the internal regulator ON during Stop mode, the consumption 00452 * is higher although the startup time is reduced. 00453 * @param Regulator: Specifies the regulator state in Stop mode. 00454 * This parameter can be one of the following values: 00455 * @arg PWR_MAINREGULATOR_ON: Stop mode with regulator ON 00456 * @arg PWR_LOWPOWERREGULATOR_ON: Stop mode with low power regulator ON 00457 * @param STOPEntry: Specifies if Stop mode in entered with WFI or WFE instruction. 00458 * This parameter can be one of the following values: 00459 * @arg PWR_STOPENTRY_WFI: Enter Stop mode with WFI instruction 00460 * @arg PWR_STOPENTRY_WFE: Enter Stop mode with WFE instruction 00461 * @retval None 00462 */ 00463 void HAL_PWR_EnterSTOPMode(uint32_t Regulator, uint8_t STOPEntry) 00464 { 00465 /* Check the parameters */ 00466 assert_param(IS_PWR_REGULATOR(Regulator)); 00467 assert_param(IS_PWR_STOP_ENTRY(STOPEntry)); 00468 00469 /* Clear PDDS bit in PWR register to specify entering in STOP mode when CPU enter in Deepsleep */ 00470 CLEAR_BIT(PWR->CR, PWR_CR_PDDS); 00471 00472 /* Select the voltage regulator mode by setting LPDS bit in PWR register according to Regulator parameter value */ 00473 MODIFY_REG(PWR->CR, PWR_CR_LPDS, Regulator); 00474 00475 /* Set SLEEPDEEP bit of Cortex System Control Register */ 00476 SET_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPDEEP_Msk)); 00477 00478 /* Select Stop mode entry --------------------------------------------------*/ 00479 if(STOPEntry == PWR_STOPENTRY_WFI) 00480 { 00481 /* Request Wait For Interrupt */ 00482 __WFI(); 00483 } 00484 else 00485 { 00486 /* Request Wait For Event */ 00487 __SEV(); 00488 PWR_OverloadWfe(); /* WFE redefine locally */ 00489 PWR_OverloadWfe(); /* WFE redefine locally */ 00490 } 00491 /* Reset SLEEPDEEP bit of Cortex System Control Register */ 00492 CLEAR_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPDEEP_Msk)); 00493 } 00494 00495 /** 00496 * @brief Enters Standby mode. 00497 * @note In Standby mode, all I/O pins are high impedance except for: 00498 * - Reset pad (still available) 00499 * - TAMPER pin if configured for tamper or calibration out. 00500 * - WKUP pin (PA0) if enabled. 00501 * @retval None 00502 */ 00503 void HAL_PWR_EnterSTANDBYMode(void) 00504 { 00505 /* Select Standby mode */ 00506 SET_BIT(PWR->CR, PWR_CR_PDDS); 00507 00508 /* Set SLEEPDEEP bit of Cortex System Control Register */ 00509 SET_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPDEEP_Msk)); 00510 00511 /* This option is used to ensure that store operations are completed */ 00512 #if defined ( __CC_ARM) 00513 __force_stores(); 00514 #endif 00515 /* Request Wait For Interrupt */ 00516 __WFI(); 00517 } 00518 00519 00520 /** 00521 * @brief Indicates Sleep-On-Exit when returning from Handler mode to Thread mode. 00522 * @note Set SLEEPONEXIT bit of SCR register. When this bit is set, the processor 00523 * re-enters SLEEP mode when an interruption handling is over. 00524 * Setting this bit is useful when the processor is expected to run only on 00525 * interruptions handling. 00526 * @retval None 00527 */ 00528 void HAL_PWR_EnableSleepOnExit(void) 00529 { 00530 /* Set SLEEPONEXIT bit of Cortex System Control Register */ 00531 SET_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPONEXIT_Msk)); 00532 } 00533 00534 00535 /** 00536 * @brief Disables Sleep-On-Exit feature when returning from Handler mode to Thread mode. 00537 * @note Clears SLEEPONEXIT bit of SCR register. When this bit is set, the processor 00538 * re-enters SLEEP mode when an interruption handling is over. 00539 * @retval None 00540 */ 00541 void HAL_PWR_DisableSleepOnExit(void) 00542 { 00543 /* Clear SLEEPONEXIT bit of Cortex System Control Register */ 00544 CLEAR_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPONEXIT_Msk)); 00545 } 00546 00547 00548 /** 00549 * @brief Enables CORTEX M3 SEVONPEND bit. 00550 * @note Sets SEVONPEND bit of SCR register. When this bit is set, this causes 00551 * WFE to wake up when an interrupt moves from inactive to pended. 00552 * @retval None 00553 */ 00554 void HAL_PWR_EnableSEVOnPend(void) 00555 { 00556 /* Set SEVONPEND bit of Cortex System Control Register */ 00557 SET_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SEVONPEND_Msk)); 00558 } 00559 00560 00561 /** 00562 * @brief Disables CORTEX M3 SEVONPEND bit. 00563 * @note Clears SEVONPEND bit of SCR register. When this bit is set, this causes 00564 * WFE to wake up when an interrupt moves from inactive to pended. 00565 * @retval None 00566 */ 00567 void HAL_PWR_DisableSEVOnPend(void) 00568 { 00569 /* Clear SEVONPEND bit of Cortex System Control Register */ 00570 CLEAR_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SEVONPEND_Msk)); 00571 } 00572 00573 00574 00575 /** 00576 * @brief This function handles the PWR PVD interrupt request. 00577 * @note This API should be called under the PVD_IRQHandler(). 00578 * @retval None 00579 */ 00580 void HAL_PWR_PVD_IRQHandler(void) 00581 { 00582 /* Check PWR exti flag */ 00583 if(__HAL_PWR_PVD_EXTI_GET_FLAG() != RESET) 00584 { 00585 /* PWR PVD interrupt user callback */ 00586 HAL_PWR_PVDCallback(); 00587 00588 /* Clear PWR Exti pending bit */ 00589 __HAL_PWR_PVD_EXTI_CLEAR_FLAG(); 00590 } 00591 } 00592 00593 /** 00594 * @brief PWR PVD interrupt callback 00595 * @retval None 00596 */ 00597 __weak void HAL_PWR_PVDCallback(void) 00598 { 00599 /* NOTE : This function Should not be modified, when the callback is needed, 00600 the HAL_PWR_PVDCallback could be implemented in the user file 00601 */ 00602 } 00603 00604 /** 00605 * @} 00606 */ 00607 00608 /** 00609 * @} 00610 */ 00611 00612 #endif /* HAL_PWR_MODULE_ENABLED */ 00613 /** 00614 * @} 00615 */ 00616 00617 /** 00618 * @} 00619 */ 00620 00621 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/