13 releases

0.3.2 Mar 6, 2024
0.3.1 Nov 15, 2023
0.2.9 Aug 2, 2022
0.2.8 Mar 13, 2021
0.1.0 Dec 24, 2018

#13 in Hardware support

Download history 7980/week @ 2023-12-04 7304/week @ 2023-12-11 7673/week @ 2023-12-18 4131/week @ 2023-12-25 5953/week @ 2024-01-01 7974/week @ 2024-01-08 6749/week @ 2024-01-15 8299/week @ 2024-01-22 5321/week @ 2024-01-29 5293/week @ 2024-02-05 5505/week @ 2024-02-12 6205/week @ 2024-02-19 6017/week @ 2024-02-26 8847/week @ 2024-03-04 8184/week @ 2024-03-11 8650/week @ 2024-03-18

32,270 downloads per month
Used in 198 crates (100 directly)

MIT license

150KB
2.5K SLoC

usb-device

USB stack for embedded devices in Rust.

The UsbDevice object represents a composite USB device and is the most important object for application implementors. The UsbDevice combines a number of UsbClasses (either custom ones, or pre-existing ones provided by other crates) and a UsbBus device driver to implement the USB device.

The UsbClass trait can be used to implement USB classes such as a HID device or a serial port. An implementation may also use a custom class if the required functionality isn't covered by a standard class.

The UsbBus trait is intended to be implemented by device-specific crates to provide a driver for each device's USB peripheral.

Hardware driver crates

  • atsam4 - device-driver implementation for atsam4e & atsam4s microcontrollers (UDP). Examples can be found here. While not expressly supported with this crate, atsam3s and atsam55g could also be supported with a similar code-base.

  • atsamd - device-driver implementation for samd21 & samd51 microcontrollers. An example for the itsybitsy_m4 board from Adafruit can be found here.

  • imxrt-usbd - device-driver implementation for NXP i.MX RT microcontrollers. Examples for i.MX RT boards, like the Teensy 4, are maintained with the driver.

  • stm32-usbd - device-driver implementation for multiple STM32 microcontroller families. Examples can be found in each individual HAL crate that implements the USB peripheral.

  • rp2040-hal - device-driver implementation for the raspberry pi RP2040 microcontroller. Examples can be found in the various boards crates here.

Class crates

Others

Other implementations for USB in Rust

  • The Embassy project has an async USB stack, embassy-usb.

Dependencies

~1.5MB
~29K SLoC