for 4180 final project

Fork of 4DGL-uLCD-SE by jim hamblen

Revision:
7:e39a44de229a
Parent:
6:b759b69cbaf9
Child:
8:9a943cbbad5b
--- a/uLCD_4DGL.h	Mon Nov 25 04:24:22 2013 +0000
+++ b/uLCD_4DGL.h	Sat Nov 30 02:05:15 2013 +0000
@@ -1,7 +1,9 @@
 //
 // uLCD_4DGL is a class to drive 4D Systems TFT touch screens
 //
+// Fork of 4DGL library for 4D Systems LCD displays
 // Copyright (C) <2010> Stephane ROCHON <stephane.rochon at free.fr>
+// Modifed for Goldelox processor <2013> Jim Hamblen
 //
 // uLCD_4DGL is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -20,16 +22,15 @@
 
 #include "mbed.h"
 
-// Debug Verbose on terminal enabled
+// Debug Verbose off - SGE commands echoed to USB serial for debugmode=1
 #ifndef DEBUGMODE
 #define DEBUGMODE 0
 #endif
 
-// Common WAIT value in millisecond
-#define TEMPO 0.05
+// Common WAIT value in milliseconds between commands
+#define TEMPO 0
 
-// 4DGL Functions values
-#define AUTOBAUD     '\x55'
+// 4DGL SGE Function values for Goldelox Processor
 #define CLS          '\xD7'
 #define BAUDRATE     '\x0B' //null prefix
 #define VERSION      '\x08' //null prefix
@@ -37,10 +38,12 @@
 #define TXTBCKGDCOLOR '\x7E'
 #define DISPCONTROL  '\x68'
 #define SETVOLUME    '\x76'
-#define CIRCLE       '\xCC'
+#define CIRCLE       '\xCD'
+#define FCIRCLE      '\xCC'
 #define TRIANGLE     '\xC9'
 #define LINE         '\xD2'
-#define RECTANGLE    '\xCE'
+#define FRECTANGLE   '\xCE'
+#define RECTANGLE    '\xCF'
 #define ELLIPSE      '\x65' //na
 #define PIXEL        '\xCB'
 #define READPIXEL    '\xCA'
@@ -51,19 +54,16 @@
 #define TEXTBOLD     '\x76'
 #define TEXTITALIC   '\x75'
 #define TEXTINVERSE  '\x74'
+#define TEXTUNDERLINE '\x73'
 #define TEXTWIDTH    '\x7C'
 #define TEXTHEIGHT   '\x7B'
 #define TEXTCHAR     '\xFE'
-#define GRAPHCHAR    '\x74'
 #define TEXTSTRING   '\x06'  //null prefix
-#define GRAPHSTRING  '\x53'
-#define TEXTBUTTON   '\x62'
-#define GETTOUCH     '\x6F'
-#define WAITTOUCH    '\x77'
-#define SETTOUCH     '\x75'
+#define MOVECURSOR   '\xE4'
 #define BLITCOM      '\x0A'
 #define PUTCHAR      '\xFE'
-
+#define DISPPOWER    '\x66'
+//media commands for uSD card
 #define MINIT        '\xB1'
 #define SBADDRESS    '\xB9'
 #define SSADDRESS    '\xB8'
@@ -102,14 +102,8 @@
 #define FONT_8X8     '\x01'
 #define FONT_8X12    '\x02'
 #define FONT_12X16   '\x03'
+#define MEDIAFONT    '\x07'
 
-// Touch Values
-#define WAIT         '\x00'
-#define PRESS        '\x01'
-#define RELEASE      '\x02'
-#define MOVE         '\x03'
-#define STATUS       '\x04'
-#define GETPOSITION  '\x05'
 
 // Data speed
 #define BAUD_110     27271
@@ -132,6 +126,10 @@
 #define BAUD_375000  8
 #define BAUD_500000  6
 #define BAUD_600000  4
+#define BAUD_750000  3
+#define BAUD_1000000 2
+#define BAUD_1500000 1
+#define BAUD_3000000 0
 
 // Defined Colors
 #define WHITE 0xFFFFFF
