diff options
author | Ryan <fauxpark@gmail.com> | 2021-01-03 14:53:53 +1100 |
---|---|---|
committer | Drashna Jael're <drashna@live.com> | 2021-01-12 22:46:13 -0800 |
commit | a16e9c54d92f3bfca7ee4fc9116899a440d600a3 (patch) | |
tree | 93ef2ae04bad7279f5fd6bf8ee09cd9f32d21d53 /drivers/chibios | |
parent | ab717d2a52e7128a404ce4e0d3866bd70ca5e352 (diff) |
Align ChibiOS spi_master behaviour with AVR (#11404)
* Align ChibiOS spi_master behaviour with AVR
* Rollback `spi_transmit()` and `spi_receive()` to preserve DMA
Diffstat (limited to 'drivers/chibios')
-rw-r--r-- | drivers/chibios/spi_master.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/chibios/spi_master.c b/drivers/chibios/spi_master.c index 5aa60742e3..8341b59a53 100644 --- a/drivers/chibios/spi_master.c +++ b/drivers/chibios/spi_master.c @@ -115,11 +115,17 @@ bool spi_start(pin_t slavePin, bool lsbFirst, uint8_t mode, uint16_t divisor) { return true; } -spi_status_t spi_write(uint8_t data) { return spi_transmit(&data, 1); } +spi_status_t spi_write(uint8_t data) { + uint8_t rxData; + spiExchange(&SPI_DRIVER, 1, &data, &rxData); + + return rxData; +} spi_status_t spi_read(void) { uint8_t data = 0; - spi_receive(&data, 1); + spiReceive(&SPI_DRIVER, 1, &data); + return data; } |