spi: add CS delay to accomodate booster

feature/booster
occheung 2021-01-18 13:59:39 +08:00
parent 1a2c22cfb2
commit 500c855d00
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)
}
}