Skip to content

Commit 648e218

Browse files
fpistmxC0000005
authored andcommitted
[LP] Define weaked SystemClock_ConfigFromStop
Weaked function which can be redefined by user at the sketch level. By default, call 'SystemClock_Config()'. Example at sketch level: extern "C" void SystemClock_ConfigFromStop(void) { /* user code */ } Signed-off-by: Frederic Pillon <[email protected]>
1 parent 4b1a8fe commit 648e218

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

cores/arduino/stm32/low_power.c

+12-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ void LowPower_stop(serial_t *obj){
223223
HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
224224

225225
/* Exit Stop mode reset clocks */
226-
SystemClock_Config();
226+
SystemClock_ConfigFromStop();
227227
#if defined(UART_IT_WUF) && defined(HAL_UART_MODULE_ENABLED)
228228
if (WakeUpUart != NULL) {
229229
/* In case of WakeUp from UART, reset its clock source to HSI */
@@ -319,6 +319,17 @@ void LowPower_EnableWakeUpUart(serial_t* serial, void (*FuncPtr)( void ) ) {
319319
WakeUpUartCb = FuncPtr;
320320
}
321321

322+
/**
323+
* @brief Configures system clock after wake-up from STOP
324+
* @note Weaked function which can be redefined by user at the sketch level.
325+
* By default, call 'SystemClock_Config()'.
326+
* @param None
327+
* @retval None
328+
*/
329+
WEAK void SystemClock_ConfigFromStop(void) {
330+
SystemClock_Config();
331+
}
332+
322333
#ifdef __cplusplus
323334
}
324335
#endif

cores/arduino/stm32/low_power.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ void LowPower_sleep(uint32_t regulator);
6161
void LowPower_stop(serial_t *obj);
6262
void LowPower_standby();
6363
void LowPower_shutdown();
64-
64+
/* Weaked function */
65+
void SystemClock_ConfigFromStop(void);
6566
#ifdef __cplusplus
6667
}
6768
#endif

0 commit comments

Comments
 (0)