Fast SPI write, added LPC812 Target
Fork of BurstSPI by
Diff: BurstSPI_LPC_8XX.cpp
- Revision:
- 14:83e3b8ba3f43
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BurstSPI_LPC_8XX.cpp Sun Oct 09 16:48:17 2016 +0000 @@ -0,0 +1,23 @@ +#if (defined(TARGET_LPC81X)) +#include "BurstSPI.h" + +void BurstSPI::fastWrite(int data) { + while (!(_spi.spi->STAT & (1 << 1))); + + _spi.spi->TXDAT = (data & 0xffff); +#ifndef NO_EOT_AFTER_WRITE + // set EOT and receive ignore flag + _spi.spi->TXDATCTL |= ((1 << 20) | (1 << 22)); +#else + // EOT Flag disables SPI and sets MOSI level high. + // This is bad for cases where MOSI is used to generate NRZ signals like in wsLib for WS2812 LED + // set receive ignore flag + _spi.spi->TXDATCTL |= (1 << 22); +#endif +} + +void BurstSPI::clearRX( void ) { + //We already set receive ignore flag, so this function is never run. +} + +#endif \ No newline at end of file