ST7735 library, e.g. for Adafruit 1.8" TFT

Fork of ST7735_TFT by Jonne Valola

Fixed a few compiler warning and also some errors that were showing on my STM-F3 device.

Revision:
2:264c52bc760c
Parent:
1:967235e6fd48
--- a/ST7735_TFT.cpp	Sun Dec 11 21:18:21 2011 +0000
+++ b/ST7735_TFT.cpp	Tue Aug 19 19:58:08 2014 +0000
@@ -24,7 +24,7 @@
 #define BPP         16                  // Bits per pixel                
 
 ST7735_TFT::ST7735_TFT(PinName mosi, PinName miso, PinName sclk, PinName cs, PinName rs, PinName reset, const char *name)
-        : _spi(mosi, miso, sclk), _cs(cs), _rs(rs), _reset(reset),GraphicsDisplay(name) {
+        : GraphicsDisplay(name), _spi(mosi, miso, sclk), _cs(cs), _rs(rs), _reset(reset) {
     tft_reset();
     orientation = 2;
     char_x = 0;
@@ -172,11 +172,9 @@
 
 
 void ST7735_TFT::tft_reset() {
-    static unsigned short driverCode;
-    
     // init SPI
     _spi.format(8,3);                 // 8 bit spi mode 3
-    _spi.frequency(16000000);         // 16Mhz SPI clock ... 15Mhz is maximum for display, but it seems to work
+    _spi.frequency(8000000);         // 16Mhz SPI clock ... 15Mhz is maximum for display, but it seems to work
     
     // reset exactly like in Arduino version
     _cs = 0;
@@ -332,7 +330,7 @@
   _spi.format(8,3);
 }
 
-void ST7735_TFT::window (unsigned int x, unsigned int y, unsigned int w, unsigned int h) {
+void ST7735_TFT::window (int x, int y, int w, int h) {
   wr_cmd(ST7735_CASET);  // column addr set
   wr_dat(0x00);
   wr_dat(x+2);   // XSTART 
@@ -716,7 +714,7 @@
 
 
 void ST7735_TFT::Bitmap(unsigned int x, unsigned int y, unsigned int w, unsigned int h,unsigned char *bitmap) {
-    unsigned int    i,j,value;
+    unsigned int    i,j;
     unsigned short *bitmap_ptr = (unsigned short *)bitmap;
     window(x, y, w, h);
     wr_cmd(0x2C);
@@ -731,7 +729,7 @@
     wr_dat_stop();
 }
 
-
+/*
 int ST7735_TFT::BMP_16(unsigned int x, unsigned int y, const char *Name_BMP) {
 // BEWARE !
 // NOT TESTED
@@ -811,4 +809,4 @@
     free (line);
     fclose(Image);
     return(1);
-}
\ No newline at end of file
+}*/