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:
204:48e05a27de25
Parent:
203:704df2dbd3e6
Child:
205:f215dc32736b
--- a/RA8875.cpp	Sun May 17 14:07:46 2020 +0000
+++ b/RA8875.cpp	Thu May 21 01:32:59 2020 +0000
@@ -1711,9 +1711,11 @@
 
 rect_t RA8875::SetWindow(loc_t x1, loc_t y1, loc_t x2, loc_t y2)
 {
-    const rect_t nullRect = { 0,0,0,0 };    // in case it is invalid
+    rect_t nullRect = { 0,0,0,0 };    // in case it is invalid
     rect_t oldWin = windowrect;
     dim_t tempWidth, tempHeight;
+    nullRect.p2.x = virt_screenwidth - 1;
+    nullRect.p2.y = virt_screenheight - 1;
     //INFO("SetWindow(%d,%d)-(%d,%d)", x1,y1, x2,y2);
     // Correct the initial values (0,-1) - (0,-1)
     if (x2 == (loc_t)-1) x2 = virt_screenwidth - 1;
@@ -1867,7 +1869,18 @@
 {
     PERFORMANCE_RESET;
     const uint8_t * rowStream = boolStream;
-    rect_t restore = SetWindow(x, y, x + w * fontScaleX - 1, y + h * fontScaleY - 1);
+    loc_t x2,y2;
+    x2 = x + w * fontScaleX - 1;
+    y2 = y + h * fontScaleY - 1;
+    if (x2 >= virt_screenwidth) {
+        x -= (x2 - virt_screenwidth + 1);
+        x2 = virt_screenwidth - 1;
+    }
+    if (y2 >= virt_screenheight) {
+        y -= (y2 - virt_screenheight + 1);
+        y2 = virt_screenheight - 1;
+    }
+    rect_t restore = SetWindow(x, y, x2, y2);
     SetGraphicsCursor(x, y);
     _StartGraphicsStream();
     _select(true);