File tree 1 file changed +14
-2
lines changed
libraries/SrcWrapper/src/stm32
1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -223,12 +223,24 @@ void LowPower_stop(serial_t *obj)
223
223
HAL_PWREx_EnableFastWakeUp ();
224
224
#endif
225
225
#ifdef __HAL_RCC_WAKEUPSTOP_CLK_CONFIG
226
- /* Select HSI as system clock source after Wake Up from Stop mode */
226
+ /* Select MSI or HSI as system clock source after Wake Up from Stop mode */
227
+ #ifdef RCC_STOP_WAKEUPCLOCK_MSI
228
+ __HAL_RCC_WAKEUPSTOP_CLK_CONFIG (RCC_STOP_WAKEUPCLOCK_MSI );
229
+ #else
227
230
__HAL_RCC_WAKEUPSTOP_CLK_CONFIG (RCC_STOP_WAKEUPCLOCK_HSI );
231
+ #endif
228
232
#endif
229
233
230
234
/* Enter Stop mode */
231
- HAL_PWR_EnterSTOPMode (PWR_LOWPOWERREGULATOR_ON , PWR_STOPENTRY_WFI );
235
+ #if defined(STM32L4xx )
236
+ if ((WakeUpUart == NULL ) || (WakeUpUart -> Instance == (USART_TypeDef * )LPUART1_BASE )) {
237
+ // STM32L4xx supports STOP2 mode which halves consumption
238
+ HAL_PWREx_EnterSTOP2Mode (PWR_STOPENTRY_WFI );
239
+ } else
240
+ #endif
241
+ {
242
+ HAL_PWR_EnterSTOPMode (PWR_LOWPOWERREGULATOR_ON , PWR_STOPENTRY_WFI );
243
+ }
232
244
233
245
/* Exit Stop mode reset clocks */
234
246
SystemClock_ConfigFromStop ();
You can’t perform that action at this time.
0 commit comments