From a96dc90250fdc31ff7fe59f752618773e2aa73df Mon Sep 17 00:00:00 2001 From: Brad Campbell Date: Tue, 18 Mar 2014 10:10:13 -0400 Subject: [PATCH] [SPI] Make SPI_FLUSH() more versatile Currently the SPI driver in core/ sets `SPI_FLUSH()` to be a single read of the spi RX buffer. This is fine for many microcontrollers, but newer platforms like the CC2538 have a multi-byte FIFO for the RX buffer. In that case, a single read is not guaranteed to flush the RX. This commit allows `SPI_FLUSH()` to be platform dependent if needed, but doesn't change for platforms where it works. --- core/dev/spi.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/dev/spi.h b/core/dev/spi.h index a36be1ca7..1ccbe2bc0 100644 --- a/core/dev/spi.h +++ b/core/dev/spi.h @@ -82,10 +82,11 @@ void spi_init(void); } while(0) /* Flush the SPI read register */ +#ifndef SPI_FLUSH #define SPI_FLUSH() \ do { \ SPI_RXBUF; \ } while(0); - +#endif #endif /* SPI_H_ */