aboutsummaryrefslogtreecommitdiffstats
path: root/src/stm32
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2020-03-04 18:24:11 -0500
committerKevin O'Connor <kevin@koconnor.net>2020-03-04 18:33:34 -0500
commit121249c999f888fd6a65f857a1f85cbda19a3c7f (patch)
tree97df8b7e6816fc6520e23cfe9b5d002acb2f5443 /src/stm32
parente9e0f59204a5f051ca29d24b9217a86b8d332c31 (diff)
downloadkutter-121249c999f888fd6a65f857a1f85cbda19a3c7f.tar.gz
kutter-121249c999f888fd6a65f857a1f85cbda19a3c7f.tar.xz
kutter-121249c999f888fd6a65f857a1f85cbda19a3c7f.zip
stm32: Revert "stm32: performance improvement for spi on stm32f0"
This reverts commit a2c309a2b02d16ec15fee5702463621239261266. The above commit is causing crashes on the stm32f103xb chip when spi is in use. It's unclear what the cause of the regression is, but the optimization isn't required so revert it until the root cause can be determined. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/stm32')
-rw-r--r--src/stm32/spi.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/stm32/spi.c b/src/stm32/spi.c
index 90d71ffe..5e306fd1 100644
--- a/src/stm32/spi.c
+++ b/src/stm32/spi.c
@@ -92,14 +92,10 @@ spi_transfer(struct spi_config config, uint8_t receive_data,
uint8_t len, uint8_t *data)
{
SPI_TypeDef *spi = config.spi;
- uint8_t *wptr = data;
- uint8_t *end = data + len;
-
- while (data < end) {
- if (spi->SR & SPI_SR_TXE && wptr < end)
- writeb((void *)&spi->DR, *wptr++);
- if (!(spi->SR & SPI_SR_RXNE))
- continue;
+ while (len--) {
+ writeb((void *)&spi->DR, *data);
+ while (!(spi->SR & SPI_SR_RXNE))
+ ;
uint8_t rdata = readb((void *)&spi->DR);
if (receive_data)
*data = rdata;