@@ -154,6 +152,7 @@
 
 // change this to your specific screen (newer versions) if needed
 // Startup orientation is PORTRAIT so SIZE_X must be lesser than SIZE_Y
+//uLCD144-G2 is a 128 by 128 pixel display
 #define SIZE_X       128
 #define SIZE_Y       128
 
@@ -161,10 +160,10 @@
 #define IS_PORTRAIT  1
 
 // Screen orientation
-#define LANDSCAPE    '\x01'
-#define LANDSCAPE_R  '\x02'
-#define PORTRAIT     '\x03'
-#define PORTRAIT_R   '\x04'
+#define LANDSCAPE    '\x00'
+#define LANDSCAPE_R  '\x01'
+#define PORTRAIT     '\x02'
+#define PORTRAIT_R   '\x03'
 
 // Parameters
 #define ENABLE       '\x00'
@@ -213,8 +212,7 @@
     /** Reset screen */
     void reset();
 
-    /** Launch Autobaud for serial communication. This function is automatically called at startup */
-    void autobaud();
+
     /** Set serial Baud rate (both sides : screen and mbed)
     * @param Speed Correct BAUD value (see uLCD_4DGL.h)
     */
@@ -235,8 +233,8 @@
     * @param mode See 4DGL documentation
     * @param value See 4DGL documentation
     */
-    void display_control(char mode, char value);
-
+    void display_control(char mode);
+    void display_power(char mode);
     /** Set internal speaker to specified value
     * @param value Correct range is 8 - 127
     */
@@ -251,31 +249,28 @@
     * @param color Circle color in HEX RGB like 0xFF00FF
     */
     void circle(int x , int y , int radius, int color);
-
+    void filled_circle(int x , int y , int radius, int color);
     void triangle(int, int, int, int, int, int, int);
     void line(int, int, int, int, int);
     void rectangle(int, int, int, int, int);
-    void ellipse(int, int, int, int, int);
+    void filled_rectangle(int, int, int, int, int);
     void pixel(int, int, int);
     int  read_pixel(int, int);
-    void screen_copy(int, int, int, int, int, int);
     void pen_size(char);
     void BLIT(int x, int y, int w, int h, int *colors);
 
-// Texts Commands
+// Text Commands
     void set_font(char);
+    void set_font_size(char width, char height);  
     void text_mode(char);
     void text_bold(char);
     void text_italic(char);
     void text_inverse(char);
+    void text_underline(char);
     void text_width(char);
     void text_height(char);
     void text_char(char, char, char, int);
-    void graphic_char(char, int, int, int, char, char);
     void text_string(char *, char, char, char, int);
-    void graphic_string(char *, int, int, char, int, char, char);
-    void text_button(char *, char, int, int, int, char, int, char, char);
-
     void locate(char, char);
     void color(int);
     void putc(char);
@@ -292,18 +287,7 @@
     void flush_media();
     void display_image(int, int);
     void display_video(int, int);
-    void display_frame(int, int, int);    
-    
-    
-    
-        
-
-// Touch Command
-    void touch_mode(char);
-    void get_touch(int *, int *);
-    void wait_touch(int);
-    void set_touch(int, int, int, int);
-    int  touch_status(void);
+    void display_frame(int, int, int);
 
 // Screen Data
     int type;
@@ -335,19 +319,17 @@
         return 0;
     };
     virtual int _getc() {
-        return 0;
+        return -1;
     }
 
-
     void freeBUFFER  (void);
     void writeBYTE   (char);
     void writeBYTEfast   (char);
     int  writeCOMMAND(char *, int);
     int  writeCOMMANDnull(char *, int);
     int  readVERSION (char *, int);
-    void getTOUCH    (char *, int, int *,int *);
     int  getSTATUS   (char *, int);
-    void version     (void);
+    int  version     (void);
 #if DEBUGMODE
     Serial pc;
 #endif // DEBUGMODE
@@ -361,3 +343,4 @@
 
 
 
+