We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ae9fdd0 commit 137b473Copy full SHA for 137b473
src/blocking/spi.rs
@@ -76,3 +76,31 @@ pub mod write {
76
}
77
78
79
+
80
+/// Blocking write (iterator version)
81
+#[cfg(feature = "unproven")]
82
+pub mod write_iter {
83
+ /// Default implementation of `blocking::spi::WriteIter<W>` for implementers of
84
+ /// `spi::FullDuplex<W>`
85
+ pub trait Default<W>: ::spi::FullDuplex<W> {}
86
87
+ impl<W, S> ::blocking::spi::WriteIter<W> for S
88
+ where
89
+ S: Default<W>,
90
+ W: Clone,
91
+ {
92
+ type Error = S::Error;
93
94
+ fn write_iter<WI>(&mut self, words: WI) -> Result<(), S::Error>
95
96
+ WI: IntoIterator<Item = W>,
97
98
+ for word in words.into_iter() {
99
+ block!(self.send(word.clone()))?;
100
+ block!(self.read())?;
101
+ }
102
103
+ Ok(())
104
105
106
+}
0 commit comments