Skip to content

Commit

Permalink
Align ChibiOS spi_master behaviour with AVR (qmk#11404)
Browse files Browse the repository at this point in the history
* Align ChibiOS spi_master behaviour with AVR

* Rollback `spi_transmit()` and `spi_receive()` to preserve DMA
  • Loading branch information
fauxpark authored Jan 3, 2021
1 parent b3de903 commit f3ac792
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions drivers/chibios/spi_master.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit f3ac792

Please sign in to comment.