pub struct Spi<I, P, State> { /* private fields */ }Expand description
Entry point to the SPI API
Implementations§
Source§impl<I, P, Word> Spi<I, P, Enabled<Word>>
impl<I, P, Word> Spi<I, P, Enabled<Word>>
Sourcepub fn transfer_all<B>(
self,
buffer: Pin<B>,
dma_rx: &Handle<<Rx<I> as Target>::Instance, Enabled>,
dma_tx: &Handle<<Tx<I> as Target>::Instance, Enabled>,
rx: <Rx<I> as Target>::Stream,
tx: <Tx<I> as Target>::Stream,
) -> Transfer<Word, I, P, B, Rx<I>, Tx<I>, Ready>
pub fn transfer_all<B>( self, buffer: Pin<B>, dma_rx: &Handle<<Rx<I> as Target>::Instance, Enabled>, dma_tx: &Handle<<Tx<I> as Target>::Instance, Enabled>, rx: <Rx<I> as Target>::Stream, tx: <Tx<I> as Target>::Stream, ) -> Transfer<Word, I, P, B, Rx<I>, Tx<I>, Ready>
Start an SPI transfer using DMA
Sends the data in buffer and writes the received data into buffer
right after. Returns a Transfer, to represent the ongoing SPI
transfer.
Please note that the word “transfer” is used with two different meanings here:
- An SPI transfer, as in an SPI transaction that involves both sending and receiving data. The method name refers to this kind of transfer.
- A DMA transfer, as in an ongoing DMA operation. The name of the return type refers to this kind of transfer.
This method, as well as all other DMA-related methods in this module, requires references to two DMA handles, one each for the RX and TX streams. This will actually always be the same handle, as each SPI instance uses the same DMA instance for both sending and receiving. It would be nice to simplify that, but I believe that requires an equality constraint in the where clause, which is not supported yet by the compiler.
Trait Implementations§
Source§impl<I, P, Word> FullDuplex<Word> for Spi<I, P, Enabled<Word>>
impl<I, P, Word> FullDuplex<Word> for Spi<I, P, Enabled<Word>>
impl<I, P, Word> Default<Word> for Spi<I, P, Enabled<Word>>
impl<I, P, Word> Default<Word> for Spi<I, P, Enabled<Word>>
impl<I, P, Word> Default<Word> for Spi<I, P, Enabled<Word>>
Auto Trait Implementations§
impl<I, P, State> Freeze for Spi<I, P, State>
impl<I, P, State> RefUnwindSafe for Spi<I, P, State>
impl<I, P, State> Send for Spi<I, P, State>
impl<I, P, State> Sync for Spi<I, P, State>
impl<I, P, State> Unpin for Spi<I, P, State>
impl<I, P, State> UnwindSafe for Spi<I, P, State>
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
Source§impl<W, S> WriteIter<W> for S
impl<W, S> WriteIter<W> for S
Source§type Error = <S as FullDuplex<W>>::Error
type Error = <S as FullDuplex<W>>::Error
Error type
Source§fn write_iter<WI>(
&mut self,
words: WI,
) -> Result<(), <S as FullDuplex<W>>::Error>where
WI: IntoIterator<Item = W>,
fn write_iter<WI>(
&mut self,
words: WI,
) -> Result<(), <S as FullDuplex<W>>::Error>where
WI: IntoIterator<Item = W>,
Sends
words to the slave, ignoring all the incoming words