spi: add CS delay to accomodate booster

This commit is contained in:
occheung 2021-01-18 14:13:05 +08:00
parent 2ca717c94f
commit 61182a8ef0
1 changed files with 4 additions and 0 deletions

View File

@ -131,13 +131,17 @@ impl <SPI: Transfer<u8>,
match self.spi.transfer(&mut buf) {
Ok(_) => {
// Disable chip select
cortex_m::asm::delay(10_u32);
self.nss.set_high();
cortex_m::asm::delay(4_u32);
Ok(buf[2])
},
// TODO: Maybe too naive?
Err(_) => {
// Disable chip select
cortex_m::asm::delay(10_u32);
self.nss.set_high();
cortex_m::asm::delay(4_u32);
Err(SpiPortError::TransferError)
}
}