| Crates.io | embassy-usb |
| lib.rs | embassy-usb |
| version | 0.5.1 |
| created_at | 2021-04-21 18:39:38.840033+00 |
| updated_at | 2025-08-27 17:02:44.068087+00 |
| description | Async USB device stack for embedded devices in Rust. |
| homepage | |
| repository | https://github.com/embassy-rs/embassy |
| max_upload_size | |
| id | 387800 |
| size | 250,946 |
Async USB device stack for embedded devices in Rust.
To add embassy-usb support for new hardware (i.e. a new MCU chip), you have to write a driver that implements
the embassy-usb-driver traits.
Before writing a new driver, you can first verify whether the chip uses a common USB IP. Several widely used USB IPs already have implementations available, such as:
Driver crates should depend only on embassy-usb-driver, not on the main embassy-usb crate.
This allows existing drivers to continue working for newer embassy-usb major versions, without needing an update, if the driver
trait has not had breaking changes.
embassy-usb has some configuration settings that are set at compile time, affecting sizes
and counts of buffers.
They can be set in two ways:
<name>-<value>. name must be in lowercase and
use dashes instead of underscores. For example. max-interface-count-3. Only a selection of values
is available, check Cargo.toml for the list.EMBASSY_USB_<value>. For example
EMBASSY_USB_MAX_INTERFACE_COUNT=3 cargo build. You can also set them in the [env] section of .cargo/config.toml.
Any value can be set, unlike with Cargo features.Environment variables take precedence over Cargo features. If two Cargo features are enabled for the same setting with different values, compilation fails.
MAX_INTERFACE_COUNTMax amount of interfaces that can be created in one device. Default: 4.
This crate can run on any executor.