pub trait I2cOps<H, SDA, SCL> {
    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

Internal trait for low-level I2C peripherals.

This trait defines the common interface for all I2C peripheral variants. It is used as an intermediate abstraction ontop of which the I2c API is built. Prefer using the I2c API instead of this trait.

Required Methods

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.

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.

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.

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.

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.

Implementors