pub trait I2cOps<H, SDA, SCL> {
// Required methods
fn raw_setup<CLOCK>(&mut self, speed: u32)
where CLOCK: Clock;
fn raw_start(
&mut self,
address: u8,
direction: Direction,
) -> Result<(), Error>;
fn raw_write(&mut self, bytes: &[u8]) -> Result<(), Error>;
fn raw_read(&mut self, buffer: &mut [u8]) -> Result<(), Error>;
fn raw_stop(&mut self) -> Result<(), Error>;
}
Expand description
Required Methods§
Sourcefn raw_setup<CLOCK>(&mut self, speed: u32)where
CLOCK: Clock,
fn raw_setup<CLOCK>(&mut self, speed: u32)where
CLOCK: Clock,
Setup the bus for operation at a certain speed.
Warning: This is a low-level method and should not be called directly from user code.
Sourcefn raw_start(&mut self, address: u8, direction: Direction) -> Result<(), Error>
fn raw_start(&mut self, address: u8, direction: Direction) -> Result<(), Error>
Start a bus transaction to a certain address
in either read or write mode.
If a previous transaction was not stopped via raw_stop()
, this should generate a repeated
start condition.
Warning: This is a low-level method and should not be called directly from user code.
Sourcefn raw_write(&mut self, bytes: &[u8]) -> Result<(), Error>
fn raw_write(&mut self, bytes: &[u8]) -> Result<(), Error>
Write some bytes to the bus.
This method must only be called after a transaction in write mode was successfully started.
Warning: This is a low-level method and should not be called directly from user code.
Sourcefn raw_read(&mut self, buffer: &mut [u8]) -> Result<(), Error>
fn raw_read(&mut self, buffer: &mut [u8]) -> Result<(), Error>
Read some bytes from the bus.
This method must only be called after a transaction in read mode was successfully started.
Warning: This is a low-level method and should not be called directly from user code.
Sourcefn raw_stop(&mut self) -> Result<(), Error>
fn raw_stop(&mut self) -> Result<(), Error>
Send a stop-condition and release the bus.
This method must only be called after successfully starting a bus transaction. This method does not need to block until the stop condition has actually occured.
Warning: This is a low-level method and should not be called directly from user code.
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.