From c4a8eb7b843fcc736844ecd7a1818520c8b7b0af Mon Sep 17 00:00:00 2001 From: David Sawatzke Date: Wed, 2 Jan 2019 17:59:31 +0100 Subject: [PATCH 1/4] Document implicit assumption in spi non-blocking trait --- src/spi.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/spi.rs b/src/spi.rs index d2c8a15e4..83080156f 100644 --- a/src/spi.rs +++ b/src/spi.rs @@ -10,6 +10,9 @@ use nb; /// /// - Due to how full duplex SPI works each `read` call must be preceded by a `send` call. /// +/// - `read` calls only return the data received with the last `send` call. +/// Previously received data is discarded +/// /// - 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. pub trait FullDuplex { From ce8a7b9729a67a507a557e99495d784d606999cd Mon Sep 17 00:00:00 2001 From: David Sawatzke Date: Thu, 3 Jan 2019 15:56:01 +0100 Subject: [PATCH 2/4] Document implicit assumption about the blocking behaviour of the calls --- src/spi.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/spi.rs b/src/spi.rs index 83080156f..b9b55e66a 100644 --- a/src/spi.rs +++ b/src/spi.rs @@ -13,6 +13,9 @@ use nb; /// - `read` calls only return the data received with the last `send` call. /// Previously received data is discarded /// +/// - Data is only guaranteed to be clocked out when the `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. pub trait FullDuplex { From b8df447267d58b48ff176276808a18ee388c4acb Mon Sep 17 00:00:00 2001 From: David Sawatzke Date: Mon, 27 Jul 2020 18:55:05 +0200 Subject: [PATCH 3/4] Update documentation for FullDuplex to `try_` methods --- src/spi.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/spi.rs b/src/spi.rs index b9b55e66a..c6ae0fb77 100644 --- a/src/spi.rs +++ b/src/spi.rs @@ -8,12 +8,12 @@ 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. /// -/// - `read` calls only return the data received with the last `send` call. +/// - `try_read` calls only return the data received with the last `send` call. /// Previously received data is discarded /// -/// - Data is only guaranteed to be clocked out when the `read` call succeeds. +/// - 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 From 5bae50b7a08f932d7d617c3bbfe1cad815d70e8e Mon Sep 17 00:00:00 2001 From: david-sawatzke Date: Wed, 16 Sep 2020 13:43:38 +0200 Subject: [PATCH 4/4] Fix missed remaining `send` in FullDuplex documentation Co-authored-by: Vadim Kaushan --- src/spi.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/spi.rs b/src/spi.rs index c6ae0fb77..4ab422d65 100644 --- a/src/spi.rs +++ b/src/spi.rs @@ -10,7 +10,7 @@ use nb; /// /// - 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 `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.