File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
hal/targets/hal/TARGET_STM/TARGET_STM32L4 Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -48,8 +48,18 @@ void deepsleep(void)
4848 // Stop HAL systick
4949 HAL_SuspendTick ();
5050
51- // Request to enter STOP mode with regulator in low power mode
52- HAL_PWR_EnterSTOPMode (PWR_LOWPOWERREGULATOR_ON , PWR_STOPENTRY_WFI );
51+ // Request to enter STOP mode 1 with regulator in low power mode
52+ if (__HAL_RCC_PWR_IS_CLK_ENABLED ()) {
53+ HAL_PWREx_EnableLowPowerRunMode ();
54+ HAL_PWR_EnterSTOPMode (PWR_LOWPOWERREGULATOR_ON , PWR_STOPENTRY_WFI );
55+ HAL_PWREx_DisableLowPowerRunMode ();
56+ } else {
57+ __HAL_RCC_PWR_CLK_ENABLE ();
58+ HAL_PWREx_EnableLowPowerRunMode ();
59+ HAL_PWR_EnterSTOPMode (PWR_LOWPOWERREGULATOR_ON , PWR_STOPENTRY_WFI );
60+ HAL_PWREx_DisableLowPowerRunMode ();
61+ __HAL_RCC_PWR_CLK_DISABLE ();
62+ }
5363
5464 // After wake-up from STOP reconfigure the PLL
5565 SetSysClock ();
You can’t perform that action at this time.
0 commit comments