Skip to main content

AsyncI2c

Struct AsyncI2c 

Source
pub struct AsyncI2c { /* private fields */ }
Expand description

Async I2C bus master.

Implementations§

Source§

impl AsyncI2c

Source

pub const unsafe fn from_handle(handle: ove_i2c_t) -> Self

Wrap an existing ove_i2c_t handle for async use.

§Safety

handle must be a valid I2C handle. Don’t use the same handle through a sync crate::i2c::I2c wrapper while async transactions are in flight.

Source

pub async fn write_read( &self, addr: u16, tx: &[u8], rx: &mut [u8], ) -> Result<()>

Async write-then-read with repeated start.

Source

pub async fn write(&self, addr: u16, data: &[u8]) -> Result<()>

Async write-only transaction.

Source

pub async fn read(&self, addr: u16, buf: &mut [u8]) -> Result<()>

Async read-only transaction.

Trait Implementations§

Source§

impl ErrorType for AsyncI2c

Source§

type Error = Error

Error type
Source§

impl I2c for AsyncI2c

Source§

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

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

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

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

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

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

async fn write_read( &mut self, address: A, write: &[u8], read: &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§

impl Send for AsyncI2c

Source§

impl Sync for AsyncI2c

Auto Trait Implementations§

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, 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.