Added SPI burst mode to spi 8 bit.

Dependents:   Bicycl_Computer_NUCLEO-F411RE Bicycl_Computer_NUCLEO-L476RG

Fork of UniGraphic by GraphicsDisplay

Added SPI burst mode to this graphics driver. If whoever wants this rolled in to repository let me know. I replaced _spi.write(); with fastWrite(); and clearRX();

SPI8.cpp

// need to re-create SPI firmware to access SPI handle
static SPI_HandleTypeDef SpiHandle;

void SPI8::fastWrite(int data) {
    
      SpiHandle.Instance = SPI1;
    // Check if data is transmitted
    while ((SpiHandle.Instance->SR & SPI_SR_TXE) == 0);
    SpiHandle.Instance->DR = data;
}
    
void SPI8::clearRX( void ) {
        SpiHandle.Instance = SPI1;
    //Check if the RX buffer is busy
    //While busy, keep checking
    while (SpiHandle.Instance->SR & SPI_SR_BSY){   
        // Check RX buffer readable
        while ((SpiHandle.Instance->SR & SPI_SR_RXNE) == 0);
        int dummy = SpiHandle.Instance->DR;
    }
}      
Revision:
7:bb0383b91104
Parent:
5:b222a9461d6b
Child:
11:b842b8e332cb
--- a/Protocols/PAR16.cpp	Mon Feb 16 01:18:29 2015 +0000
+++ b/Protocols/PAR16.cpp	Tue Feb 17 11:02:06 2015 +0000
@@ -150,11 +150,36 @@
     _CS = 1;
 #endif
 }
-unsigned int PAR16::rd_data32_wdummy()
+unsigned short PAR16::rd_gram()
 {
 #ifdef USE_CS
     _CS = 0;
 #endif
+    unsigned short r=0;
+    _DC = 1; // 1=data
+   _port.input();
+   
+    _RD = 0;
+    _port.read(); //dummy read
+    _RD = 1;
+    
+    _RD = 0;
+//    _RD = 0; // add wait
+    r |= _port.read();
+    _RD = 1;
+    
+#ifdef USE_CS
+    _CS = 1;
+#endif
+    _port.output();
+    return r;
+}
+unsigned int PAR16::rd_reg_data32(unsigned char reg)
+{
+#ifdef USE_CS
+    _CS = 0;
+#endif
+    wr_cmd8(reg);
     unsigned int r=0;
     _DC = 1; // 1=data
    _port.input();
@@ -193,29 +218,10 @@
     _port.output();
     return r;
 }
-unsigned short PAR16::rd_gram()
+// in Par mode EXTC regs (0xB0-0xFF) can be directly read
+unsigned int PAR16::rd_extcreg_data32(unsigned char reg, unsigned char SPIreadenablecmd)
 {
-#ifdef USE_CS
-    _CS = 0;
-#endif
-    unsigned short r=0;
-    _DC = 1; // 1=data
-   _port.input();
-   
-    _RD = 0;
-    _port.read(); //dummy read
-    _RD = 1;
-    
-    _RD = 0;
-//    _RD = 0; // add wait
-    r |= _port.read();
-    _RD = 1;
-    
-#ifdef USE_CS
-    _CS = 1;
-#endif
-    _port.output();
-    return r;
+    return rd_reg_data32(reg);
 }
 void PAR16::hw_reset()
 {