@@ -25,7 +25,7 @@ osThreadDef(CLRStartupThread, osPriorityNormal, 4096, "CLRStartupThread");
2525// Application entry point.
2626int main (void )
2727{
28- // find out wakeup reason
28+ // find out wakeup reason
2929 if ((PWR -> CSR1 & PWR_CSR1_WUIF ) == PWR_CSR1_WUIF )
3030 {
3131 // standby, match WakeupReason_FromStandby enum
@@ -74,17 +74,6 @@ int main(void)
7474 crcStart (NULL );
7575#endif
7676
77- // Initializes a serial-over-USB CDC driver.
78- sduObjectInit (& SDU1 );
79- sduStart (& SDU1 , & serusbcfg );
80-
81- // Activates the USB driver and then the USB bus pull-up on D+.
82- // Note, a delay is inserted in order to not have to disconnect the cable after a reset
83- usbDisconnectBus (serusbcfg .usbp );
84- chThdSleepMilliseconds (100 );
85- usbStart (serusbcfg .usbp , & usbcfg );
86- usbConnectBus (serusbcfg .usbp );
87-
8877 // create the receiver thread
8978 osThreadCreate (osThread (ReceiverThread ), NULL );
9079
@@ -108,3 +97,17 @@ int main(void)
10897 osDelay (100 );
10998 }
11099}
100+
101+ void WP_Message_PrepareReception_Target ()
102+ {
103+ // Initializes a serial-over-USB CDC driver.
104+ sduObjectInit (& SDU1 );
105+ sduStart (& SDU1 , & serusbcfg );
106+
107+ // Activates the USB driver and then the USB bus pull-up on D+.
108+ // Note, a delay is inserted in order to not have to disconnect the cable after a reset
109+ usbDisconnectBus (serusbcfg .usbp );
110+ chThdSleepMilliseconds (100 );
111+ usbStart (serusbcfg .usbp , & usbcfg );
112+ usbConnectBus (serusbcfg .usbp );
113+ }
0 commit comments