Skip to main content

build_usb

Function build_usb 

Source
pub(crate) fn build_usb<'d>(
    usb: Peri<'d, USB>,
    buffers: &'d mut UsbBuffers,
    hid_state: &'d mut State<'d>,
) -> (UsbDevice<'d, Driver<'d, USB>>, HidReader<'d, Driver<'d, USB>, REPORT_SIZE>, HidWriter<'d, Driver<'d, USB>, REPORT_SIZE>)
Expand description

Build the USB device with one HID interface.

buffers holds the descriptor and control buffers; hid_state holds the HID class internal state. Both must outlive the returned device, reader, and writer, so the caller typically allocates them in static storage and passes mutable references with 'static lifetime.

Returns the device (whose run future must be polled forever by a task) and the split HID reader/writer.