pub struct I2cProxy<'a, M> { /* private fields */ }
Expand description
Proxy type for I2C bus sharing.
The I2cProxy
implements all (blocking) I2C traits so it can be passed to drivers instead of
the bus instance. Internally, it holds reference to the bus via a mutex, ensuring that all
accesses are strictly synchronized.
An I2cProxy
is created by calling BusManager::acquire_i2c()
.
Trait Implementations§
Source§impl<'a, M: BusMutex> I2c for I2cProxy<'a, M>
impl<'a, M: BusMutex> I2c for I2cProxy<'a, M>
Source§fn write(&mut self, address: u8, bytes: &[u8]) -> Result<(), Self::Error>
fn write(&mut self, address: u8, bytes: &[u8]) -> Result<(), Self::Error>
Writes bytes to slave with address
address
Read moreSource§fn write_iter<B>(&mut self, address: u8, bytes: B) -> Result<(), Self::Error>where
B: IntoIterator<Item = u8>,
fn write_iter<B>(&mut self, address: u8, bytes: B) -> Result<(), Self::Error>where
B: IntoIterator<Item = u8>,
Writes bytes to slave with address
address
Read moreSource§fn write_read(
&mut self,
address: u8,
bytes: &[u8],
buffer: &mut [u8],
) -> Result<(), Self::Error>
fn write_read( &mut self, address: u8, bytes: &[u8], buffer: &mut [u8], ) -> Result<(), Self::Error>
Writes bytes to slave with address
address
and then reads enough bytes to fill buffer
in a
single transaction Read moreSource§fn write_iter_read<B>(
&mut self,
address: u8,
bytes: B,
buffer: &mut [u8],
) -> Result<(), Self::Error>where
B: IntoIterator<Item = u8>,
fn write_iter_read<B>(
&mut self,
address: u8,
bytes: B,
buffer: &mut [u8],
) -> Result<(), Self::Error>where
B: IntoIterator<Item = u8>,
Writes bytes to slave with address
address
and then reads enough bytes to fill buffer
in a
single transaction Read moreSource§fn transaction<'b>(
&mut self,
address: u8,
operations: &mut [Operation<'b>],
) -> Result<(), Self::Error>
fn transaction<'b>( &mut self, address: u8, operations: &mut [Operation<'b>], ) -> Result<(), Self::Error>
Execute the provided operations on the I2C bus. Read more
Source§fn transaction_iter<'b, O>(
&mut self,
address: u8,
operations: O,
) -> Result<(), Self::Error>where
O: IntoIterator<Item = Operation<'b>>,
fn transaction_iter<'b, O>(
&mut self,
address: u8,
operations: O,
) -> Result<(), Self::Error>where
O: IntoIterator<Item = Operation<'b>>,
Execute the provided operations on the I2C bus (iterator version). Read more
Source§impl<'a, M: BusMutex> WriteIterRead for I2cProxy<'a, M>where
M::Bus: WriteIterRead,
impl<'a, M: BusMutex> WriteIterRead for I2cProxy<'a, M>where
M::Bus: WriteIterRead,
Auto Trait Implementations§
impl<'a, M> Freeze for I2cProxy<'a, M>
impl<'a, M> RefUnwindSafe for I2cProxy<'a, M>where
M: RefUnwindSafe,
impl<'a, M> Send for I2cProxy<'a, M>where
M: Sync,
impl<'a, M> Sync for I2cProxy<'a, M>where
M: Sync,
impl<'a, M> Unpin for I2cProxy<'a, M>
impl<'a, M> UnwindSafe for I2cProxy<'a, M>where
M: RefUnwindSafe,
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