Fork for fixing STM32

Dependents:   SSD1351

Fork of BurstSPI by Erik -

Revision:
13:bc069279eb37
Child:
14:98658a80a698
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BurstSPI_STM32F4.cpp	Sat May 16 11:09:59 2015 +0000
@@ -0,0 +1,23 @@
+#if defined(TARGET_STM32F4)
+#include "BurstSPI.h"
+ 
+void BurstSPI::fastWrite(int data) {
+    
+    SPI_TypeDef *spi = (SPI_TypeDef *)(_spi.spi);
+    // Check if data is transmitted
+    while ((spi->SR & SPI_SR_TXE) == 0);
+    spi->DR = data;
+}
+    
+void BurstSPI::clearRX( void ) {
+    //Check if the RX buffer is busy
+    SPI_TypeDef *spi = (SPI_TypeDef *)(_spi.spi);
+    //While busy, keep checking
+    while (spi->SR & SPI_SR_BSY){   
+        // Check RX buffer readable
+        while ((spi->SR & SPI_SR_RXNE) == 0);
+        int dummy = spi->DR;
+    }
+}
+#endif
+