Skip to content

Commit 5e6234d

Browse files
bjoernQjessebraham
authored andcommitted
Fix embedded-hal 0.2.x SPI implementation
1 parent 4c94337 commit 5e6234d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

esp-hal-common/src/spi.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,9 @@ where
203203
type Error = Infallible;
204204

205205
fn write(&mut self, words: &[u8]) -> Result<(), Self::Error> {
206-
self.spi.write_bytes(words)
206+
self.spi.write_bytes(words)?;
207+
self.spi.flush()?;
208+
Ok(())
207209
}
208210
}
209211

@@ -592,6 +594,9 @@ pub trait Instance {
592594
// Wait for all chunks to complete except the last one.
593595
// The function is allowed to return before the bus is idle.
594596
// see [embedded-hal flushing](https://docs.rs/embedded-hal/1.0.0-alpha.8/embedded_hal/spi/blocking/index.html#flushing)
597+
//
598+
// THIS IS NOT TRUE FOR EH 0.2.X! MAKE SURE TO FLUSH IN EH 0.2.X TRAIT
599+
// IMPLEMENTATIONS!
595600
if i < num_chunks {
596601
while reg_block.cmd.read().usr().bit_is_set() {
597602
// wait

0 commit comments

Comments
 (0)