Struct stm32f4xx_hal::i2c::I2c
source · [−]pub struct I2c<I2C: Instance, PINS> { /* private fields */ }
Expand description
I2C abstraction
Implementations
sourceimpl<I2C: Instance, PINS> I2c<I2C, PINS>
impl<I2C: Instance, PINS> I2c<I2C, PINS>
sourcepub fn use_dma<TX_STREAM, const TX_CH: u8, RX_STREAM, const RX_CH: u8>(
self,
tx_stream: TX_STREAM,
rx_stream: RX_STREAM
) -> I2CMasterDma<I2C, PINS, TX_STREAM, TX_CH, RX_STREAM, RX_CH>where
TX_STREAM: Stream,
RX_STREAM: Stream,
pub fn use_dma<TX_STREAM, const TX_CH: u8, RX_STREAM, const RX_CH: u8>(
self,
tx_stream: TX_STREAM,
rx_stream: RX_STREAM
) -> I2CMasterDma<I2C, PINS, TX_STREAM, TX_CH, RX_STREAM, RX_CH>where
TX_STREAM: Stream,
RX_STREAM: Stream,
Converts blocking I2c to non-blocking I2CMasterDma that use tx_stream
and rx_stream
to send/receive data
sourceimpl<I2C, SCL, SDA> I2c<I2C, (SCL, SDA)>where
I2C: Instance,
(SCL, SDA): Pins<I2C>,
impl<I2C, SCL, SDA> I2c<I2C, (SCL, SDA)>where
I2C: Instance,
(SCL, SDA): Pins<I2C>,
pub fn new(
i2c: I2C,
pins: (SCL, SDA),
mode: impl Into<Mode>,
clocks: &Clocks
) -> Self
pub fn release(self) -> (I2C, (SCL, SDA))
sourceimpl<I2C: Instance, PINS> I2c<I2C, PINS>
impl<I2C: Instance, PINS> I2c<I2C, PINS>
pub fn read(&mut self, addr: u8, buffer: &mut [u8]) -> Result<(), Error>
pub fn write(&mut self, addr: u8, bytes: &[u8]) -> Result<(), Error>
pub fn write_iter<B>(&mut self, addr: u8, bytes: B) -> Result<(), Error>where
B: IntoIterator<Item = u8>,
pub fn write_read(
&mut self,
addr: u8,
bytes: &[u8],
buffer: &mut [u8]
) -> Result<(), Error>
pub fn write_iter_read<B>(
&mut self,
addr: u8,
bytes: B,
buffer: &mut [u8]
) -> Result<(), Error>where
B: IntoIterator<Item = u8>,
pub fn transaction<'a>(
&mut self,
addr: u8,
ops: impl Iterator<Item = Operation<'a>>
) -> Result<(), Error>
pub fn transaction_slice<'a>(
&mut self,
addr: u8,
ops_slice: &mut [Operation<'a>]
) -> Result<(), Error>
Trait Implementations
sourceimpl<I2C: Instance, PINS> I2c<u8> for I2c<I2C, PINS>
impl<I2C: Instance, PINS> I2c<u8> for I2c<I2C, PINS>
sourcefn write(&mut self, addr: u8, bytes: &[u8]) -> Result<(), Self::Error>
fn write(&mut self, addr: u8, bytes: &[u8]) -> Result<(), Self::Error>
Writes bytes to slave with address
address
Read moresourcefn write_iter<B>(&mut self, addr: u8, bytes: B) -> Result<(), Self::Error>where
B: IntoIterator<Item = u8>,
fn write_iter<B>(&mut self, addr: u8, bytes: B) -> Result<(), Self::Error>where
B: IntoIterator<Item = u8>,
Writes bytes to slave with address
address
Read moresourcefn write_read(
&mut self,
addr: u8,
bytes: &[u8],
buffer: &mut [u8]
) -> Result<(), Self::Error>
fn write_read(
&mut self,
addr: u8,
bytes: &[u8],
buffer: &mut [u8]
) -> Result<(), Self::Error>
Writes bytes to slave with address
address
and then reads enough bytes to fill buffer
in a
single transaction Read moresourcefn write_iter_read<B>(
&mut self,
addr: u8,
bytes: B,
buffer: &mut [u8]
) -> Result<(), Self::Error>where
B: IntoIterator<Item = u8>,
fn write_iter_read<B>(
&mut self,
addr: u8,
bytes: B,
buffer: &mut [u8]
) -> Result<(), Self::Error>where
B: IntoIterator<Item = u8>,
Writes bytes to slave with address
address
and then reads enough bytes to fill buffer
in a
single transaction Read moresourcefn transaction<'a>(
&mut self,
addr: u8,
operations: &mut [Operation<'a>]
) -> Result<(), Self::Error>
fn transaction<'a>(
&mut self,
addr: u8,
operations: &mut [Operation<'a>]
) -> Result<(), Self::Error>
Execute the provided operations on the I2C bus. Read more
sourcefn transaction_iter<'a, O>(
&mut self,
addr: u8,
operations: O
) -> Result<(), Self::Error>where
O: IntoIterator<Item = Operation<'a>>,
fn transaction_iter<'a, O>(
&mut self,
addr: u8,
operations: O
) -> Result<(), Self::Error>where
O: IntoIterator<Item = Operation<'a>>,
Execute the provided operations on the I2C bus (iterator version). Read more
sourceimpl<I2C, PINS> WriteIterRead<u8> for I2c<I2C, PINS>where
I2C: Instance,
impl<I2C, PINS> WriteIterRead<u8> for I2c<I2C, PINS>where
I2C: Instance,
Auto Trait Implementations
impl<I2C, PINS> RefUnwindSafe for I2c<I2C, PINS>where
I2C: RefUnwindSafe,
PINS: RefUnwindSafe,
impl<I2C, PINS> Send for I2c<I2C, PINS>where
I2C: Send,
PINS: Send,
impl<I2C, PINS> Sync for I2c<I2C, PINS>where
I2C: Sync,
PINS: Sync,
impl<I2C, PINS> Unpin for I2c<I2C, PINS>where
I2C: Unpin,
PINS: Unpin,
impl<I2C, PINS> UnwindSafe for I2c<I2C, PINS>where
I2C: UnwindSafe,
PINS: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more