Trait DfuAsyncIo

Source
pub trait DfuAsyncIo {
    type Read;
    type Write;
    type Reset;
    type Error: From<Error>;
    type MemoryLayout: AsRef<mem>;

    // Required methods
    fn read_control(
        &self,
        request_type: u8,
        request: u8,
        value: u16,
        buffer: &mut [u8],
    ) -> impl Future<Output = Result<Self::Read, Self::Error>> + Send;
    fn write_control(
        &self,
        request_type: u8,
        request: u8,
        value: u16,
        buffer: &[u8],
    ) -> impl Future<Output = Result<Self::Write, Self::Error>> + Send;
    fn usb_reset(
        &self,
    ) -> impl Future<Output = Result<Self::Reset, Self::Error>> + Send;
    fn protocol(&self) -> &DfuProtocol<Self::MemoryLayout>;
    fn functional_descriptor(&self) -> &FunctionalDescriptor;
}
Available on crate feature async only.
Expand description

Trait to implement lower level communication with a USB device.

Required Associated Types§

Source

type Read

Return type after calling Self::read_control.

Source

type Write

Return type after calling Self::write_control.

Source

type Reset

Return type after calling Self::usb_reset.

Source

type Error: From<Error>

Error type.

Source

type MemoryLayout: AsRef<mem>

Dfuse Memory layout type

Required Methods§

Source

fn read_control( &self, request_type: u8, request: u8, value: u16, buffer: &mut [u8], ) -> impl Future<Output = Result<Self::Read, Self::Error>> + Send

Read data using control transfer.

Source

fn write_control( &self, request_type: u8, request: u8, value: u16, buffer: &[u8], ) -> impl Future<Output = Result<Self::Write, Self::Error>> + Send

Write data using control transfer.

Source

fn usb_reset( &self, ) -> impl Future<Output = Result<Self::Reset, Self::Error>> + Send

Triggers a USB reset.

Source

fn protocol(&self) -> &DfuProtocol<Self::MemoryLayout>

Returns the protocol of the device

Source

fn functional_descriptor(&self) -> &FunctionalDescriptor

Returns the functional descriptor of the device.

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§