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§
Sourcetype Read
type Read
Return type after calling Self::read_control
.
Sourcetype Write
type Write
Return type after calling Self::write_control
.
Sourcetype Reset
type Reset
Return type after calling Self::usb_reset
.
Sourcetype MemoryLayout: AsRef<mem>
type MemoryLayout: AsRef<mem>
Dfuse Memory layout type
Required Methods§
Sourcefn read_control(
&self,
request_type: u8,
request: u8,
value: u16,
buffer: &mut [u8],
) -> impl Future<Output = Result<Self::Read, Self::Error>> + Send
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.
Sourcefn write_control(
&self,
request_type: u8,
request: u8,
value: u16,
buffer: &[u8],
) -> impl Future<Output = Result<Self::Write, 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
Write data using control transfer.
Sourcefn usb_reset(
&self,
) -> impl Future<Output = Result<Self::Reset, Self::Error>> + Send
fn usb_reset( &self, ) -> impl Future<Output = Result<Self::Reset, Self::Error>> + Send
Triggers a USB reset.
Sourcefn protocol(&self) -> &DfuProtocol<Self::MemoryLayout>
fn protocol(&self) -> &DfuProtocol<Self::MemoryLayout>
Returns the protocol of the device
Sourcefn functional_descriptor(&self) -> &FunctionalDescriptor
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.