Struct serpente::sercom::v2::spi_future::SpiFuture [−][src]
pub struct SpiFuture<S, B, SS = NoneT, W = fn()> where
W: 'static + FnOnce(),
B: 'static + AsRef<[u8]> + AsMut<[u8]>,
S: CheckBufLen,
SS: ControlSS, { /* fields omitted */ }
Expand description
A Future
-like interface for SPI transactions
See the module-level documentation for more details.
Implementations
Add a waker to the SpiFuture
This function changes the waker type, so it must take an owned self
.
Start the SpiFuture
transaction
This will assert the SS pin, if present, and enable the DRE
and RXC
interrupts.
Send the next set of bytes from the buffer
This method should be called from the DRE
interrupt handler. Once all
bytes of the transaction have been sent, this function will
automatically disable the DRE
interrupt.
Received the next set of bytes and write them to the buffer
This method should be called from the RXC
interrupt handler. Once all
bytes of the transaction have been received, this function will
automatically disable the RXC
interrupt, deassert the SS pin (if
present), and call the waker (if present).
Poll the SpiFuture
This function will return Poll::Pending
until all bytes have been
received. When the transaction is complete, it will return
Poll::Ready
with a reference to the completed buffer.