Trait arduino_hal::i2c::I2cOps
source · 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.