Wrapper

Struct Wrapper 

Source
pub struct Wrapper<Spi, CsPin, BusyPin, ReadyPin, ResetPin, Delay> { /* private fields */ }
Expand description

Wrapper provides a wrapper around an SPI object with Chip Select management

Implementations§

Source§

impl<Spi, CsPin, BusyPin, ReadyPin, ResetPin, Delay> Wrapper<Spi, CsPin, BusyPin, ReadyPin, ResetPin, Delay>
where Spi: SpiDevice<u8>, CsPin: OutputPin,

Source

pub fn new( spi: Spi, cs: CsPin, reset: ResetPin, busy: BusyPin, ready: ReadyPin, delay: Delay, ) -> Self

Create a new wrapper with the provided chip select pin

Source

pub fn inner_spi(&mut self) -> &mut Spi

Explicitly fetch the inner spi (non-CS controlling) object

(note that deref is also implemented for this)

Trait Implementations§

Source§

impl<Spi, CsPin, BusyPin, ReadyPin, ResetPin, Delay> Busy for Wrapper<Spi, CsPin, BusyPin, ReadyPin, ResetPin, Delay>
where BusyPin: InputPin,

Busy pin implementation for inner objects implementing Busy

Source§

fn get_busy(&mut self) -> Result<PinState, Self::Error>

Fetch the busy pin state

Source§

type Error = <BusyPin as ErrorType>::Error

Source§

impl<Spi, CsPin, BusyPin, ReadyPin, ResetPin, Delay> DelayNs for Wrapper<Spi, CsPin, BusyPin, ReadyPin, ResetPin, Delay>
where Delay: DelayNs,

Source§

fn delay_ns(&mut self, ns: u32)

Pauses execution for at minimum ns nanoseconds. Pause can be longer if the implementation requires it due to precision/timing issues.
Source§

fn delay_us(&mut self, us: u32)

Pauses execution for at minimum us microseconds. Pause can be longer if the implementation requires it due to precision/timing issues.
Source§

fn delay_ms(&mut self, ms: u32)

Pauses execution for at minimum ms milliseconds. Pause can be longer if the implementation requires it due to precision/timing issues.
Source§

impl<Spi, CsPin, BusyPin, ReadyPin, ResetPin, Delay> ErrorType for Wrapper<Spi, CsPin, BusyPin, ReadyPin, ResetPin, Delay>
where Spi: ErrorType, CsPin: ErrorType, Delay: DelayNs,

Source§

type Error = Error<<Spi as ErrorType>::Error, <CsPin as ErrorType>::Error>

Error type.
Source§

impl<Spi, CsPin, BusyPin, ReadyPin, ResetPin, Delay> ErrorType for Wrapper<Spi, CsPin, BusyPin, ReadyPin, ResetPin, Delay>
where Spi: ErrorType, CsPin: ErrorType, Delay: DelayNs,

Source§

type Error = Error<<Spi as ErrorType>::Error, <CsPin as ErrorType>::Error>

Error type
Source§

impl<Spi, CsPin, BusyPin, ReadyPin, ResetPin, Delay> Ready for Wrapper<Spi, CsPin, BusyPin, ReadyPin, ResetPin, Delay>
where ReadyPin: InputPin,

Ready pin implementation for inner object implementing Ready

Source§

fn get_ready(&mut self) -> Result<PinState, Self::Error>

Fetch the ready pin state

Source§

type Error = <ReadyPin as ErrorType>::Error

Source§

impl<Spi, CsPin, BusyPin, ReadyPin, ResetPin, Delay> Reset for Wrapper<Spi, CsPin, BusyPin, ReadyPin, ResetPin, Delay>
where ResetPin: OutputPin,

Reset pin implementation for inner objects implementing Reset

Source§

fn set_reset(&mut self, state: PinState) -> Result<(), Self::Error>

Set the reset pin state

Source§

type Error = <ResetPin as ErrorType>::Error

Source§

impl<Spi, CsPin, BusyPin, ReadyPin, ResetPin, Delay> SpiDevice for Wrapper<Spi, CsPin, BusyPin, ReadyPin, ResetPin, Delay>
where Spi: SpiDevice<u8>, CsPin: OutputPin, Delay: DelayNs,

Source§

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

spi write implementation managing the CS pin

Source§

fn transaction( &mut self, operations: &mut [Operation<'_, u8>], ) -> Result<(), Self::Error>

Perform a transaction against the device. Read more
Source§

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

Do an in-place transfer within a transaction. Read more
Source§

fn read(&mut self, buf: &mut [Word]) -> Result<(), Self::Error>

Do a read within a transaction. Read more
Source§

fn transfer( &mut self, read: &mut [Word], write: &[Word], ) -> Result<(), Self::Error>

Do a transfer within a transaction. Read more
Source§

impl<Spi, CsPin, BusyPin, ReadyPin, ResetPin, Delay> ManagedChipSelect for Wrapper<Spi, CsPin, BusyPin, ReadyPin, ResetPin, Delay>

ManagedChipSelect indicates wrapper controls CS line

Auto Trait Implementations§

§

impl<Spi, CsPin, BusyPin, ReadyPin, ResetPin, Delay> Freeze for Wrapper<Spi, CsPin, BusyPin, ReadyPin, ResetPin, Delay>
where Spi: Freeze, CsPin: Freeze, ResetPin: Freeze, BusyPin: Freeze, ReadyPin: Freeze, Delay: Freeze,

§

impl<Spi, CsPin, BusyPin, ReadyPin, ResetPin, Delay> RefUnwindSafe for Wrapper<Spi, CsPin, BusyPin, ReadyPin, ResetPin, Delay>
where Spi: RefUnwindSafe, CsPin: RefUnwindSafe, ResetPin: RefUnwindSafe, BusyPin: RefUnwindSafe, ReadyPin: RefUnwindSafe, Delay: RefUnwindSafe,

§

impl<Spi, CsPin, BusyPin, ReadyPin, ResetPin, Delay> Send for Wrapper<Spi, CsPin, BusyPin, ReadyPin, ResetPin, Delay>
where Spi: Send, CsPin: Send, ResetPin: Send, BusyPin: Send, ReadyPin: Send, Delay: Send,

§

impl<Spi, CsPin, BusyPin, ReadyPin, ResetPin, Delay> Sync for Wrapper<Spi, CsPin, BusyPin, ReadyPin, ResetPin, Delay>
where Spi: Sync, CsPin: Sync, ResetPin: Sync, BusyPin: Sync, ReadyPin: Sync, Delay: Sync,

§

impl<Spi, CsPin, BusyPin, ReadyPin, ResetPin, Delay> Unpin for Wrapper<Spi, CsPin, BusyPin, ReadyPin, ResetPin, Delay>
where Spi: Unpin, CsPin: Unpin, ResetPin: Unpin, BusyPin: Unpin, ReadyPin: Unpin, Delay: Unpin,

§

impl<Spi, CsPin, BusyPin, ReadyPin, ResetPin, Delay> UnwindSafe for Wrapper<Spi, CsPin, BusyPin, ReadyPin, ResetPin, Delay>
where Spi: UnwindSafe, CsPin: UnwindSafe, ResetPin: UnwindSafe, BusyPin: UnwindSafe, ReadyPin: UnwindSafe, Delay: UnwindSafe,

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> 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, 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.
Source§

impl<T, E> Hal<E> for T
where T: SpiDevice<Error = E> + PrefixWrite<Error = E> + Busy<Error = E> + Ready<Error = E> + PrefixRead<Error = E> + Reset<Error = E> + DelayNs,