Flush MISO before transfer operation

This commit is contained in:
Ulf Lilleengen
2021-12-02 11:38:43 +01:00
parent 9a730ef692
commit 81ec4c82fd
3 changed files with 11 additions and 2 deletions

View File

@ -560,9 +560,8 @@ where
byte: u8,
) -> Result<(), Error<E, CS::Error, RESET::Error>> {
self.cs.set_low().map_err(CS)?;
let mut rx = [0, 0];
let buffer = [reg | 0x80, byte];
self.spi.read_write(&mut rx, &buffer).await.map_err(SPI)?;
self.spi.write(&buffer).await.map_err(SPI)?;
self.cs.set_high().map_err(CS)?;
Ok(())
}