pub trait I2CDevice {
// Required methods
fn enable(&self);
fn disable(&self);
fn write_read(
&self,
data: &'static mut [u8],
write_len: usize,
read_len: usize,
) -> Result<(), (Error, &'static mut [u8])>;
fn write(
&self,
data: &'static mut [u8],
len: usize,
) -> Result<(), (Error, &'static mut [u8])>;
fn read(
&self,
buffer: &'static mut [u8],
len: usize,
) -> Result<(), (Error, &'static mut [u8])>;
}Expand description
Higher-level interface for I2C Master commands that wraps in the I2C address. It gives an interface for communicating with a specific I2C device.
Required Methods§
fn enable(&self)
fn disable(&self)
fn write_read( &self, data: &'static mut [u8], write_len: usize, read_len: usize, ) -> Result<(), (Error, &'static mut [u8])>
fn write( &self, data: &'static mut [u8], len: usize, ) -> Result<(), (Error, &'static mut [u8])>
fn read( &self, buffer: &'static mut [u8], len: usize, ) -> Result<(), (Error, &'static mut [u8])>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".