pub trait RegisterInterface {
type Error;
type AddressType: Copy;
// Required methods
fn write_register(
&mut self,
address: Self::AddressType,
size_bits: u32,
data: &[u8],
) -> Result<(), Self::Error>;
fn read_register(
&mut self,
address: Self::AddressType,
size_bits: u32,
data: &mut [u8],
) -> Result<(), Self::Error>;
}Expand description
A trait to represent the interface to the device.
This is called to write to and read from registers.
Required Associated Types§
Sourcetype AddressType: Copy
type AddressType: Copy
The address type used by this interface. Should likely be an integer.
Required Methods§
Sourcefn write_register(
&mut self,
address: Self::AddressType,
size_bits: u32,
data: &[u8],
) -> Result<(), Self::Error>
fn write_register( &mut self, address: Self::AddressType, size_bits: u32, data: &[u8], ) -> Result<(), Self::Error>
Write the given data to the register located at the given address
Sourcefn read_register(
&mut self,
address: Self::AddressType,
size_bits: u32,
data: &mut [u8],
) -> Result<(), Self::Error>
fn read_register( &mut self, address: Self::AddressType, size_bits: u32, data: &mut [u8], ) -> Result<(), Self::Error>
Read the register located at the given addres to the given data slice
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".