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

Create a new SpiFuture with no SS pin or waker

Add an SS pin to the SpiFuture

This function changes the SS type, so it must take an owned self.

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.

Consume the SpiFuture and free its components

If the transaction is complete, this function will consume the SpiFuture and return the Spi object, the buffer, and the SS pin, if present.

If the transaction is not complete, it will return Err(self).

Consume the SpiFuture and free its components without checking for completion

Ending the transaction prematurely could leave the Spi in an inconsistent state. It is not safe to call this function unless the transaction is complete.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.