Lib BurstSPI give access to fastWrite function and clearRX function, this lib is now compatible with Nucleo L152RE board

Fork of BurstSPI by Erik -

Committer:
Alamalione
Date:
Wed Jun 25 14:11:39 2014 +0000
Revision:
5:c9c9ef0a40b9
Parent:
3:7d9b64d67b22
Add Nucleo F030R8.cpp

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