atsamd_hal::sercom::i2c

Struct I2cFuture

Source
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>
where C: AnyConfig, D: AnyChannel<Status = ReadyFuture>,

Source

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>
where C: AnyConfig<Sercom = S>, S: Sercom, D: AnyChannel<Status = ReadyFuture>,

Source

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>
where C: AnyConfig<Sercom = S>, S: Sercom,

Source

pub fn free(self) -> I2c<C>

Return the underlying I2c.

Source

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, D> AsMut<I2c<C, D>> for I2cFuture<C, D>

Source§

fn as_mut(&mut self) -> &mut I2c<C, D>

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<C: AnyConfig, D> AsRef<I2c<C, D>> for I2cFuture<C, D>

Source§

fn as_ref(&self) -> &I2c<C, D>

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<C, D> ErrorType for I2cFuture<C, D>
where C: AnyConfig,

Source§

type Error = Error

Error type
Source§

impl<C: AnyConfig> I2c for I2cFuture<C>

Source§

async fn read( &mut self, address: u8, buffer: &mut [u8], ) -> Result<(), Self::Error>

Reads enough bytes from slave with address to fill buffer. Read more
Source§

async fn write(&mut self, address: u8, bytes: &[u8]) -> Result<(), Self::Error>

Writes bytes to slave with address address. Read more
Source§

async fn write_read( &mut self, address: u8, write_buf: &[u8], read_buf: &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 more
Source§

async fn transaction( &mut self, address: u8, operations: &mut [Operation<'_>], ) -> Result<(), Self::Error>

Execute the provided operations on the I2C bus as a single transaction. Read more
Source§

impl<C, D> I2c for I2cFuture<C, D>
where C: AnyConfig, D: AnyChannel<Status = ReadyFuture>,

Source§

async fn read( &mut self, address: u8, buffer: &mut [u8], ) -> Result<(), Self::Error>

Reads enough bytes from slave with address to fill buffer. Read more
Source§

async fn write(&mut self, address: u8, bytes: &[u8]) -> Result<(), Self::Error>

Writes bytes to slave with address address. Read more
Source§

async fn write_read( &mut self, address: u8, wr_buffer: &[u8], rd_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 more
Source§

async fn transaction( &mut self, address: u8, operations: &mut [Operation<'_>], ) -> Result<(), Self::Error>

Execute the provided operations on the I2C bus as a single transaction. Read more

Auto Trait Implementations§

§

impl<C, D> Freeze for I2cFuture<C, D>
where C: Freeze, D: Freeze,

§

impl<C, D> RefUnwindSafe for I2cFuture<C, D>

§

impl<C, D> Send for I2cFuture<C, D>
where C: Send, D: Send,

§

impl<C, D> Sync for I2cFuture<C, D>
where C: Sync, D: Sync,

§

impl<C, D> Unpin for I2cFuture<C, D>
where C: Unpin, D: Unpin,

§

impl<C, D> UnwindSafe for I2cFuture<C, D>
where C: UnwindSafe, D: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.