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>, AsRef<Spi> and AsMut<Spi> if you need to
use Spi methods.
Trait Implementations§
Source§impl<C: ValidConfig, R, T> AsMut<Spi<C, Rx, R, T>> for PanicOnWrite<Spi<C, Rx, R, T>>
 
impl<C: ValidConfig, R, T> AsMut<Spi<C, Rx, R, T>> for PanicOnWrite<Spi<C, Rx, R, T>>
Source§impl<C: ValidConfig, R, T> AsRef<Spi<C, Rx, R, T>> for PanicOnWrite<Spi<C, Rx, R, T>>
 
impl<C: ValidConfig, R, T> AsRef<Spi<C, Rx, R, T>> for PanicOnWrite<Spi<C, Rx, R, T>>
Source§impl<T: ErrorType> ErrorType for PanicOnWrite<T>
 
impl<T: ErrorType> ErrorType for PanicOnWrite<T>
Source§impl<C: ValidConfig, R, T> From<PanicOnWrite<Spi<C, Rx, R, T>>> for Spi<C, Rx, R, T>
 
impl<C: ValidConfig, R, T> From<PanicOnWrite<Spi<C, Rx, R, T>>> for Spi<C, Rx, R, T>
Source§impl<P, M, C> SpiBus<<C as Length>::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
 
impl<P, M, C> SpiBus<<C as Length>::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>
 
fn read(&mut self, words: &mut [Word<C>]) -> Result<(), Self::Error>
Read 
words from the slave. Read moreSource§fn write(&mut self, _words: &[Word<C>]) -> Result<(), Self::Error>
 
fn write(&mut self, _words: &[Word<C>]) -> Result<(), Self::Error>
Write 
words to the slave, ignoring all the incoming words. Read moreSource§fn transfer(
    &mut self,
    _read: &mut [Word<C>],
    _write: &[Word<C>],
) -> Result<(), Self::Error>
 
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 moreSource§impl<P, M, C, R, T> SpiBus<<C as Length>::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
 
impl<P, M, C, R, T> SpiBus<<C as Length>::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>
 
fn read(&mut self, words: &mut [Word<C>]) -> Result<(), Self::Error>
Read 
words from the slave. Read moreSource§fn write(&mut self, _words: &[Word<C>]) -> Result<(), Self::Error>
 
fn write(&mut self, _words: &[Word<C>]) -> Result<(), Self::Error>
Write 
words to the slave, ignoring all the incoming words. Read moreSource§fn transfer(
    &mut self,
    _read: &mut [Word<C>],
    _write: &[Word<C>],
) -> Result<(), Self::Error>
 
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 moreAuto 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> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more