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