for 4180 final project
Fork of 4DGL-uLCD-SE by
uLCD_4DGL_Graphics.cpp@3:9ba47197d94f, 2013-11-18 (annotated)
- Committer:
- 4180_1
- Date:
- Mon Nov 18 03:05:40 2013 +0000
- Revision:
- 3:9ba47197d94f
- Parent:
- 1:8b656995301f
- Child:
- 4:74df7fc26fef
ver 1.02
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
4180_1 | 1:8b656995301f | 1 | // |
4180_1 | 1:8b656995301f | 2 | // uLCD_4DGL is a class to drive 4D Systems TFT touch screens |
4180_1 | 1:8b656995301f | 3 | // |
4180_1 | 1:8b656995301f | 4 | // Copyright (C) <2010> Stephane ROCHON <stephane.rochon at free.fr> |
4180_1 | 1:8b656995301f | 5 | // |
4180_1 | 1:8b656995301f | 6 | // uLCD_4DGL is free software: you can redistribute it and/or modify |
4180_1 | 1:8b656995301f | 7 | // it under the terms of the GNU General Public License as published by |
4180_1 | 1:8b656995301f | 8 | // the Free Software Foundation, either version 3 of the License, or |
4180_1 | 1:8b656995301f | 9 | // (at your option) any later version. |
4180_1 | 1:8b656995301f | 10 | // |
4180_1 | 1:8b656995301f | 11 | // uLCD_4DGL is distributed in the hope that it will be useful, |
4180_1 | 1:8b656995301f | 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
4180_1 | 1:8b656995301f | 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4180_1 | 1:8b656995301f | 14 | // GNU General Public License for more details. |
4180_1 | 1:8b656995301f | 15 | // |
4180_1 | 1:8b656995301f | 16 | // You should have received a copy of the GNU General Public License |
4180_1 | 1:8b656995301f | 17 | // along with uLCD_4DGL. If not, see <http://www.gnu.org/licenses/>. |
4180_1 | 1:8b656995301f | 18 | |
4180_1 | 1:8b656995301f | 19 | #include "mbed.h" |
4180_1 | 1:8b656995301f | 20 | #include "uLCD_4DGL.h" |
4180_1 | 1:8b656995301f | 21 | |
4180_1 | 1:8b656995301f | 22 | #define ARRAY_SIZE(X) sizeof(X)/sizeof(X[0]) |
4180_1 | 1:8b656995301f | 23 | |
4180_1 | 1:8b656995301f | 24 | //**************************************************************************************************** |
4180_1 | 3:9ba47197d94f | 25 | void uLCD_4DGL :: circle(int x, int y , int radius, int color) // draw a circle in (x,y) |
4180_1 | 3:9ba47197d94f | 26 | { |
4180_1 | 1:8b656995301f | 27 | char command[9]= ""; |
4180_1 | 1:8b656995301f | 28 | |
4180_1 | 1:8b656995301f | 29 | command[0] = CIRCLE; |
4180_1 | 1:8b656995301f | 30 | |
4180_1 | 1:8b656995301f | 31 | command[1] = (x >> 8) & 0xFF; |
4180_1 | 1:8b656995301f | 32 | command[2] = x & 0xFF; |
4180_1 | 1:8b656995301f | 33 | |
4180_1 | 1:8b656995301f | 34 | command[3] = (y >> 8) & 0xFF; |
4180_1 | 1:8b656995301f | 35 | command[4] = y & 0xFF; |
4180_1 | 1:8b656995301f | 36 | |
4180_1 | 1:8b656995301f | 37 | command[5] = (radius >> 8) & 0xFF; |
4180_1 | 1:8b656995301f | 38 | command[6] = radius & 0xFF; |
4180_1 | 1:8b656995301f | 39 | |
4180_1 | 1:8b656995301f | 40 | int red5 = (color >> (16 + 3)) & 0x1F; // get red on 5 bits |
4180_1 | 1:8b656995301f | 41 | int green6 = (color >> (8 + 2)) & 0x3F; // get green on 6 bits |
4180_1 | 1:8b656995301f | 42 | int blue5 = (color >> (0 + 3)) & 0x1F; // get blue on 5 bits |
4180_1 | 1:8b656995301f | 43 | |
4180_1 | 1:8b656995301f | 44 | command[7] = ((red5 << 3) + (green6 >> 3)) & 0xFF; // first part of 16 bits color |
4180_1 | 1:8b656995301f | 45 | command[8] = ((green6 << 5) + (blue5 >> 0)) & 0xFF; // second part of 16 bits color |
4180_1 | 1:8b656995301f | 46 | |
4180_1 | 1:8b656995301f | 47 | writeCOMMAND(command, 9); |
4180_1 | 1:8b656995301f | 48 | } |
4180_1 | 1:8b656995301f | 49 | |
4180_1 | 1:8b656995301f | 50 | //**************************************************************************************************** |
4180_1 | 3:9ba47197d94f | 51 | void uLCD_4DGL :: triangle(int x1, int y1 , int x2, int y2, int x3, int y3, int color) // draw a traingle |
4180_1 | 3:9ba47197d94f | 52 | { |
4180_1 | 1:8b656995301f | 53 | char command[15]= ""; |
4180_1 | 1:8b656995301f | 54 | |
4180_1 | 1:8b656995301f | 55 | command[0] = TRIANGLE; |
4180_1 | 1:8b656995301f | 56 | |
4180_1 | 1:8b656995301f | 57 | command[1] = (x1 >> 8) & 0xFF; |
4180_1 | 1:8b656995301f | 58 | command[2] = x1 & 0xFF; |
4180_1 | 1:8b656995301f | 59 | |
4180_1 | 1:8b656995301f | 60 | command[3] = (y1 >> 8) & 0xFF; |
4180_1 | 1:8b656995301f | 61 | command[4] = y1 & 0xFF; |
4180_1 | 1:8b656995301f | 62 | |
4180_1 | 1:8b656995301f | 63 | command[5] = (x2 >> 8) & 0xFF; |
4180_1 | 1:8b656995301f | 64 | command[6] = x2 & 0xFF; |
4180_1 | 1:8b656995301f | 65 | |
4180_1 | 1:8b656995301f | 66 | command[7] = (y2 >> 8) & 0xFF; |
4180_1 | 1:8b656995301f | 67 | command[8] = y2 & 0xFF; |
4180_1 | 1:8b656995301f | 68 | |
4180_1 | 1:8b656995301f | 69 | command[9] = (x3 >> 8) & 0xFF; |
4180_1 | 1:8b656995301f | 70 | command[10] = x3 & 0xFF; |
4180_1 | 1:8b656995301f | 71 | |
4180_1 | 1:8b656995301f | 72 | command[11] = (y3 >> 8) & 0xFF; |
4180_1 | 1:8b656995301f | 73 | command[12] = y3 & 0xFF; |
4180_1 | 1:8b656995301f | 74 | |
4180_1 | 1:8b656995301f | 75 | int red5 = (color >> (16 + 3)) & 0x1F; // get red on 5 bits |
4180_1 | 1:8b656995301f | 76 | int green6 = (color >> (8 + 2)) & 0x3F; // get green on 6 bits |
4180_1 | 1:8b656995301f | 77 | int blue5 = (color >> (0 + 3)) & 0x1F; // get blue on 5 bits |
4180_1 | 1:8b656995301f | 78 | |
4180_1 | 1:8b656995301f | 79 | command[13] = ((red5 << 3) + (green6 >> 3)) & 0xFF; // first part of 16 bits color |
4180_1 | 1:8b656995301f | 80 | command[14] = ((green6 << 5) + (blue5 >> 0)) & 0xFF; // second part of 16 bits color |
4180_1 | 1:8b656995301f | 81 | |
4180_1 | 1:8b656995301f | 82 | writeCOMMAND(command, 15); |
4180_1 | 1:8b656995301f | 83 | } |
4180_1 | 1:8b656995301f | 84 | |
4180_1 | 1:8b656995301f | 85 | //**************************************************************************************************** |
4180_1 | 3:9ba47197d94f | 86 | void uLCD_4DGL :: line(int x1, int y1 , int x2, int y2, int color) // draw a line |
4180_1 | 3:9ba47197d94f | 87 | { |
4180_1 | 1:8b656995301f | 88 | char command[11]= ""; |
4180_1 | 1:8b656995301f | 89 | |
4180_1 | 1:8b656995301f | 90 | command[0] = LINE; |
4180_1 | 1:8b656995301f | 91 | |
4180_1 | 1:8b656995301f | 92 | command[1] = (x1 >> 8) & 0xFF; |
4180_1 | 1:8b656995301f | 93 | command[2] = x1 & 0xFF; |
4180_1 | 1:8b656995301f | 94 | |
4180_1 | 1:8b656995301f | 95 | command[3] = (y1 >> 8) & 0xFF; |
4180_1 | 1:8b656995301f | 96 | command[4] = y1 & 0xFF; |
4180_1 | 1:8b656995301f | 97 | |
4180_1 | 1:8b656995301f | 98 | command[5] = (x2 >> 8) & 0xFF; |
4180_1 | 1:8b656995301f | 99 | command[6] = x2 & 0xFF; |
4180_1 | 1:8b656995301f | 100 | |
4180_1 | 1:8b656995301f | 101 | command[7] = (y2 >> 8) & 0xFF; |
4180_1 | 1:8b656995301f | 102 | command[8] = y2 & 0xFF; |
4180_1 | 1:8b656995301f | 103 | |
4180_1 | 1:8b656995301f | 104 | int red5 = (color >> (16 + 3)) & 0x1F; // get red on 5 bits |
4180_1 | 1:8b656995301f | 105 | int green6 = (color >> (8 + 2)) & 0x3F; // get green on 6 bits |
4180_1 | 1:8b656995301f | 106 | int blue5 = (color >> (0 + 3)) & 0x1F; // get blue on 5 bits |
4180_1 | 1:8b656995301f | 107 | |
4180_1 | 1:8b656995301f | 108 | command[9] = ((red5 << 3) + (green6 >> 3)) & 0xFF; // first part of 16 bits color |
4180_1 | 1:8b656995301f | 109 | command[10] = ((green6 << 5) + (blue5 >> 0)) & 0xFF; // second part of 16 bits color |
4180_1 | 1:8b656995301f | 110 | |
4180_1 | 1:8b656995301f | 111 | writeCOMMAND(command, 11); |
4180_1 | 1:8b656995301f | 112 | } |
4180_1 | 1:8b656995301f | 113 | |
4180_1 | 1:8b656995301f | 114 | //**************************************************************************************************** |
4180_1 | 3:9ba47197d94f | 115 | void uLCD_4DGL :: rectangle(int x1, int y1 , int x2, int y2, int color) // draw a rectangle |
4180_1 | 3:9ba47197d94f | 116 | { |
4180_1 | 1:8b656995301f | 117 | char command[11]= ""; |
4180_1 | 1:8b656995301f | 118 | |
4180_1 | 1:8b656995301f | 119 | command[0] = RECTANGLE; |
4180_1 | 1:8b656995301f | 120 | |
4180_1 | 1:8b656995301f | 121 | command[1] = (x1 >> 8) & 0xFF; |
4180_1 | 1:8b656995301f | 122 | command[2] = x1 & 0xFF; |
4180_1 | 1:8b656995301f | 123 | |
4180_1 | 1:8b656995301f | 124 | command[3] = (y1 >> 8) & 0xFF; |
4180_1 | 1:8b656995301f | 125 | command[4] = y1 & 0xFF; |
4180_1 | 1:8b656995301f | 126 | |
4180_1 | 1:8b656995301f | 127 | command[5] = (x2 >> 8) & 0xFF; |
4180_1 | 1:8b656995301f | 128 | command[6] = x2 & 0xFF; |
4180_1 | 1:8b656995301f | 129 | |
4180_1 | 1:8b656995301f | 130 | command[7] = (y2 >> 8) & 0xFF; |
4180_1 | 1:8b656995301f | 131 | command[8] = y2 & 0xFF; |
4180_1 | 1:8b656995301f | 132 | |
4180_1 | 1:8b656995301f | 133 | int red5 = (color >> (16 + 3)) & 0x1F; // get red on 5 bits |
4180_1 | 1:8b656995301f | 134 | int green6 = (color >> (8 + 2)) & 0x3F; // get green on 6 bits |
4180_1 | 1:8b656995301f | 135 | int blue5 = (color >> (0 + 3)) & 0x1F; // get blue on 5 bits |
4180_1 | 1:8b656995301f | 136 | |
4180_1 | 1:8b656995301f | 137 | command[9] = ((red5 << 3) + (green6 >> 3)) & 0xFF; // first part of 16 bits color |
4180_1 | 1:8b656995301f | 138 | command[10] = ((green6 << 5) + (blue5 >> 0)) & 0xFF; // second part of 16 bits color |
4180_1 | 1:8b656995301f | 139 | |
4180_1 | 1:8b656995301f | 140 | writeCOMMAND(command, 11); |
4180_1 | 1:8b656995301f | 141 | } |
4180_1 | 1:8b656995301f | 142 | |
4180_1 | 1:8b656995301f | 143 | //**************************************************************************************************** |
4180_1 | 3:9ba47197d94f | 144 | void uLCD_4DGL :: ellipse(int x, int y , int radius_x, int radius_y, int color) // draw an ellipse |
4180_1 | 3:9ba47197d94f | 145 | { |
4180_1 | 1:8b656995301f | 146 | char command[11]= ""; |
4180_1 | 1:8b656995301f | 147 | |
4180_1 | 1:8b656995301f | 148 | command[0] = ELLIPSE; |
4180_1 | 1:8b656995301f | 149 | |
4180_1 | 1:8b656995301f | 150 | command[1] = (x >> 8) & 0xFF; |
4180_1 | 1:8b656995301f | 151 | command[2] = x & 0xFF; |
4180_1 | 1:8b656995301f | 152 | |
4180_1 | 1:8b656995301f | 153 | command[3] = (y >> 8) & 0xFF; |
4180_1 | 1:8b656995301f | 154 | command[4] = y & 0xFF; |
4180_1 | 1:8b656995301f | 155 | |
4180_1 | 1:8b656995301f | 156 | command[5] = (radius_x >> 8) & 0xFF; |
4180_1 | 1:8b656995301f | 157 | command[6] = radius_x & 0xFF; |
4180_1 | 1:8b656995301f | 158 | |
4180_1 | 1:8b656995301f | 159 | command[7] = (radius_y >> 8) & 0xFF; |
4180_1 | 1:8b656995301f | 160 | command[8] = radius_y & 0xFF; |
4180_1 | 1:8b656995301f | 161 | |
4180_1 | 1:8b656995301f | 162 | int red5 = (color >> (16 + 3)) & 0x1F; // get red on 5 bits |
4180_1 | 1:8b656995301f | 163 | int green6 = (color >> (8 + 2)) & 0x3F; // get green on 6 bits |
4180_1 | 1:8b656995301f | 164 | int blue5 = (color >> (0 + 3)) & 0x1F; // get blue on 5 bits |
4180_1 | 1:8b656995301f | 165 | |
4180_1 | 1:8b656995301f | 166 | command[9] = ((red5 << 3) + (green6 >> 3)) & 0xFF; // first part of 16 bits color |
4180_1 | 1:8b656995301f | 167 | command[10] = ((green6 << 5) + (blue5 >> 0)) & 0xFF; // second part of 16 bits color |
4180_1 | 1:8b656995301f | 168 | |
4180_1 | 1:8b656995301f | 169 | writeCOMMAND(command, 11); |
4180_1 | 1:8b656995301f | 170 | } |
4180_1 | 1:8b656995301f | 171 | |
4180_1 | 1:8b656995301f | 172 | //**************************************************************************************************** |
4180_1 | 3:9ba47197d94f | 173 | void uLCD_4DGL :: pixel(int x, int y, int color) // draw a pixel |
4180_1 | 3:9ba47197d94f | 174 | { |
4180_1 | 1:8b656995301f | 175 | char command[7]= ""; |
4180_1 | 1:8b656995301f | 176 | |
4180_1 | 1:8b656995301f | 177 | command[0] = PIXEL; |
4180_1 | 1:8b656995301f | 178 | |
4180_1 | 1:8b656995301f | 179 | command[1] = (x >> 8) & 0xFF; |
4180_1 | 1:8b656995301f | 180 | command[2] = x & 0xFF; |
4180_1 | 1:8b656995301f | 181 | |
4180_1 | 1:8b656995301f | 182 | command[3] = (y >> 8) & 0xFF; |
4180_1 | 1:8b656995301f | 183 | command[4] = y & 0xFF; |
4180_1 | 1:8b656995301f | 184 | |
4180_1 | 1:8b656995301f | 185 | int red5 = (color >> (16 + 3)) & 0x1F; // get red on 5 bits |
4180_1 | 1:8b656995301f | 186 | int green6 = (color >> (8 + 2)) & 0x3F; // get green on 6 bits |
4180_1 | 1:8b656995301f | 187 | int blue5 = (color >> (0 + 3)) & 0x1F; // get blue on 5 bits |
4180_1 | 1:8b656995301f | 188 | |
4180_1 | 1:8b656995301f | 189 | command[5] = ((red5 << 3) + (green6 >> 3)) & 0xFF; // first part of 16 bits color |
4180_1 | 1:8b656995301f | 190 | command[6] = ((green6 << 5) + (blue5 >> 0)) & 0xFF; // second part of 16 bits color |
4180_1 | 1:8b656995301f | 191 | |
4180_1 | 1:8b656995301f | 192 | writeCOMMAND(command, 7); |
4180_1 | 1:8b656995301f | 193 | } |
4180_1 | 3:9ba47197d94f | 194 | //**************************************************************************************************** |
4180_1 | 3:9ba47197d94f | 195 | void uLCD_4DGL :: BLIT(int x, int y, int w, int h, int *colors) // draw a block of pixels |
4180_1 | 3:9ba47197d94f | 196 | { |
4180_1 | 3:9ba47197d94f | 197 | int red5, green6, blue5; |
4180_1 | 3:9ba47197d94f | 198 | writeBYTE('\x00'); |
4180_1 | 3:9ba47197d94f | 199 | writeBYTE(BLITCOM); |
4180_1 | 3:9ba47197d94f | 200 | writeBYTE((x >> 8) & 0xFF); |
4180_1 | 3:9ba47197d94f | 201 | writeBYTE(x & 0xFF); |
4180_1 | 3:9ba47197d94f | 202 | writeBYTE((y >> 8) & 0xFF); |
4180_1 | 3:9ba47197d94f | 203 | writeBYTE(y & 0xFF); |
4180_1 | 3:9ba47197d94f | 204 | writeBYTE((w >> 8) & 0xFF); |
4180_1 | 3:9ba47197d94f | 205 | writeBYTE(w & 0xFF); |
4180_1 | 3:9ba47197d94f | 206 | writeBYTE((h >> 8) & 0xFF); |
4180_1 | 3:9ba47197d94f | 207 | writeBYTE(h & 0xFF); |
4180_1 | 3:9ba47197d94f | 208 | for (int i=0; i<w*h; i++) { |
4180_1 | 3:9ba47197d94f | 209 | red5 = (colors[i] >> (16 + 3)) & 0x1F; // get red on 5 bits |
4180_1 | 3:9ba47197d94f | 210 | green6 = (colors[i] >> (8 + 2)) & 0x3F; // get green on 6 bits |
4180_1 | 3:9ba47197d94f | 211 | blue5 = (colors[i] >> (0 + 3)) & 0x1F; // get blue on 5 bits |
4180_1 | 3:9ba47197d94f | 212 | writeBYTE(((red5 << 3) + (green6 >> 3)) & 0xFF); // first part of 16 bits color |
4180_1 | 3:9ba47197d94f | 213 | writeBYTE(((green6 << 5) + (blue5 >> 0)) & 0xFF); // second part of 16 bits color |
4180_1 | 3:9ba47197d94f | 214 | } |
4180_1 | 3:9ba47197d94f | 215 | int resp=0; |
4180_1 | 3:9ba47197d94f | 216 | while (!_cmd.readable()) wait_ms(TEMPO); // wait for screen answer |
4180_1 | 3:9ba47197d94f | 217 | if (_cmd.readable()) resp = _cmd.getc(); // read response if any |
4180_1 | 3:9ba47197d94f | 218 | switch (resp) { |
4180_1 | 3:9ba47197d94f | 219 | case ACK : // if OK return 1 |
4180_1 | 3:9ba47197d94f | 220 | resp = 1; |
4180_1 | 3:9ba47197d94f | 221 | break; |
4180_1 | 3:9ba47197d94f | 222 | case NAK : // if NOK return -1 |
4180_1 | 3:9ba47197d94f | 223 | resp = -1; |
4180_1 | 3:9ba47197d94f | 224 | break; |
4180_1 | 3:9ba47197d94f | 225 | default : |
4180_1 | 3:9ba47197d94f | 226 | resp = 0; // else return 0 |
4180_1 | 3:9ba47197d94f | 227 | break; |
4180_1 | 3:9ba47197d94f | 228 | } |
4180_1 | 3:9ba47197d94f | 229 | #if DEBUGMODE |
4180_1 | 3:9ba47197d94f | 230 | pc.printf(" Answer received : %d\n",resp); |
4180_1 | 3:9ba47197d94f | 231 | #endif |
4180_1 | 1:8b656995301f | 232 | |
4180_1 | 3:9ba47197d94f | 233 | } |
4180_1 | 1:8b656995301f | 234 | //****************************************************************************************************** |
4180_1 | 3:9ba47197d94f | 235 | int uLCD_4DGL :: read_pixel(int x, int y) // read screen info and populate data |
4180_1 | 3:9ba47197d94f | 236 | { |
4180_1 | 1:8b656995301f | 237 | |
4180_1 | 1:8b656995301f | 238 | char command[6]= ""; |
4180_1 | 1:8b656995301f | 239 | command[0] = 0xFF; |
4180_1 | 1:8b656995301f | 240 | command[1] = READPIXEL; |
4180_1 | 1:8b656995301f | 241 | |
4180_1 | 1:8b656995301f | 242 | command[2] = (x >> 8) & 0xFF; |
4180_1 | 1:8b656995301f | 243 | command[3] = x & 0xFF; |
4180_1 | 1:8b656995301f | 244 | |
4180_1 | 1:8b656995301f | 245 | command[4] = (y >> 8) & 0xFF; |
4180_1 | 1:8b656995301f | 246 | command[5] = y & 0xFF; |
4180_1 | 1:8b656995301f | 247 | |
4180_1 | 1:8b656995301f | 248 | int i, temp = 0, color = 0, resp = 0; |
4180_1 | 1:8b656995301f | 249 | char response[2] = ""; |
4180_1 | 1:8b656995301f | 250 | |
4180_1 | 1:8b656995301f | 251 | freeBUFFER(); |
4180_1 | 1:8b656995301f | 252 | |
4180_1 | 1:8b656995301f | 253 | for (i = 0; i < 6; i++) { // send all chars to serial port |
4180_1 | 1:8b656995301f | 254 | writeBYTE(command[i]); |
4180_1 | 1:8b656995301f | 255 | } |
4180_1 | 1:8b656995301f | 256 | |
4180_1 | 1:8b656995301f | 257 | while (!_cmd.readable()) wait_ms(TEMPO); // wait for screen answer |
4180_1 | 1:8b656995301f | 258 | |
4180_1 | 1:8b656995301f | 259 | while (_cmd.readable() && resp < ARRAY_SIZE(response)) { |
4180_1 | 1:8b656995301f | 260 | temp = _cmd.getc(); |
4180_1 | 1:8b656995301f | 261 | response[resp++] = (char)temp; |
4180_1 | 1:8b656995301f | 262 | } |
4180_1 | 1:8b656995301f | 263 | |
4180_1 | 1:8b656995301f | 264 | color = ((response[0] << 8) + response[1]); |
4180_1 | 1:8b656995301f | 265 | |
4180_1 | 1:8b656995301f | 266 | return color; // WARNING : this is 16bits color, not 24bits... need to be fixed |
4180_1 | 1:8b656995301f | 267 | } |
4180_1 | 1:8b656995301f | 268 | |
4180_1 | 1:8b656995301f | 269 | //****************************************************************************************************** |
4180_1 | 3:9ba47197d94f | 270 | void uLCD_4DGL :: screen_copy(int xs, int ys , int xd, int yd , int width, int height) |
4180_1 | 3:9ba47197d94f | 271 | { |
4180_1 | 1:8b656995301f | 272 | |
4180_1 | 1:8b656995301f | 273 | char command[13]= ""; |
4180_1 | 1:8b656995301f | 274 | |
4180_1 | 1:8b656995301f | 275 | command[0] = SCREENCOPY; |
4180_1 | 1:8b656995301f | 276 | |
4180_1 | 1:8b656995301f | 277 | command[1] = (xs >> 8) & 0xFF; |
4180_1 | 1:8b656995301f | 278 | command[2] = xs & 0xFF; |
4180_1 | 1:8b656995301f | 279 | |
4180_1 | 1:8b656995301f | 280 | command[3] = (ys >> 8) & 0xFF; |
4180_1 | 1:8b656995301f | 281 | command[4] = ys & 0xFF; |
4180_1 | 1:8b656995301f | 282 | |
4180_1 | 1:8b656995301f | 283 | command[5] = (xd >> 8) & 0xFF; |
4180_1 | 1:8b656995301f | 284 | command[6] = xd & 0xFF; |
4180_1 | 1:8b656995301f | 285 | |
4180_1 | 1:8b656995301f | 286 | command[7] = (yd >> 8) & 0xFF; |
4180_1 | 1:8b656995301f | 287 | command[8] = yd & 0xFF; |
4180_1 | 1:8b656995301f | 288 | |
4180_1 | 1:8b656995301f | 289 | command[9] = (width >> 8) & 0xFF; |
4180_1 | 1:8b656995301f | 290 | command[10] = width & 0xFF; |
4180_1 | 1:8b656995301f | 291 | |
4180_1 | 1:8b656995301f | 292 | command[11] = (height >> 8) & 0xFF; |
4180_1 | 1:8b656995301f | 293 | command[12] = height & 0xFF; |
4180_1 | 1:8b656995301f | 294 | |
4180_1 | 1:8b656995301f | 295 | writeCOMMAND(command, 13); |
4180_1 | 1:8b656995301f | 296 | } |
4180_1 | 1:8b656995301f | 297 | |
4180_1 | 1:8b656995301f | 298 | //**************************************************************************************************** |
4180_1 | 3:9ba47197d94f | 299 | void uLCD_4DGL :: pen_size(char mode) // set pen to SOLID or WIREFRAME |
4180_1 | 3:9ba47197d94f | 300 | { |
4180_1 | 1:8b656995301f | 301 | char command[2]= ""; |
4180_1 | 1:8b656995301f | 302 | |
4180_1 | 1:8b656995301f | 303 | command[0] = PENSIZE; |
4180_1 | 1:8b656995301f | 304 | command[1] = mode; |
4180_1 | 1:8b656995301f | 305 | |
4180_1 | 1:8b656995301f | 306 | writeCOMMAND(command, 2); |
4180_1 | 1:8b656995301f | 307 | } |