pub struct SpiFuture<S, B, SS = NoneT, W = fn()> where
S: CheckBufLen,
B: 'static + AsRef<[u8]> + AsMut<[u8]>,
SS: ControlSS,
W: 'static + FnOnce(), { /* 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.
Auto Trait Implementations
impl<S, B, SS, W> RefUnwindSafe for SpiFuture<S, B, SS, W> where
B: RefUnwindSafe,
S: RefUnwindSafe,
SS: RefUnwindSafe,
W: RefUnwindSafe,
impl<S, B, SS, W> UnwindSafe for SpiFuture<S, B, SS, W> where
B: UnwindSafe,
S: UnwindSafe,
SS: UnwindSafe,
W: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
Casts the value.
Casts the value.
Casts the value.
OverflowingCasts the value.
Casts the value.
Casts the value.
Casts the value.
UnwrappedCasts the value.
Casts the value.
WrappingCasts the value.