STM32L4 - Update deepsleep implementation

pull/2771/head
svastm 2016-09-21 17:16:23 +02:00
parent e4a40cd6a7
commit 6d73dd338b
1 changed files with 12 additions and 2 deletions

View File

@ -47,8 +47,18 @@ void deepsleep(void)
// Stop HAL systick
HAL_SuspendTick();
// Request to enter STOP mode with regulator in low power mode
// Request to enter STOP mode 1 with regulator in low power mode
if (__HAL_RCC_PWR_IS_CLK_ENABLED()) {
HAL_PWREx_EnableLowPowerRunMode();
HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
HAL_PWREx_DisableLowPowerRunMode();
} else {
__HAL_RCC_PWR_CLK_ENABLE();
HAL_PWREx_EnableLowPowerRunMode();
HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
HAL_PWREx_DisableLowPowerRunMode();
__HAL_RCC_PWR_CLK_DISABLE();
}
// After wake-up from STOP reconfigure the PLL
SetSysClock();