Struct stm32_hal2::i2c::I2c [−][src]
pub struct I2c<R> { /* fields omitted */ }
Expand description
Represents an Inter-Integrated Circuit (I2C) peripheral.
Implementations
Configures the I2C peripheral. freq
is in Hz. Doesn’t check pin config.
Enable SMBus support. See L44 RM, section 37.4.11: SMBus initialization
Write and read an array of words.
pub unsafe fn write_dma<D>(
&mut self,
addr: u8,
buf: &[u8],
autoend: bool,
channel: DmaChannel,
dma: &mut Dma<D>
) where
D: Deref<Target = RegisterBlock>,
pub unsafe fn write_dma<D>(
&mut self,
addr: u8,
buf: &[u8],
autoend: bool,
channel: DmaChannel,
dma: &mut Dma<D>
) where
D: Deref<Target = RegisterBlock>,
Read data, using DMA. See L44 RM, 37.4.16: “Transmissino 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
.
pub unsafe fn read_dma<D>(
&mut self,
addr: u8,
buf: &mut [u8],
channel: DmaChannel,
dma: &mut Dma<D>
) where
D: Deref<Target = RegisterBlock>,
pub unsafe fn read_dma<D>(
&mut self,
addr: u8,
buf: &mut [u8],
channel: DmaChannel,
dma: &mut Dma<D>
) where
D: Deref<Target = RegisterBlock>,
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.