embassy-usb-driver

Crates

git

Versions

default

Flavors

UsbHostController

Trait UsbHostController 

Source
pub trait UsbHostController<'d>: Sized {
    type Allocator: UsbHostAllocator<'d>;

    // Required methods
    fn allocator(&self) -> Self::Allocator;
    async fn wait_for_device_event(&mut self) -> DeviceEvent;
    async fn bus_reset(&mut self);
}
Expand description

Main USB host controller trait.

Covers the bus-level operations that must be serialised on a single controller instance (root-port event waiting, bus reset). Pipe allocation lives on the companion UsbHostAllocator trait.

Implemented by the HAL.

Required Associated Types§

Source

type Allocator: UsbHostAllocator<'d>

Pipe allocator associated with this controller.

Required Methods§

Source

fn allocator(&self) -> Self::Allocator

Return an allocator handle.

Callers may keep the handle and use it to allocate pipes concurrently with wait_for_device_event or bus_reset.

Source

async fn wait_for_device_event(&mut self) -> DeviceEvent

Wait for a root-port attach/detach.

On attach, the implementation must drive a bus reset to completion before returning and must report the speed that the device settled on after reset.

Source

async fn bus_reset(&mut self)

Force a bus reset on the root port.

Invalidates every pipe currently allocated against addresses other than 0. Used to recover from a misbehaving device or to force re-enumeration without unplug.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§