Replace wait_for_idle with spin_until_idle

This commit is contained in:
Grant Miller
2021-12-14 16:05:39 -06:00
parent e75cb1a564
commit a13a7a6616
4 changed files with 46 additions and 43 deletions

View File

@ -431,6 +431,26 @@ fn spin_until_rx_ready(regs: Regs) -> Result<(), Error> {
}
}
fn spin_until_idle(regs: Regs) {
#[cfg(any(spi_v1, spi_f1))]
unsafe {
while regs.sr().read().bsy() {}
}
#[cfg(spi_v2)]
unsafe {
while regs.sr().read().ftlvl() > 0 {}
while regs.sr().read().frlvl() > 0 {}
while regs.sr().read().bsy() {}
}
#[cfg(spi_v3)]
unsafe {
while !regs.sr().read().txc() {}
while regs.sr().read().rxplvl().0 > 0 {}
}
}
trait Word {
const WORDSIZE: WordSize;
}