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