Skip to main content

usb_stack/device/
mod.rs

1//! The device side of the stack.
2//!
3//! ```text
4//!   application / class          class::cdc_acm, your own UsbClass
5//!   ────────────────────────     this module
6//!   core::UsbDevice              enumeration, standard requests, EP0
7//!   ────────────────────────     this module
8//!   bus::UsbBus                  trait: allocate, poll, read, write
9//!   ────────────────────────     this module
10//!   (a microcontroller crate)    implements UsbBus
11//! ```
12//!
13//! A peripheral driver implements [`bus::UsbBus`] and re-exports this crate;
14//! everything above it — the device state machine, the control pipe, descriptor
15//! emission and the classes — is hardware independent.
16//!
17//! The vocabulary shared with the host side ([`crate::endpoint`],
18//! [`crate::descriptor`], [`crate::request`]) is re-exported here, so a class
19//! driver only has to import this module.
20
21pub mod bus;
22pub mod class;
23pub mod control;
24pub mod descriptor;
25pub mod endpoint;
26pub mod error;
27
28mod core;
29
30pub use bus::{InterfaceNumber, PollResult, StringIndex, UsbBus, UsbBusAllocator};
31pub use class::UsbClass;
32pub use control::{ControlIn, ControlOut, ControlPipe};
33pub use core::{DeviceInfo, DeviceState, UsbDevice, UsbDeviceBuilder};
34pub use descriptor::DescriptorWriter;
35pub use endpoint::{Endpoint, EndpointIn, EndpointOut};
36pub use error::{UsbError, UsbResult};
37
38pub use crate::endpoint::{
39    Direction, EndpointAddress, EndpointType, In, IsoSynchronization, IsoUsage, Out,
40};
41pub use crate::request::{Feature, Recipient, Request, RequestType, StandardRequest};