Skip to content

Commit

Permalink
Fix embedded-hal 0.2.x SPI implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
bjoernQ authored and jessebraham committed Aug 24, 2022
1 parent 4c94337 commit 5e6234d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion esp-hal-common/src/spi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,9 @@ where
type Error = Infallible;

fn write(&mut self, words: &[u8]) -> Result<(), Self::Error> {
self.spi.write_bytes(words)
self.spi.write_bytes(words)?;
self.spi.flush()?;
Ok(())
}
}

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

0 comments on commit 5e6234d

Please sign in to comment.