pub trait CommandInterface {
type Error;
type AddressType: Copy;
// Required method
fn dispatch_command(
&mut self,
address: Self::AddressType,
size_bits_in: u32,
input: &[u8],
size_bits_out: u32,
output: &mut [u8],
) -> Result<(), Self::Error>;
}
Expand description
A trait to represent the interface to the device.
This is called to dispatch commands.
Required Associated Types§
Sourcetype AddressType: Copy
type AddressType: Copy
The address type used by this interface. Should likely be an integer.
Required Methods§
Sourcefn dispatch_command(
&mut self,
address: Self::AddressType,
size_bits_in: u32,
input: &[u8],
size_bits_out: u32,
output: &mut [u8],
) -> Result<(), Self::Error>
fn dispatch_command( &mut self, address: Self::AddressType, size_bits_in: u32, input: &[u8], size_bits_out: u32, output: &mut [u8], ) -> Result<(), Self::Error>
Dispatch a command on the device by sending the command.
The input is the content that needs to be sent to the device. The output is the buffer where the response needs to be written to.
The slices are empty if the respective in or out fields are not specified.