Fork of the 4DGL-uLCD-SE library by Jim Hamblen.

Dependents:   ulcd_demo ulcd_accel internet_clock 4180_Final_Project ... more

Fork of 4DGL-uLCD-SE by jim hamblen

Revision:
2:edae99e4abe7
Parent:
1:8b656995301f
Child:
4:74df7fc26fef
--- a/uLCD_4DGL_main.cpp	Mon Nov 11 01:22:41 2013 +0000
+++ b/uLCD_4DGL_main.cpp	Sun Nov 17 04:36:12 2013 +0000
@@ -1,5 +1,5 @@
 //
-// uLCD_4DGL is a class to drive 4D Systems TFT touch screens
+// uLCD_4DGL is a class to drive 4D Systems uLCD 144 G2
 //
 // Copyright (C) <2010> Stephane ROCHON <stephane.rochon at free.fr>
 //
@@ -53,8 +53,9 @@
     current_row         = 0;            // initial cursor row
     current_color       = WHITE;        // initial text color
     current_orientation = IS_PORTRAIT;  // initial screen orientation
-
-    set_font(FONT_5X7);                 // initial font
+    current_hf = 1;
+    current_wf = 1;
+    set_font(FONT_7X8);                 // initial font
 //   text_mode(OPAQUE);                  // initial texr mode
 }
 
@@ -132,7 +133,7 @@
 #endif
     int i, resp = 0;
     freeBUFFER();
-    writeBYTE(0x00);
+    writeBYTE(0x00); //command has a null prefix byte
     for (i = 0; i < number; i++) writeBYTE(command[i]); // send command to serial port
 
     while (!_cmd.readable()) wait_ms(TEMPO);              // wait for screen answer
@@ -172,6 +173,9 @@
 
     command[0] = CLS;
     writeCOMMAND(command, 1);
+    current_hf = 1;
+    current_wf = 1;
+    set_font(FONT_7X8);                 // initial font
 }
 
 //**************************************************************************
@@ -322,6 +326,23 @@
 }
 
 //****************************************************************************************************
+void uLCD_4DGL :: textbackground_color(int color)              // set screen background color
+{
+    char command[3]= "";                                  // input color is in 24bits like 0xRRGGBB
+
+    command[0] = TXTBCKGDCOLOR;
+
+    int red5   = (color >> (16 + 3)) & 0x1F;              // get red on 5 bits
+    int green6 = (color >> (8 + 2))  & 0x3F;              // get green on 6 bits
+    int blue5  = (color >> (0 + 3))  & 0x1F;              // get blue on 5 bits
+
+    command[1] = ((red5 << 3)   + (green6 >> 3)) & 0xFF;  // first part of 16 bits color
+    command[2] = ((green6 << 5) + (blue5 >>  0)) & 0xFF;  // second part of 16 bits color
+
+    writeCOMMAND(command, 3);
+}
+
+//****************************************************************************************************
 void uLCD_4DGL :: display_control(char mode, char value)     // set screen mode to value
 {
     char command[3]= "";
@@ -440,4 +461,4 @@
 #endif
 
     return resp;
-}
\ No newline at end of file
+}