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