@@ -11,7 +11,7 @@ use core::mem::MaybeUninit;
1111use core:: sync:: atomic:: { compiler_fence, Ordering } ;
1212use critical_section:: { CriticalSection , Mutex } ;
1313use usb_device:: {
14- bus:: { PollResult , UsbBus , UsbBusAllocator } ,
14+ bus:: { PollResult , UsbBus } ,
1515 endpoint:: { EndpointAddress , EndpointType } ,
1616 UsbDirection , UsbError ,
1717} ;
@@ -57,6 +57,11 @@ struct EP0State {
5757}
5858
5959/// 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
6065pub struct Usbd < T : UsbPeripheral > {
6166 _periph : Mutex < T > ,
6267 // argument passed to `UsbDeviceBuilder.max_packet_size_0`
@@ -71,14 +76,14 @@ pub struct Usbd<T: UsbPeripheral> {
7176}
7277
7378impl < 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.
7580 ///
7681 /// # Parameters
7782 ///
7883 /// * `periph`: The raw USBD peripheral.
7984 #[ inline]
80- pub fn new ( periph : T ) -> UsbBusAllocator < Self > {
81- UsbBusAllocator :: new ( Self {
85+ pub fn new ( periph : T ) -> Self {
86+ Self {
8287 _periph : Mutex :: new ( periph) ,
8388 max_packet_size_0 : 0 ,
8489 bufs : Buffers :: new ( ) ,
@@ -93,7 +98,7 @@ impl<T: UsbPeripheral> Usbd<T> {
9398 is_set_address : false ,
9499 } ) ) ,
95100 busy_in_endpoints : Mutex :: new ( Cell :: new ( 0 ) ) ,
96- } )
101+ }
97102 }
98103
99104 fn regs < ' a > ( & self , _cs : & ' a CriticalSection ) -> & ' a RegisterBlock {
0 commit comments