Align ChibiOS spi_master behaviour with AVR (#11404)

* Align ChibiOS spi_master behaviour with AVR

* Rollback `spi_transmit()` and `spi_receive()` to preserve DMA
This commit is contained in:
Ryan 2021-01-03 14:53:53 +11:00 committed by GitHub
parent b3de903a3d
commit f3ac792c09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;
}