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 {
42
42
}
43
43
}
44
44
45
- unsafe impl Sync for Buffers { }
46
-
47
45
#[ derive( Copy , Clone ) ]
48
46
enum TransferState {
49
47
NoTransfer ,
@@ -733,10 +731,15 @@ impl<T: UsbPeripheral> UsbBus for Usbd<'_, T> {
733
731
734
732
fn force_reset ( & self ) -> usb_device:: Result < ( ) > {
735
733
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 ( ) ) ;
740
743
} ) ;
741
744
742
745
Ok ( ( ) )
You can’t perform that action at this time.
0 commit comments