pub struct SpiExclusiveDevice<SPI, PINS> { /* private fields */ }
Expand description

SPI exclusive device abstraction

Implementations§

source§

impl<SPI, PINS> SpiExclusiveDevice<SPI, PINS>where SPI: SpiX, PINS: Pins<SPI>,

source

pub fn new(bus: SpiBus<SPI, PINS>, config: &SpiConfig) -> Selfwhere PINS: Pins<SPI>,

Create SpiExclusiveDevice using the existing SpiBus with the given SpiConfig

source

pub fn release(self) -> (SPI, PINS)

Releases the Bus back deconstructing it

Trait Implementations§

source§

impl<SPI, PINS> FullDuplex<u8> for SpiExclusiveDevice<SPI, PINS>where SPI: SpiX, PINS: Pins<SPI>,

§

type Error = Infallible

An enumeration of SPI errors
source§

fn read(&mut self) -> Result<u8, Infallible>

Reads the word stored in the shift register Read more
source§

fn send(&mut self, byte: u8) -> Result<(), Infallible>

Sends a word to the slave
source§

impl<SPI, PINS> Transactional<u8> for SpiExclusiveDevice<SPI, PINS>where SPI: SpiX, PINS: Pins<SPI>,

§

type Error = Infallible

Associated error type
source§

fn exec<'op>( &mut self, operations: &mut [Operation<'op, u8>] ) -> Result<(), Infallible>

Execute the provided transactions
source§

impl<SPI, PINS> Transfer<u8> for SpiExclusiveDevice<SPI, PINS>where SPI: SpiX, PINS: Pins<SPI>,

§

type Error = Infallible

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<SPI, PINS> Write<u8> for SpiExclusiveDevice<SPI, PINS>where SPI: SpiX, PINS: Pins<SPI>,

§

type Error = Infallible

Error type
source§

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

Sends words to the slave, ignoring all the incoming words
source§

impl<SPI, PINS> WriteIter<u8> for SpiExclusiveDevice<SPI, PINS>where SPI: SpiX, PINS: Pins<SPI>,

§

type Error = Infallible

Error type
source§

fn write_iter<WI>(&mut self, words: WI) -> Result<(), Self::Error>where WI: IntoIterator<Item = u8>,

Sends words to the slave, ignoring all the incoming words

Auto Trait Implementations§

§

impl<SPI, PINS> RefUnwindSafe for SpiExclusiveDevice<SPI, PINS>where PINS: RefUnwindSafe, SPI: RefUnwindSafe,

§

impl<SPI, PINS> Send for SpiExclusiveDevice<SPI, PINS>where PINS: Send, SPI: Send,

§

impl<SPI, PINS> Sync for SpiExclusiveDevice<SPI, PINS>where PINS: Sync, SPI: Sync,

§

impl<SPI, PINS> Unpin for SpiExclusiveDevice<SPI, PINS>where PINS: Unpin, SPI: Unpin,

§

impl<SPI, PINS> UnwindSafe for SpiExclusiveDevice<SPI, PINS>where PINS: UnwindSafe, SPI: UnwindSafe,

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,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · 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.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.