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:
4:12ba0ecc2c1f
Parent:
2:713844a55c4e
Child:
7:bb0383b91104
--- a/Inits/ILI9341.cpp	Sat Feb 14 17:42:21 2015 +0000
+++ b/Inits/ILI9341.cpp	Sun Feb 15 20:06:07 2015 +0000
@@ -1,3 +1,8 @@
+ /* mbed UniGraphic library - Device specific class
+ * Copyright (c) 2015 Giuliano Dianda
+ * Released under the MIT License: http://mbed.org/license/mit
+ */
+ 
 #include "Protocols.h"
 #include "ILI9341.h"
 
@@ -16,8 +21,9 @@
     hw_reset();
     BusEnable(true);
     init();
+    mipistd=false;
+    set_orientation(0);
     cls();
-    set_orientation(0);
     locate(0,0); 
 }
 ILI9341::ILI9341(proto_t displayproto, int Hz, PinName mosi, PinName miso, PinName sclk, PinName CS, PinName reset, PinName DC, const char *name)
@@ -26,8 +32,9 @@
     hw_reset(); //TFT class forwards to Protocol class
     BusEnable(true); //TFT class forwards to Protocol class
     init(); // per display custom init cmd sequence, implemented here
+    mipistd=false;
+    set_orientation(0); //TFT class does for MIPI standard and some ILIxxx
     cls();
-    set_orientation(1); //TFT class does for MIPI standard and some ILIxxx
     locate(0,0); 
 }
 // reset and init the lcd controller
@@ -78,11 +85,7 @@
      wr_cmd8(0xC7);                     // VCOM_CONTROL_2
      wr_data8(0x86);  // AN A7, was BE
      
-     wr_cmd8(0x36);                     // MEMORY_ACCESS_CONTROL
-     wr_data8(0x48);
      
-     wr_cmd8(0x3A);                     // COLMOD_PIXEL_FORMAT_SET, not present in AN
-     wr_data8(0x55);                 // 16 bit pixel 
      
      wr_cmd8(0xB1);                     // Frame Rate
      wr_data8(0x00);
@@ -140,13 +143,19 @@
       
   //   wr_cmd8(0xB7);                       // ENTRY_MODE_SET
   //   wr_data8(0x07);
-         
+  
+    wr_cmd8(0x36);      // MEMORY_ACCESS_CONTROL (orientation stuff)
+    wr_data8(0x48);
+     
+    wr_cmd8(0x3A);      // COLMOD_PIXEL_FORMAT_SET
+    wr_data8(0x55);     // 16 bit pixel 
+
+    wr_cmd8(0x13); // Nomal Displaymode
+    
      wr_cmd8(0x11);                     // sleep out
-     
      wait_ms(150);
      
      wr_cmd8(0x29);                     // display on
-     
      wait_ms(150);
 
 }
\ No newline at end of file