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:
4:12ba0ecc2c1f
Child:
10:668cf78ff93a
--- a/Display/LCD.h	Mon Feb 16 01:18:29 2015 +0000
+++ b/Display/LCD.h	Tue Feb 17 11:02:06 2015 +0000
@@ -53,9 +53,6 @@
     */
     virtual void pixel(int x, int y, unsigned short color);
 
-    
-        
-    
     /** Set the window, which controls where items are written to the screen.
     * When something hits the window width, it wraps back to the left side
     * and down a row. If the initial write is outside the window, it will
@@ -66,6 +63,8 @@
     * @param h is the window height in pixels.
     */
     virtual void window(int x, int y, int w, int h);
+    
+    
 
     /** Push a single pixel into the window and increment position.
     * You must first call window() then push pixels in loop.
@@ -102,7 +101,7 @@
       */
     int get_contrast(void);
 
-    /** invert the screen
+    /** display inverted colors
       *
       * @param o = 0 normal, 1 invert
       */
@@ -114,10 +113,6 @@
     */
     virtual void cls();
     
-    
-    
-    
-    
     /** Set the orientation of the screen
     *  x,y: 0,0 is always top left 
     *
@@ -135,6 +130,29 @@
     */
     virtual void BusEnable(bool enable);
     
+    /** get display X size in pixels (native, orientation independent)
+    * @returns X size in pixels
+    */
+    int sizeX();
+
+    /** get display X size in pixels (native, orientation independent)
+    * @returns screen height in pixels.
+    */
+    int sizeY();
+    
+////////////////////////////////////////////////////////////////////////////////    
+    // not implemented yet
+//////////////////////////////////////////////////////////////////
+    virtual unsigned short pixelread(int x, int y){return 0;};
+    virtual void window4read(int x, int y, int w, int h){};
+    void setscrollarea (int startY, int areasize){};
+    void scroll (int lines){};
+    void scrollreset(){};
+    
+    unsigned int tftID;
+    
+    
+    
     
 protected:
 
@@ -196,12 +214,12 @@
     Protocols* proto;
     unsigned char *buffer;
     unsigned short *buffer16;
-    const int LCDSIZE_X;
-    const int LCDSIZE_Y;
-    const int LCDPAGES;
-    const int IC_X_SEGS;
-    const int IC_Y_COMS;
-    const int IC_PAGES;
+    const int screensize_X;
+    const int screensize_Y;
+    const int _LCDPAGES;
+    const int _IC_X_SEGS;
+    const int _IC_Y_COMS;
+    const int _IC_PAGES;
     
     int page_offset;
     int col_offset;