Skip to main content

Module device

Module device 

Source
Expand description

The device side of the stack.

  application / class          class::cdc_acm, your own UsbClass
  ────────────────────────     this module
  core::UsbDevice              enumeration, standard requests, EP0
  ────────────────────────     this module
  bus::UsbBus                  trait: allocate, poll, read, write
  ────────────────────────     this module
  (a microcontroller crate)    implements UsbBus

A peripheral driver implements bus::UsbBus and re-exports this crate; everything above it — the device state machine, the control pipe, descriptor emission and the classes — is hardware independent.

The vocabulary shared with the host side (crate::endpoint, crate::descriptor, crate::request) is re-exported here, so a class driver only has to import this module.

Re-exports§

pub use bus::InterfaceNumber;
pub use bus::PollResult;
pub use bus::StringIndex;
pub use bus::UsbBus;
pub use bus::UsbBusAllocator;
pub use class::UsbClass;
pub use control::ControlIn;
pub use control::ControlOut;
pub use control::ControlPipe;
pub use descriptor::DescriptorWriter;
pub use endpoint::Endpoint;
pub use endpoint::EndpointIn;
pub use endpoint::EndpointOut;
pub use error::UsbError;
pub use error::UsbResult;
pub use crate::endpoint::Direction;
pub use crate::endpoint::EndpointAddress;
pub use crate::endpoint::EndpointType;
pub use crate::endpoint::In;
pub use crate::endpoint::IsoSynchronization;
pub use crate::endpoint::IsoUsage;
pub use crate::endpoint::Out;
pub use crate::request::Feature;
pub use crate::request::Recipient;
pub use crate::request::Request;
pub use crate::request::RequestType;
pub use crate::request::StandardRequest;

Modules§

bus
USB bus trait and allocator.
class
UsbClass trait and the class implementations.
control
Control transfer state machine.
descriptor
Configuration descriptor builder.
endpoint
Endpoint handles owned by the device stack.
error
USB error types.

Structs§

DeviceInfo
Static device metadata. Passed to UsbDeviceBuilder via the fluent API.
UsbDevice
USB composite device.
UsbDeviceBuilder
Builder for UsbDevice.

Enums§

DeviceState
High-level USB device state.