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§
Sourcetype Channel<T: Type, D: Direction>: UsbChannel<T, D>
type Channel<T: Type, D: Direction>: UsbChannel<T, D>
Channel implementation of this UsbHostDriver
Required Methods§
Sourceasync fn wait_for_device_event(&self) -> DeviceEvent
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
Sourcefn alloc_channel<T: Type, D: Direction>(
&self,
addr: u8,
endpoint: &EndpointInfo,
pre: bool,
) -> Result<Self::Channel<T, D>, HostError>
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.