Fork of BurstSPI with Nucleo F411RE support

Fork of BurstSPI by Erik -

BurstSPI_LPC_X.cpp

Committer:
infotech1
Date:
2014-12-05
Revision:
11:9d43f61b3184
Parent:
9:b69faea5252c

File content as of revision 11:9d43f61b3184:

#if defined(TARGET_LPC1768) || defined(TARGET_LPC1114) || defined(TARGET_LPC11U24) || defined(TARGET_LPC13XX)
#include "BurstSPI.h"

void BurstSPI::fastWrite(int data) {
    //Wait until FIFO has space
    while(((_spi.spi->SR) & 0x02) == 0);
    
    //transmit data
    _spi.spi->DR = data;
    }

void BurstSPI::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