File tree Expand file tree Collapse file tree 3 files changed +22
-4
lines changed Expand file tree Collapse file tree 3 files changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -317,7 +317,7 @@ void HAL_PCD_SuspendCallback(PCD_HandleTypeDef *hpcd)
317
317
void HAL_PCD_ResumeCallback (PCD_HandleTypeDef * hpcd )
318
318
{
319
319
if (hpcd -> Init .low_power_enable ) {
320
- SystemClock_Config ();
320
+ USBD_SystemClockConfigFromResume ();
321
321
322
322
/* Reset SLEEPDEEP bit of Cortex System Control Register */
323
323
SCB -> SCR &= (uint32_t )~((uint32_t )(SCB_SCR_SLEEPDEEP_Msk | SCB_SCR_SLEEPONEXIT_Msk ));
@@ -415,9 +415,8 @@ void USB_H_IRQHandler(void)
415
415
/* Reset SLEEPDEEP bit of Cortex System Control Register */
416
416
SCB -> SCR &= (uint32_t )~((uint32_t )(SCB_SCR_SLEEPDEEP_Msk | SCB_SCR_SLEEPONEXIT_Msk ));
417
417
418
- /* Configures system clock after wake-up from STOP: enable HSE, PLL and select
419
- PLL as system clock source (HSE and PLL are disabled in STOP mode) */
420
- SystemClock_Config ();
418
+ /* Configures system clock after wake-up */
419
+ USBD_SystemClockConfigFromResume ();
421
420
422
421
/* ungate PHY clock */
423
422
__HAL_PCD_UNGATE_PHYCLOCK ((& g_hpcd ));
Original file line number Diff line number Diff line change @@ -175,4 +175,19 @@ void USBD_CDC_init(void)
175
175
CDC_init ();
176
176
}
177
177
#endif /* USBD_USE_CDC */
178
+
179
+ /**
180
+ * @brief Configures system clock and system IP clocks after wake-up from USB
181
+ * resume callBack
182
+ * @note Weaked function which can be redefined by user at the sketch level.
183
+ * By default, calls 'SystemClock_Config()'.
184
+ * @param None
185
+ * @retval None
186
+ */
187
+ WEAK void USBD_SystemClockConfigFromResume (void )
188
+ {
189
+ configIPClock ();
190
+ SystemClock_Config ();
191
+ }
192
+
178
193
#endif /* USBCON */
Original file line number Diff line number Diff line change @@ -27,6 +27,10 @@ void USBD_reenumerate(void);
27
27
#ifdef USBD_USE_CDC
28
28
void USBD_CDC_init (void );
29
29
#endif
30
+
31
+ /* Weaked function */
32
+ void USBD_SystemClockConfigFromResume (void );
33
+
30
34
#ifdef __cplusplus
31
35
}
32
36
#endif
You can’t perform that action at this time.
0 commit comments