Add support for KL46Z

Fork of BurstSPI by Erik -

Committer:
kenno
Date:
Fri Jul 25 15:09:45 2014 +0000
Revision:
6:b862ffb6c5e2
Parent:
3:7d9b64d67b22
Merge with version 2.0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Sissors 3:7d9b64d67b22 1 #ifdef TARGET_LPC1768
Sissors 0:600eecd89a78 2 #include "BurstSPI.h"
Sissors 0:600eecd89a78 3
Sissors 0:600eecd89a78 4 void BurstSPI::fastWrite(int data) {
Sissors 0:600eecd89a78 5 //Wait until FIFO has space
Sissors 0:600eecd89a78 6 while(((_spi.spi->SR) & 0x02) == 0);
Sissors 0:600eecd89a78 7
Sissors 0:600eecd89a78 8 //transmit data
Sissors 0:600eecd89a78 9 _spi.spi->DR = data;
Sissors 0:600eecd89a78 10 }
Sissors 0:600eecd89a78 11
Sissors 0:600eecd89a78 12 void BurstSPI::clearRX( void ) {
Sissors 0:600eecd89a78 13 //Do it while either data in RX buffer, or while it is busy
Sissors 0:600eecd89a78 14 while(((_spi.spi->SR) & ((1<<4) + (1<<2))) != 0) {
Sissors 0:600eecd89a78 15 //Wait until data in RX buffer
Sissors 0:600eecd89a78 16 while(((_spi.spi->SR) & (1<<2)) == 0);
Sissors 0:600eecd89a78 17 int dummy = _spi.spi->DR;
Sissors 0:600eecd89a78 18 }
Sissors 3:7d9b64d67b22 19 }
Sissors 3:7d9b64d67b22 20 #endif