pub struct I2c<I2C: Instance> { /* private fields */ }
Expand description
I2C abstraction
Implementations§
Source§impl<I2C: Instance> I2c<I2C>
impl<I2C: Instance> I2c<I2C>
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, TxDMA<I2C, TX_STREAM, TX_CH>, RxDMA<I2C, RX_STREAM, RX_CH>>
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, TxDMA<I2C, TX_STREAM, TX_CH>, RxDMA<I2C, RX_STREAM, RX_CH>>
Converts blocking I2c to non-blocking I2CMasterDma that use tx_stream
and rx_stream
to send/receive data
Sourcepub fn use_dma_tx<TX_STREAM, const TX_CH: u8>(
self,
tx_stream: TX_STREAM,
) -> I2CMasterDma<I2C, TxDMA<I2C, TX_STREAM, TX_CH>, NoDMA>
pub fn use_dma_tx<TX_STREAM, const TX_CH: u8>( self, tx_stream: TX_STREAM, ) -> I2CMasterDma<I2C, TxDMA<I2C, TX_STREAM, TX_CH>, NoDMA>
Converts blocking I2c to non-blocking I2CMasterDma that use tx_stream
to only send data
Sourcepub fn use_dma_rx<RX_STREAM, const RX_CH: u8>(
self,
rx_stream: RX_STREAM,
) -> I2CMasterDma<I2C, NoDMA, RxDMA<I2C, RX_STREAM, RX_CH>>
pub fn use_dma_rx<RX_STREAM, const RX_CH: u8>( self, rx_stream: RX_STREAM, ) -> I2CMasterDma<I2C, NoDMA, RxDMA<I2C, RX_STREAM, RX_CH>>
Converts blocking I2c to non-blocking I2CMasterDma that use rx_stream
to only receive data
Source§impl<I2C: Instance> I2c<I2C>
impl<I2C: Instance> I2c<I2C>
pub fn read( &mut self, addr: impl Into<Address>, buffer: &mut [u8], ) -> Result<(), Error>
pub fn write( &mut self, addr: impl Into<Address>, bytes: &[u8], ) -> Result<(), Error>
pub fn write_iter<B>(
&mut self,
addr: impl Into<Address>,
bytes: B,
) -> Result<(), Error>where
B: IntoIterator<Item = u8>,
pub fn write_read( &mut self, addr: impl Into<Address>, bytes: &[u8], buffer: &mut [u8], ) -> Result<(), Error>
pub fn write_iter_read<B>(
&mut self,
addr: impl Into<Address>,
bytes: B,
buffer: &mut [u8],
) -> Result<(), Error>where
B: IntoIterator<Item = u8>,
pub fn transaction<'a>( &mut self, addr: impl Into<Address>, ops: impl Iterator<Item = Operation<'a>>, ) -> Result<(), Error>
pub fn transaction_slice( &mut self, addr: impl Into<Address>, ops_slice: &mut [Operation<'_>], ) -> Result<(), Error>
Trait Implementations§
Source§impl<I2C: Instance> I2c<u16> for I2c<I2C>
impl<I2C: Instance> I2c<u16> for I2c<I2C>
Source§fn write(
&mut self,
addr: TenBitAddress,
bytes: &[u8],
) -> Result<(), Self::Error>
fn write( &mut self, addr: TenBitAddress, bytes: &[u8], ) -> Result<(), Self::Error>
Writes bytes to slave with address
address
. Read moreSource§fn write_read(
&mut self,
addr: TenBitAddress,
bytes: &[u8],
buffer: &mut [u8],
) -> Result<(), Self::Error>
fn write_read( &mut self, addr: TenBitAddress, bytes: &[u8], buffer: &mut [u8], ) -> Result<(), Self::Error>
Writes bytes to slave with address
address
and then reads enough bytes to fill read
in a
single transaction. Read moreSource§fn transaction(
&mut self,
addr: TenBitAddress,
operations: &mut [Operation<'_>],
) -> Result<(), Self::Error>
fn transaction( &mut self, addr: TenBitAddress, operations: &mut [Operation<'_>], ) -> Result<(), Self::Error>
Execute the provided operations on the I2C bus. Read more
Source§impl<I2C: Instance> I2c for I2c<I2C>
impl<I2C: Instance> I2c for I2c<I2C>
Source§fn write(
&mut self,
addr: SevenBitAddress,
bytes: &[u8],
) -> Result<(), Self::Error>
fn write( &mut self, addr: SevenBitAddress, bytes: &[u8], ) -> Result<(), Self::Error>
Writes bytes to slave with address
address
. Read moreSource§fn write_read(
&mut self,
addr: SevenBitAddress,
bytes: &[u8],
buffer: &mut [u8],
) -> Result<(), Self::Error>
fn write_read( &mut self, addr: SevenBitAddress, bytes: &[u8], buffer: &mut [u8], ) -> Result<(), Self::Error>
Writes bytes to slave with address
address
and then reads enough bytes to fill read
in a
single transaction. Read moreSource§fn transaction(
&mut self,
addr: SevenBitAddress,
operations: &mut [Operation<'_>],
) -> Result<(), Self::Error>
fn transaction( &mut self, addr: SevenBitAddress, operations: &mut [Operation<'_>], ) -> Result<(), Self::Error>
Execute the provided operations on the I2C bus. Read more
Source§impl<I2C: Instance> Transactional for I2c<I2C>
impl<I2C: Instance> Transactional for I2c<I2C>
Source§impl<I2C: Instance> WriteIterRead for I2c<I2C>
impl<I2C: Instance> WriteIterRead for I2c<I2C>
Auto Trait Implementations§
impl<I2C> Freeze for I2c<I2C>
impl<I2C> RefUnwindSafe for I2c<I2C>where
I2C: RefUnwindSafe,
<I2C as I2cCommon>::Scl: RefUnwindSafe,
<I2C as I2cCommon>::Sda: RefUnwindSafe,
impl<I2C> Send for I2c<I2C>
impl<I2C> Sync for I2c<I2C>
impl<I2C> Unpin for I2c<I2C>
impl<I2C> UnwindSafe for I2c<I2C>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more