I am working on a specific epd which requires to read data from the MOSI line after sending a command but switching the CS pin between each byte. It's unclear to me if this is even achievable with the SPI Bus implementation. If so some guidance would be appreciated.
Some relevant parts from the documentation:
Here it also states that a CS pulse is necessary between each read.
I thought something like this would be working:
pub fn read_otp(&mut self, buffer: &mut [u8]) -> Result<(), E> {
self.bus.lock(|bus| {
let mut bus = bus.borrow_mut();
self.cs.set_low().ok();
// Command mode
self.dc.set_low().ok();
// Send read command
bus.write(&[0xA2])?;
self.dc.set_high().ok(); // Data mode
// Read data
for byte in buffer.iter_mut() {
self.cs.set_high().ok();
self.cs.set_low().ok();
// Send dummy byte and read the result
let mut read_buf = [0u8];
bus.transfer(&mut read_buf, &[0x00])?;
*byte = read_buf[0];
}
self.cs.set_high().ok();
Ok(())
})
}
but then i found out that the transfer also wants to read on the MISO line.
While it may (or may not) be supported by the SPI hardware of your microcontroller, it's not something supported by the abstraction layer provided by embedded-hal.
I am working on a specific epd which requires to read data from the MOSI line after sending a command but switching the CS pin between each byte. It's unclear to me if this is even achievable with the SPI Bus implementation. If so some guidance would be appreciated. Some relevant parts from the documentation:
Here it also states that a CS pulse is necessary between each read.
I thought something like this would be working:
but then i found out that the transfer also wants to read on the MISO line.