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

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§

source

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.

source

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.

source

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.

source

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.

source

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.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl I2cOps<Atmega, Pin<Input, PC4>, Pin<Input, PC5>> for TWI

source§

fn raw_setup<CLOCK>(&mut self, speed: u32)
where CLOCK: Clock,

source§

fn raw_start(&mut self, address: u8, direction: Direction) -> Result<(), Error>

source§

fn raw_write(&mut self, bytes: &[u8]) -> Result<(), Error>

source§

fn raw_read(&mut self, buffer: &mut [u8]) -> Result<(), Error>

source§

fn raw_stop(&mut self) -> Result<(), Error>

Implementors§