summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorNick Brassel <nick@tzarc.org>2021-01-03 15:26:43 +1100
committerNick Brassel <nick@tzarc.org>2021-01-03 15:26:43 +1100
commit271c0cf136c5dd5b9456d8b79272e67bc1a13cea (patch)
treec2b6eec8c298acc0de000e980d806f68dbe84482 /drivers
parente8e090acede2596e19de40628543f4ed27d33ab0 (diff)
parentf3ac792c096c10c9dd5004e6e06aad60710ef599 (diff)
Merge remote-tracking branch 'upstream/master' into develop
Diffstat (limited to 'drivers')
-rw-r--r--drivers/chibios/spi_master.c10
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;
}