pub struct PanicOnRead<T: ErrorType>(/* private fields */);Expand description
Wrapper type around a Spi that allows using
embedded_hal::spi::SpiBus even though it only has TX capability. Will
panic if any write-adjacent method is used (ie, read, transfer, and
transfer_in_place).
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, Tx, R, T>> for PanicOnRead<Spi<C, Tx, R, T>>
impl<C: ValidConfig, R, T> AsMut<Spi<C, Tx, R, T>> for PanicOnRead<Spi<C, Tx, R, T>>
Source§impl<C: ValidConfig, R, T> AsRef<Spi<C, Tx, R, T>> for PanicOnRead<Spi<C, Tx, R, T>>
impl<C: ValidConfig, R, T> AsRef<Spi<C, Tx, R, T>> for PanicOnRead<Spi<C, Tx, R, T>>
Source§impl<T: ErrorType> ErrorType for PanicOnRead<T>
impl<T: ErrorType> ErrorType for PanicOnRead<T>
Source§impl<C: ValidConfig, R, T> From<PanicOnRead<Spi<C, Tx, R, T>>> for Spi<C, Tx, R, T>
impl<C: ValidConfig, R, T> From<PanicOnRead<Spi<C, Tx, R, T>>> for Spi<C, Tx, R, T>
Source§impl<P, M, C> SpiBus<<C as CharSize>::Word> for PanicOnRead<Spi<Config<P, M, C>, Tx>>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 PanicOnRead using word-by-word transfers
impl<P, M, C> SpiBus<<C as CharSize>::Word> for PanicOnRead<Spi<Config<P, M, C>, Tx>>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 PanicOnRead 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, T, S> SpiBus<<C as CharSize>::Word> for PanicOnRead<Spi<Config<P, M, C>, Tx, NoneT, T>>where
Config<P, M, C>: ValidConfig<Sercom = S, OpMode = M>,
P: ValidPads,
M: MasterMode,
C: Size + 'static,
C::Word: PrimInt + AsPrimitive<DataWidth> + Beat,
S: Sercom,
DataWidth: AsPrimitive<C::Word>,
T: AnyChannel<Status = Ready>,
SpiBus implementation for PanicOnRead using DMA transfers
impl<P, M, C, T, S> SpiBus<<C as CharSize>::Word> for PanicOnRead<Spi<Config<P, M, C>, Tx, NoneT, T>>where
Config<P, M, C>: ValidConfig<Sercom = S, OpMode = M>,
P: ValidPads,
M: MasterMode,
C: Size + 'static,
C::Word: PrimInt + AsPrimitive<DataWidth> + Beat,
S: Sercom,
DataWidth: AsPrimitive<C::Word>,
T: AnyChannel<Status = Ready>,
SpiBus implementation for PanicOnRead 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 PanicOnRead<T>where
T: Freeze,
impl<T> RefUnwindSafe for PanicOnRead<T>where
T: RefUnwindSafe,
impl<T> Send for PanicOnRead<T>where
T: Send,
impl<T> Sync for PanicOnRead<T>where
T: Sync,
impl<T> Unpin for PanicOnRead<T>where
T: Unpin,
impl<T> UnwindSafe for PanicOnRead<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