aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/stm32f1/spi.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/stm32f1/spi.c b/src/stm32f1/spi.c
index 7bea6cb5..a90a030a 100644
--- a/src/stm32f1/spi.c
+++ b/src/stm32f1/spi.c
@@ -97,9 +97,10 @@ spi_transfer(struct spi_config config, uint8_t receive_data,
while (len--) {
LL_SPI_TransmitData8(SPI2, *data);
while (!LL_SPI_IsActiveFlag_TXE(SPI2));
+ while (!LL_SPI_IsActiveFlag_RXNE(SPI2));
+ uint8_t rdata = LL_SPI_ReceiveData8(SPI2);
if (receive_data) {
- while (!LL_SPI_IsActiveFlag_RXNE(SPI2));
- *data = LL_SPI_ReceiveData8(SPI2);
+ *data = rdata;
}
data++;
}