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, 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: The implementation of of serial::Write::flush
waits on and
clears the TXC
flag. Manually clearing this flag could cause it 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, D, RxDma, TxDma, S> Spi<C, D, RxDma, TxDma>where
C: ValidConfig,
D: Capability,
RxDma: AnyChannel<Status = S>,
TxDma: AnyChannel<Status = S>,
S: ReadyChannel,
impl<C, D, RxDma, TxDma, S> Spi<C, D, RxDma, TxDma>where
C: ValidConfig,
D: Capability,
RxDma: AnyChannel<Status = S>,
TxDma: AnyChannel<Status = S>,
S: ReadyChannel,
Sourcepub fn take_dma_channels(self) -> (Spi<C, D, NoneT, NoneT>, RxDma, TxDma)
pub fn take_dma_channels(self) -> (Spi<C, D, NoneT, NoneT>, RxDma, TxDma)
Reclaim the DMA channels. Any subsequent SPI transaction will not use DMA.
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, D, R, T, S> Spi<C, D, R, T>
impl<C, D, R, T, S> Spi<C, D, R, T>
Sourcepub fn take_rx_channel(self) -> (Spi<C, D, NoneT, T>, R)
pub fn take_rx_channel(self) -> (Spi<C, D, NoneT, T>, R)
Reclaim the Rx DMA channel. Any subsequent SPI transaction will not use DMA.
Source§impl<C> Spi<C, Tx>where
C: ValidConfig,
impl<C> Spi<C, Tx>where
C: ValidConfig,
Source§impl<C, D, R, T, S> Spi<C, D, R, T>
impl<C, D, R, T, S> Spi<C, D, R, T>
Sourcepub fn take_tx_channel(self) -> (Spi<C, D, R, NoneT>, T)
pub fn take_tx_channel(self) -> (Spi<C, D, R, NoneT>, T)
Reclaim the DMA channel. Any subsequent SPI 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, A> Spi<C, A>
impl<C, A> Spi<C, A>
Sourcepub fn send_with_dma<Ch, B>(
self,
buf: B,
channel: Ch,
) -> Transfer<Channel<Ch::Id, Busy>, BufferPair<B, Self>>
👎Deprecated since 0.19.0: Use Spi::with_dma_channels
instead. You will have access to DMA-enabled embedded-hal
implementations.
pub fn send_with_dma<Ch, B>( self, buf: B, channel: Ch, ) -> Transfer<Channel<Ch::Id, Busy>, BufferPair<B, Self>>
Spi::with_dma_channels
instead. You will have access to DMA-enabled embedded-hal
implementations.Source§impl<C, A> Spi<C, A>
impl<C, A> Spi<C, A>
Sourcepub fn receive_with_dma<Ch, B>(
self,
buf: B,
channel: Ch,
) -> Transfer<Channel<Ch::Id, Busy>, BufferPair<Self, B>>
👎Deprecated since 0.19.0: Use Spi::with_dma_channels
instead. You will have access to DMA-enabled embedded-hal
implementations.
pub fn receive_with_dma<Ch, B>( self, buf: B, channel: Ch, ) -> Transfer<Channel<Ch::Id, Busy>, BufferPair<Self, B>>
Spi::with_dma_channels
instead. You will have access to DMA-enabled embedded-hal
implementations.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, A> Buffer for Spi<C, A>where
C: ValidConfig,
C::OpMode: MasterMode,
C::Size: AtomicSize<Word = C::Word>,
C::Word: Beat,
A: Capability,
impl<C, A> Buffer for Spi<C, A>where
C: ValidConfig,
C::OpMode: MasterMode,
C::Size: AtomicSize<Word = C::Word>,
C::Word: Beat,
A: Capability,
Source§fn dma_ptr(&mut self) -> *mut Self::Beat
fn dma_ptr(&mut self) -> *mut Self::Beat
Source§fn incrementing(&self) -> bool
fn incrementing(&self) -> bool
Source§fn buffer_len(&self) -> usize
fn buffer_len(&self) -> usize
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 [spi::FullDuplex
] for Spi
structs with AtomicSize
impl<C> FullDuplex<<C as AnyConfig>::Word> for Spi<C, Duplex>
Implement [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
Spi
s 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
Spi
s 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
Spi
s 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
Spi
s 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
Spi
s 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
Spi
s 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 [spi::FullDuplex
] for Spi
structs with AtomicSize
impl<C> FullDuplex<<C as AnyConfig>::Word> for Spi<C, Duplex>
Implement [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
.
impl<C> Default<<C as AnyConfig>::Word> for Spi<C, Tx>
Auto Trait Implementations§
impl<C, A, RxDma, TxDma> Freeze for Spi<C, A, RxDma, TxDma>
impl<C, A, RxDma, TxDma> RefUnwindSafe for Spi<C, A, RxDma, TxDma>
impl<C, A, RxDma, TxDma> Send for Spi<C, A, RxDma, TxDma>
impl<C, A, RxDma, TxDma> Sync for Spi<C, A, RxDma, TxDma>
impl<C, A, RxDma, TxDma> Unpin for Spi<C, A, RxDma, TxDma>
impl<C, A, RxDma, TxDma> UnwindSafe for Spi<C, A, RxDma, TxDma>
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
Source§impl<S> CheckBufLen for Swhere
S: AnySpi,
impl<S> CheckBufLen for Swhere
S: AnySpi,
Source§const LEN: usize = _
const LEN: usize = _
async
APIs available in the spi
module as a replacement.Spi
transaction lengthSource§fn len(&self) -> usize
fn len(&self) -> usize
async
APIs available in the spi
module as a replacement.Source§const STEP: usize = _
const STEP: usize = _
async
APIs available in the spi
module as a replacement.