Trait CommandInterface

Source
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§

Source

type Error

The error type

Source

type AddressType: Copy

The address type used by this interface. Should likely be an integer.

Required Methods§

Source

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.

Implementors§