pub struct I2c<R> {
    pub regs: R,
    pub cfg: I2cConfig,
}
Expand description

Represents an Inter-Integrated Circuit (I2C) peripheral.

Fields

regs: Rcfg: I2cConfig

Implementations

Initialize a I2C peripheral, including configuration register writes, and enabling and resetting its RCC peripheral clock. freq is in Hz.

Enable SMBus support. See L44 RM, section 37.4.11: SMBus initialization

Read multiple words to a buffer. Can return an error due to Bus, Arbitration, or NACK.

Write an array of words. Can return an error due to Bus, Arbitration, or NACK.

Write and read an array of words. Can return an error due to Bus, Arbitration, or NACK.

Read data, using DMA. See L44 RM, 37.4.16: “Transmission using DMA” Note that the channel argument is only used on F3 and L4. For a single write, set autoend to true. For a write_read and other use cases, set it to false.

Read data, using DMA. See L44 RM, 37.4.16: “Reception using DMA” Note that the channel argument is only used on F3 and L4.

Trait Implementations

Error type
Reads enough bytes from slave with address to fill buffer Read more
Error type
Writes bytes to slave with address address Read more
Error type
Writes bytes to slave with address address and then reads enough bytes to fill buffer in a single transaction Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.