embassy-mcxa

Crates

git

Versions

mcx-a256

Flavors

I2c

Struct I2c 

Source
pub struct I2c<'d, T: Instance, M: Mode> { /* private fields */ }
Expand description

I2C Controller Driver.

Implementations§

Source§

impl<'d, T: Instance> I2c<'d, T, Blocking>

Source

pub fn new_blocking( peri: Peri<'d, T>, scl: Peri<'d, impl SclPin<T>>, sda: Peri<'d, impl SdaPin<T>>, config: Config, ) -> Result<Self>

Create a new blocking instance of the I2C Controller bus driver.

Source§

impl<'d, T: Instance, M: Mode> I2c<'d, T, M>

Source

pub fn blocking_read(&mut self, address: u8, read: &mut [u8]) -> Result<()>

Read from address into buffer blocking caller until done.

Source

pub fn blocking_write(&mut self, address: u8, write: &[u8]) -> Result<()>

Write to address from buffer blocking caller until done.

Source

pub fn blocking_write_read( &mut self, address: u8, write: &[u8], read: &mut [u8], ) -> Result<()>

Write to address from bytes and read from address into buffer blocking caller until done.

Source§

impl<'d, T: Instance> I2c<'d, T, Async>

Source

pub fn new_async( peri: Peri<'d, T>, scl: Peri<'d, impl SclPin<T>>, sda: Peri<'d, impl SdaPin<T>>, _irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd, config: Config, ) -> Result<Self>

Create a new async instance of the I2C Controller bus driver.

Source

pub fn async_read<'a>( &mut self, address: u8, read: &'a mut [u8], ) -> impl Future<Output = Result<()>> + use<'_, 'a, 'd, T>

Read from address into buffer asynchronously.

Source

pub fn async_write<'a>( &mut self, address: u8, write: &'a [u8], ) -> impl Future<Output = Result<()>> + use<'_, 'a, 'd, T>

Write to address from buffer asynchronously.

Source

pub async fn async_write_read( &mut self, address: u8, write: &[u8], read: &mut [u8], ) -> Result<()>

Write to address from bytes and read from address into buffer asynchronously.

Trait Implementations§

Source§

impl<'d, T: Instance, M: Mode> ErrorType for I2c<'d, T, M>

Source§

type Error = Error

Error type
Source§

impl<'d, T: Instance> I2c for I2c<'d, T, Async>

Source§

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

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<'d, T: Instance, M: Mode> I2c for I2c<'d, T, M>

Source§

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

Execute the provided operations on the I2C bus. Read more
Source§

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

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

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

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

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<'d, T: Instance, M: Mode> SetConfig for I2c<'d, T, M>

Source§

type Config = Config

The configuration type used by this driver.
Source§

type ConfigError = Error

The error type that can occur if set_config fails.
Source§

fn set_config(&mut self, config: &Self::Config) -> Result<()>

Set the configuration of the driver.
Source§

impl<'d, T: Instance, M: Mode> Transactional for I2c<'d, T, M>

Source§

type Error = Error

Error type
Source§

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

Execute the provided operations on the I2C bus. Read more
Source§

impl<'d, T: Instance, M: Mode> Read for I2c<'d, T, M>

Source§

type Error = Error

Error type
Source§

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

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

impl<'d, T: Instance, M: Mode> Write for I2c<'d, T, M>

Source§

type Error = Error

Error type
Source§

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

Writes bytes to slave with address address Read more
Source§

impl<'d, T: Instance, M: Mode> WriteRead for I2c<'d, T, M>

Source§

type Error = Error

Error type
Source§

fn write_read( &mut self, address: u8, bytes: &[u8], buffer: &mut [u8], ) -> Result<()>

Writes bytes to slave with address address and then reads enough bytes to fill buffer in a single transaction Read more

Auto Trait Implementations§

§

impl<'d, T, M> Freeze for I2c<'d, T, M>
where T: Freeze,

§

impl<'d, T, M> !RefUnwindSafe for I2c<'d, T, M>

§

impl<'d, T, M> !Send for I2c<'d, T, M>

§

impl<'d, T, M> !Sync for I2c<'d, T, M>

§

impl<'d, T, M> Unpin for I2c<'d, T, M>
where T: Unpin, M: Unpin,

§

impl<'d, T, M> !UnwindSafe for I2c<'d, T, M>

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.