Skip to content

Commit fba9834

Browse files
bors[bot]newAM
andauthored
Merge #131
131: Poll for completion on SPI write. r=therealprof a=newAM Closes #130 --- Continuing discussion from #130 : The suggested implementation was replacing this: ```rust self.check_send().ok(); Ok(()) ``` With this: ```rust nb::block!(self.check_send()) ``` The concern I have with that is it seems the last `check_send().ok()` was intended to clear the `OVR` error bit that may be set due to dropped reads. Additionally, it does not seem that this works as intended, the CS still goes high before the write is completed with consecutive write calls. Co-authored-by: Alex M <[email protected]>
2 parents fa3f2c2 + 05f3e34 commit fba9834

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/spi.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ where
400400
nb::Error::Other(Error::ModeFault)
401401
} else if sr.crcerr().bit_is_set() {
402402
nb::Error::Other(Error::Crc)
403-
} else if sr.txe().bit_is_set() {
403+
} else if sr.txe().bit_is_set() && sr.bsy().bit_is_clear() {
404404
return Ok(());
405405
} else {
406406
nb::Error::WouldBlock
@@ -482,7 +482,7 @@ where
482482
}
483483

484484
// Do one last status register check before continuing
485-
self.check_send().ok();
485+
nb::block!(self.check_send()).ok();
486486
Ok(())
487487
}
488488
}
@@ -526,7 +526,7 @@ where
526526
}
527527

528528
// Do one last status register check before continuing
529-
self.check_send().ok();
529+
nb::block!(self.check_send()).ok();
530530
Ok(())
531531
}
532532
}

0 commit comments

Comments
 (0)