spi: Always delay for NSS setup time
* Fixes the lack of setup time delay of an fixed-byte command that immediately follows an N-byte command. * Extra 50ns will be inserted in-between fixed-byte commands but should be acceptable.
This commit is contained in:
parent
bb6824b944
commit
fbcc3778d2
|
@ -199,13 +199,7 @@ impl <SPI: Transfer<u8>,
|
||||||
self.nss.set_low();
|
self.nss.set_low();
|
||||||
// >=50ns min. CS_n setup time
|
// >=50ns min. CS_n setup time
|
||||||
#[cfg(feature = "cortex-m-cpu")]
|
#[cfg(feature = "cortex-m-cpu")]
|
||||||
match opcode {
|
cortex_m::asm::delay((0.05*(self.cpu_freq_mhz+1.)) as u32);
|
||||||
opcodes::RCRU | opcodes::WCRU |
|
|
||||||
opcodes::RRXDATA | opcodes::WGPDATA => {
|
|
||||||
cortex_m::asm::delay((0.05*(self.cpu_freq_mhz+1.)) as u32);
|
|
||||||
}
|
|
||||||
_ => { }
|
|
||||||
}
|
|
||||||
// Start writing to SLAVE
|
// Start writing to SLAVE
|
||||||
buf[0] = opcode;
|
buf[0] = opcode;
|
||||||
let result = self.spi.transfer(&mut buf[..data_length+1]);
|
let result = self.spi.transfer(&mut buf[..data_length+1]);
|
||||||
|
|
Loading…
Reference in New Issue