pub struct Spi<C, A, RxDma = NoneT, TxDma = NoneT>where
C: ValidConfig,
A: Capability,{ /* private fields */ }Expand description
An enabled SPI peripheral that can perform transactions
See the impl_ehal documentation for details on the implementations of
the embedded HAL traits, which vary based on Size and Capability.
Implementations§
Source§impl<C, A, S> Spi<C, A>
impl<C, A, S> Spi<C, A>
Sourcepub fn into_future<I>(self, _interrupts: I) -> SpiFuture<C, A>
pub fn into_future<I>(self, _interrupts: I) -> SpiFuture<C, A>
In cases where the underlying Spi is Duplex, reading words need
to be accompanied with sending a no-op word. By default it is set to
0x00, but you can configure it using Config::set_nop_word.
Source§impl<C, A, RxDma, TxDma> Spi<C, A, RxDma, TxDma>where
C: ValidConfig,
A: Capability,
impl<C, A, RxDma, TxDma> Spi<C, A, RxDma, TxDma>where
C: ValidConfig,
A: Capability,
Sourcepub fn reconfigure(&mut self, update: impl FnOnce(&mut SpecificConfig<C>))
pub fn reconfigure(&mut self, update: impl FnOnce(&mut SpecificConfig<C>))
Update the SPI configuration.
Calling this method will temporarily disable the SERCOM peripheral, as some registers are enable-protected. This may interrupt any ongoing transactions.
Sourcepub fn enable_interrupts(&mut self, flags: Flags)
pub fn enable_interrupts(&mut self, flags: Flags)
Enable interrupts for the specified flags
Sourcepub fn disable_interrupts(&mut self, flags: Flags)
pub fn disable_interrupts(&mut self, flags: Flags)
Disable interrupts for the specified flags
Sourcepub fn read_flags(&self) -> Flags
pub fn read_flags(&self) -> Flags
Read the interrupt flags
Sourcepub fn clear_flags(&mut self, flags: Flags)
pub fn clear_flags(&mut self, flags: Flags)
Clear the corresponding interrupt flags
Only the ERROR, SSL and TXC flags can be cleared.
Note: Implementations of flush methods (eg SpiBus::flush) wait
on and clear the TXC flag. Manually clearing this flag could cause
them to hang indefinitely.
Sourcepub fn read_status(&self) -> Status
pub fn read_status(&self) -> Status
Read the error status flags
Sourcepub fn clear_status(&mut self, status: Status)
pub fn clear_status(&mut self, status: Status)
Clear the corresponding error status flags
Sourcepub fn read_flags_errors(&self) -> Result<Flags, Error>
pub fn read_flags_errors(&self) -> Result<Flags, Error>
Try to read the interrupt flags, but first check the error status flags.
Sourcepub unsafe fn read_data(&mut self) -> DataWidth
pub unsafe fn read_data(&mut self) -> DataWidth
Read from the DATA register
§Safety
Reading from the data register directly is unsafe, because it will
clear the RXC flag, which could break assumptions made elsewhere in
this module.
Sourcepub unsafe fn write_data(&mut self, data: DataWidth)
pub unsafe fn write_data(&mut self, data: DataWidth)
Write to the DATA register
§Safety
Writing to the data register directly is unsafe, because it will clear
the DRE flag, which could break assumptions made elsewhere in this
module.
Source§impl<C, D> Spi<C, D>
impl<C, D> Spi<C, D>
Sourcepub fn with_dma_channels<R, T>(self, rx: R, tx: T) -> Spi<C, D, R, T>
pub fn with_dma_channels<R, T>(self, rx: R, tx: T) -> Spi<C, D, R, T>
Source§impl<C> Spi<C, Duplex>where
C: ValidConfig<OpMode = Slave>,
impl<C> Spi<C, Duplex>where
C: ValidConfig<OpMode = Slave>,
Sourcepub fn with_dma_channels_slave<R, T>(self, rx: R, tx: T) -> Spi<C, Duplex, R, T>
pub fn with_dma_channels_slave<R, T>(self, rx: R, tx: T) -> Spi<C, Duplex, R, T>
Source§impl<C, T> Spi<C, Rx, NoneT, T>where
C: ValidConfig<OpMode = Slave>,
impl<C, T> Spi<C, Rx, NoneT, T>where
C: ValidConfig<OpMode = Slave>,
Sourcepub fn with_rx_channel<R>(self, rx: R) -> Spi<C, Rx, R, T>where
R: AnyChannel<Status = Ready>,
pub fn with_rx_channel<R>(self, rx: R) -> Spi<C, Rx, R, T>where
R: AnyChannel<Status = Ready>,
Source§impl<C, R> Spi<C, Tx, R, NoneT>where
C: ValidConfig,
impl<C, R> Spi<C, Tx, R, NoneT>where
C: ValidConfig,
Sourcepub fn with_tx_channel<T>(self, tx: T) -> Spi<C, Tx, R, T>where
T: AnyChannel<Status = Ready>,
pub fn with_tx_channel<T>(self, tx: T) -> Spi<C, Tx, R, T>where
T: AnyChannel<Status = Ready>,
Source§impl<C, D, R, T> Spi<C, D, R, T>where
C: ValidConfig,
D: Capability,
impl<C, D, R, T> Spi<C, D, R, T>where
C: ValidConfig,
D: Capability,
Sourcepub fn take_dma_channels(self) -> (Spi<C, D, NoneT, NoneT>, R, T)
pub fn take_dma_channels(self) -> (Spi<C, D, NoneT, NoneT>, R, T)
Reclaim both RX and TX DMA channels. Any subsequent SPI transaction will not use DMA.
Sourcepub fn take_rx_channel(self) -> (Spi<C, D, NoneT, T>, R)where
R: AnyChannel<Status: ReadyChannel>,
pub fn take_rx_channel(self) -> (Spi<C, D, NoneT, T>, R)where
R: AnyChannel<Status: ReadyChannel>,
Reclaim the RX DMA channel. Any subsequent SPI RX transaction will not use DMA.
Sourcepub fn take_tx_channel(self) -> (Spi<C, D, R, NoneT>, T)where
T: AnyChannel<Status: ReadyChannel>,
pub fn take_tx_channel(self) -> (Spi<C, D, R, NoneT>, T)where
T: AnyChannel<Status: ReadyChannel>,
Reclaim the TX DMA channel. Any subsequent SPI TX transaction will not use DMA.
Source§impl<C: ValidConfig, R, T> Spi<C, Tx, R, T>
impl<C: ValidConfig, R, T> Spi<C, Tx, R, T>
Sourcepub fn into_panic_on_write(self) -> PanicOnWrite<Self>
pub fn into_panic_on_write(self) -> PanicOnWrite<Self>
Turn a Tx Spi into a PanicOnWrite
Source§impl<C: ValidConfig, R, T> Spi<C, Tx, R, T>
impl<C: ValidConfig, R, T> Spi<C, Tx, R, T>
Sourcepub fn into_panic_on_read(self) -> PanicOnRead<Self>
pub fn into_panic_on_read(self) -> PanicOnRead<Self>
Turn a Rx Spi into a PanicOnRead
Source§impl<C: ValidConfig, R, T> Spi<C, Tx, R, T>
impl<C: ValidConfig, R, T> Spi<C, Tx, R, T>
Sourcepub fn get_dyn_length(&self) -> u8
pub fn get_dyn_length(&self) -> u8
This method is not present with the selected feature set, defined for documentation only
Trait Implementations§
Source§impl<C, A> AnySpi for Spi<C, A>where
C: ValidConfig,
A: Capability,
impl<C, A> AnySpi for Spi<C, A>where
C: ValidConfig,
A: Capability,
Source§impl<C, A> AsMut<Spi<C, A>> for Spi<C, A>where
C: ValidConfig,
A: Capability,
impl<C, A> AsMut<Spi<C, A>> for Spi<C, A>where
C: ValidConfig,
A: Capability,
Source§impl<C, A, R, T> AsMut<Spi<C, A, R, T>> for SpiFuture<C, A, R, T>where
C: ValidConfig,
A: Capability,
impl<C, A, R, T> AsMut<Spi<C, A, R, T>> for SpiFuture<C, A, R, T>where
C: ValidConfig,
A: Capability,
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> 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, A> AsRef<Config<<C as AnyConfig>::Pads, <C as AnyConfig>::OpMode, <C as AnyConfig>::Size>> for Spi<C, A>where
C: ValidConfig,
A: Capability,
Get a shared reference to the underlying Config struct
impl<C, A> AsRef<Config<<C as AnyConfig>::Pads, <C as AnyConfig>::OpMode, <C as AnyConfig>::Size>> for Spi<C, A>where
C: ValidConfig,
A: Capability,
Get a shared reference to the underlying Config struct
This can be used to call the various get_* functions on Config
Source§fn as_ref(&self) -> &SpecificConfig<C>
fn as_ref(&self) -> &SpecificConfig<C>
Source§impl<C, A> AsRef<Spi<C, A>> for Spi<C, A>where
C: ValidConfig,
A: Capability,
impl<C, A> AsRef<Spi<C, A>> for Spi<C, A>where
C: ValidConfig,
A: Capability,
Source§impl<C, A, R, T> AsRef<Spi<C, A, R, T>> for SpiFuture<C, A, R, T>where
C: ValidConfig,
A: Capability,
impl<C, A, R, T> AsRef<Spi<C, A, R, T>> for SpiFuture<C, A, R, T>where
C: ValidConfig,
A: Capability,
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<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<C, D, R, T> ErrorType for Spi<C, D, R, T>where
C: ValidConfig,
D: Capability,
impl<C, D, R, T> ErrorType for Spi<C, D, R, T>where
C: ValidConfig,
D: Capability,
Source§impl<C, D, R, T> ErrorType for Spi<C, D, R, T>where
C: ValidConfig,
D: Capability,
impl<C, D, R, T> ErrorType for Spi<C, D, R, T>where
C: ValidConfig,
D: Capability,
Source§impl<C, D, R, T> ErrorType for Spi<C, D, R, T>where
C: ValidConfig,
D: Capability,
impl<C, D, R, T> ErrorType for Spi<C, D, R, T>where
C: ValidConfig,
D: Capability,
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<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<C> FullDuplex<<C as AnyConfig>::Word> for Spi<C, Duplex>
Implement embedded-hal-nb spi::FullDuplex for Spi structs with AtomicSize
impl<C> FullDuplex<<C as AnyConfig>::Word> for Spi<C, Duplex>
Implement embedded-hal-nb spi::FullDuplex for Spi structs with AtomicSize
spi::FullDuplex is only implemented when the Spi struct has Duplex
Capability. The Word size used in the implementation depends on the
corresponding CharSize.
Source§impl<P, M, C> Read<<C as CharSize>::Word> for Spi<Config<P, M, C>, Rx>where
Config<P, M, C>: ValidConfig,
P: ValidPads,
M: MasterMode,
C: CharSize,
C::Word: PrimInt,
DataWidth: AsPrimitive<C::Word>,
Implement Read for Rx Spi structs in a MasterMode
impl<P, M, C> Read<<C as CharSize>::Word> for Spi<Config<P, M, C>, Rx>where
Config<P, M, C>: ValidConfig,
P: ValidPads,
M: MasterMode,
C: CharSize,
C::Word: PrimInt,
DataWidth: AsPrimitive<C::Word>,
Implement Read for Rx Spi structs in a MasterMode
Read is only implemented for Spi structs with Rx
Capability. In a MasterMode, Read has to initiate transactions, so
it keeps track of the transaction state. If a transaction is in progress,
it will wait on RXC. If not, it will wait on DRE, and then send 0.
Source§impl<P, C> Read<<C as CharSize>::Word> for Spi<Config<P, Slave, C>, Rx>where
Config<P, Slave, C>: ValidConfig,
P: ValidPads,
C: CharSize,
C::Word: PrimInt,
DataWidth: AsPrimitive<C::Word>,
impl<P, C> Read<<C as CharSize>::Word> for Spi<Config<P, Slave, C>, Rx>where
Config<P, Slave, C>: ValidConfig,
P: ValidPads,
C: CharSize,
C::Word: PrimInt,
DataWidth: AsPrimitive<C::Word>,
Read is only implemented for Spi structs with Rx
Capability. In Slave OpMode, Read does not have to initiate
transactions, so it does not have to store any internal state. It only has
to wait on RXC.
Source§impl<P, M> Read for Spi<Config<P, M, EightBit>, Rx>
impl<P, M> Read for Spi<Config<P, M, EightBit>, Rx>
Source§fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
Source§fn read_exact(
&mut self,
buf: &mut [u8],
) -> Result<(), ReadExactError<Self::Error>>
fn read_exact( &mut self, buf: &mut [u8], ) -> Result<(), ReadExactError<Self::Error>>
buf. Read moreSource§impl<P, M, Z, D, R, T, S> Read for Spi<Config<P, M, Z>, D, R, T>where
P: ValidPads,
M: MasterMode,
Z: Size<Word = u8> + 'static,
Config<P, M, Z>: ValidConfig<Sercom = S>,
D: Receive,
S: Sercom,
R: AnyChannel<Status = Ready>,
T: AnyChannel<Status = Ready>,
embedded_io::Read implementation for Receive Spis in
MasterMode, using DMA transfers.
impl<P, M, Z, D, R, T, S> Read for Spi<Config<P, M, Z>, D, R, T>where
P: ValidPads,
M: MasterMode,
Z: Size<Word = u8> + 'static,
Config<P, M, Z>: ValidConfig<Sercom = S>,
D: Receive,
S: Sercom,
R: AnyChannel<Status = Ready>,
T: AnyChannel<Status = Ready>,
embedded_io::Read implementation for Receive Spis in
MasterMode, using DMA transfers.
Source§fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
Source§fn read_exact(
&mut self,
buf: &mut [u8],
) -> Result<(), ReadExactError<Self::Error>>
fn read_exact( &mut self, buf: &mut [u8], ) -> Result<(), ReadExactError<Self::Error>>
buf. Read moreSource§impl<P> Read for Spi<Config<P, Slave, EightBit>, Rx>
impl<P> Read for Spi<Config<P, Slave, EightBit>, Rx>
Source§fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
Source§fn read_exact(
&mut self,
buf: &mut [u8],
) -> Result<(), ReadExactError<Self::Error>>
fn read_exact( &mut self, buf: &mut [u8], ) -> Result<(), ReadExactError<Self::Error>>
buf. Read moreSource§impl<P, Z, D, R, T, S> Read for Spi<Config<P, Slave, Z>, D, R, T>where
P: ValidPads,
Z: Size<Word = u8> + 'static,
Config<P, Slave, Z>: ValidConfig<Sercom = S>,
D: Receive,
S: Sercom,
R: AnyChannel<Status = Ready>,
embedded_io::Read implementation for Receive Spis in Slave
mode, using DMA transfers.
impl<P, Z, D, R, T, S> Read for Spi<Config<P, Slave, Z>, D, R, T>where
P: ValidPads,
Z: Size<Word = u8> + 'static,
Config<P, Slave, Z>: ValidConfig<Sercom = S>,
D: Receive,
S: Sercom,
R: AnyChannel<Status = Ready>,
embedded_io::Read implementation for Receive Spis in Slave
mode, using DMA transfers.
Source§fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
Source§fn read_exact(
&mut self,
buf: &mut [u8],
) -> Result<(), ReadExactError<Self::Error>>
fn read_exact( &mut self, buf: &mut [u8], ) -> Result<(), ReadExactError<Self::Error>>
buf. Read moreSource§impl<P, M, C> SpiBus<<C as CharSize>::Word> for Spi<Config<P, M, C>, Duplex>where
Config<P, M, C>: ValidConfig,
P: ValidPads,
M: MasterMode,
C: Size + 'static,
C::Word: PrimInt + AsPrimitive<DataWidth> + Copy,
DataWidth: AsPrimitive<C::Word>,
impl<P, M, C> SpiBus<<C as CharSize>::Word> for Spi<Config<P, M, C>, Duplex>where
Config<P, M, C>: ValidConfig,
P: ValidPads,
M: MasterMode,
C: Size + 'static,
C::Word: PrimInt + AsPrimitive<DataWidth> + Copy,
DataWidth: AsPrimitive<C::Word>,
Source§fn read(&mut self, words: &mut [Word<C>]) -> Result<(), Self::Error>
fn read(&mut self, words: &mut [Word<C>]) -> Result<(), Self::Error>
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>
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 is written to the slave on MOSI and
words received on MISO are stored in read. Read moreSource§impl<P, M, S, C, R, T> SpiBus<<C as CharSize>::Word> for Spi<Config<P, M, C>, Duplex, R, T>where
Config<P, M, C>: ValidConfig<Sercom = S>,
S: Sercom,
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>,
impl<P, M, S, C, R, T> SpiBus<<C as CharSize>::Word> for Spi<Config<P, M, C>, Duplex, R, T>where
Config<P, M, C>: ValidConfig<Sercom = S>,
S: Sercom,
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>,
Source§fn read(&mut self, words: &mut [C::Word]) -> Result<(), Self::Error>
fn read(&mut self, words: &mut [C::Word]) -> Result<(), Self::Error>
words from the slave. Read moreSource§fn write(&mut self, words: &[C::Word]) -> Result<(), Self::Error>
fn write(&mut self, words: &[C::Word]) -> Result<(), Self::Error>
words to the slave, ignoring all the incoming words. Read moreSource§fn transfer(
&mut self,
read: &mut [C::Word],
write: &[C::Word],
) -> Result<(), Self::Error>
fn transfer( &mut self, read: &mut [C::Word], write: &[C::Word], ) -> Result<(), Self::Error>
write is written to the slave on MOSI and
words received on MISO are stored in read. Read moreSource§impl<P, M, C> Write<<C as CharSize>::Word> for Spi<Config<P, M, C>, Tx>where
Config<P, M, C>: ValidConfig,
P: ValidPads,
M: OpMode,
C: CharSize,
C::Word: PrimInt + AsPrimitive<DataWidth>,
impl<P, M, C> Write<<C as CharSize>::Word> for Spi<Config<P, M, C>, Tx>where
Config<P, M, C>: ValidConfig,
P: ValidPads,
M: OpMode,
C: CharSize,
C::Word: PrimInt + AsPrimitive<DataWidth>,
Write is only implemented for Spi structs with Tx
Capability. Because the Capability is Tx, this implementation never
reads the DATA register and ignores all buffer overflow errors.
Source§impl<P, M> Write for Spi<Config<P, M, EightBit>, Tx>
impl<P, M> Write for Spi<Config<P, M, EightBit>, Tx>
Source§fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error>
fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error>
Source§fn flush(&mut self) -> Result<(), Self::Error>
fn flush(&mut self) -> Result<(), Self::Error>
Source§impl<P, M, Z, D, R, T, S> Write for Spi<Config<P, M, Z>, D, R, T>where
P: ValidPads,
M: OpMode,
Z: Size<Word = u8> + 'static,
Config<P, M, Z>: ValidConfig<Sercom = S>,
D: Transmit,
S: Sercom,
T: AnyChannel<Status = Ready>,
embedded_io::Write implementation for Transmit Spis in either
Slave or MasterMode, using DMA transfers.
impl<P, M, Z, D, R, T, S> Write for Spi<Config<P, M, Z>, D, R, T>where
P: ValidPads,
M: OpMode,
Z: Size<Word = u8> + 'static,
Config<P, M, Z>: ValidConfig<Sercom = S>,
D: Transmit,
S: Sercom,
T: AnyChannel<Status = Ready>,
embedded_io::Write implementation for Transmit Spis in either
Slave or MasterMode, using DMA transfers.
Source§fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error>
fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error>
Source§fn flush(&mut self) -> Result<(), Self::Error>
fn flush(&mut self) -> Result<(), Self::Error>
Source§impl<P, M> WriteIter<<EightBit as CharSize>::Word> for Spi<Config<P, M, EightBit>, Duplex>
Implement WriteIter for Spi structs with Duplex
Capability
impl<P, M> WriteIter<<EightBit as CharSize>::Word> for Spi<Config<P, M, EightBit>, Duplex>
Implement WriteIter for Spi structs with Duplex
Capability
The transfer accepts a slice of primitive integers, depending on
the CharSize (u8 or u16).
Source§impl<P, M> WriteIter<<EightBit as CharSize>::Word> for Spi<Config<P, M, EightBit>, Tx>
Implement WriteIter for Spi structs with Tx
Capability
impl<P, M> WriteIter<<EightBit as CharSize>::Word> for Spi<Config<P, M, EightBit>, Tx>
Implement WriteIter for Spi structs with Tx
Capability
The transfer accepts a slice of primitive integers, depending on
the CharSize (u8 or u16).
Because the Capability is Tx, this implementation never
reads the DATA register and ignores all buffer overflow errors.
Source§impl<P, M> WriteIter<<NineBit as CharSize>::Word> for Spi<Config<P, M, NineBit>, Duplex>
Implement WriteIter for Spi structs with Duplex
Capability
impl<P, M> WriteIter<<NineBit as CharSize>::Word> for Spi<Config<P, M, NineBit>, Duplex>
Implement WriteIter for Spi structs with Duplex
Capability
The transfer accepts a slice of primitive integers, depending on
the CharSize (u8 or u16).
Source§impl<P, M> WriteIter<<NineBit as CharSize>::Word> for Spi<Config<P, M, NineBit>, Tx>
Implement WriteIter for Spi structs with Tx
Capability
impl<P, M> WriteIter<<NineBit as CharSize>::Word> for Spi<Config<P, M, NineBit>, Tx>
Implement WriteIter for Spi structs with Tx
Capability
The transfer accepts a slice of primitive integers, depending on
the CharSize (u8 or u16).
Because the Capability is Tx, this implementation never
reads the DATA register and ignores all buffer overflow errors.
Source§impl<P, M, A> Transfer<<EightBit as CharSize>::Word> for Spi<Config<P, M, EightBit>, A>
impl<P, M, A> Transfer<<EightBit as CharSize>::Word> for Spi<Config<P, M, EightBit>, A>
The transfer accepts a slice of primitive integers, depending on
the CharSize (u8 or u16).
Source§impl<P, M, A> Transfer<<NineBit as CharSize>::Word> for Spi<Config<P, M, NineBit>, A>
impl<P, M, A> Transfer<<NineBit as CharSize>::Word> for Spi<Config<P, M, NineBit>, A>
The transfer accepts a slice of primitive integers, depending on
the CharSize (u8 or u16).
Source§impl<P, M> Write<<EightBit as CharSize>::Word> for Spi<Config<P, M, EightBit>, Duplex>
Implement Write for Spi structs with Duplex
Capability
impl<P, M> Write<<EightBit as CharSize>::Word> for Spi<Config<P, M, EightBit>, Duplex>
Implement Write for Spi structs with Duplex
Capability
The transfer accepts a slice of primitive integers, depending on
the CharSize (u8 or u16).
Source§impl<P, M> Write<<EightBit as CharSize>::Word> for Spi<Config<P, M, EightBit>, Tx>
Implement Write for Spi structs with Tx
Capability
impl<P, M> Write<<EightBit as CharSize>::Word> for Spi<Config<P, M, EightBit>, Tx>
Implement Write for Spi structs with Tx
Capability
The transfer accepts a slice of primitive integers, depending on
the CharSize (u8 or u16).
Because the Capability is Tx, this implementation never
reads the DATA register and ignores all buffer overflow errors.
Source§impl<P, M> Write<<NineBit as CharSize>::Word> for Spi<Config<P, M, NineBit>, Duplex>
Implement Write for Spi structs with Duplex
Capability
impl<P, M> Write<<NineBit as CharSize>::Word> for Spi<Config<P, M, NineBit>, Duplex>
Implement Write for Spi structs with Duplex
Capability
The transfer accepts a slice of primitive integers, depending on
the CharSize (u8 or u16).
Source§impl<P, M> Write<<NineBit as CharSize>::Word> for Spi<Config<P, M, NineBit>, Tx>
Implement Write for Spi structs with Tx
Capability
impl<P, M> Write<<NineBit as CharSize>::Word> for Spi<Config<P, M, NineBit>, Tx>
Implement Write for Spi structs with Tx
Capability
The transfer accepts a slice of primitive integers, depending on
the CharSize (u8 or u16).
Because the Capability is Tx, this implementation never
reads the DATA register and ignores all buffer overflow errors.
Source§impl<P, M, C> Read<<C as CharSize>::Word> for Spi<Config<P, M, C>, Rx>where
Config<P, M, C>: ValidConfig,
P: ValidPads,
M: MasterMode,
C: CharSize,
C::Word: PrimInt,
DataWidth: AsPrimitive<C::Word>,
Implement serial::Read for Rx Spi structs in a MasterMode
impl<P, M, C> Read<<C as CharSize>::Word> for Spi<Config<P, M, C>, Rx>where
Config<P, M, C>: ValidConfig,
P: ValidPads,
M: MasterMode,
C: CharSize,
C::Word: PrimInt,
DataWidth: AsPrimitive<C::Word>,
Implement serial::Read for Rx Spi structs in a MasterMode
Read is only implemented for Spi structs with Rx
Capability. In a MasterMode, Read has to initiate transactions, so
it keeps track of the transaction state. If a transaction is in progress,
it will wait on RXC. If not, it will wait on DRE, and then send 0.
Source§impl<P, C> Read<<C as CharSize>::Word> for Spi<Config<P, Slave, C>, Rx>where
Config<P, Slave, C>: ValidConfig,
P: ValidPads,
C: CharSize,
C::Word: PrimInt,
DataWidth: AsPrimitive<C::Word>,
Implement serial::Read for Rx Spi structs in Slave
OpMode
impl<P, C> Read<<C as CharSize>::Word> for Spi<Config<P, Slave, C>, Rx>where
Config<P, Slave, C>: ValidConfig,
P: ValidPads,
C: CharSize,
C::Word: PrimInt,
DataWidth: AsPrimitive<C::Word>,
Implement serial::Read for Rx Spi structs in Slave
OpMode
serial::Read is only implemented for Spi structs with Rx
Capability. In Slave OpMode, Read does not have to initiate
transactions, so it does not have to store any internal state. It only has
to wait on RXC.
Source§impl<P, M, C> Write<<C as CharSize>::Word> for Spi<Config<P, M, C>, Tx>where
Config<P, M, C>: ValidConfig,
P: ValidPads,
M: OpMode,
C: CharSize,
C::Word: PrimInt + AsPrimitive<DataWidth>,
Implement serial::Write for Tx Spi structs
impl<P, M, C> Write<<C as CharSize>::Word> for Spi<Config<P, M, C>, Tx>where
Config<P, M, C>: ValidConfig,
P: ValidPads,
M: OpMode,
C: CharSize,
C::Word: PrimInt + AsPrimitive<DataWidth>,
Implement serial::Write for Tx Spi structs
serial::Write is only implemented for Spi structs with Tx
Capability. Because the Capability is Tx, this implementation never
reads the DATA register and ignores all buffer overflow errors.
Source§impl<C> FullDuplex<<C as AnyConfig>::Word> for Spi<C, Duplex>
Implement embedded-hal 0.2 spi::FullDuplex for Spi structs with AtomicSize
impl<C> FullDuplex<<C as AnyConfig>::Word> for Spi<C, Duplex>
Implement embedded-hal 0.2 spi::FullDuplex for Spi structs with AtomicSize
spi::FullDuplex is only implemented when the Spi struct has Duplex
Capability. The Word size used in the implementation depends on the
corresponding CharSize.