[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.
This commit is contained in:
Brad Campbell 2014-03-18 10:10:13 -04:00
parent d3b9954342
commit a96dc90250

View file

@ -82,10 +82,11 @@ void spi_init(void);
} while(0) } while(0)
/* Flush the SPI read register */ /* Flush the SPI read register */
#ifndef SPI_FLUSH
#define SPI_FLUSH() \ #define SPI_FLUSH() \
do { \ do { \
SPI_RXBUF; \ SPI_RXBUF; \
} while(0); } while(0);
#endif
#endif /* SPI_H_ */ #endif /* SPI_H_ */