je ne sais plus
Diff: BurstSPI_LPC_X.cpp
- Revision:
- 0:3787bbf77ca8
diff -r 000000000000 -r 3787bbf77ca8 BurstSPI_LPC_X.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BurstSPI_LPC_X.cpp Wed Jun 17 13:49:54 2015 +0000 @@ -0,0 +1,20 @@ +#if defined(TARGET_LPC1768) || defined(TARGET_LPC1114) || defined(TARGET_LPC11U24) || defined(TARGET_LPC13XX) +#include "FastSPI.h" + +void FastSPI::fastWrite(int data) { + //Wait until FIFO has space + while(((_spi.spi->SR) & 0x02) == 0); + + //transmit data + _spi.spi->DR = data; + } + +void FastSPI::clearRX( void ) { + //Do it while either data in RX buffer, or while it is busy + while(((_spi.spi->SR) & ((1<<4) + (1<<2))) != 0) { + //Wait until data in RX buffer + while(((_spi.spi->SR) & (1<<2)) == 0); + int dummy = _spi.spi->DR; + } +} +#endif \ No newline at end of file