Skip to content

Commit aadcd21

Browse files
bors[bot]imihajlow
andauthored
Merge #442
442: Add a public method to check for Busy flag in SPI r=burrbull a=imihajlow Use case: after waiting on a DMA transfer in master mode, make sure the last byte is transferred correctly by waiting for the busy flag to be cleared before disabling SPI. Co-authored-by: Ivan Mikhailov <[email protected]>
2 parents f063d5b + 18ab7ad commit aadcd21

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
2727
- Allow access to the `Tx` and `Rx` parts of the `Serial` without the need for splitting.
2828
- Allow `Serial` reconfiguration by references to the `Tx` and `Rx` parts.
2929
- Allow `Serial` release after splitting.
30+
- `Spi::is_busy()`
3031

3132
## [v0.9.0] - 2022-03-02
3233

src/spi.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,10 @@ where
460460
pub fn is_overrun(&self) -> bool {
461461
self.spi.sr.read().ovr().bit_is_set()
462462
}
463+
464+
pub fn is_busy(&self) -> bool {
465+
self.spi.sr.read().bsy().bit_is_set()
466+
}
463467
}
464468

465469
impl<SPI, REMAP, PINS> Spi<SPI, REMAP, PINS, u8, Master>

0 commit comments

Comments
 (0)