void RtcEnterLowPowerStopMode( void ) { if( ( LowPowerDisableDuringTask == false ) && ( RtcTimerEventAllowsLowPower == true ) ) { BoardDeInitMcu( ); // Disable the Power Voltage Detector HAL_PWR_DisablePVD( ); SET_BIT( PWR->CR, PWR_CR_CWUF ); // Enable Ultra low power mode HAL_PWREx_EnableUltraLowPower( ); // Enable the fast wake up from Ultra low power mode HAL_PWREx_EnableFastWakeUp( ); // Enter Stop Mode HAL_PWR_EnterSTOPMode( PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI ); } }
void RtcEnterLowPowerStopMode( void ) { if( ( LowPowerDisableDuringTask == false ) && ( RtcTimerEventAllowsLowPower == true ) ) { // Disable IRQ while the MCU is being deinitialized to prevent race issues __disable_irq( ); BoardDeInitMcu( ); __enable_irq( ); /* Disable the Power Voltage Detector */ PWR_PVDCmd( DISABLE ); /* Set MCU in ULP (Ultra Low Power) */ PWR_UltraLowPowerCmd( ENABLE ); /*Disable fast wakeUp*/ PWR_FastWakeUpCmd( DISABLE ); /* Enter Stop Mode */ PWR_EnterSTOPMode( PWR_Regulator_LowPower, PWR_STOPEntry_WFI ); } }