Skip to content

Commit

Permalink
Merge #120
Browse files Browse the repository at this point in the history
120: Document implicit assumption in non-blocking spi trait r=therealprof a=david-sawatzke

It should only be able to read the data returned by the last write call. Otherwise the overflow handling isn't really possible when doing only write calls (at least on stm32f0). @therealprof and me came to this conclusion after chatting on irc that this is the intended usage of this api.

Co-authored-by: David Sawatzke <david-sawatzke@users.noreply.github.com>
Co-authored-by: David Sawatzke <d-git@sawatzke.dev>
Co-authored-by: david-sawatzke <david-sawatzke@users.noreply.github.com>
  • Loading branch information
3 people authored Sep 16, 2020
2 parents 6f17287 + 5bae50b commit ea5b5ce
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/spi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@ use nb;
///
/// - It's the task of the user of this interface to manage the slave select lines
///
/// - Due to how full duplex SPI works each `read` call must be preceded by a `send` call.
/// - Due to how full duplex SPI works each `try_read` call must be preceded by a `try_send` call.
///
/// - `try_read` calls only return the data received with the last `try_send` call.
/// Previously received data is discarded
///
/// - Data is only guaranteed to be clocked out when the `try_read` call succeeds.
/// The slave select line shouldn't be released before that.
///
/// - Some SPIs can work with 8-bit *and* 16-bit words. You can overload this trait with different
/// `Word` types to allow operation in both modes.
Expand Down

0 comments on commit ea5b5ce

Please sign in to comment.