@@ -11,7 +11,7 @@ use core::mem::MaybeUninit;
11
11
use core:: sync:: atomic:: { compiler_fence, Ordering } ;
12
12
use critical_section:: { CriticalSection , Mutex } ;
13
13
use usb_device:: {
14
- bus:: { PollResult , UsbBus , UsbBusAllocator } ,
14
+ bus:: { PollResult , UsbBus } ,
15
15
endpoint:: { EndpointAddress , EndpointType } ,
16
16
UsbDirection , UsbError ,
17
17
} ;
@@ -57,6 +57,11 @@ struct EP0State {
57
57
}
58
58
59
59
/// USB device implementation.
60
+ ///
61
+ /// This type implements the [`UsbBus`] trait and can be passed to a [`UsbBusAllocator`] to
62
+ /// configure and use the USB device.
63
+ ///
64
+ /// [`UsbBusAllocator`]: usb_device::bus::UsbBusAllocator
60
65
pub struct Usbd < T : UsbPeripheral > {
61
66
_periph : Mutex < T > ,
62
67
// argument passed to `UsbDeviceBuilder.max_packet_size_0`
@@ -71,14 +76,14 @@ pub struct Usbd<T: UsbPeripheral> {
71
76
}
72
77
73
78
impl < T : UsbPeripheral > Usbd < T > {
74
- /// Creates a new USB bus , taking ownership of the raw peripheral.
79
+ /// Creates a new USB device wrapper , taking ownership of the raw peripheral.
75
80
///
76
81
/// # Parameters
77
82
///
78
83
/// * `periph`: The raw USBD peripheral.
79
84
#[ inline]
80
- pub fn new ( periph : T ) -> UsbBusAllocator < Self > {
81
- UsbBusAllocator :: new ( Self {
85
+ pub fn new ( periph : T ) -> Self {
86
+ Self {
82
87
_periph : Mutex :: new ( periph) ,
83
88
max_packet_size_0 : 0 ,
84
89
bufs : Buffers :: new ( ) ,
@@ -93,7 +98,7 @@ impl<T: UsbPeripheral> Usbd<T> {
93
98
is_set_address : false ,
94
99
} ) ) ,
95
100
busy_in_endpoints : Mutex :: new ( Cell :: new ( 0 ) ) ,
96
- } )
101
+ }
97
102
}
98
103
99
104
fn regs < ' a > ( & self , _cs : & ' a CriticalSection ) -> & ' a RegisterBlock {
0 commit comments