pub struct I2cFuture<C, D = NoneT>where
C: AnyConfig,{ /* private fields */ }
Expand description
async
version of I2c
.
Create this struct by calling I2c::into_future
.
Implementations§
Source§impl<C, D> I2cFuture<C, D>
impl<C, D> I2cFuture<C, D>
Sourcepub fn take_dma_channel(self) -> (I2cFuture<C, NoneT>, D)
pub fn take_dma_channel(self) -> (I2cFuture<C, NoneT>, D)
Reclaim the DMA channel. Any subsequent I2C operations will no longer use DMA.
Source§impl<C, S, D> I2cFuture<C, D>
impl<C, S, D> I2cFuture<C, D>
Sourcepub async fn write_read(
&mut self,
addr: u8,
write_buf: &[u8],
read_buf: &mut [u8],
) -> Result<(), Error>
pub async fn write_read( &mut self, addr: u8, write_buf: &[u8], read_buf: &mut [u8], ) -> Result<(), Error>
Asynchronously write from a buffer, then read into a buffer, all using DMA.
This is an extremely common pattern: for example, writing a register address, then read its value from the slave.
Source§impl<C, S> I2cFuture<C, NoneT>
impl<C, S> I2cFuture<C, NoneT>
Sourcepub fn with_dma_channel<D: AnyChannel<Status = ReadyFuture>>(
self,
dma_channel: D,
) -> I2cFuture<C, D>
pub fn with_dma_channel<D: AnyChannel<Status = ReadyFuture>>( self, dma_channel: D, ) -> I2cFuture<C, D>
Use a DMA channel for reads/writes
Trait Implementations§
Source§impl<C: AnyConfig> I2c for I2cFuture<C>
impl<C: AnyConfig> I2c for I2cFuture<C>
Source§async fn write(&mut self, address: u8, bytes: &[u8]) -> Result<(), Self::Error>
async fn write(&mut self, address: u8, bytes: &[u8]) -> Result<(), Self::Error>
Writes bytes to slave with address
address
. Read moreSource§impl<C, D> I2c for I2cFuture<C, D>
impl<C, D> I2c for I2cFuture<C, D>
Source§async fn write(&mut self, address: u8, bytes: &[u8]) -> Result<(), Self::Error>
async fn write(&mut self, address: u8, bytes: &[u8]) -> Result<(), Self::Error>
Writes bytes to slave with address
address
. Read moreAuto Trait Implementations§
impl<C, D> Freeze for I2cFuture<C, D>
impl<C, D> RefUnwindSafe for I2cFuture<C, D>where
C: RefUnwindSafe,
D: RefUnwindSafe,
impl<C, D> Send for I2cFuture<C, D>
impl<C, D> Sync for I2cFuture<C, D>
impl<C, D> Unpin for I2cFuture<C, D>
impl<C, D> UnwindSafe for I2cFuture<C, D>where
C: UnwindSafe,
D: UnwindSafe,
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