fhfhfh
uLCD_4DGL.h@0:320fdce0d6fa, 2014-09-25 (annotated)
- Committer:
- jaustin32
- Date:
- Thu Sep 25 00:20:19 2014 +0000
- Revision:
- 0:320fdce0d6fa
asfignsag
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jaustin32 | 0:320fdce0d6fa | 1 | // |
jaustin32 | 0:320fdce0d6fa | 2 | // uLCD_4DGL is a class to drive 4D Systems TFT touch screens |
jaustin32 | 0:320fdce0d6fa | 3 | // |
jaustin32 | 0:320fdce0d6fa | 4 | // Fork of 4DGL library for 4D Systems LCD displays |
jaustin32 | 0:320fdce0d6fa | 5 | // Copyright (C) <2010> Stephane ROCHON <stephane.rochon at free.fr> |
jaustin32 | 0:320fdce0d6fa | 6 | // Modifed for Goldelox processor <2013> Jim Hamblen |
jaustin32 | 0:320fdce0d6fa | 7 | // |
jaustin32 | 0:320fdce0d6fa | 8 | // uLCD_4DGL is free software: you can redistribute it and/or modify |
jaustin32 | 0:320fdce0d6fa | 9 | // it under the terms of the GNU General Public License as published by |
jaustin32 | 0:320fdce0d6fa | 10 | // the Free Software Foundation, either version 3 of the License, or |
jaustin32 | 0:320fdce0d6fa | 11 | // (at your option) any later version. |
jaustin32 | 0:320fdce0d6fa | 12 | // |
jaustin32 | 0:320fdce0d6fa | 13 | // uLCD_4DGL is distributed in the hope that it will be useful, |
jaustin32 | 0:320fdce0d6fa | 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
jaustin32 | 0:320fdce0d6fa | 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
jaustin32 | 0:320fdce0d6fa | 16 | // GNU General Public License for more details. |
jaustin32 | 0:320fdce0d6fa | 17 | // |
jaustin32 | 0:320fdce0d6fa | 18 | // You should have received a copy of the GNU General Public License |
jaustin32 | 0:320fdce0d6fa | 19 | // along with uLCD_4DGL. If not, see <http://www.gnu.org/licenses/>. |
jaustin32 | 0:320fdce0d6fa | 20 | |
jaustin32 | 0:320fdce0d6fa | 21 | // @author Stephane Rochon |
jaustin32 | 0:320fdce0d6fa | 22 | |
jaustin32 | 0:320fdce0d6fa | 23 | #include "mbed.h" |
jaustin32 | 0:320fdce0d6fa | 24 | |
jaustin32 | 0:320fdce0d6fa | 25 | // Debug Verbose off - SGE commands echoed to USB serial for debugmode=1 |
jaustin32 | 0:320fdce0d6fa | 26 | #ifndef DEBUGMODE |
jaustin32 | 0:320fdce0d6fa | 27 | #define DEBUGMODE 0 |
jaustin32 | 0:320fdce0d6fa | 28 | #endif |
jaustin32 | 0:320fdce0d6fa | 29 | |
jaustin32 | 0:320fdce0d6fa | 30 | // Common WAIT value in milliseconds between commands |
jaustin32 | 0:320fdce0d6fa | 31 | #define TEMPO 0 |
jaustin32 | 0:320fdce0d6fa | 32 | |
jaustin32 | 0:320fdce0d6fa | 33 | // 4DGL SGE Function values for Goldelox Processor |
jaustin32 | 0:320fdce0d6fa | 34 | #define CLS '\xD7' |
jaustin32 | 0:320fdce0d6fa | 35 | #define BAUDRATE '\x0B' //null prefix |
jaustin32 | 0:320fdce0d6fa | 36 | #define VERSION '\x08' //null prefix |
jaustin32 | 0:320fdce0d6fa | 37 | #define BCKGDCOLOR '\x6E' |
jaustin32 | 0:320fdce0d6fa | 38 | #define TXTBCKGDCOLOR '\x7E' |
jaustin32 | 0:320fdce0d6fa | 39 | #define DISPCONTROL '\x68' |
jaustin32 | 0:320fdce0d6fa | 40 | #define SETVOLUME '\x76' |
jaustin32 | 0:320fdce0d6fa | 41 | #define CIRCLE '\xCD' |
jaustin32 | 0:320fdce0d6fa | 42 | #define FCIRCLE '\xCC' |
jaustin32 | 0:320fdce0d6fa | 43 | #define TRIANGLE '\xC9' |
jaustin32 | 0:320fdce0d6fa | 44 | #define LINE '\xD2' |
jaustin32 | 0:320fdce0d6fa | 45 | #define FRECTANGLE '\xCE' |
jaustin32 | 0:320fdce0d6fa | 46 | #define RECTANGLE '\xCF' |
jaustin32 | 0:320fdce0d6fa | 47 | #define ELLIPSE '\x65' //na |
jaustin32 | 0:320fdce0d6fa | 48 | #define PIXEL '\xCB' |
jaustin32 | 0:320fdce0d6fa | 49 | #define READPIXEL '\xCA' |
jaustin32 | 0:320fdce0d6fa | 50 | #define SCREENCOPY '\x63' //na? |
jaustin32 | 0:320fdce0d6fa | 51 | #define PENSIZE '\xD8' |
jaustin32 | 0:320fdce0d6fa | 52 | #define SETFONT '\x7D' |
jaustin32 | 0:320fdce0d6fa | 53 | #define TEXTMODE '\x77' |
jaustin32 | 0:320fdce0d6fa | 54 | #define TEXTBOLD '\x76' |
jaustin32 | 0:320fdce0d6fa | 55 | #define TEXTITALIC '\x75' |
jaustin32 | 0:320fdce0d6fa | 56 | #define TEXTINVERSE '\x74' |
jaustin32 | 0:320fdce0d6fa | 57 | #define TEXTUNDERLINE '\x73' |
jaustin32 | 0:320fdce0d6fa | 58 | #define TEXTWIDTH '\x7C' |
jaustin32 | 0:320fdce0d6fa | 59 | #define TEXTHEIGHT '\x7B' |
jaustin32 | 0:320fdce0d6fa | 60 | #define TEXTCHAR '\xFE' |
jaustin32 | 0:320fdce0d6fa | 61 | #define TEXTSTRING '\x06' //null prefix |
jaustin32 | 0:320fdce0d6fa | 62 | #define MOVECURSOR '\xE4' |
jaustin32 | 0:320fdce0d6fa | 63 | #define BLITCOM '\x0A' |
jaustin32 | 0:320fdce0d6fa | 64 | #define PUTCHAR '\xFE' |
jaustin32 | 0:320fdce0d6fa | 65 | #define DISPPOWER '\x66' |
jaustin32 | 0:320fdce0d6fa | 66 | //media commands for uSD card |
jaustin32 | 0:320fdce0d6fa | 67 | #define MINIT '\xB1' |
jaustin32 | 0:320fdce0d6fa | 68 | #define SBADDRESS '\xB9' |
jaustin32 | 0:320fdce0d6fa | 69 | #define SSADDRESS '\xB8' |
jaustin32 | 0:320fdce0d6fa | 70 | #define READBYTE '\xB7' |
jaustin32 | 0:320fdce0d6fa | 71 | #define READWORD '\xB6' |
jaustin32 | 0:320fdce0d6fa | 72 | #define WRITEBYTE '\xB5' |
jaustin32 | 0:320fdce0d6fa | 73 | #define WRITEWORD '\xB4' |
jaustin32 | 0:320fdce0d6fa | 74 | #define FLUSHMEDIA '\xB2' |
jaustin32 | 0:320fdce0d6fa | 75 | #define DISPLAYIMAGE '\xB3' |
jaustin32 | 0:320fdce0d6fa | 76 | #define DISPLAYVIDEO '\xBB' |
jaustin32 | 0:320fdce0d6fa | 77 | #define DISPLAYFRAME '\xBA' |
jaustin32 | 0:320fdce0d6fa | 78 | |
jaustin32 | 0:320fdce0d6fa | 79 | |
jaustin32 | 0:320fdce0d6fa | 80 | |
jaustin32 | 0:320fdce0d6fa | 81 | // Screen answers |
jaustin32 | 0:320fdce0d6fa | 82 | #define ACK '\x06' |
jaustin32 | 0:320fdce0d6fa | 83 | #define NAK '\x15' |
jaustin32 | 0:320fdce0d6fa | 84 | |
jaustin32 | 0:320fdce0d6fa | 85 | |
jaustin32 | 0:320fdce0d6fa | 86 | |
jaustin32 | 0:320fdce0d6fa | 87 | // Screen states |
jaustin32 | 0:320fdce0d6fa | 88 | #define OFF '\x00' |
jaustin32 | 0:320fdce0d6fa | 89 | #define ON '\x01' |
jaustin32 | 0:320fdce0d6fa | 90 | |
jaustin32 | 0:320fdce0d6fa | 91 | // Graphics modes |
jaustin32 | 0:320fdce0d6fa | 92 | #define SOLID '\x00' |
jaustin32 | 0:320fdce0d6fa | 93 | #define WIREFRAME '\x01' |
jaustin32 | 0:320fdce0d6fa | 94 | |
jaustin32 | 0:320fdce0d6fa | 95 | // Text modes |
jaustin32 | 0:320fdce0d6fa | 96 | #define TRANSPARENT '\x00' |
jaustin32 | 0:320fdce0d6fa | 97 | #define OPAQUE '\x01' |
jaustin32 | 0:320fdce0d6fa | 98 | |
jaustin32 | 0:320fdce0d6fa | 99 | // Fonts Sizes |
jaustin32 | 0:320fdce0d6fa | 100 | #define FONT_7X8 '\x00' //only builtin font |
jaustin32 | 0:320fdce0d6fa | 101 | #define FONT_5X7 '\x04' |
jaustin32 | 0:320fdce0d6fa | 102 | #define FONT_8X8 '\x01' |
jaustin32 | 0:320fdce0d6fa | 103 | #define FONT_8X12 '\x02' |
jaustin32 | 0:320fdce0d6fa | 104 | #define FONT_12X16 '\x03' |
jaustin32 | 0:320fdce0d6fa | 105 | #define MEDIAFONT '\x07' |
jaustin32 | 0:320fdce0d6fa | 106 | |
jaustin32 | 0:320fdce0d6fa | 107 | |
jaustin32 | 0:320fdce0d6fa | 108 | // Data speed |
jaustin32 | 0:320fdce0d6fa | 109 | #define BAUD_110 27271 |
jaustin32 | 0:320fdce0d6fa | 110 | #define BAUD_300 9999 |
jaustin32 | 0:320fdce0d6fa | 111 | #define BAUD_600 4999 |
jaustin32 | 0:320fdce0d6fa | 112 | #define BAUD_1200 2499 |
jaustin32 | 0:320fdce0d6fa | 113 | #define BAUD_2400 1249 |
jaustin32 | 0:320fdce0d6fa | 114 | #define BAUD_4800 624 |
jaustin32 | 0:320fdce0d6fa | 115 | #define BAUD_9600 312 |
jaustin32 | 0:320fdce0d6fa | 116 | #define BAUD_14400 207 |
jaustin32 | 0:320fdce0d6fa | 117 | #define BAUD_19200 155 |
jaustin32 | 0:320fdce0d6fa | 118 | #define BAUD_31250 95 |
jaustin32 | 0:320fdce0d6fa | 119 | #define BAUD_38400 77 |
jaustin32 | 0:320fdce0d6fa | 120 | #define BAUD_56000 53 |
jaustin32 | 0:320fdce0d6fa | 121 | #define BAUD_57600 51 |
jaustin32 | 0:320fdce0d6fa | 122 | #define BAUD_115200 25 |
jaustin32 | 0:320fdce0d6fa | 123 | #define BAUD_128000 22 |
jaustin32 | 0:320fdce0d6fa | 124 | #define BAUD_256000 11 |
jaustin32 | 0:320fdce0d6fa | 125 | #define BAUD_300000 10 |
jaustin32 | 0:320fdce0d6fa | 126 | #define BAUD_375000 8 |
jaustin32 | 0:320fdce0d6fa | 127 | #define BAUD_500000 6 |
jaustin32 | 0:320fdce0d6fa | 128 | #define BAUD_600000 4 |
jaustin32 | 0:320fdce0d6fa | 129 | #define BAUD_750000 3 |
jaustin32 | 0:320fdce0d6fa | 130 | #define BAUD_1000000 2 |
jaustin32 | 0:320fdce0d6fa | 131 | #define BAUD_1500000 1 |
jaustin32 | 0:320fdce0d6fa | 132 | #define BAUD_3000000 0 |
jaustin32 | 0:320fdce0d6fa | 133 | |
jaustin32 | 0:320fdce0d6fa | 134 | // Defined Colors |
jaustin32 | 0:320fdce0d6fa | 135 | #define WHITE 0xFFFFFF |
jaustin32 | 0:320fdce0d6fa | 136 | #define BLACK 0x000000 |
jaustin32 | 0:320fdce0d6fa | 137 | #define RED 0xFF0000 |
jaustin32 | 0:320fdce0d6fa | 138 | #define GREEN 0x00FF00 |
jaustin32 | 0:320fdce0d6fa | 139 | #define BLUE 0x0000FF |
jaustin32 | 0:320fdce0d6fa | 140 | #define LGREY 0xBFBFBF |
jaustin32 | 0:320fdce0d6fa | 141 | #define DGREY 0x5F5F5F |
jaustin32 | 0:320fdce0d6fa | 142 | |
jaustin32 | 0:320fdce0d6fa | 143 | // Mode data |
jaustin32 | 0:320fdce0d6fa | 144 | #define BACKLIGHT '\x00' |
jaustin32 | 0:320fdce0d6fa | 145 | #define DISPLAY '\x01' |
jaustin32 | 0:320fdce0d6fa | 146 | #define CONTRAST '\x02' |
jaustin32 | 0:320fdce0d6fa | 147 | #define POWER '\x03' |
jaustin32 | 0:320fdce0d6fa | 148 | #define ORIENTATION '\x04' |
jaustin32 | 0:320fdce0d6fa | 149 | #define TOUCH_CTRL '\x05' |
jaustin32 | 0:320fdce0d6fa | 150 | #define IMAGE_FORMAT '\x06' |
jaustin32 | 0:320fdce0d6fa | 151 | #define PROTECT_FAT '\x08' |
jaustin32 | 0:320fdce0d6fa | 152 | |
jaustin32 | 0:320fdce0d6fa | 153 | // change this to your specific screen (newer versions) if needed |
jaustin32 | 0:320fdce0d6fa | 154 | // Startup orientation is PORTRAIT so SIZE_X must be lesser than SIZE_Y |
jaustin32 | 0:320fdce0d6fa | 155 | //uLCD144-G2 is a 128 by 128 pixel display |
jaustin32 | 0:320fdce0d6fa | 156 | #define SIZE_X 128 |
jaustin32 | 0:320fdce0d6fa | 157 | #define SIZE_Y 128 |
jaustin32 | 0:320fdce0d6fa | 158 | |
jaustin32 | 0:320fdce0d6fa | 159 | #define IS_LANDSCAPE 0 |
jaustin32 | 0:320fdce0d6fa | 160 | #define IS_PORTRAIT 1 |
jaustin32 | 0:320fdce0d6fa | 161 | |
jaustin32 | 0:320fdce0d6fa | 162 | // Screen orientation |
jaustin32 | 0:320fdce0d6fa | 163 | #define LANDSCAPE '\x00' |
jaustin32 | 0:320fdce0d6fa | 164 | #define LANDSCAPE_R '\x01' |
jaustin32 | 0:320fdce0d6fa | 165 | #define PORTRAIT '\x02' |
jaustin32 | 0:320fdce0d6fa | 166 | #define PORTRAIT_R '\x03' |
jaustin32 | 0:320fdce0d6fa | 167 | |
jaustin32 | 0:320fdce0d6fa | 168 | // Parameters |
jaustin32 | 0:320fdce0d6fa | 169 | #define ENABLE '\x00' |
jaustin32 | 0:320fdce0d6fa | 170 | #define DISABLE '\x01' |
jaustin32 | 0:320fdce0d6fa | 171 | #define RESET '\x02' |
jaustin32 | 0:320fdce0d6fa | 172 | |
jaustin32 | 0:320fdce0d6fa | 173 | #define NEW '\x00' |
jaustin32 | 0:320fdce0d6fa | 174 | #define OLD '\x01' |
jaustin32 | 0:320fdce0d6fa | 175 | |
jaustin32 | 0:320fdce0d6fa | 176 | #define DOWN '\x00' |
jaustin32 | 0:320fdce0d6fa | 177 | #define UP '\x01' |
jaustin32 | 0:320fdce0d6fa | 178 | |
jaustin32 | 0:320fdce0d6fa | 179 | #define PROTECT '\x00' |
jaustin32 | 0:320fdce0d6fa | 180 | #define UNPROTECT '\x02' |
jaustin32 | 0:320fdce0d6fa | 181 | |
jaustin32 | 0:320fdce0d6fa | 182 | //************************************************************************** |
jaustin32 | 0:320fdce0d6fa | 183 | // \class uLCD_4DGL uLCD_4DGL.h |
jaustin32 | 0:320fdce0d6fa | 184 | // \brief This is the main class. It shoud be used like this : uLCD_4GDL myLCD(p9,p10,p11); |
jaustin32 | 0:320fdce0d6fa | 185 | /** |
jaustin32 | 0:320fdce0d6fa | 186 | Example: |
jaustin32 | 0:320fdce0d6fa | 187 | * @code |
jaustin32 | 0:320fdce0d6fa | 188 | * // Display a white circle on the screen |
jaustin32 | 0:320fdce0d6fa | 189 | * #include "mbed.h" |
jaustin32 | 0:320fdce0d6fa | 190 | * #include " uLCD_4DGL.h" |
jaustin32 | 0:320fdce0d6fa | 191 | * |
jaustin32 | 0:320fdce0d6fa | 192 | * uLCD_4GDL myLCD(p9,p10,p11); |
jaustin32 | 0:320fdce0d6fa | 193 | * |
jaustin32 | 0:320fdce0d6fa | 194 | * int main() { |
jaustin32 | 0:320fdce0d6fa | 195 | * myLCD.circle(120, 160, 80, WHITE); |
jaustin32 | 0:320fdce0d6fa | 196 | * } |
jaustin32 | 0:320fdce0d6fa | 197 | * @endcode |
jaustin32 | 0:320fdce0d6fa | 198 | */ |
jaustin32 | 0:320fdce0d6fa | 199 | |
jaustin32 | 0:320fdce0d6fa | 200 | class uLCD_4DGL : public Stream |
jaustin32 | 0:320fdce0d6fa | 201 | { |
jaustin32 | 0:320fdce0d6fa | 202 | |
jaustin32 | 0:320fdce0d6fa | 203 | public : |
jaustin32 | 0:320fdce0d6fa | 204 | |
jaustin32 | 0:320fdce0d6fa | 205 | uLCD_4DGL(PinName tx, PinName rx, PinName rst); |
jaustin32 | 0:320fdce0d6fa | 206 | |
jaustin32 | 0:320fdce0d6fa | 207 | // General Commands ******************************************************************************* |
jaustin32 | 0:320fdce0d6fa | 208 | |
jaustin32 | 0:320fdce0d6fa | 209 | /** Clear the entire screen using the current background colour */ |
jaustin32 | 0:320fdce0d6fa | 210 | void cls(); |
jaustin32 | 0:320fdce0d6fa | 211 | |
jaustin32 | 0:320fdce0d6fa | 212 | /** Reset screen */ |
jaustin32 | 0:320fdce0d6fa | 213 | void reset(); |
jaustin32 | 0:320fdce0d6fa | 214 | |
jaustin32 | 0:320fdce0d6fa | 215 | |
jaustin32 | 0:320fdce0d6fa | 216 | /** Set serial Baud rate (both sides : screen and mbed) |
jaustin32 | 0:320fdce0d6fa | 217 | * @param Speed Correct BAUD value (see uLCD_4DGL.h) |
jaustin32 | 0:320fdce0d6fa | 218 | */ |
jaustin32 | 0:320fdce0d6fa | 219 | void baudrate(int speed); |
jaustin32 | 0:320fdce0d6fa | 220 | |
jaustin32 | 0:320fdce0d6fa | 221 | /** Set background colour to the specified value |
jaustin32 | 0:320fdce0d6fa | 222 | * @param color in HEX RGB like 0xFF00FF |
jaustin32 | 0:320fdce0d6fa | 223 | */ |
jaustin32 | 0:320fdce0d6fa | 224 | void background_color(int color); |
jaustin32 | 0:320fdce0d6fa | 225 | |
jaustin32 | 0:320fdce0d6fa | 226 | /** Set screen display mode to specific values |
jaustin32 | 0:320fdce0d6fa | 227 | * @param mode See 4DGL documentation |
jaustin32 | 0:320fdce0d6fa | 228 | * @param value See 4DGL documentation |
jaustin32 | 0:320fdce0d6fa | 229 | */ |
jaustin32 | 0:320fdce0d6fa | 230 | void textbackground_color(int color); |
jaustin32 | 0:320fdce0d6fa | 231 | |
jaustin32 | 0:320fdce0d6fa | 232 | /** Set screen display mode to specific values |
jaustin32 | 0:320fdce0d6fa | 233 | * @param mode See 4DGL documentation |
jaustin32 | 0:320fdce0d6fa | 234 | * @param value See 4DGL documentation |
jaustin32 | 0:320fdce0d6fa | 235 | */ |
jaustin32 | 0:320fdce0d6fa | 236 | void display_control(char mode); |
jaustin32 | 0:320fdce0d6fa | 237 | void display_power(char mode); |
jaustin32 | 0:320fdce0d6fa | 238 | /** Set internal speaker to specified value |
jaustin32 | 0:320fdce0d6fa | 239 | * @param value Correct range is 8 - 127 |
jaustin32 | 0:320fdce0d6fa | 240 | */ |
jaustin32 | 0:320fdce0d6fa | 241 | void set_volume(char value); |
jaustin32 | 0:320fdce0d6fa | 242 | |
jaustin32 | 0:320fdce0d6fa | 243 | // Graphics Commands ******************************************************************************* |
jaustin32 | 0:320fdce0d6fa | 244 | |
jaustin32 | 0:320fdce0d6fa | 245 | /** Draw a circle centered at x,y with a radius and a colour. It uses Pen Size stored value to draw a solid or wireframe circle |
jaustin32 | 0:320fdce0d6fa | 246 | * @param x Horizontal position of the circle centre |
jaustin32 | 0:320fdce0d6fa | 247 | * @param y Vertical position of the circle centre |
jaustin32 | 0:320fdce0d6fa | 248 | * @param radius Radius of the circle |
jaustin32 | 0:320fdce0d6fa | 249 | * @param color Circle color in HEX RGB like 0xFF00FF |
jaustin32 | 0:320fdce0d6fa | 250 | */ |
jaustin32 | 0:320fdce0d6fa | 251 | void circle(int x , int y , int radius, int color); |
jaustin32 | 0:320fdce0d6fa | 252 | void filled_circle(int x , int y , int radius, int color); |
jaustin32 | 0:320fdce0d6fa | 253 | void triangle(int, int, int, int, int, int, int); |
jaustin32 | 0:320fdce0d6fa | 254 | void line(int, int, int, int, int); |
jaustin32 | 0:320fdce0d6fa | 255 | void rectangle(int, int, int, int, int); |
jaustin32 | 0:320fdce0d6fa | 256 | void filled_rectangle(int, int, int, int, int); |
jaustin32 | 0:320fdce0d6fa | 257 | void pixel(int, int, int); |
jaustin32 | 0:320fdce0d6fa | 258 | int read_pixel(int, int); |
jaustin32 | 0:320fdce0d6fa | 259 | void pen_size(char); |
jaustin32 | 0:320fdce0d6fa | 260 | void BLIT(int x, int y, int w, int h, int *colors); |
jaustin32 | 0:320fdce0d6fa | 261 | |
jaustin32 | 0:320fdce0d6fa | 262 | // Text Commands |
jaustin32 | 0:320fdce0d6fa | 263 | void set_font(char); |
jaustin32 | 0:320fdce0d6fa | 264 | void set_font_size(char width, char height); |
jaustin32 | 0:320fdce0d6fa | 265 | void text_mode(char); |
jaustin32 | 0:320fdce0d6fa | 266 | void text_bold(char); |
jaustin32 | 0:320fdce0d6fa | 267 | void text_italic(char); |
jaustin32 | 0:320fdce0d6fa | 268 | void text_inverse(char); |
jaustin32 | 0:320fdce0d6fa | 269 | void text_underline(char); |
jaustin32 | 0:320fdce0d6fa | 270 | void text_width(char); |
jaustin32 | 0:320fdce0d6fa | 271 | void text_height(char); |
jaustin32 | 0:320fdce0d6fa | 272 | void text_char(char, char, char, int); |
jaustin32 | 0:320fdce0d6fa | 273 | void text_string(char *, char, char, char, int); |
jaustin32 | 0:320fdce0d6fa | 274 | void locate(char, char); |
jaustin32 | 0:320fdce0d6fa | 275 | void color(int); |
jaustin32 | 0:320fdce0d6fa | 276 | void putc(char); |
jaustin32 | 0:320fdce0d6fa | 277 | void puts(char *); |
jaustin32 | 0:320fdce0d6fa | 278 | |
jaustin32 | 0:320fdce0d6fa | 279 | //Media Commands |
jaustin32 | 0:320fdce0d6fa | 280 | int media_init(); |
jaustin32 | 0:320fdce0d6fa | 281 | void set_byte_address(int, int); |
jaustin32 | 0:320fdce0d6fa | 282 | void set_sector_address(int, int); |
jaustin32 | 0:320fdce0d6fa | 283 | char read_byte(); |
jaustin32 | 0:320fdce0d6fa | 284 | int read_word(); |
jaustin32 | 0:320fdce0d6fa | 285 | void write_byte(int); |
jaustin32 | 0:320fdce0d6fa | 286 | void write_word(int); |
jaustin32 | 0:320fdce0d6fa | 287 | void flush_media(); |
jaustin32 | 0:320fdce0d6fa | 288 | void display_image(int, int); |
jaustin32 | 0:320fdce0d6fa | 289 | void display_video(int, int); |
jaustin32 | 0:320fdce0d6fa | 290 | void display_frame(int, int, int); |
jaustin32 | 0:320fdce0d6fa | 291 | |
jaustin32 | 0:320fdce0d6fa | 292 | // Screen Data |
jaustin32 | 0:320fdce0d6fa | 293 | int type; |
jaustin32 | 0:320fdce0d6fa | 294 | int revision; |
jaustin32 | 0:320fdce0d6fa | 295 | int firmware; |
jaustin32 | 0:320fdce0d6fa | 296 | int reserved1; |
jaustin32 | 0:320fdce0d6fa | 297 | int reserved2; |
jaustin32 | 0:320fdce0d6fa | 298 | |
jaustin32 | 0:320fdce0d6fa | 299 | // Text data |
jaustin32 | 0:320fdce0d6fa | 300 | char current_col; |
jaustin32 | 0:320fdce0d6fa | 301 | char current_row; |
jaustin32 | 0:320fdce0d6fa | 302 | int current_color; |
jaustin32 | 0:320fdce0d6fa | 303 | char current_font; |
jaustin32 | 0:320fdce0d6fa | 304 | char current_orientation; |
jaustin32 | 0:320fdce0d6fa | 305 | char max_col; |
jaustin32 | 0:320fdce0d6fa | 306 | char max_row; |
jaustin32 | 0:320fdce0d6fa | 307 | int current_w, current_h; |
jaustin32 | 0:320fdce0d6fa | 308 | int current_fx, current_fy; |
jaustin32 | 0:320fdce0d6fa | 309 | int current_wf, current_hf; |
jaustin32 | 0:320fdce0d6fa | 310 | |
jaustin32 | 0:320fdce0d6fa | 311 | |
jaustin32 | 0:320fdce0d6fa | 312 | protected : |
jaustin32 | 0:320fdce0d6fa | 313 | |
jaustin32 | 0:320fdce0d6fa | 314 | Serial _cmd; |
jaustin32 | 0:320fdce0d6fa | 315 | DigitalOut _rst; |
jaustin32 | 0:320fdce0d6fa | 316 | //used by printf |
jaustin32 | 0:320fdce0d6fa | 317 | virtual int _putc(int c) { |
jaustin32 | 0:320fdce0d6fa | 318 | putc(c); |
jaustin32 | 0:320fdce0d6fa | 319 | return 0; |
jaustin32 | 0:320fdce0d6fa | 320 | }; |
jaustin32 | 0:320fdce0d6fa | 321 | virtual int _getc() { |
jaustin32 | 0:320fdce0d6fa | 322 | return -1; |
jaustin32 | 0:320fdce0d6fa | 323 | } |
jaustin32 | 0:320fdce0d6fa | 324 | |
jaustin32 | 0:320fdce0d6fa | 325 | void freeBUFFER (void); |
jaustin32 | 0:320fdce0d6fa | 326 | void writeBYTE (char); |
jaustin32 | 0:320fdce0d6fa | 327 | void writeBYTEfast (char); |
jaustin32 | 0:320fdce0d6fa | 328 | int writeCOMMAND(char *, int); |
jaustin32 | 0:320fdce0d6fa | 329 | int writeCOMMANDnull(char *, int); |
jaustin32 | 0:320fdce0d6fa | 330 | int readVERSION (char *, int); |
jaustin32 | 0:320fdce0d6fa | 331 | int getSTATUS (char *, int); |
jaustin32 | 0:320fdce0d6fa | 332 | int version (void); |
jaustin32 | 0:320fdce0d6fa | 333 | #if DEBUGMODE |
jaustin32 | 0:320fdce0d6fa | 334 | Serial pc; |
jaustin32 | 0:320fdce0d6fa | 335 | #endif // DEBUGMODE |
jaustin32 | 0:320fdce0d6fa | 336 | }; |
jaustin32 | 0:320fdce0d6fa | 337 | |
jaustin32 | 0:320fdce0d6fa | 338 | typedef unsigned char BYTE; |
jaustin32 | 0:320fdce0d6fa | 339 | |
jaustin32 | 0:320fdce0d6fa | 340 | |
jaustin32 | 0:320fdce0d6fa | 341 | |
jaustin32 | 0:320fdce0d6fa | 342 | |
jaustin32 | 0:320fdce0d6fa | 343 | |
jaustin32 | 0:320fdce0d6fa | 344 | |
jaustin32 | 0:320fdce0d6fa | 345 | |
jaustin32 | 0:320fdce0d6fa | 346 |