From 93efdf1d42411724a7432145d573212481ade3a2 Mon Sep 17 00:00:00 2001 From: Diego Barrios Romero Date: Wed, 11 May 2022 21:17:23 +0200 Subject: [PATCH 1/2] Add I2S trait --- src/i2s.rs | 35 +++++++++++++++++++++++++++++++++++ src/lib.rs | 1 + 2 files changed, 36 insertions(+) create mode 100644 src/i2s.rs diff --git a/src/i2s.rs b/src/i2s.rs new file mode 100644 index 000000000..3932d202c --- /dev/null +++ b/src/i2s.rs @@ -0,0 +1,35 @@ +//! I2S API + +/// Blocking I2S traits +pub mod blocking { + + /// Blocking I2S trait + pub trait I2s { + /// Error type + type Error: core::fmt::Debug; + + /// Reads enough bytes to fill `left_words` and `right_words`. + fn read<'w>( + &mut self, + left_words: &'w mut [W], + right_words: &'w mut [W], + ) -> Result<(), Self::Error>; + + /// Sends `left_words` and `right_words`. + fn write<'w>( + &mut self, + left_words: &'w [W], + right_words: &'w [W], + ) -> Result<(), Self::Error>; + + /// Sends `left_words` and `right_words`. + fn write_iter( + &mut self, + left_words: LW, + right_words: RW, + ) -> Result<(), Self::Error> + where + LW: IntoIterator, + RW: IntoIterator; + } +} diff --git a/src/lib.rs b/src/lib.rs index 30099bf0b..4b9162659 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -359,6 +359,7 @@ pub mod can; pub mod delay; pub mod digital; pub mod i2c; +pub mod i2s; pub mod serial; pub mod spi; From 4bb8f1d37e6f398252e50b4223b4674405ea1ba6 Mon Sep 17 00:00:00 2001 From: Diego Barrios Romero Date: Wed, 11 May 2022 21:33:49 +0200 Subject: [PATCH 2/2] Add changleog entry --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ca79a8ec..8f720d894 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +### Added +- I2S traits + ## [v1.0.0-alpha.8] - 2022-04-15 *** This is (also) an alpha release with breaking changes (sorry) ***