With added colors.

Dependents:   Arcade_RedX

Fork of 4DGL-uLCD-SE by jim hamblen

Revision:
8:2cb1845d7681
Parent:
7:e39a44de229a
--- a/uLCD_4DGL_Graphics.cpp	Sat Nov 30 02:05:15 2013 +0000
+++ b/uLCD_4DGL_Graphics.cpp	Wed Oct 28 14:52:48 2015 +0000
@@ -275,7 +275,7 @@
     command[5] = y & 0xFF;
 
     int i, temp = 0, color = 0, resp = 0;
-    char response[2] = "";
+    char response[3] = "";
 
     freeBUFFER();
 
@@ -283,16 +283,16 @@
         writeBYTE(command[i]);
     }
 
-    while (!_cmd.readable()) wait_ms(TEMPO);    // wait for screen answer
+    while (!_cmd.readable()) wait_ms(TEMPO);    // wait a bit for screen answer
 
-    while (_cmd.readable() && resp < ARRAY_SIZE(response)) {
+    while ( resp < ARRAY_SIZE(response)) {   //read ack and 16-bit color response
         temp = _cmd.getc();
         response[resp++] = (char)temp;
     }
 
-    color = ((response[0] << 8) + response[1]);
+    color = ((response[1] << 8) + response[2]);
 
-    return color; // WARNING : this is 16bits color, not 24bits... need to be fixed
+    return color; 
 }