Description
In embedded-hal SPI transfers, the read and write buffers may be different lengths:
It is allowed for read and write to have different lengths, even zero length. The transfer runs for max(read.len(), write.len()) words. If read is shorter, incoming words after read has been filled will be discarded. If write is shorter, the value of words sent in MOSI after all write has been sent is implementation-defined, typically 0x00, 0xFF, or configurable.
In spidev read_write, it is not:
Note that the tx_buf and rx_buf must be the same length.
However currently we implement transfer
by calling read_write
directly:
Line 100 in 86ab035
leading to panics when the buffer lengths differ. We should adjust the buffers passed to read_write
, or split the transfer into a read_write and a write or something, to accommodate.