spi: add CS delay
This commit is contained in:
parent
c4b62cc238
commit
26dabd4dc0
|
@ -131,13 +131,17 @@ impl <SPI: Transfer<u8>,
|
||||||
match self.spi.transfer(&mut buf) {
|
match self.spi.transfer(&mut buf) {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
// Disable chip select
|
// Disable chip select
|
||||||
|
cortex_m::asm::delay(10_u32);
|
||||||
self.nss.set_high();
|
self.nss.set_high();
|
||||||
|
cortex_m::asm::delay(5_u32);
|
||||||
Ok(buf[2])
|
Ok(buf[2])
|
||||||
},
|
},
|
||||||
// TODO: Maybe too naive?
|
// TODO: Maybe too naive?
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
// Disable chip select
|
// Disable chip select
|
||||||
|
cortex_m::asm::delay(10_u32);
|
||||||
self.nss.set_high();
|
self.nss.set_high();
|
||||||
|
cortex_m::asm::delay(5_u32);
|
||||||
Err(SpiPortError::TransferError)
|
Err(SpiPortError::TransferError)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue