BurstSPI fork

Fork of BurstSPI by Erik -

Files at this revision

API Documentation at this revision

Comitter:
Backstrom
Date:
Fri Apr 03 05:51:48 2015 +0000
Parent:
11:863e7ae251c6
Parent:
10:6ed1d9f1ef37
Commit message:
Merge with head

Changed in this revision

--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BurstSPI_LPC_X.cpp	Fri Apr 03 05:51:48 2015 +0000
@@ -0,0 +1,20 @@
+#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
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BurstSPI_Unsupported.cpp	Fri Apr 03 05:51:48 2015 +0000
@@ -0,0 +1,18 @@
+#if !(defined(TARGET_KL25Z) || defined(TARGET_KL46Z))
+#if !(defined(TARGET_LPC1768) || defined(TARGET_LPC1114) || defined(TARGET_LPC11U24) || defined(TARGET_LPC13XX))
+#if !(defined(TARGET_NUCLEO_L152RE))
+
+#warning BurstSPI target not supported, reverting to regular SPI
+
+#include "BurstSPI.h"
+
+void BurstSPI::fastWrite(int data) {
+    write(data);
+}
+
+void BurstSPI::clearRX( void ) {
+
+}
+#endif          //Freescale
+#endif          //NXP
+#endif          //NUCLEO
\ No newline at end of file