Struct shared_bus::SpiProxy

source ·
pub struct SpiProxy<'a, M> { /* private fields */ }
Expand description

Proxy type for SPI bus sharing.

The SpiProxy implements all (blocking) SPI traits so it can be passed to drivers instead of the bus instance. An SpiProxy is created by calling BusManager::acquire_spi().

Note: The SpiProxy can only be used for sharing withing a single task/thread. This is due to drivers usually managing the chip-select pin manually which would be inherently racy in a concurrent environment (because the mutex is locked only after asserting CS). To ensure safe usage, a SpiProxy can only be created when using BusManagerSimple and is !Send.

Trait Implementations§

source§

impl<'a, M: BusMutex> Clone for SpiProxy<'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 SpiProxy<'a, M>

source§

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

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

impl<'a, M: BusMutex> Transfer<u8> for SpiProxy<'a, M>where M::Bus: Transfer<u8>,

§

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

Error type
source§

fn transfer<'w>(&mut self, words: &'w mut [u8]) -> Result<&'w [u8], Self::Error>

Sends words to the slave. Returns the words received from the slave
source§

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

§

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

Error type
source§

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

Sends words to the slave, ignoring all the incoming words

Auto Trait Implementations§

§

impl<'a, M> RefUnwindSafe for SpiProxy<'a, M>where M: RefUnwindSafe,

§

impl<'a, M> !Send for SpiProxy<'a, M>

§

impl<'a, M> !Sync for SpiProxy<'a, M>

§

impl<'a, M> Unpin for SpiProxy<'a, M>

§

impl<'a, M> UnwindSafe for SpiProxy<'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.