atsamd_hal::sercom::spi

Struct PanicOnWrite

Source
pub struct PanicOnWrite<T: ErrorType>(/* private fields */);
Expand description

Wrapper type around a Spi that allows using embedded_hal::spi::SpiBus even though it only has RX capability. Will panic if any write-adjacent method is used (ie, write, transfer, transfer_in_place, and flush).

Also implements Into<Spi>, AsRefandAsMutif you need to useSpi` methods.

Trait Implementations§

Source§

impl<C: ValidConfig, R, T> AsMut<Spi<C, Rx, R, T>> for PanicOnWrite<Spi<C, Rx, R, T>>

Source§

fn as_mut(&mut self) -> &mut Spi<C, Rx, R, T>

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<C: ValidConfig, R, T> AsRef<Spi<C, Rx, R, T>> for PanicOnWrite<Spi<C, Rx, R, T>>

Source§

fn as_ref(&self) -> &Spi<C, Rx, R, T>

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<T: ErrorType> ErrorType for PanicOnWrite<T>

Source§

type Error = <T as ErrorType>::Error

Error type.
Source§

impl<C: ValidConfig, R, T> From<PanicOnWrite<Spi<C, Rx, R, T>>> for Spi<C, Rx, R, T>

Source§

fn from(value: PanicOnWrite<Spi<C, Rx, R, T>>) -> Self

Converts to this type from the input type.
Source§

impl<P, M, C> SpiBus<<C as CharSize>::Word> for PanicOnWrite<Spi<Config<P, M, C>, Rx>>
where Config<P, M, C>: ValidConfig<OpMode = M>, P: ValidPads, M: MasterMode, C: Size + 'static, C::Word: PrimInt + AsPrimitive<DataWidth> + Copy, DataWidth: AsPrimitive<C::Word>,

SpiBus implementation for PanicOnWrite using word-by-word transfers

Source§

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

Read words from the slave. Read more
Source§

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

Write words to the slave, ignoring all the incoming words. Read more
Source§

fn transfer( &mut self, _read: &mut [Word<C>], _write: &[Word<C>], ) -> Result<(), Self::Error>

Write and read simultaneously. write is written to the slave on MOSI and words received on MISO are stored in read. Read more
Source§

fn transfer_in_place( &mut self, _words: &mut [Word<C>], ) -> Result<(), Self::Error>

Write and read simultaneously. The contents of words are written to the slave, and the received words are stored into the same words buffer, overwriting it. Read more
Source§

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

Wait until all operations have completed and the bus is idle. Read more
Source§

impl<P, M, C, R, T> SpiBus<<C as CharSize>::Word> for PanicOnWrite<Spi<Config<P, M, C>, Rx, R, T>>
where Config<P, M, C>: ValidConfig<OpMode = M>, P: ValidPads, M: MasterMode, C: Size + 'static, C::Word: PrimInt + AsPrimitive<DataWidth> + Beat, DataWidth: AsPrimitive<C::Word>, R: AnyChannel<Status = Ready>, T: AnyChannel<Status = Ready>,

SpiBus implementation for PanicOnWrite using DMA transfers

Source§

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

Read words from the slave. Read more
Source§

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

Write words to the slave, ignoring all the incoming words. Read more
Source§

fn transfer( &mut self, _read: &mut [Word<C>], _write: &[Word<C>], ) -> Result<(), Self::Error>

Write and read simultaneously. write is written to the slave on MOSI and words received on MISO are stored in read. Read more
Source§

fn transfer_in_place( &mut self, _words: &mut [Word<C>], ) -> Result<(), Self::Error>

Write and read simultaneously. The contents of words are written to the slave, and the received words are stored into the same words buffer, overwriting it. Read more
Source§

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

Wait until all operations have completed and the bus is idle. Read more

Auto Trait Implementations§

§

impl<T> Freeze for PanicOnWrite<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for PanicOnWrite<T>
where T: RefUnwindSafe,

§

impl<T> Send for PanicOnWrite<T>
where T: Send,

§

impl<T> Sync for PanicOnWrite<T>
where T: Sync,

§

impl<T> Unpin for PanicOnWrite<T>
where T: Unpin,

§

impl<T> UnwindSafe for PanicOnWrite<T>
where T: 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> Same for T

Source§

type Output = T

Should always be Self
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.