pub struct I2c<I2C: Instance> { /* private fields */ }
Expand description
I2C peripheral operating in master mode
Implementations§
Source§impl<I2C: Instance> I2c<I2C>
impl<I2C: Instance> I2c<I2C>
Sourcepub fn blocking(
self,
start_timeout_us: u32,
start_retries: u8,
addr_timeout_us: u32,
data_timeout_us: u32,
clocks: &Clocks,
) -> BlockingI2c<I2C>
pub fn blocking( self, start_timeout_us: u32, start_retries: u8, addr_timeout_us: u32, data_timeout_us: u32, clocks: &Clocks, ) -> BlockingI2c<I2C>
Generates a blocking I2C instance from a universal I2C object
pub fn blocking_default(self, clocks: Clocks) -> BlockingI2c<I2C>
Source§impl<I2C: Instance> I2c<I2C>
impl<I2C: Instance> I2c<I2C>
Sourcepub fn release(self) -> (I2C, (I2C::Scl, I2C::Sda))
pub fn release(self) -> (I2C, (I2C::Scl, I2C::Sda))
Releases the I2C peripheral and associated pins
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