Fork of 4DGL lib for uLCD-144-G2. Different command values needed. See https://mbed.org/users/4180_1/notebook/ulcd-144-g2-128-by-128-color-lcd/ for instructions and demo code.

Dependents:   mythermostat MorseCode SuperMbedBall frogger_G ... more

Fork of 4DGL by Adam Green

Files at this revision

API Documentation at this revision

Comitter:
4180_1
Date:
Wed Oct 28 14:52:48 2015 +0000
Parent:
7:e39a44de229a
Commit message:
Added include guards and Fixed Read Pixel bug

Changed in this revision

uLCD_4DGL.h Show annotated file Show diff for this revision Revisions of this file
uLCD_4DGL_Graphics.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/uLCD_4DGL.h	Sat Nov 30 02:05:15 2013 +0000
+++ b/uLCD_4DGL.h	Wed Oct 28 14:52:48 2015 +0000
@@ -21,7 +21,8 @@
 // @author Stephane Rochon
 
 #include "mbed.h"
-
+#ifndef _uLCD
+#define _uLCD 0
 // Debug Verbose off - SGE commands echoed to USB serial for debugmode=1
 #ifndef DEBUGMODE
 #define DEBUGMODE 0
@@ -336,6 +337,7 @@
 };
 
 typedef unsigned char BYTE;
+#endif
 
 
 
@@ -343,4 +345,3 @@
 
 
 
-
--- 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; 
 }