File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -42,8 +42,6 @@ impl Buffers {
4242 }
4343}
4444
45- unsafe impl Sync for Buffers { }
46-
4745#[ derive( Copy , Clone ) ]
4846enum TransferState {
4947 NoTransfer ,
@@ -733,10 +731,15 @@ impl<T: UsbPeripheral> UsbBus for Usbd<'_, T> {
733731
734732 fn force_reset ( & self ) -> usb_device:: Result < ( ) > {
735733 interrupt:: free ( |cs| {
736- let regs = self . regs ( cs) ;
737- regs. usbpullup . write ( |w| w. connect ( ) . disabled ( ) ) ;
738- // TODO delay needed?
739- regs. usbpullup . write ( |w| w. connect ( ) . enabled ( ) ) ;
734+ self . regs ( cs) . usbpullup . write ( |w| w. connect ( ) . disabled ( ) ) ;
735+ } ) ;
736+
737+ // Delay for 1ms, to give the host a chance to detect this.
738+ // We run at 64 MHz, so 64k cycles are 1ms.
739+ cortex_m:: asm:: delay ( 64_000 ) ;
740+
741+ interrupt:: free ( |cs| {
742+ self . regs ( cs) . usbpullup . write ( |w| w. connect ( ) . enabled ( ) ) ;
740743 } ) ;
741744
742745 Ok ( ( ) )
You can’t perform that action at this time.
0 commit comments