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§

source§

impl<'a, M: BusMutex> Clone for I2cProxy<'a, M>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'a, M: Debug> Debug for I2cProxy<'a, M>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a, M: BusMutex> ErrorType for I2cProxy<'a, M>where M::Bus: ErrorType,

§

type Error = <<M as BusMutex>::Bus as ErrorType>::Error

Error type
source§

impl<'a, M: BusMutex> I2c<u8> for I2cProxy<'a, M>where M::Bus: I2c,

source§

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

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

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

Writes bytes to slave with address address Read more
source§

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 more
source§

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 more
source§

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 more
source§

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

Execute the provided operations on the I2C bus (iterator version). Read more
source§

impl<'a, M: BusMutex> Read<u8> for I2cProxy<'a, M>where M::Bus: Read,

§

type Error = <<M as BusMutex>::Bus as Read<u8>>::Error

Error type
source§

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

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

impl<'a, M: BusMutex> Write<u8> for I2cProxy<'a, M>where M::Bus: Write,

§

type Error = <<M as BusMutex>::Bus as Write<u8>>::Error

Error type
source§

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

Writes bytes to slave with address address Read more
source§

impl<'a, M: BusMutex> WriteRead<u8> for I2cProxy<'a, M>where M::Bus: WriteRead,

§

type Error = <<M as BusMutex>::Bus as WriteRead<u8>>::Error

Error type
source§

fn write_read( &mut self, addr: u8, buffer_in: &[u8], buffer_out: &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 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§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.