Library to control a Graphics TFT connected to 4-wire SPI - revised for the Raio RA8875 Display Controller.

Dependents:   FRDM_RA8875_mPaint RA8875_Demo RA8875_KeyPadDemo SignalGenerator ... more

Fork of SPI_TFT by Peter Drescher

See Components - RA8875 Based Display

Enhanced touch-screen support - where it previous supported both the Resistive Touch and Capacitive Touch based on the FT5206 Touch Controller, now it also has support for the GSL1680 Touch Controller.

Offline Help Manual (Windows chm)

/media/uploads/WiredHome/ra8875.zip.bin (download, rename to .zip and unzip)

Revision:
21:3c1efb192927
Parent:
20:6e2e4a8372eb
Child:
23:a50ded45dbaf
--- a/RA8875.cpp	Sun Jan 12 18:44:58 2014 +0000
+++ b/RA8875.cpp	Sun Jan 12 21:11:15 2014 +0000
@@ -468,13 +468,15 @@
     return roundrect(x1,y1,x2,y2,radius1,radius2,fillit);
 }
 
-RetCode_t RA8875::roundrect(unsigned int x1, unsigned int y1 ,unsigned int x2, unsigned int y2, 
+RetCode_t RA8875::roundrect(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2, 
     unsigned int radius1, unsigned int radius2, fill_t fillit)
 {
     RetCode_t ret = noerror;
     
     PERFORMANCE_RESET;
-    if (x1 == x2 && y1 == y2) {
+    if (x1 > x2 || y1 > y2 || (radius1 > (x2-x1)/2) || (radius2 > (y2-y1)/2) ) {
+        ret = bad_parameter;
+    } else if (x1 == x2 && y1 == y2) {
         pixel(x1, y1);
     } else if (x1 == x2) {
         line(x1, y1, x2, y2);
@@ -490,12 +492,16 @@
         WriteCommand(0x97, y2 & 0xFF);
         WriteCommand(0x98, y2 >> 8);
 
-        //while (r && r > (x2 - x1) || r > (y2 - y1))
-        //    r--;
         WriteCommand(0xA1, radius1 & 0xFF);
         WriteCommand(0xA2, radius1 >> 8);
         WriteCommand(0xA3, radius2 & 0xFF);
         WriteCommand(0xA4, radius2 >> 8);
+
+        // Should not need this...
+        WriteCommand(0xA5, 0 & 0xFF);
+        WriteCommand(0xA6, 0 >> 8);
+        WriteCommand(0xA7, 0 & 0xFF);
+        WriteCommand(0xA8, 0 >> 8);
         
         unsigned char drawCmd = 0x20;       // Rounded Rectangle
         if (fillit == FILL)
@@ -504,7 +510,7 @@
         WriteCommand(0xA0, 0x80 + drawCmd); // Start drawing.
         while (ReadCommand(0xA0) & 0x80) {   // await completion.
             wait_us(POLLWAITuSec);
-        }        
+        }
     }
     REGISTERPERFORMANCE(PRF_DRAWROUNDEDRECTANGLE);
     return ret;