Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Picaso_4DGL-32PTU.h@13:1a0800957412, 2016-09-15 (annotated)
- Committer:
- CaptainR
- Date:
- Thu Sep 15 08:04:37 2016 +0000
- Revision:
- 13:1a0800957412
- Parent:
- 12:29f5ad896382
- Child:
- 14:561cb06a2739
Fixed RX callback function, fixed uSD read function
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| CaptainR | 0:a5ef6bc3c2e8 | 1 | // |
| CaptainR | 2:81eaaa491a02 | 2 | // Picaso_4DGL-32PTU is a class to drive 4D Systems TFT touch screens with PICASO processor |
| CaptainR | 2:81eaaa491a02 | 3 | // Tested with NUCLEO L152RE development board |
| CaptainR | 2:81eaaa491a02 | 4 | // Copyright (C) <2016> Rihards Balass <rihards.balass@gmail.com> |
| CaptainR | 0:a5ef6bc3c2e8 | 5 | // |
| CaptainR | 2:81eaaa491a02 | 6 | // Picaso_4DGL-32PTU is free software: you can redistribute it and/or modify |
| CaptainR | 2:81eaaa491a02 | 7 | // it under the terms of the GNU General Public License as published by |
| CaptainR | 2:81eaaa491a02 | 8 | // the Free Software Foundation, either version 3 of the License, or |
| CaptainR | 2:81eaaa491a02 | 9 | // (at your option) any later version. |
| CaptainR | 2:81eaaa491a02 | 10 | // |
| CaptainR | 2:81eaaa491a02 | 11 | // Picaso_4DGL-32PTU is distributed in the hope that it will be useful, |
| CaptainR | 2:81eaaa491a02 | 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| CaptainR | 2:81eaaa491a02 | 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| CaptainR | 2:81eaaa491a02 | 14 | // GNU General Public License for more details. |
| CaptainR | 2:81eaaa491a02 | 15 | // |
| CaptainR | 2:81eaaa491a02 | 16 | // You can see GNU General Public License at <http://www.gnu.org/licenses/>. |
| CaptainR | 0:a5ef6bc3c2e8 | 17 | // |
| CaptainR | 0:a5ef6bc3c2e8 | 18 | |
| CaptainR | 0:a5ef6bc3c2e8 | 19 | #include "mbed.h" |
| CaptainR | 0:a5ef6bc3c2e8 | 20 | |
| CaptainR | 0:a5ef6bc3c2e8 | 21 | #ifndef DEBUGMODE |
| CaptainR | 0:a5ef6bc3c2e8 | 22 | #define DEBUGMODE 1 |
| CaptainR | 0:a5ef6bc3c2e8 | 23 | #endif |
| CaptainR | 0:a5ef6bc3c2e8 | 24 | |
| CaptainR | 12:29f5ad896382 | 25 | #ifndef DEMO |
| CaptainR | 12:29f5ad896382 | 26 | #define DEMO 1 |
| CaptainR | 12:29f5ad896382 | 27 | #endif |
| CaptainR | 12:29f5ad896382 | 28 | |
| CaptainR | 0:a5ef6bc3c2e8 | 29 | // functions |
| CaptainR | 2:81eaaa491a02 | 30 | #define CHECK_BIT(var,pos) ((var) & (1<<(pos))) // to check if required bit is set |
| CaptainR | 0:a5ef6bc3c2e8 | 31 | |
| CaptainR | 0:a5ef6bc3c2e8 | 32 | // Common WAIT value in millisecond |
| CaptainR | 12:29f5ad896382 | 33 | #define TEMPO 1 |
| CaptainR | 12:29f5ad896382 | 34 | #define MAX_WAIT 10 |
| CaptainR | 0:a5ef6bc3c2e8 | 35 | |
| CaptainR | 12:29f5ad896382 | 36 | // Main commands |
| CaptainR | 3:dcfbceb81fef | 37 | #define BAUDRATE 0x0026 |
| CaptainR | 3:dcfbceb81fef | 38 | #define ORIENTATION 0xFF9E |
| CaptainR | 0:a5ef6bc3c2e8 | 39 | |
| CaptainR | 12:29f5ad896382 | 40 | // text commands |
| CaptainR | 5:890ddd974624 | 41 | #define TEXT_BG_COLOR 0xFFE6 |
| CaptainR | 3:dcfbceb81fef | 42 | #define SET_FONT 0xFFE5 |
| CaptainR | 3:dcfbceb81fef | 43 | #define PUT_CHAR 0xFFFE |
| CaptainR | 3:dcfbceb81fef | 44 | #define PUT_STRING 0x0018 |
| CaptainR | 3:dcfbceb81fef | 45 | #define MOVE_CURSOR 0xFFE9 |
| CaptainR | 3:dcfbceb81fef | 46 | #define TEXT_FG_COLOR 0xFFE7 |
| CaptainR | 3:dcfbceb81fef | 47 | #define TEXT_WIDTH 0xFFE4 |
| CaptainR | 3:dcfbceb81fef | 48 | #define TEXT_HEIGHT 0xFFE3 |
| CaptainR | 3:dcfbceb81fef | 49 | #define TEXT_X_GAP 0xFFE2 |
| CaptainR | 3:dcfbceb81fef | 50 | #define TEXT_Y_GAP 0xFFE1 |
| CaptainR | 3:dcfbceb81fef | 51 | #define TEXT_BOLD 0xFFDE |
| CaptainR | 3:dcfbceb81fef | 52 | #define TEXT_INVERSE 0xFFDC |
| CaptainR | 3:dcfbceb81fef | 53 | #define TEXT_ITALIC 0xFFDD |
| CaptainR | 3:dcfbceb81fef | 54 | #define TEXT_OPACITY 0xFFDF |
| CaptainR | 3:dcfbceb81fef | 55 | #define TEXT_UNDERLINE 0xFFDB |
| CaptainR | 3:dcfbceb81fef | 56 | #define TEXT_ATTRIBUTES 0xFFDA |
| CaptainR | 0:a5ef6bc3c2e8 | 57 | |
| CaptainR | 12:29f5ad896382 | 58 | // graphics commands |
| CaptainR | 5:890ddd974624 | 59 | #define CHANGE_COLOR 0xFFB4 |
| CaptainR | 3:dcfbceb81fef | 60 | #define DRAW_CIRCLE 0xFFC3 |
| CaptainR | 3:dcfbceb81fef | 61 | #define CIRCLE_FILLED 0xFFC2 |
| CaptainR | 3:dcfbceb81fef | 62 | #define DRAW_LINE 0xFFC8 |
| CaptainR | 3:dcfbceb81fef | 63 | #define DRAW_RECTANGLE 0xFFC5 |
| CaptainR | 3:dcfbceb81fef | 64 | #define RECTANGLE_FILLED 0xFFC4 |
| CaptainR | 3:dcfbceb81fef | 65 | #define DRAW_POLYLINE 0x0015 |
| CaptainR | 3:dcfbceb81fef | 66 | #define DRAW_POLYGON 0x0013 |
| CaptainR | 3:dcfbceb81fef | 67 | #define POLYGON_FILLED 0x0014 |
| CaptainR | 3:dcfbceb81fef | 68 | #define DRAW_TRIANGLE 0xFFBF |
| CaptainR | 3:dcfbceb81fef | 69 | #define TRIANGLE_FILLED 0xFFA9 |
| CaptainR | 4:50511ed54ab4 | 70 | #define CALCULATE_ORBIT 0x0012 |
| CaptainR | 6:a1a85f2bc04b | 71 | #define PUT_PIXEL 0xFFC1 |
| CaptainR | 6:a1a85f2bc04b | 72 | #define MOVE_ORIGIN 0xFFCC |
| CaptainR | 8:b634ac9c92f8 | 73 | #define LINE_TO 0xFFCA |
| CaptainR | 9:32eb75c01e9d | 74 | #define SET_CLIP_WINDOW 0xFFB5 |
| CaptainR | 9:32eb75c01e9d | 75 | #define CLIPPING 0xFFA2 |
| CaptainR | 9:32eb75c01e9d | 76 | #define EXTEND_CLIP 0xFFB3 |
| CaptainR | 10:b959bb206e6b | 77 | #define DRAW_ELIPSE 0xFFB2 |
| CaptainR | 10:b959bb206e6b | 78 | #define ELIPSE_FILLED 0xFFB1 |
| CaptainR | 10:b959bb206e6b | 79 | #define DRAW_BUTTON 0x0011 |
| CaptainR | 10:b959bb206e6b | 80 | #define BEVEL_SHADOW 0xFF98 |
| CaptainR | 11:3ebd2263f3e9 | 81 | #define BEVEL_WIDTH 0xFF99 |
| CaptainR | 10:b959bb206e6b | 82 | #define DRAW_PANEL 0xFFAF |
| CaptainR | 10:b959bb206e6b | 83 | #define DRAW_SLIDER 0xFFAE |
| CaptainR | 10:b959bb206e6b | 84 | #define SCREEN_CP 0xFFAD |
| CaptainR | 11:3ebd2263f3e9 | 85 | #define BG_COLOR 0xFFA4 |
| CaptainR | 11:3ebd2263f3e9 | 86 | #define OUTLINE_COLOR 0xFF9D |
| CaptainR | 11:3ebd2263f3e9 | 87 | #define CONTRAST 0xFF9C |
| CaptainR | 11:3ebd2263f3e9 | 88 | #define FRAME_DELAY 0xFF9F |
| CaptainR | 11:3ebd2263f3e9 | 89 | #define LINE_PATERN 0xFF9B |
| CaptainR | 11:3ebd2263f3e9 | 90 | #define TRANSPARENCY 0xFFA0 |
| CaptainR | 11:3ebd2263f3e9 | 91 | #define TRANSPARENT_COLOR 0xFFA1 |
| CaptainR | 11:3ebd2263f3e9 | 92 | #define SET_GRAPHICS 0xFFCE |
| CaptainR | 11:3ebd2263f3e9 | 93 | #define GET_GRAPHICS 0xFFA6 |
| CaptainR | 12:29f5ad896382 | 94 | #define CLS 0xFFCD |
| CaptainR | 8:b634ac9c92f8 | 95 | |
| CaptainR | 12:29f5ad896382 | 96 | // media commands |
| CaptainR | 12:29f5ad896382 | 97 | #define MEDIA_INIT 0xFF89 |
| CaptainR | 12:29f5ad896382 | 98 | #define MEDIA_SET_ADD 0xFF93 |
| CaptainR | 12:29f5ad896382 | 99 | #define MEDIA_SET_SECTOR 0xFF92 |
| CaptainR | 12:29f5ad896382 | 100 | #define MEDIA_READ_SECTOR 0x0016 |
| CaptainR | 12:29f5ad896382 | 101 | #define MEDIA_WRITE_SECTOR 0x0017 |
| CaptainR | 0:a5ef6bc3c2e8 | 102 | |
| CaptainR | 0:a5ef6bc3c2e8 | 103 | |
| CaptainR | 0:a5ef6bc3c2e8 | 104 | // Screen answers |
| CaptainR | 0:a5ef6bc3c2e8 | 105 | #define ACK 0x06 |
| CaptainR | 8:b634ac9c92f8 | 106 | #define NACK 0x15 |
| CaptainR | 0:a5ef6bc3c2e8 | 107 | |
| CaptainR | 0:a5ef6bc3c2e8 | 108 | // Predefined Fonts |
| CaptainR | 2:81eaaa491a02 | 109 | #define FONT1 0x0000 |
| CaptainR | 2:81eaaa491a02 | 110 | #define FONT2 0x0001 |
| CaptainR | 2:81eaaa491a02 | 111 | #define FONT3 0x0002 |
| CaptainR | 0:a5ef6bc3c2e8 | 112 | |
| CaptainR | 0:a5ef6bc3c2e8 | 113 | // Line and column values depending on orientation and font F1LL = font1 landscape line |
| CaptainR | 0:a5ef6bc3c2e8 | 114 | #define F1LL 29 |
| CaptainR | 0:a5ef6bc3c2e8 | 115 | #define F1LC 44 |
| CaptainR | 0:a5ef6bc3c2e8 | 116 | #define F1PL 39 |
| CaptainR | 0:a5ef6bc3c2e8 | 117 | #define F1PC 33 |
| CaptainR | 0:a5ef6bc3c2e8 | 118 | |
| CaptainR | 0:a5ef6bc3c2e8 | 119 | #define F2LL 29 |
| CaptainR | 0:a5ef6bc3c2e8 | 120 | #define F2LC 39 |
| CaptainR | 0:a5ef6bc3c2e8 | 121 | #define F2PL 39 |
| CaptainR | 0:a5ef6bc3c2e8 | 122 | #define F2PC 29 |
| CaptainR | 0:a5ef6bc3c2e8 | 123 | |
| CaptainR | 0:a5ef6bc3c2e8 | 124 | #define F3LL 19 |
| CaptainR | 0:a5ef6bc3c2e8 | 125 | #define F3LC 39 |
| CaptainR | 0:a5ef6bc3c2e8 | 126 | #define F3PL 26 |
| CaptainR | 0:a5ef6bc3c2e8 | 127 | #define F3PC 29 |
| CaptainR | 0:a5ef6bc3c2e8 | 128 | |
| CaptainR | 0:a5ef6bc3c2e8 | 129 | // Data speed |
| CaptainR | 2:81eaaa491a02 | 130 | #define BAUD_300 0x0001 |
| CaptainR | 2:81eaaa491a02 | 131 | #define BAUD_600 0x0002 |
| CaptainR | 2:81eaaa491a02 | 132 | #define BAUD_1200 0x0003 |
| CaptainR | 2:81eaaa491a02 | 133 | #define BAUD_2400 0x0004 |
| CaptainR | 2:81eaaa491a02 | 134 | #define BAUD_4800 0x0005 |
| CaptainR | 2:81eaaa491a02 | 135 | #define BAUD_9600 0x0006 |
| CaptainR | 2:81eaaa491a02 | 136 | #define BAUD_14400 0x0007 |
| CaptainR | 2:81eaaa491a02 | 137 | #define BAUD_19200 0x0008 |
| CaptainR | 2:81eaaa491a02 | 138 | #define BAUD_31250 0x0009 |
| CaptainR | 2:81eaaa491a02 | 139 | #define BAUD_38400 0x000A |
| CaptainR | 2:81eaaa491a02 | 140 | #define BAUD_56000 0x000B |
| CaptainR | 2:81eaaa491a02 | 141 | #define BAUD_57600 0x000C |
| CaptainR | 2:81eaaa491a02 | 142 | #define BAUD_115200 0x000D |
| CaptainR | 2:81eaaa491a02 | 143 | #define BAUD_128000 0x000E |
| CaptainR | 2:81eaaa491a02 | 144 | #define BAUD_256000 0x000F |
| CaptainR | 2:81eaaa491a02 | 145 | #define BAUD_300000 0x0010 |
| CaptainR | 2:81eaaa491a02 | 146 | #define BAUD_375000 0x0011 |
| CaptainR | 2:81eaaa491a02 | 147 | #define BAUD_500000 0x0012 |
| CaptainR | 2:81eaaa491a02 | 148 | #define BAUD_600000 0x0013 |
| CaptainR | 0:a5ef6bc3c2e8 | 149 | |
| CaptainR | 3:dcfbceb81fef | 150 | // Defined colors |
| CaptainR | 2:81eaaa491a02 | 151 | #define Black 0x0000 |
| CaptainR | 2:81eaaa491a02 | 152 | #define Navy 0x000F |
| CaptainR | 2:81eaaa491a02 | 153 | #define DGreen 0x03E0 |
| CaptainR | 2:81eaaa491a02 | 154 | #define DCyan 0x03EF |
| CaptainR | 2:81eaaa491a02 | 155 | #define Purple 0x780F |
| CaptainR | 2:81eaaa491a02 | 156 | #define Olive 0x7BE0 |
| CaptainR | 2:81eaaa491a02 | 157 | #define Grey 0x8410 |
| CaptainR | 2:81eaaa491a02 | 158 | #define Blue 0x001F |
| CaptainR | 2:81eaaa491a02 | 159 | #define Green 0x07E0 |
| CaptainR | 2:81eaaa491a02 | 160 | #define Red 0xF800 |
| CaptainR | 2:81eaaa491a02 | 161 | #define Yellow 0xFFE0 |
| CaptainR | 2:81eaaa491a02 | 162 | #define White 0xFFFF |
| CaptainR | 2:81eaaa491a02 | 163 | #define Orange 0xFD20 |
| CaptainR | 2:81eaaa491a02 | 164 | #define GYellow 0xAFE5 |
| CaptainR | 2:81eaaa491a02 | 165 | #define Pink 0xF81F |
| CaptainR | 2:81eaaa491a02 | 166 | #define Violet 0x901A |
| CaptainR | 2:81eaaa491a02 | 167 | #define Aqua 0x07FF |
| CaptainR | 2:81eaaa491a02 | 168 | #define Cream 0xFFDE |
| CaptainR | 0:a5ef6bc3c2e8 | 169 | |
| CaptainR | 0:a5ef6bc3c2e8 | 170 | // Screen orientation |
| CaptainR | 2:81eaaa491a02 | 171 | #define LANDSCAPE 0x0000 |
| CaptainR | 2:81eaaa491a02 | 172 | #define LANDSCAPE_R 0x0001 |
| CaptainR | 2:81eaaa491a02 | 173 | #define PORTRAIT 0x0002 |
| CaptainR | 2:81eaaa491a02 | 174 | #define PORTRAIT_R 0x0003 |
| CaptainR | 0:a5ef6bc3c2e8 | 175 | |
| CaptainR | 0:a5ef6bc3c2e8 | 176 | // Parameters |
| CaptainR | 2:81eaaa491a02 | 177 | #define ENABLE 1 |
| CaptainR | 2:81eaaa491a02 | 178 | #define DISABLE 0 |
| CaptainR | 10:b959bb206e6b | 179 | // orientation |
| CaptainR | 2:81eaaa491a02 | 180 | #define landscape 1 |
| CaptainR | 2:81eaaa491a02 | 181 | #define landscapeRew 2 |
| CaptainR | 2:81eaaa491a02 | 182 | #define portrait 3 |
| CaptainR | 2:81eaaa491a02 | 183 | #define portraitRew 4 |
| CaptainR | 10:b959bb206e6b | 184 | // text attributes |
| CaptainR | 2:81eaaa491a02 | 185 | #define bold 16 |
| CaptainR | 2:81eaaa491a02 | 186 | #define italic 32 |
| CaptainR | 2:81eaaa491a02 | 187 | #define inverse 64 |
| CaptainR | 2:81eaaa491a02 | 188 | #define underline 128 |
| CaptainR | 10:b959bb206e6b | 189 | // Fonts |
| CaptainR | 2:81eaaa491a02 | 190 | #define font1 1 |
| CaptainR | 2:81eaaa491a02 | 191 | #define font2 2 |
| CaptainR | 2:81eaaa491a02 | 192 | #define font3 3 |
| CaptainR | 10:b959bb206e6b | 193 | // Receive buffer length |
| CaptainR | 13:1a0800957412 | 194 | #define RXBUFLEN 1024 |
| CaptainR | 12:29f5ad896382 | 195 | #define BUFFER_SIZE 512 |
| CaptainR | 10:b959bb206e6b | 196 | // 3D states |
| CaptainR | 10:b959bb206e6b | 197 | #define DEPRESSED 0 |
| CaptainR | 12:29f5ad896382 | 198 | #define RECESSED 0 |
| CaptainR | 10:b959bb206e6b | 199 | #define INDENTED 0 |
| CaptainR | 10:b959bb206e6b | 200 | #define RAISED 1 |
| CaptainR | 10:b959bb206e6b | 201 | #define HIDDEN 2 |
| CaptainR | 11:3ebd2263f3e9 | 202 | // set graphic parameters |
| CaptainR | 11:3ebd2263f3e9 | 203 | #define objColor 18 |
| CaptainR | 11:3ebd2263f3e9 | 204 | #define scrResolution 32 |
| CaptainR | 11:3ebd2263f3e9 | 205 | #define pageDisplay 33 |
| CaptainR | 11:3ebd2263f3e9 | 206 | #define pageRead 34 |
| CaptainR | 11:3ebd2263f3e9 | 207 | #define pageWrite 35 |
| CaptainR | 11:3ebd2263f3e9 | 208 | // get graphic parameters |
| CaptainR | 11:3ebd2263f3e9 | 209 | #define currentXMax 0 |
| CaptainR | 11:3ebd2263f3e9 | 210 | #define currentYMax 1 |
| CaptainR | 11:3ebd2263f3e9 | 211 | #define lastObjLeft 2 |
| CaptainR | 11:3ebd2263f3e9 | 212 | #define lastObjTop 3 |
| CaptainR | 11:3ebd2263f3e9 | 213 | #define lastObjRight 4 |
| CaptainR | 11:3ebd2263f3e9 | 214 | #define lastObjBot 5 |
| CaptainR | 11:3ebd2263f3e9 | 215 | // Screen resolution |
| CaptainR | 11:3ebd2263f3e9 | 216 | #define res320x240 0 |
| CaptainR | 11:3ebd2263f3e9 | 217 | #define res640x480 1 |
| CaptainR | 11:3ebd2263f3e9 | 218 | #define res800x480 2 |
| CaptainR | 0:a5ef6bc3c2e8 | 219 | |
| CaptainR | 0:a5ef6bc3c2e8 | 220 | //************************************************************************** |
| CaptainR | 3:dcfbceb81fef | 221 | class PICASO_4DGL { |
| CaptainR | 0:a5ef6bc3c2e8 | 222 | |
| CaptainR | 0:a5ef6bc3c2e8 | 223 | public : |
| CaptainR | 0:a5ef6bc3c2e8 | 224 | |
| CaptainR | 0:a5ef6bc3c2e8 | 225 | Serial pc; // serial variable for debug information |
| CaptainR | 3:dcfbceb81fef | 226 | PICASO_4DGL(PinName tx, PinName rx, PinName rst); // LCD serial construnctor |
| CaptainR | 5:890ddd974624 | 227 | int index; // received response from screen |
| CaptainR | 6:a1a85f2bc04b | 228 | short Xdest, Ydest; |
| CaptainR | 13:1a0800957412 | 229 | char buffer[BUFFER_SIZE]; |
| CaptainR | 13:1a0800957412 | 230 | char rxBuf[RXBUFLEN]; |
| CaptainR | 12:29f5ad896382 | 231 | char currentFont; // stores current used font |
| CaptainR | 12:29f5ad896382 | 232 | char currentMode; // stores current orientation |
| CaptainR | 0:a5ef6bc3c2e8 | 233 | |
| CaptainR | 0:a5ef6bc3c2e8 | 234 | // General Commands |
| CaptainR | 5:890ddd974624 | 235 | void rxCallback(); |
| CaptainR | 12:29f5ad896382 | 236 | bool getResponse(int); // wait for LCD response |
| CaptainR | 12:29f5ad896382 | 237 | bool calculateOrbitResponse(); // wait for LCD response |
| CaptainR | 11:3ebd2263f3e9 | 238 | short getGraphicsResponse(); // wait for LCD response |
| CaptainR | 12:29f5ad896382 | 239 | short mediaInitResponse(); // response from mediaInit command |
| CaptainR | 12:29f5ad896382 | 240 | bool readSectorResponse(int); // response from mediaInit command |
| CaptainR | 0:a5ef6bc3c2e8 | 241 | void reset(); // reset screen |
| CaptainR | 0:a5ef6bc3c2e8 | 242 | void baudrate(long); // set baudrate |
| CaptainR | 12:29f5ad896382 | 243 | void mainDemo(); // play demo with main functions |
| CaptainR | 0:a5ef6bc3c2e8 | 244 | void textDemo(); // play demo with text based functions |
| CaptainR | 12:29f5ad896382 | 245 | void graphicsDemo(); // play demo with graphics based functions |
| CaptainR | 12:29f5ad896382 | 246 | void mediaDemo(); // play demo with media based functions |
| CaptainR | 0:a5ef6bc3c2e8 | 247 | |
| CaptainR | 0:a5ef6bc3c2e8 | 248 | // Graphics Commands |
| CaptainR | 0:a5ef6bc3c2e8 | 249 | void cls(); // clear screen |
| CaptainR | 2:81eaaa491a02 | 250 | void changeColor(short, short); // change one color to another |
| CaptainR | 2:81eaaa491a02 | 251 | void drawCircle(short, short, short, short); // draw a circle (x, y, radius, color) |
| CaptainR | 3:dcfbceb81fef | 252 | void drawFilledCircle(short, short, short, short); // draw a filled circle (x, y, radius, color) |
| CaptainR | 3:dcfbceb81fef | 253 | void drawLine(short, short, short, short, short); // draw a line (x1, y1, x2, y2, color) |
| CaptainR | 3:dcfbceb81fef | 254 | void drawRectangle(short, short, short, short, short); // draw a rectangle (x1, y1, x2, y2, color) |
| CaptainR | 3:dcfbceb81fef | 255 | void drawFilledRectangle(short, short, short, short, short); // draw a solid rectangle (x1, y1, x2, y2, color) |
| CaptainR | 3:dcfbceb81fef | 256 | void drawPolyline(short, short *, short *, short); // draw multiple lines (n, vx1…vxN, vy1…vyN, color) |
| CaptainR | 3:dcfbceb81fef | 257 | void drawPolygon(short, short *, short *, short); // draw a polygon (n, vx1…vxN, vy1…vyN, color) |
| CaptainR | 3:dcfbceb81fef | 258 | void drawFilledPolygon(short, short *, short *, short); // draw a solid polygon (n, vx1…vxN, vy1…vyN, color) |
| CaptainR | 3:dcfbceb81fef | 259 | void drawTriangle(short, short, short, short, short, short, short); // draw a triangle (x1, y1, x2, y2, x3, y3, color) |
| CaptainR | 3:dcfbceb81fef | 260 | void drawFilledTriangle(short, short, short, short, short, short, short); // draw a solid triangle (x1, y1, x2, y2, x3, y3, color) |
| CaptainR | 10:b959bb206e6b | 261 | void drawElipse(short, short, short, short, short); // draw elipse (x1, y1, xrad, yrad, color) |
| CaptainR | 10:b959bb206e6b | 262 | void drawFilledElipse(short, short, short, short, short); // draw a solid elipse (x1, y1, xrad, yrad, color) |
| CaptainR | 4:50511ed54ab4 | 263 | void calculateOrbit(short, short); // calculate distant point coordinates (angle, distance) |
| CaptainR | 6:a1a85f2bc04b | 264 | void putPixel(short, short, short); // draw a pixel (x, y, color) |
| CaptainR | 6:a1a85f2bc04b | 265 | void moveOrigin(short, short); // change origin point (x, y) |
| CaptainR | 8:b634ac9c92f8 | 266 | void lineTo(short, short); // draw a line from current origin to set point (x, y) |
| CaptainR | 9:32eb75c01e9d | 267 | void setClipWindow(short, short, short, short); // set a clipping window |
| CaptainR | 9:32eb75c01e9d | 268 | void clipping(short); // enable / disable clipping |
| CaptainR | 9:32eb75c01e9d | 269 | void extendClipRegion(); // extend clipping region to the last text or image shown |
| CaptainR | 10:b959bb206e6b | 270 | void drawButton(short, short, short, short, short, short, short, short, char *); // draw a 3D button (state, x, y, btnColor, txtColor, font, txtWidth, txtHeight, string) |
| CaptainR | 11:3ebd2263f3e9 | 271 | bool bevelShadow(short); // change the drawButton bevel shadow depth |
| CaptainR | 11:3ebd2263f3e9 | 272 | bool bevelWidth(short); // change the drawButton bevel width |
| CaptainR | 10:b959bb206e6b | 273 | void drawPanel(short, short, short, short, short, short); // draw a 3D panel (state, x, y, width, height, color) |
| CaptainR | 10:b959bb206e6b | 274 | void drawSlider(short, short, short, short, short, short, short, short); // draw a slider bar (mode, x1, y1, x2, y2, color, scale, value) |
| CaptainR | 10:b959bb206e6b | 275 | void screenCopyPaste(short, short, short, short, short, short); // copy a portion of screen (xs, ys, xd, yd, width, height) |
| CaptainR | 11:3ebd2263f3e9 | 276 | void bgColor(short); // change background color |
| CaptainR | 11:3ebd2263f3e9 | 277 | void outlineColor(short); // change outline color |
| CaptainR | 11:3ebd2263f3e9 | 278 | void contrast(short); // change display contrast |
| CaptainR | 11:3ebd2263f3e9 | 279 | bool frameDelay(short); // set inter frame delay for media video command |
| CaptainR | 11:3ebd2263f3e9 | 280 | void linePatern(short); // set the line draw pattern for line drawing |
| CaptainR | 11:3ebd2263f3e9 | 281 | void screenMode(char); // set desired orientation of a screen |
| CaptainR | 11:3ebd2263f3e9 | 282 | void transparency(short); // turn on or off transparency |
| CaptainR | 11:3ebd2263f3e9 | 283 | void transparentColor(short); // change transparent to color |
| CaptainR | 11:3ebd2263f3e9 | 284 | void setGraphics(short, short); // set graphics parameters |
| CaptainR | 11:3ebd2263f3e9 | 285 | short getGraphics(short); // get graphics parameters |
| CaptainR | 2:81eaaa491a02 | 286 | |
| CaptainR | 12:29f5ad896382 | 287 | // Media Commands |
| CaptainR | 12:29f5ad896382 | 288 | short media_Init(); // initialise memory card |
| CaptainR | 12:29f5ad896382 | 289 | bool media_SetAdd(int); // set byte address |
| CaptainR | 12:29f5ad896382 | 290 | bool media_SetSector(int); // set sector address |
| CaptainR | 13:1a0800957412 | 291 | bool media_RdSector(); // read sector |
| CaptainR | 13:1a0800957412 | 292 | bool media_WrSector(char *); // write sector |
| CaptainR | 12:29f5ad896382 | 293 | |
| CaptainR | 0:a5ef6bc3c2e8 | 294 | // Texts Commands |
| CaptainR | 0:a5ef6bc3c2e8 | 295 | void setFont(char); // set desired font from embedded fonts |
| CaptainR | 0:a5ef6bc3c2e8 | 296 | char moveCursor(short, short); // move cursot to a specific location |
| CaptainR | 0:a5ef6bc3c2e8 | 297 | char validateMoveCursor(short, short); // check if requested values are not out of range, based on font and orientation |
| CaptainR | 2:81eaaa491a02 | 298 | void textBgColor(short); // set background color of next text messages |
| CaptainR | 0:a5ef6bc3c2e8 | 299 | void putc(char); // send a single character to LCD |
| CaptainR | 0:a5ef6bc3c2e8 | 300 | void puts(char *); // send a string to LCD |
| CaptainR | 2:81eaaa491a02 | 301 | void textFgColor(short); // set text color |
| CaptainR | 2:81eaaa491a02 | 302 | int textWidth(short); // set width of a text |
| CaptainR | 2:81eaaa491a02 | 303 | int textHeight(short); // set text height |
| CaptainR | 2:81eaaa491a02 | 304 | int textXGap(short); // set gap between characters in pixels (X axis) |
| CaptainR | 2:81eaaa491a02 | 305 | int textYGap(short); // set gap between characters in pixels (Y axis) |
| CaptainR | 2:81eaaa491a02 | 306 | void textBold(short); // set text to bold |
| CaptainR | 2:81eaaa491a02 | 307 | void textInverse(short); // invert text BG and FG colors |
| CaptainR | 2:81eaaa491a02 | 308 | void textItalic(short); // set text to italic |
| CaptainR | 2:81eaaa491a02 | 309 | void textOpacity(short); // set text opacity |
| CaptainR | 2:81eaaa491a02 | 310 | void textUnderline(short); // set text to underline |
| CaptainR | 2:81eaaa491a02 | 311 | void textAttributes(short); // set 4 attributes (bold, italic, inverse, underline) |
| CaptainR | 0:a5ef6bc3c2e8 | 312 | |
| CaptainR | 0:a5ef6bc3c2e8 | 313 | |
| CaptainR | 0:a5ef6bc3c2e8 | 314 | protected : |
| CaptainR | 0:a5ef6bc3c2e8 | 315 | |
| CaptainR | 2:81eaaa491a02 | 316 | Serial _cmd; // serial variable, to comunicate with screen |
| CaptainR | 2:81eaaa491a02 | 317 | DigitalOut _rst; // screen reset pin |
| CaptainR | 4:50511ed54ab4 | 318 | |
| CaptainR | 4:50511ed54ab4 | 319 | |
| CaptainR | 0:a5ef6bc3c2e8 | 320 | void freeBUFFER (void); |
| CaptainR | 0:a5ef6bc3c2e8 | 321 | void writeBYTE (char); |
| CaptainR | 2:81eaaa491a02 | 322 | void writeCOMMAND(char *, int); // send command to screen |
| CaptainR | 0:a5ef6bc3c2e8 | 323 | }; |