This is the David Smart RA8875 Library with mods for working with FRDM-K64F

Revision:
181:0032d1b8f5d4
Parent:
178:ae472eb22740
Child:
182:8832d03a2a29
--- a/RA8875.cpp	Thu Aug 01 22:35:29 2019 +0000
+++ b/RA8875.cpp	Fri Aug 02 02:12:26 2019 +0000
@@ -247,7 +247,7 @@
     #if MBED_VERSION >= MBED_ENCODE_VERSION(5,8,0)
     eventThread.start(callback(&queue, &EventQueue::dispatch_forever));
     m_irq->fall(queue.event(callback(this, &RA8875::TouchPanelISR)));
-    #elif (MBED_MAJOR_VERSION >= 5) || (MBED_LIBRARY_VERSION > 128)   // Is this the right version?
+    #elif (MBED_MAJOR_VERSION >= 5) || (MBED_LIBRARY_VERSION > 127)
     m_irq->fall(callback(this, &RA8875::TouchPanelISR));
     #else
     m_irq->fall(this, &RA8875::TouchPanelISR);
@@ -295,7 +295,7 @@
     #if MBED_VERSION >= MBED_ENCODE_VERSION(5,8,0)
     eventThread.start(callback(&queue, &EventQueue::dispatch_forever));
     m_irq->fall(queue.event(callback(this, &RA8875::TouchPanelISR)));
-    #elif (MBED_MAJOR_VERSION >= 5) || (MBED_LIBRARY_VERSION > 128)   // Is this the right version?
+    #elif (MBED_MAJOR_VERSION >= 5) || (MBED_LIBRARY_VERSION > 127)
     m_irq->fall(callback(this, &RA8875::TouchPanelISR));
     #else
     m_irq->fall(this, &RA8875::TouchPanelISR);
@@ -1110,7 +1110,9 @@
 {
     uint8_t fncr1Val = ReadCommand(0x22);
     uint8_t dpcrVal = ReadCommand(0x20);
+    RetCode_t r;
     
+    screen_orientation = angle;
     fncr1Val &= ~0x10;      // remove the old direction bit
     dpcrVal &= ~0x0C;       // remove the old scan direction bits
     switch (angle) {
@@ -1138,8 +1140,9 @@
             return bad_parameter;
     }
     INFO("Orientation: %d, %d", angle, portraitmode);
-    WriteCommand(RA8875_FNCR1, fncr1Val);
-    return WriteCommand(RA8875_DPCR, dpcrVal);
+    r = WriteCommand(RA8875_FNCR1, fncr1Val);
+    r = WriteCommand(RA8875_DPCR, dpcrVal);
+    return r;
 }
 
 
@@ -1940,11 +1943,31 @@
 RetCode_t RA8875::circle(loc_t x, loc_t y, dim_t radius, fill_t fillit)
 {
     RetCode_t ret = noerror;
-
+    
     INFO("circle");
     PERFORMANCE_RESET;
-    if (radius <= 0 || (x - radius) < 0 || (x + radius) > screenwidth 
-    || (y - radius) < 0 || (y + radius) > screenheight) {
+    #if 0
+    loc_t t;
+    SetTextCursor(0,10);
+    printf("Circle(%3d,%3d) => ", x,y);
+    switch (screen_orientation) {
+        default:
+        case rotate_0:
+            break;
+        case rotate_90:
+            t = x;
+            x = y;
+            y = t;
+            break;
+        case rotate_180:
+            break;
+        case rotate_270:
+            break;
+    }
+    printf("  => (%3d,%3d)\r\n", x,y);
+    #endif
+    if (radius <= 0 || (x - radius) < 0 || (x + radius) > width()
+    || (y - radius) < 0 || (y + radius) > height()) {
         ret = bad_parameter;
     } else if (radius == 1) {
         pixel(x,y);