embassy-usb-driver

Crates

git

Versions

default

Flavors

UsbHostDriver

Trait UsbHostDriver 

Source
pub trait UsbHostDriver: Sized {
    type Channel<T: Type, D: Direction>: UsbChannel<T, D>;

    // Required methods
    async fn wait_for_device_event(&self) -> DeviceEvent;
    async fn bus_reset(&self);
    fn alloc_channel<T: Type, D: Direction>(
        &self,
        addr: u8,
        endpoint: &EndpointInfo,
        pre: bool,
    ) -> Result<Self::Channel<T, D>, HostError>;
}
Expand description

Async USB Host Driver trait. To be implemented by the HAL.

Required Associated Types§

Source

type Channel<T: Type, D: Direction>: UsbChannel<T, D>

Channel implementation of this UsbHostDriver

Required Methods§

Source

async fn wait_for_device_event(&self) -> DeviceEvent

Wait for device connect or disconnect

When connected, this function must issue a bus reset before the speed is reported

Source

async fn bus_reset(&self)

Issue a bus reset.

Source

fn alloc_channel<T: Type, D: Direction>( &self, addr: u8, endpoint: &EndpointInfo, pre: bool, ) -> Result<Self::Channel<T, D>, HostError>

Allocate channel for communication with device

This can be a scarce resource, for one-off requests please scope the channel so it’s dropped after completion

pre - device is low-speed and communication is going through hub, so send PRE packet

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§