From 849801aa8898e47a28b3bbaf99de04977b0c919f Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Tue, 22 Jun 2021 17:11:57 +0200 Subject: [PATCH] blocking/spi: Don't return the same buffer back. --- CHANGELOG.md | 1 + src/blocking/spi.rs | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a025f091d..2528edb68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - `blocking::Serial`: renamed `bwrite_all` to `write`, `bflush` to `flush. - Removed `prelude` to avoid method name conflicts between different flavors (blocking, nb) of the same trait. Traits must now be manually imported. - Removed the various `Default` marker traits. +- Removed `&[W]` returned slice in `spi::blocking::Transfer`. ### Removed - Removed random number generation (`rng`) traits in favor of [rand_core](https://crates.io/crates/rand_core). diff --git a/src/blocking/spi.rs b/src/blocking/spi.rs index 1ef690f8b..36fa90e2a 100644 --- a/src/blocking/spi.rs +++ b/src/blocking/spi.rs @@ -5,8 +5,10 @@ pub trait Transfer { /// Error type type Error; - /// Writes `words` to the slave. Returns the `words` received from the slave - fn transfer<'w>(&mut self, words: &'w mut [W]) -> Result<&'w [W], Self::Error>; + /// Writes and reads simultaneously. The contents of `words` are + /// written to the slave, and the received words are stored into the same + /// `words` buffer, overwriting it. + fn transfer(&mut self, words: &mut [W]) -> Result<(), Self::Error>; } /// Blocking write