pub struct SpiSharedDevice<'bus, SPI, PINS, CS> { /* private fields */ }
Expand description

SPI shared device abstraction

Implementations§

source§

impl<'bus, SPI, PINS, CS> SpiSharedDevice<'bus, SPI, PINS, CS>where SPI: SpiX, PINS: PinsNoCS<SPI>, CS: PinCS<SPI>,

source

pub fn new(bus: &'bus SharedBus<SPI, PINS>, cs: CS, config: &SpiConfig) -> Selfwhere PINS: PinsNoCS<SPI>,

Create shared SpiSharedDevice using the existing SharedBus and given SpiConfig. The config gets cloned.

source

pub fn release(self) -> CS

Releases the CS pin back

Trait Implementations§

source§

impl<SPI, PINS, CS> FullDuplex<u8> for SpiSharedDevice<'_, SPI, PINS, CS>where SPI: SpiX, PINS: Pins<SPI>, CS: PinCS<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, CS> Transactional<u8> for SpiSharedDevice<'_, SPI, PINS, CS>where SPI: SpiX, PINS: Pins<SPI>, CS: PinCS<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, CS> Transfer<u8> for SpiSharedDevice<'_, SPI, PINS, CS>where SPI: SpiX, PINS: Pins<SPI>, CS: PinCS<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, CS> Write<u8> for SpiSharedDevice<'_, SPI, PINS, CS>where SPI: SpiX, PINS: Pins<SPI>, CS: PinCS<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, CS> WriteIter<u8> for SpiSharedDevice<'_, SPI, PINS, CS>where SPI: SpiX, PINS: Pins<SPI>, CS: PinCS<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<'bus, SPI, PINS, CS> !RefUnwindSafe for SpiSharedDevice<'bus, SPI, PINS, CS>

§

impl<'bus, SPI, PINS, CS> !Send for SpiSharedDevice<'bus, SPI, PINS, CS>

§

impl<'bus, SPI, PINS, CS> !Sync for SpiSharedDevice<'bus, SPI, PINS, CS>

§

impl<'bus, SPI, PINS, CS> Unpin for SpiSharedDevice<'bus, SPI, PINS, CS>where CS: Unpin,

§

impl<'bus, SPI, PINS, CS> !UnwindSafe for SpiSharedDevice<'bus, SPI, PINS, CS>

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.