File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,11 @@ mod sizes {
22
22
pub const INTERRUPT_ENDPOINT : u16 = 31 ;
23
23
}
24
24
25
- static mut CONTROL_BUFFER : UnsafeCell < [ u8 ; 256 ] > = UnsafeCell :: new ( [ 0 ; 256 ] ) ;
25
+ pub struct ControlBuffer ( UnsafeCell < [ u8 ; 256 ] > ) ;
26
+
27
+ unsafe impl Sync for ControlBuffer { }
28
+
29
+ static CONTROL_BUFFER : ControlBuffer = ControlBuffer ( UnsafeCell :: new ( [ 0 ; 256 ] ) ) ;
26
30
27
31
/// Test USB class for testing USB driver implementations. Supports various endpoint types and
28
32
/// requests for testing USB peripheral drivers on actual hardware.
@@ -115,7 +119,7 @@ impl<B: UsbBus> TestClass<'_, B> {
115
119
usb_bus : & ' a UsbBusAllocator < B > ,
116
120
) -> UsbDeviceBuilder < ' a , B > {
117
121
UsbDeviceBuilder :: new ( usb_bus, UsbVidPid ( VID , PID ) , unsafe {
118
- CONTROL_BUFFER . get_mut ( )
122
+ & mut * ( CONTROL_BUFFER . 0 . get ( ) )
119
123
} )
120
124
. strings ( & [ StringDescriptors :: default ( )
121
125
. manufacturer ( MANUFACTURER )
You can’t perform that action at this time.
0 commit comments