pub struct SpiFuture<C, A, R = NoneT, T = NoneT>where
C: ValidConfig,
A: Capability,{ /* private fields */ }
Expand description
async
version of Spi
.
Create this struct by calling Spi::into_future
.
Implementations§
Source§impl<C, D, RxDma, TxDma> SpiFuture<C, D, RxDma, TxDma>where
C: ValidConfig,
D: Capability,
RxDma: AnyChannel<Status = ReadyFuture>,
TxDma: AnyChannel<Status = ReadyFuture>,
impl<C, D, RxDma, TxDma> SpiFuture<C, D, RxDma, TxDma>where
C: ValidConfig,
D: Capability,
RxDma: AnyChannel<Status = ReadyFuture>,
TxDma: AnyChannel<Status = ReadyFuture>,
Sourcepub fn take_dma_channels(self) -> (SpiFuture<C, D, NoneT, NoneT>, RxDma, TxDma)
pub fn take_dma_channels(self) -> (SpiFuture<C, D, NoneT, NoneT>, RxDma, TxDma)
Reclaim the DMA channels. Any subsequent SPI transaction will not use DMA.
Source§impl<C, D, R, T> SpiFuture<C, D, R, T>
impl<C, D, R, T> SpiFuture<C, D, R, T>
Sourcepub fn take_rx_channel(self) -> (SpiFuture<C, D, NoneT, T>, R)
pub fn take_rx_channel(self) -> (SpiFuture<C, D, NoneT, T>, R)
Reclaim the Rx DMA channel. Any subsequent SPI transaction will not use DMA.
Source§impl<C, D, R, T> SpiFuture<C, D, R, T>
impl<C, D, R, T> SpiFuture<C, D, R, T>
Sourcepub fn take_tx_channel(self) -> (SpiFuture<C, D, R, NoneT>, T)
pub fn take_tx_channel(self) -> (SpiFuture<C, D, R, NoneT>, T)
Reclaim the DMA channel. Any subsequent SPI transaction will not use DMA.
Source§impl<C, S, R> SpiFuture<C, Rx, R, NoneT>where
C: ValidConfig<Sercom = S>,
C::Word: PrimInt + AsPrimitive<DataWidth>,
DataWidth: AsPrimitive<C::Word>,
S: Sercom,
impl<C, S, R> SpiFuture<C, Rx, R, NoneT>where
C: ValidConfig<Sercom = S>,
C::Word: PrimInt + AsPrimitive<DataWidth>,
DataWidth: AsPrimitive<C::Word>,
S: Sercom,
Sourcepub fn with_rx_dma_channel<Chan: AnyChannel<Status = ReadyFuture>>(
self,
rx_channel: Chan,
) -> SpiFuture<C, Rx, Chan, NoneT>
pub fn with_rx_dma_channel<Chan: AnyChannel<Status = ReadyFuture>>( self, rx_channel: Chan, ) -> SpiFuture<C, Rx, Chan, NoneT>
Add a DMA channel for receiving transactions
Source§impl<C, S, T> SpiFuture<C, Tx, NoneT, T>where
C: ValidConfig<Sercom = S>,
C::Word: PrimInt + AsPrimitive<DataWidth>,
DataWidth: AsPrimitive<C::Word>,
S: Sercom,
impl<C, S, T> SpiFuture<C, Tx, NoneT, T>where
C: ValidConfig<Sercom = S>,
C::Word: PrimInt + AsPrimitive<DataWidth>,
DataWidth: AsPrimitive<C::Word>,
S: Sercom,
Sourcepub fn with_tx_dma_channel<Chan: AnyChannel<Status = ReadyFuture>>(
self,
tx_channel: Chan,
) -> SpiFuture<C, Tx, NoneT, Chan>
pub fn with_tx_dma_channel<Chan: AnyChannel<Status = ReadyFuture>>( self, tx_channel: Chan, ) -> SpiFuture<C, Tx, NoneT, Chan>
Add a DMA channel for receiving transactions
Source§impl<C, S, R, T> SpiFuture<C, Duplex, R, T>where
C: ValidConfig<Sercom = S>,
C::Word: PrimInt + AsPrimitive<DataWidth>,
DataWidth: AsPrimitive<C::Word>,
S: Sercom,
impl<C, S, R, T> SpiFuture<C, Duplex, R, T>where
C: ValidConfig<Sercom = S>,
C::Word: PrimInt + AsPrimitive<DataWidth>,
DataWidth: AsPrimitive<C::Word>,
S: Sercom,
Sourcepub fn with_dma_channels<ChanRx, ChanTx>(
self,
rx_channel: ChanRx,
tx_channel: ChanTx,
) -> SpiFuture<C, Duplex, ChanRx, ChanTx>
pub fn with_dma_channels<ChanRx, ChanTx>( self, rx_channel: ChanRx, tx_channel: ChanTx, ) -> SpiFuture<C, Duplex, ChanRx, ChanTx>
Add a DMA channel for receiving transactions
Source§impl<P, M, Z, D, R, T, S> SpiFuture<Config<P, M, Z>, D, R, T>where
P: ValidPads,
M: OpMode,
Z: Size + 'static,
Config<P, M, Z>: ValidConfig<Sercom = S>,
D: Transmit,
S: Sercom,
Z::Word: PrimInt + AsPrimitive<DataWidth> + Beat,
DataWidth: AsPrimitive<Z::Word>,
T: AnyChannel<Status = ReadyFuture>,
impl<P, M, Z, D, R, T, S> SpiFuture<Config<P, M, Z>, D, R, T>where
P: ValidPads,
M: OpMode,
Z: Size + 'static,
Config<P, M, Z>: ValidConfig<Sercom = S>,
D: Transmit,
S: Sercom,
Z::Word: PrimInt + AsPrimitive<DataWidth> + Beat,
DataWidth: AsPrimitive<Z::Word>,
T: AnyChannel<Status = ReadyFuture>,
Source§impl<P, M, S, C, D, R, T> SpiFuture<Config<P, M, C>, D, 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,
D: Capability,
DataWidth: AsPrimitive<C::Word>,
R: AnyChannel<Status = ReadyFuture>,
T: AnyChannel<Status = ReadyFuture>,
impl<P, M, S, C, D, R, T> SpiFuture<Config<P, M, C>, D, 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,
D: Capability,
DataWidth: AsPrimitive<C::Word>,
R: AnyChannel<Status = ReadyFuture>,
T: AnyChannel<Status = ReadyFuture>,
Source§impl<C, D> SpiFuture<C, D, NoneT, NoneT>where
C: ValidConfig,
D: Capability,
impl<C, D> SpiFuture<C, D, NoneT, NoneT>where
C: ValidConfig,
D: Capability,
Source§impl<P, M, C, D, R, S> SpiFuture<Config<P, M, C>, D, R, NoneT>where
Config<P, M, C>: ValidConfig<Sercom = S>,
P: ValidPads,
M: OpMode,
C: Size + 'static,
C::Word: PrimInt + AsPrimitive<DataWidth>,
D: Transmit,
DataWidth: AsPrimitive<C::Word>,
S: Sercom,
impl<P, M, C, D, R, S> SpiFuture<Config<P, M, C>, D, R, NoneT>where
Config<P, M, C>: ValidConfig<Sercom = S>,
P: ValidPads,
M: OpMode,
C: Size + 'static,
C::Word: PrimInt + AsPrimitive<DataWidth>,
D: Transmit,
DataWidth: AsPrimitive<C::Word>,
S: Sercom,
Source§impl<P, M, C, D, T, S> SpiFuture<Config<P, M, C>, D, NoneT, T>where
Config<P, M, C>: ValidConfig<Sercom = S>,
P: ValidPads,
M: MasterMode,
C: Size + 'static,
C::Word: PrimInt + AsPrimitive<DataWidth>,
D: Receive,
DataWidth: AsPrimitive<C::Word>,
S: Sercom,
impl<P, M, C, D, T, S> SpiFuture<Config<P, M, C>, D, NoneT, T>where
Config<P, M, C>: ValidConfig<Sercom = S>,
P: ValidPads,
M: MasterMode,
C: Size + 'static,
C::Word: PrimInt + AsPrimitive<DataWidth>,
D: Receive,
DataWidth: AsPrimitive<C::Word>,
S: Sercom,
Source§impl<P, M, C, S, D, R, T> SpiFuture<Config<P, M, C>, D, R, T>where
Config<P, M, C>: ValidConfig<Sercom = S>,
P: ValidPads,
M: OpMode,
C: Size + 'static,
C::Word: PrimInt + AsPrimitive<DataWidth>,
DataWidth: AsPrimitive<C::Word>,
D: Capability,
S: Sercom,
impl<P, M, C, S, D, R, T> SpiFuture<Config<P, M, C>, D, R, T>where
Config<P, M, C>: ValidConfig<Sercom = S>,
P: ValidPads,
M: OpMode,
C: Size + 'static,
C::Word: PrimInt + AsPrimitive<DataWidth>,
DataWidth: AsPrimitive<C::Word>,
D: Capability,
S: Sercom,
Trait Implementations§
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, 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, A, R, T> ErrorType for SpiFuture<C, A, R, T>where
C: ValidConfig,
A: Capability,
impl<C, A, R, T> ErrorType for SpiFuture<C, A, R, T>where
C: ValidConfig,
A: Capability,
Source§impl<C, A, R, T> ErrorType for SpiFuture<C, A, R, T>where
C: ValidConfig,
A: Capability,
impl<C, A, R, T> ErrorType for SpiFuture<C, A, R, T>where
C: ValidConfig,
A: Capability,
Source§impl<C, A, R, T> Format for SpiFuture<C, A, R, T>where
C: ValidConfig,
A: Capability,
impl<C, A, R, T> Format for SpiFuture<C, A, R, T>where
C: ValidConfig,
A: Capability,
Source§impl<P, M, Z, D, T, S> Read for SpiFuture<Config<P, M, Z>, D, NoneT, T>where
P: ValidPads,
M: MasterMode,
Z: Size<Word = u8> + 'static,
Config<P, M, Z>: ValidConfig<Sercom = S>,
D: Receive,
S: Sercom,
embedded_io::Read
implementation for Receive
SpiFuture
s in
MasterMode
.
impl<P, M, Z, D, T, S> Read for SpiFuture<Config<P, M, Z>, D, NoneT, T>where
P: ValidPads,
M: MasterMode,
Z: Size<Word = u8> + 'static,
Config<P, M, Z>: ValidConfig<Sercom = S>,
D: Receive,
S: Sercom,
embedded_io::Read
implementation for Receive
SpiFuture
s in
MasterMode
.
Source§async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
Source§async fn read_exact(
&mut self,
buf: &mut [u8],
) -> Result<(), ReadExactError<Self::Error>>
async 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 SpiFuture<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 = ReadyFuture>,
T: AnyChannel<Status = ReadyFuture>,
embedded_io::Read
implementation for Receive
SpiFuture
s in
MasterMode
, using DMA transfers.
impl<P, M, Z, D, R, T, S> Read for SpiFuture<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 = ReadyFuture>,
T: AnyChannel<Status = ReadyFuture>,
embedded_io::Read
implementation for Receive
SpiFuture
s in
MasterMode
, using DMA transfers.
Source§async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
Source§async fn read_exact(
&mut self,
buf: &mut [u8],
) -> Result<(), ReadExactError<Self::Error>>
async fn read_exact( &mut self, buf: &mut [u8], ) -> Result<(), ReadExactError<Self::Error>>
buf
. Read moreSource§impl<P, Z, D, T, S> Read for SpiFuture<Config<P, Slave, Z>, D, NoneT, T>
embedded_io::Read
implementation for Receive
SpiFuture
s in
Slave
mode.
impl<P, Z, D, T, S> Read for SpiFuture<Config<P, Slave, Z>, D, NoneT, T>
embedded_io::Read
implementation for Receive
SpiFuture
s in
Slave
mode.
Source§async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
Source§async fn read_exact(
&mut self,
buf: &mut [u8],
) -> Result<(), ReadExactError<Self::Error>>
async fn read_exact( &mut self, buf: &mut [u8], ) -> Result<(), ReadExactError<Self::Error>>
buf
. Read moreSource§impl<P, Z, D, R, T, S> Read for SpiFuture<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 = ReadyFuture>,
embedded_io::Read
implementation for Receive
SpiFuture
s in
Slave
mode, using DMA transfers.
impl<P, Z, D, R, T, S> Read for SpiFuture<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 = ReadyFuture>,
embedded_io::Read
implementation for Receive
SpiFuture
s in
Slave
mode, using DMA transfers.
Source§async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
Source§async fn read_exact(
&mut self,
buf: &mut [u8],
) -> Result<(), ReadExactError<Self::Error>>
async fn read_exact( &mut self, buf: &mut [u8], ) -> Result<(), ReadExactError<Self::Error>>
buf
. Read moreSource§impl<P, M, C, S> SpiBus<<C as CharSize>::Word> for SpiFuture<Config<P, M, C>, Duplex>where
Config<P, M, C>: ValidConfig<Sercom = S>,
P: ValidPads,
M: MasterMode,
C: Size + 'static,
C::Word: PrimInt + AsPrimitive<DataWidth>,
DataWidth: AsPrimitive<C::Word>,
S: Sercom,
impl<P, M, C, S> SpiBus<<C as CharSize>::Word> for SpiFuture<Config<P, M, C>, Duplex>where
Config<P, M, C>: ValidConfig<Sercom = S>,
P: ValidPads,
M: MasterMode,
C: Size + 'static,
C::Word: PrimInt + AsPrimitive<DataWidth>,
DataWidth: AsPrimitive<C::Word>,
S: Sercom,
Source§async fn read(&mut self, words: &mut [C::Word]) -> Result<(), Self::Error>
async fn read(&mut self, words: &mut [C::Word]) -> Result<(), Self::Error>
words
from the slave. Read moreSource§async fn write(&mut self, words: &[C::Word]) -> Result<(), Self::Error>
async fn write(&mut self, words: &[C::Word]) -> Result<(), Self::Error>
words
to the slave, ignoring all the incoming words. Read moreSource§async fn transfer(
&mut self,
read: &mut [C::Word],
write: &[C::Word],
) -> Result<(), Self::Error>
async 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, S, R, T> SpiBus<<C as CharSize>::Word> for SpiFuture<Config<P, M, C>, Duplex, R, T>where
S: Sercom,
Config<P, M, C>: ValidConfig<Sercom = S>,
P: ValidPads,
M: MasterMode,
C: Size + 'static,
C::Word: PrimInt + AsPrimitive<DataWidth> + Beat,
DataWidth: AsPrimitive<C::Word>,
R: AnyChannel<Status = ReadyFuture>,
T: AnyChannel<Status = ReadyFuture>,
impl<P, M, C, S, R, T> SpiBus<<C as CharSize>::Word> for SpiFuture<Config<P, M, C>, Duplex, R, T>where
S: Sercom,
Config<P, M, C>: ValidConfig<Sercom = S>,
P: ValidPads,
M: MasterMode,
C: Size + 'static,
C::Word: PrimInt + AsPrimitive<DataWidth> + Beat,
DataWidth: AsPrimitive<C::Word>,
R: AnyChannel<Status = ReadyFuture>,
T: AnyChannel<Status = ReadyFuture>,
Source§async fn read(&mut self, words: &mut [C::Word]) -> Result<(), Self::Error>
async fn read(&mut self, words: &mut [C::Word]) -> Result<(), Self::Error>
words
from the slave. Read moreSource§async fn write(&mut self, words: &[C::Word]) -> Result<(), Self::Error>
async fn write(&mut self, words: &[C::Word]) -> Result<(), Self::Error>
words
to the slave, ignoring all the incoming words. Read moreSource§async fn transfer(
&mut self,
read: &mut [C::Word],
write: &[C::Word],
) -> Result<(), Self::Error>
async 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, Z, D, R, S> Write for SpiFuture<Config<P, M, Z>, D, R, NoneT>
embedded_io::Write
implementation for Transmit
SpiFuture
s in
either Slave
or MasterMode
.
impl<P, M, Z, D, R, S> Write for SpiFuture<Config<P, M, Z>, D, R, NoneT>
embedded_io::Write
implementation for Transmit
SpiFuture
s in
either Slave
or MasterMode
.
Source§async fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error>
async fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error>
Source§impl<P, M, Z, D, R, T, S> Write for SpiFuture<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 = ReadyFuture>,
embedded_io::Write
implementation for Transmit
SpiFuture
s in
either Slave
or MasterMode
, using DMA transfers.
impl<P, M, Z, D, R, T, S> Write for SpiFuture<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 = ReadyFuture>,
embedded_io::Write
implementation for Transmit
SpiFuture
s in
either Slave
or MasterMode
, using DMA transfers.