SPI based library for the ST7735 LCD controller.

Dependents:   RayCastingEngine RETRO_LCD_PerformanceTest RETRO_loop_test RETRO_RickGame ... more

Revision:
8:12f16befa7e1
Parent:
7:f39c980a589c
Child:
9:7ecd74dcb8ef
--- a/LCD_ST7735.h	Sun Oct 05 23:57:36 2014 +0000
+++ b/LCD_ST7735.h	Sat Oct 25 04:10:47 2014 +0000
@@ -23,6 +23,16 @@
             Rotate270
         };
         
+        /** Type of color filter of the panel */
+        enum PanelColorFilter
+        {
+            /** RGB color filter panel */
+            RGB = 0,
+            
+            /** BGR color filter panel */
+            BGR = 8,
+        };
+        
     public:
         /**Creates an instance of the LCD_ST7735 driver
          * @param backlightPin pin used to control the backlight
@@ -40,7 +50,8 @@
             PinName mosiPin,
             PinName misoPin,
             PinName clkPin,
-            PinName csPin
+            PinName csPin,
+            PanelColorFilter colorFilter = BGR
             );
             
         /** Set the orientation of the display
@@ -187,7 +198,12 @@
          * @param pString ASCIIZ string to draw to the display.
          * @note The font is currently limited to an 8x8 font. See the font_IBM.h file for an example font.
         */
-        void drawString(const uint8_t *pFont, int x, int y, const char *pString);    
+        void drawString(const uint8_t *pFont, int x, int y, const char *pString); 
+        
+        /** Select the device on the SPI bus.
+        selectDevice needs to be called before accessing the screen if there are multiple devices on the SPI bus.
+        */
+        void selectDevice();   
         
     private:
         void setPixelFast(int x, int y, uint16_t color);
@@ -219,6 +235,7 @@
         int         _width;
         int         _height;
         Orientation _orientation;
+        PanelColorFilter _colorFilter;
         bool        _flip; 
         uint8_t    _foregroundColorHigh;
         uint8_t    _foregroundColorLow;
@@ -270,7 +287,7 @@
                 }            
         };
         
-    private:        
+    private:                
         DigitalOut  _backlight;
         DigitalOut  _reset;
         DigitalOut  _ds;