Struct shared_bus::I2cProxy
source · 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
sourceimpl<'a, M: BusMutex> I2c<u8> for I2cProxy<'a, M>where
M::Bus: I2c,
impl<'a, M: BusMutex> I2c<u8> for I2cProxy<'a, M>where
M::Bus: I2c,
sourcefn 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 moresourcefn 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 moresourcefn 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 moresourcefn 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 moresourcefn 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
sourcefn 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
Auto Trait Implementations
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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more