Library to control a QVGA TFT connected to SPI. You can use printf to print text The lib can handle different fonts, draw lines, circles, rect and bmp

Files at this revision

API Documentation at this revision

Comitter:
dreschpe
Date:
Wed Dec 21 22:38:25 2011 +0000
Parent:
8:e1f5232d93a0
Child:
10:1e868317ff49
Commit message:
speed up the pixel drawing

Changed in this revision

SPI_TFT.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/SPI_TFT.cpp	Mon Dec 12 23:07:26 2011 +0000
+++ b/SPI_TFT.cpp	Wed Dec 21 22:38:25 2011 +0000
@@ -240,10 +240,10 @@
     wr_reg(0x02, (x >> 8));
     wr_reg(0x07, (y >> 0));
     wr_reg(0x06, (y >> 8));
-    wr_reg(0x05, (x+1 >> 0));
-    wr_reg(0x04, (x+1 >> 8));
-    wr_reg(0x09, (y+1 >> 0));
-    wr_reg(0x08, (y+1 >> 8));
+    //wr_reg(0x05, (x+1 >> 0));
+    //wr_reg(0x04, (x+1 >> 8));
+    //wr_reg(0x09, (y+1 >> 0));
+    //wr_reg(0x08, (y+1 >> 8));
     wr_cmd(0x22);
     wr_dat(color);
 }
@@ -271,7 +271,7 @@
 
 void SPI_TFT::cls (void) {
     unsigned int i;
-    WindowMax();
+    //WindowMax();
     wr_cmd(0x22);
     wr_dat_start();
     _spi.format(16,3);         // 16 bit Mode 3
@@ -294,7 +294,7 @@
     int draw_x7, draw_y7;
     int xx, yy;
     int di;
-    WindowMax();
+    //WindowMax();
     if (r == 0) {       /* no radius */
         return;
     }
@@ -409,6 +409,7 @@
     }
     _spi.format(8,3);
     wr_dat_stop();
+    WindowMax();
     return;
 }
 
@@ -426,13 +427,14 @@
     }
     _spi.format(8,3);
     wr_dat_stop();
+    WindowMax();
     return;
 }
 
 
 
 void SPI_TFT::line(int x0, int y0, int x1, int y1, int color) {
-    WindowMax();
+    //WindowMax();
     int   dx = 0, dy = 0;
     int   dx_sym = 0, dy_sym = 0;
     int   dx_x2 = 0, dy_x2 = 0;
@@ -537,6 +539,7 @@
     }
     _spi.format(8,3);
     wr_dat_stop();
+    WindowMax();
     return;
 }
 
@@ -618,6 +621,7 @@
     }
     _spi.format(8,3);                      // 8 bit
     wr_dat_stop();
+    WindowMax();
     if ((w + 2) < hor) {                   // x offset to next char
         char_x += w + 2;
     } else char_x += hor;
@@ -657,6 +661,7 @@
     }
     _spi.format(8,3);
     wr_dat_stop();
+    WindowMax();
 }
 
 
@@ -737,5 +742,6 @@
     wr_dat_stop();
     free (line);
     fclose(Image);
+    WindowMax();
     return(1);
 }
\ No newline at end of file