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

Source§

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

Source§

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> Freeze for SpiProxy<'a, M>

§

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 T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 T
where 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 T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

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

Source§

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.