Guillermo Stedile / RA8875

Dependencies:   GPS

Dependents:   SNOCC_V1 SNOCC_V2

Fork of RA8875 by SNOCC

Files at this revision

API Documentation at this revision

Comitter:
WiredHome
Date:
Sat Aug 16 19:26:17 2014 +0000
Parent:
59:fb40aad4efd4
Child:
61:8f3153bf0baa
Commit message:
Correct an issue - trap line(...) where the xy pairs actually represent a point, and call pixel(...) instead. It appeared that the RA8875 would hang in for this line api call.

Changed in this revision

RA8875.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/RA8875.cpp	Thu Jul 24 00:41:37 2014 +0000
+++ b/RA8875.cpp	Sat Aug 16 19:26:17 2014 +0000
@@ -814,15 +814,19 @@
 RetCode_t RA8875::line(loc_t x1, loc_t y1, loc_t x2, loc_t y2)
 {
     PERFORMANCE_RESET;
-    WriteCommandW(0x91, x1);
-    WriteCommandW(0x93, y1);
-    WriteCommandW(0x95, x2);
-    WriteCommandW(0x97, y2);
-    unsigned char drawCmd = 0x00;       // Line
-    WriteCommand(0x90, drawCmd);
-    WriteCommand(0x90, 0x80 + drawCmd); // Start drawing.
-    while (ReadCommand(0x90) & 0x80)    // await completion.
-        wait_us(POLLWAITuSec);
+    if (x1 == x2 && y1 == y2)
+        pixel(x1, y1);
+    else {
+        WriteCommandW(0x91, x1);
+        WriteCommandW(0x93, y1);
+        WriteCommandW(0x95, x2);
+        WriteCommandW(0x97, y2);
+        unsigned char drawCmd = 0x00;       // Line
+        WriteCommand(0x90, drawCmd);
+        WriteCommand(0x90, 0x80 + drawCmd); // Start drawing.
+        while (ReadCommand(0x90) & 0x80)    // await completion.
+            wait_us(POLLWAITuSec);
+    }
     REGISTERPERFORMANCE(PRF_DRAWLINE);
     return noerror;
 }