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