Library for 3.2'' uLcd Picaso Display4D system Picaso Serial Environment Command Set web: http://www.4dsystems.com.au/product/20/67/Processors_Graphics/PICASO/

Committer:
adelino
Date:
Sun Jul 06 10:36:27 2014 +0000
Revision:
0:65fd8b1cbf86
Child:
1:a74e42cf52b2
Library to communicate and draw on an LCD

Who changed what in which revision?

UserRevisionLine numberNew contents of line
adelino 0:65fd8b1cbf86 1 #include "PicasoSerial.h"
adelino 0:65fd8b1cbf86 2
adelino 0:65fd8b1cbf86 3 PicasoSerial::PicasoSerial(PinName _pinTx,PinName _pinRx,PinName _pinReset):Serial(_pinTx,_pinRx),myPinReset(_pinReset)
adelino 0:65fd8b1cbf86 4 {
adelino 0:65fd8b1cbf86 5 this->baud(9600);
adelino 0:65fd8b1cbf86 6 myPinReset=1;
adelino 0:65fd8b1cbf86 7 }
adelino 0:65fd8b1cbf86 8 //--------------------------------------------
adelino 0:65fd8b1cbf86 9 //
adelino 0:65fd8b1cbf86 10 //--------------------------------------------
adelino 0:65fd8b1cbf86 11 // fonction Touch Screen
adelino 0:65fd8b1cbf86 12 //--------------------------------------------
adelino 0:65fd8b1cbf86 13 void PicasoSerial::touch_set(UINT16 mode)
adelino 0:65fd8b1cbf86 14 {
adelino 0:65fd8b1cbf86 15 unsigned char zecom[4] = "";
adelino 0:65fd8b1cbf86 16
adelino 0:65fd8b1cbf86 17 zecom[0] = (CMD_TOUCH_SET >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 18 zecom[1] = CMD_TOUCH_SET & 0xFF;
adelino 0:65fd8b1cbf86 19
adelino 0:65fd8b1cbf86 20 zecom[2] = (mode >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 21 zecom[3] = mode & 0xFF;
adelino 0:65fd8b1cbf86 22
adelino 0:65fd8b1cbf86 23 put_gfx_Commande(zecom, 4);
adelino 0:65fd8b1cbf86 24
adelino 0:65fd8b1cbf86 25 wait_gfx_ack();
adelino 0:65fd8b1cbf86 26 }
adelino 0:65fd8b1cbf86 27 //------------------------------------------------
adelino 0:65fd8b1cbf86 28 void PicasoSerial::touch_detect_region(UINT16 x1, UINT16 y1, UINT16 x2, UINT16 y2)
adelino 0:65fd8b1cbf86 29 {
adelino 0:65fd8b1cbf86 30 unsigned char zecom[10] = "";
adelino 0:65fd8b1cbf86 31
adelino 0:65fd8b1cbf86 32 zecom[0] = (CMD_TOUCH_DETECT_REGION >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 33 zecom[1] = CMD_TOUCH_DETECT_REGION & 0xFF;
adelino 0:65fd8b1cbf86 34
adelino 0:65fd8b1cbf86 35 zecom[2] = (x1 >> 8)&0xFF;
adelino 0:65fd8b1cbf86 36 zecom[3] = x1 & 0xFF;
adelino 0:65fd8b1cbf86 37
adelino 0:65fd8b1cbf86 38 zecom[4] = (y1 >> 8)&0xFF;
adelino 0:65fd8b1cbf86 39 zecom[5] = y1 & 0xFF;
adelino 0:65fd8b1cbf86 40
adelino 0:65fd8b1cbf86 41 zecom[6] = (x2 >> 8)&0xFF;
adelino 0:65fd8b1cbf86 42 zecom[7] = x2 & 0xFF;
adelino 0:65fd8b1cbf86 43
adelino 0:65fd8b1cbf86 44 zecom[8] = (y2 >> 8)&0xFF;
adelino 0:65fd8b1cbf86 45 zecom[9] = y2 & 0xFF;
adelino 0:65fd8b1cbf86 46
adelino 0:65fd8b1cbf86 47 put_gfx_Commande(zecom, 10);
adelino 0:65fd8b1cbf86 48
adelino 0:65fd8b1cbf86 49 wait_gfx_ack();
adelino 0:65fd8b1cbf86 50 }
adelino 0:65fd8b1cbf86 51 //--------------------------------------
adelino 0:65fd8b1cbf86 52 TouchEvent PicasoSerial::touch_get_status()
adelino 0:65fd8b1cbf86 53 {
adelino 0:65fd8b1cbf86 54 //0 No touch
adelino 0:65fd8b1cbf86 55 //1 press
adelino 0:65fd8b1cbf86 56 //2 release
adelino 0:65fd8b1cbf86 57 //3 moving
adelino 0:65fd8b1cbf86 58
adelino 0:65fd8b1cbf86 59 UINT8 msb = 0;
adelino 0:65fd8b1cbf86 60 UINT8 lsb = 0;
adelino 0:65fd8b1cbf86 61
adelino 0:65fd8b1cbf86 62 // TouchEvent res = EVENT_NO_ACTIVITY;
adelino 0:65fd8b1cbf86 63 UINT16 temp=0;
adelino 0:65fd8b1cbf86 64
adelino 0:65fd8b1cbf86 65 unsigned char zecom[4] = "";
adelino 0:65fd8b1cbf86 66
adelino 0:65fd8b1cbf86 67 zecom[0] = (CMD_TOUCH_GET >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 68 zecom[1] = CMD_TOUCH_GET & 0xFF;
adelino 0:65fd8b1cbf86 69
adelino 0:65fd8b1cbf86 70 zecom[2] = 0x00;
adelino 0:65fd8b1cbf86 71 zecom[3] = 0x00;
adelino 0:65fd8b1cbf86 72
adelino 0:65fd8b1cbf86 73 put_gfx_Commande(zecom, 4);
adelino 0:65fd8b1cbf86 74
adelino 0:65fd8b1cbf86 75 wait_gfx_ack();
adelino 0:65fd8b1cbf86 76
adelino 0:65fd8b1cbf86 77 msb = get_gfx_char();
adelino 0:65fd8b1cbf86 78
adelino 0:65fd8b1cbf86 79 lsb = get_gfx_char();
adelino 0:65fd8b1cbf86 80
adelino 0:65fd8b1cbf86 81 temp=(msb << 8) + lsb;
adelino 0:65fd8b1cbf86 82
adelino 0:65fd8b1cbf86 83 switch(temp)
adelino 0:65fd8b1cbf86 84 {
adelino 0:65fd8b1cbf86 85 case 0:
adelino 0:65fd8b1cbf86 86 return EVENT_NO_ACTIVITY;
adelino 0:65fd8b1cbf86 87
adelino 0:65fd8b1cbf86 88 //
adelino 0:65fd8b1cbf86 89 case 1:
adelino 0:65fd8b1cbf86 90 return EVENT_PRESS;
adelino 0:65fd8b1cbf86 91
adelino 0:65fd8b1cbf86 92 //
adelino 0:65fd8b1cbf86 93 case 2:
adelino 0:65fd8b1cbf86 94 return EVENT_RELEASE;
adelino 0:65fd8b1cbf86 95
adelino 0:65fd8b1cbf86 96 //
adelino 0:65fd8b1cbf86 97 case 3:
adelino 0:65fd8b1cbf86 98 return EVENT_MOVE;
adelino 0:65fd8b1cbf86 99 }
adelino 0:65fd8b1cbf86 100
adelino 0:65fd8b1cbf86 101 return EVENT_NO_ACTIVITY;
adelino 0:65fd8b1cbf86 102 }
adelino 0:65fd8b1cbf86 103 //--------------------------------
adelino 0:65fd8b1cbf86 104 UINT16 PicasoSerial::touch_get_x()
adelino 0:65fd8b1cbf86 105 {
adelino 0:65fd8b1cbf86 106 UINT16 res = 0;
adelino 0:65fd8b1cbf86 107 UINT8 lsb = 0;
adelino 0:65fd8b1cbf86 108 UINT8 msb = 0;
adelino 0:65fd8b1cbf86 109
adelino 0:65fd8b1cbf86 110 unsigned char zecom[4] = "";
adelino 0:65fd8b1cbf86 111
adelino 0:65fd8b1cbf86 112 zecom[0] = (CMD_TOUCH_GET >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 113 zecom[1] = CMD_TOUCH_GET & 0xFF;
adelino 0:65fd8b1cbf86 114
adelino 0:65fd8b1cbf86 115 zecom[2] = 0x00;
adelino 0:65fd8b1cbf86 116 zecom[3] = 0x01;
adelino 0:65fd8b1cbf86 117
adelino 0:65fd8b1cbf86 118 put_gfx_Commande(zecom, 4);
adelino 0:65fd8b1cbf86 119
adelino 0:65fd8b1cbf86 120 wait_gfx_ack();
adelino 0:65fd8b1cbf86 121
adelino 0:65fd8b1cbf86 122 msb = get_gfx_char();
adelino 0:65fd8b1cbf86 123
adelino 0:65fd8b1cbf86 124 lsb = get_gfx_char();
adelino 0:65fd8b1cbf86 125
adelino 0:65fd8b1cbf86 126 res = (msb << 8) + lsb;
adelino 0:65fd8b1cbf86 127
adelino 0:65fd8b1cbf86 128 return res;
adelino 0:65fd8b1cbf86 129 }
adelino 0:65fd8b1cbf86 130 //--------------------------------
adelino 0:65fd8b1cbf86 131 UINT16 PicasoSerial::touch_get_y()
adelino 0:65fd8b1cbf86 132 {
adelino 0:65fd8b1cbf86 133 UINT16 res = 0;
adelino 0:65fd8b1cbf86 134 UINT8 lsb = 0;
adelino 0:65fd8b1cbf86 135 UINT8 msb = 0;
adelino 0:65fd8b1cbf86 136
adelino 0:65fd8b1cbf86 137 unsigned char zecom[4] = "";
adelino 0:65fd8b1cbf86 138
adelino 0:65fd8b1cbf86 139 zecom[0] = (CMD_TOUCH_GET >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 140 zecom[1] = CMD_TOUCH_GET & 0xFF;
adelino 0:65fd8b1cbf86 141
adelino 0:65fd8b1cbf86 142 zecom[2] = 0x00;
adelino 0:65fd8b1cbf86 143 zecom[3] = 0x02;
adelino 0:65fd8b1cbf86 144
adelino 0:65fd8b1cbf86 145 put_gfx_Commande(zecom, 4);
adelino 0:65fd8b1cbf86 146
adelino 0:65fd8b1cbf86 147 wait_gfx_ack();
adelino 0:65fd8b1cbf86 148
adelino 0:65fd8b1cbf86 149 msb = get_gfx_char();
adelino 0:65fd8b1cbf86 150
adelino 0:65fd8b1cbf86 151 lsb = get_gfx_char();
adelino 0:65fd8b1cbf86 152
adelino 0:65fd8b1cbf86 153 res = (msb << 8) + lsb;
adelino 0:65fd8b1cbf86 154
adelino 0:65fd8b1cbf86 155 return res;
adelino 0:65fd8b1cbf86 156 }
adelino 0:65fd8b1cbf86 157 //-----------------------------
adelino 0:65fd8b1cbf86 158 void PicasoSerial::gfx_reset()
adelino 0:65fd8b1cbf86 159 {
adelino 0:65fd8b1cbf86 160 // reSet uLCD
adelino 0:65fd8b1cbf86 161 //*****************************
adelino 0:65fd8b1cbf86 162 myPinReset = 0;
adelino 0:65fd8b1cbf86 163
adelino 0:65fd8b1cbf86 164 wait_us(10);
adelino 0:65fd8b1cbf86 165
adelino 0:65fd8b1cbf86 166 myPinReset = 1;
adelino 0:65fd8b1cbf86 167 //******************************
adelino 0:65fd8b1cbf86 168 // fin reset
adelino 0:65fd8b1cbf86 169
adelino 0:65fd8b1cbf86 170 wait(5); //wait 5s after reset
adelino 0:65fd8b1cbf86 171 }
adelino 0:65fd8b1cbf86 172 //-------------------------------------
adelino 0:65fd8b1cbf86 173 void PicasoSerial::setup(int baud)
adelino 0:65fd8b1cbf86 174 {
adelino 0:65fd8b1cbf86 175 gfx_reset();
adelino 0:65fd8b1cbf86 176
adelino 0:65fd8b1cbf86 177 gfx_set_BackGroundColor(BLUE);
adelino 0:65fd8b1cbf86 178
adelino 0:65fd8b1cbf86 179 touch_detect_region(0, 0, 240, 320);
adelino 0:65fd8b1cbf86 180 //
adelino 0:65fd8b1cbf86 181 touch_set(0x0000);
adelino 0:65fd8b1cbf86 182
adelino 0:65fd8b1cbf86 183 gfx_clearScreen();
adelino 0:65fd8b1cbf86 184
adelino 0:65fd8b1cbf86 185 gfx_set_UartSpeed(baud);
adelino 0:65fd8b1cbf86 186 }
adelino 0:65fd8b1cbf86 187 //-------------------------------
adelino 0:65fd8b1cbf86 188 void PicasoSerial::wait_gfx_ack()
adelino 0:65fd8b1cbf86 189 {
adelino 0:65fd8b1cbf86 190 UINT8 rep = GFX_NAK;
adelino 0:65fd8b1cbf86 191
adelino 0:65fd8b1cbf86 192 do {
adelino 0:65fd8b1cbf86 193 rep = get_gfx_char();
adelino 0:65fd8b1cbf86 194 } while (rep != GFX_ACK);
adelino 0:65fd8b1cbf86 195 }
adelino 0:65fd8b1cbf86 196 //-------------------------------------------------
adelino 0:65fd8b1cbf86 197 void PicasoSerial::put_gfx_char(unsigned char data)
adelino 0:65fd8b1cbf86 198 {
adelino 0:65fd8b1cbf86 199
adelino 0:65fd8b1cbf86 200 while (this->writeable()==0); // buffer plein ?
adelino 0:65fd8b1cbf86 201
adelino 0:65fd8b1cbf86 202 this->putc(data);
adelino 0:65fd8b1cbf86 203 }
adelino 0:65fd8b1cbf86 204 //------------------------------------
adelino 0:65fd8b1cbf86 205 UINT8 PicasoSerial::get_gfx_char(void)
adelino 0:65fd8b1cbf86 206 {
adelino 0:65fd8b1cbf86 207 while (this->readable()==0); // attendre data
adelino 0:65fd8b1cbf86 208
adelino 0:65fd8b1cbf86 209 //return mySerial.getc();
adelino 0:65fd8b1cbf86 210
adelino 0:65fd8b1cbf86 211 return this->getc();
adelino 0:65fd8b1cbf86 212 }
adelino 0:65fd8b1cbf86 213 //----------------------------------------------------------------------
adelino 0:65fd8b1cbf86 214 void PicasoSerial::put_gfx_Commande(unsigned char* commande, int nombre)
adelino 0:65fd8b1cbf86 215 {
adelino 0:65fd8b1cbf86 216 int i = 0;
adelino 0:65fd8b1cbf86 217
adelino 0:65fd8b1cbf86 218 for (i = 0; i < nombre; i++) {
adelino 0:65fd8b1cbf86 219 put_gfx_char(commande[i]);
adelino 0:65fd8b1cbf86 220 }
adelino 0:65fd8b1cbf86 221 }
adelino 0:65fd8b1cbf86 222 //--------------------------------------------
adelino 0:65fd8b1cbf86 223 void PicasoSerial::gfx_set_UartSpeed(int speed)
adelino 0:65fd8b1cbf86 224 {
adelino 0:65fd8b1cbf86 225 int mbaud = 0;
adelino 0:65fd8b1cbf86 226
adelino 0:65fd8b1cbf86 227 unsigned char zecom[4] = "";
adelino 0:65fd8b1cbf86 228
adelino 0:65fd8b1cbf86 229 zecom[0] = (CMD_BAUD_RATE >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 230 zecom[1] = CMD_BAUD_RATE & 0xFF;
adelino 0:65fd8b1cbf86 231
adelino 0:65fd8b1cbf86 232 switch (speed) {
adelino 0:65fd8b1cbf86 233 //
adelino 0:65fd8b1cbf86 234 case 9600:
adelino 0:65fd8b1cbf86 235 zecom[2] = (GFX_BAUD_9600 >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 236 zecom[3] = GFX_BAUD_9600 & 0xFF;
adelino 0:65fd8b1cbf86 237 mbaud = speed;
adelino 0:65fd8b1cbf86 238
adelino 0:65fd8b1cbf86 239 break;
adelino 0:65fd8b1cbf86 240 //
adelino 0:65fd8b1cbf86 241 case 19200:
adelino 0:65fd8b1cbf86 242 zecom[2] = (GFX_BAUD_19200 >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 243 zecom[3] = GFX_BAUD_19200 & 0xFF;
adelino 0:65fd8b1cbf86 244 mbaud = speed;
adelino 0:65fd8b1cbf86 245
adelino 0:65fd8b1cbf86 246 break;
adelino 0:65fd8b1cbf86 247 //
adelino 0:65fd8b1cbf86 248 case 56000:
adelino 0:65fd8b1cbf86 249 zecom[2] = (GFX_BAUD_56000 >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 250 zecom[3] = GFX_BAUD_56000 & 0xFF;
adelino 0:65fd8b1cbf86 251 mbaud = speed;
adelino 0:65fd8b1cbf86 252
adelino 0:65fd8b1cbf86 253 break;
adelino 0:65fd8b1cbf86 254 //
adelino 0:65fd8b1cbf86 255 case 115200:
adelino 0:65fd8b1cbf86 256 zecom[2] = (GFX_BAUD_115200 >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 257 zecom[3] = GFX_BAUD_115200 & 0xFF;
adelino 0:65fd8b1cbf86 258 mbaud = speed;
adelino 0:65fd8b1cbf86 259
adelino 0:65fd8b1cbf86 260 break;
adelino 0:65fd8b1cbf86 261
adelino 0:65fd8b1cbf86 262 //
adelino 0:65fd8b1cbf86 263 default:
adelino 0:65fd8b1cbf86 264 zecom[2] = (GFX_BAUD_9600 >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 265 zecom[3] = GFX_BAUD_9600 & 0xFF;
adelino 0:65fd8b1cbf86 266 mbaud = 9600;
adelino 0:65fd8b1cbf86 267
adelino 0:65fd8b1cbf86 268 break;
adelino 0:65fd8b1cbf86 269 }
adelino 0:65fd8b1cbf86 270 //
adelino 0:65fd8b1cbf86 271 put_gfx_Commande(zecom, 4);
adelino 0:65fd8b1cbf86 272
adelino 0:65fd8b1cbf86 273 wait_ms(50);
adelino 0:65fd8b1cbf86 274 this->baud(mbaud);
adelino 0:65fd8b1cbf86 275 wait_ms(100);
adelino 0:65fd8b1cbf86 276
adelino 0:65fd8b1cbf86 277 wait_gfx_ack();
adelino 0:65fd8b1cbf86 278 }
adelino 0:65fd8b1cbf86 279 //----------------------------------
adelino 0:65fd8b1cbf86 280 void PicasoSerial::gfx_clearScreen()
adelino 0:65fd8b1cbf86 281 {
adelino 0:65fd8b1cbf86 282 unsigned char zecom [2] = "";
adelino 0:65fd8b1cbf86 283 //
adelino 0:65fd8b1cbf86 284 zecom[0] = (CMD_CLEAR_SCREEN >> 8)&0xFF; //0xFFCD
adelino 0:65fd8b1cbf86 285 zecom[1] = (CMD_CLEAR_SCREEN & 0xFF);
adelino 0:65fd8b1cbf86 286
adelino 0:65fd8b1cbf86 287 put_gfx_Commande(zecom, 2);
adelino 0:65fd8b1cbf86 288
adelino 0:65fd8b1cbf86 289 wait_gfx_ack();
adelino 0:65fd8b1cbf86 290 }
adelino 0:65fd8b1cbf86 291 //-----------------------------------------------------
adelino 0:65fd8b1cbf86 292 void PicasoSerial::gfx_set_BackGroundColor(Color color)
adelino 0:65fd8b1cbf86 293 {
adelino 0:65fd8b1cbf86 294 unsigned char zecom [4] = "";
adelino 0:65fd8b1cbf86 295
adelino 0:65fd8b1cbf86 296 zecom[0] = (CMD_BACKGROUND_COLOR >> 8) & 0xFF; // 0xFFA4
adelino 0:65fd8b1cbf86 297 zecom[1] = CMD_BACKGROUND_COLOR & 0xFF;
adelino 0:65fd8b1cbf86 298
adelino 0:65fd8b1cbf86 299 zecom[2] = (color >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 300 zecom[3] = color & 0xFF;
adelino 0:65fd8b1cbf86 301
adelino 0:65fd8b1cbf86 302 put_gfx_Commande(zecom, 4);
adelino 0:65fd8b1cbf86 303
adelino 0:65fd8b1cbf86 304 wait_gfx_ack();
adelino 0:65fd8b1cbf86 305 }
adelino 0:65fd8b1cbf86 306 //----------------------------------------------
adelino 0:65fd8b1cbf86 307 unsigned short gfx_set_RGB565(unsigned char red,
adelino 0:65fd8b1cbf86 308 unsigned char green,
adelino 0:65fd8b1cbf86 309 unsigned char blue)
adelino 0:65fd8b1cbf86 310 {
adelino 0:65fd8b1cbf86 311 UINT16 r = (red * 31) / 255;
adelino 0:65fd8b1cbf86 312
adelino 0:65fd8b1cbf86 313 UINT16 v = (green * 63) / 255;
adelino 0:65fd8b1cbf86 314
adelino 0:65fd8b1cbf86 315 UINT16 b = (blue * 31) / 255;
adelino 0:65fd8b1cbf86 316
adelino 0:65fd8b1cbf86 317 return (r << 11) | (v << 5) | b;
adelino 0:65fd8b1cbf86 318
adelino 0:65fd8b1cbf86 319 }
adelino 0:65fd8b1cbf86 320 //-----------------------------------------------------------------------------
adelino 0:65fd8b1cbf86 321 void PicasoSerial::draw_circle(UINT16 x, UINT16 y, UINT16 radius,Color color)
adelino 0:65fd8b1cbf86 322 {
adelino 0:65fd8b1cbf86 323 unsigned char zecom [10] = "";
adelino 0:65fd8b1cbf86 324
adelino 0:65fd8b1cbf86 325 zecom[0] = (CMD_CIRCLE >> 8)&0xFF;
adelino 0:65fd8b1cbf86 326 zecom[1] = CMD_CIRCLE & 0xFF;
adelino 0:65fd8b1cbf86 327
adelino 0:65fd8b1cbf86 328 // coord X[msb:Lsb]
adelino 0:65fd8b1cbf86 329 zecom[2] = (x >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 330 zecom[3] = (x)& 0xFF;
adelino 0:65fd8b1cbf86 331
adelino 0:65fd8b1cbf86 332 // coord Y[msb:Lsb]
adelino 0:65fd8b1cbf86 333 zecom[4] = (y >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 334 zecom[5] = (y)& 0xFF;
adelino 0:65fd8b1cbf86 335
adelino 0:65fd8b1cbf86 336 // rayon
adelino 0:65fd8b1cbf86 337 zecom[6] = (radius >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 338 zecom[7] = (radius)& 0xFF;
adelino 0:65fd8b1cbf86 339
adelino 0:65fd8b1cbf86 340 zecom[8] = (color >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 341 zecom[9] = color & 0xFF;
adelino 0:65fd8b1cbf86 342
adelino 0:65fd8b1cbf86 343 put_gfx_Commande(zecom, 10);
adelino 0:65fd8b1cbf86 344
adelino 0:65fd8b1cbf86 345 wait_gfx_ack();
adelino 0:65fd8b1cbf86 346 }
adelino 0:65fd8b1cbf86 347 //------------------------------------------------------------------------------------
adelino 0:65fd8b1cbf86 348 void PicasoSerial::draw_filled_circle(UINT16 x, UINT16 y, UINT16 radius,Color color)
adelino 0:65fd8b1cbf86 349 {
adelino 0:65fd8b1cbf86 350 unsigned char zecom [10] = "";
adelino 0:65fd8b1cbf86 351
adelino 0:65fd8b1cbf86 352 zecom[0] = (CMD_FILLED_CIRCLE >> 8)&0xFF;
adelino 0:65fd8b1cbf86 353 zecom[1] = CMD_FILLED_CIRCLE & 0xFF;
adelino 0:65fd8b1cbf86 354
adelino 0:65fd8b1cbf86 355 // coord X[msb:Lsb]
adelino 0:65fd8b1cbf86 356 zecom[2] = (x >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 357 zecom[3] = (x)& 0xFF;
adelino 0:65fd8b1cbf86 358
adelino 0:65fd8b1cbf86 359 // coord Y[msb:Lsb]
adelino 0:65fd8b1cbf86 360 zecom[4] = (y >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 361 zecom[5] = (y)& 0xFF;
adelino 0:65fd8b1cbf86 362
adelino 0:65fd8b1cbf86 363 // rayon
adelino 0:65fd8b1cbf86 364 zecom[6] = (radius >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 365 zecom[7] = (radius)& 0xFF;
adelino 0:65fd8b1cbf86 366
adelino 0:65fd8b1cbf86 367 zecom[8] = (color >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 368 zecom[9] = color & 0xFF;
adelino 0:65fd8b1cbf86 369
adelino 0:65fd8b1cbf86 370 put_gfx_Commande(zecom, 10);
adelino 0:65fd8b1cbf86 371
adelino 0:65fd8b1cbf86 372 wait_gfx_ack();
adelino 0:65fd8b1cbf86 373 }
adelino 0:65fd8b1cbf86 374 //------------------------------------------------------------
adelino 0:65fd8b1cbf86 375 void PicasoSerial::draw_line(UINT16 x1, UINT16 y1,
adelino 0:65fd8b1cbf86 376 UINT16 x2, UINT16 y2,Color color)
adelino 0:65fd8b1cbf86 377 {
adelino 0:65fd8b1cbf86 378 unsigned char zecom [12] = "";
adelino 0:65fd8b1cbf86 379
adelino 0:65fd8b1cbf86 380 zecom[0] = (CMD_LINE >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 381 zecom[1] = CMD_LINE & 0xFF;
adelino 0:65fd8b1cbf86 382
adelino 0:65fd8b1cbf86 383 // coord X1[msb:Lsb]
adelino 0:65fd8b1cbf86 384 zecom[2] = (x1 >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 385 zecom[3] = (x1)& 0xFF;
adelino 0:65fd8b1cbf86 386
adelino 0:65fd8b1cbf86 387 // coord Y1[msb:Lsb]
adelino 0:65fd8b1cbf86 388 zecom[4] = (y1 >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 389 zecom[5] = (y1)& 0xFF;
adelino 0:65fd8b1cbf86 390
adelino 0:65fd8b1cbf86 391 // coord X2[msb:lsb]
adelino 0:65fd8b1cbf86 392 zecom[6] = (x2 >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 393 zecom[7] = (x2)& 0xFF;
adelino 0:65fd8b1cbf86 394
adelino 0:65fd8b1cbf86 395 // coord Y2[msb:lsb]
adelino 0:65fd8b1cbf86 396 zecom[8] = (y2 >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 397 zecom[9] = y2 & 0xFF;
adelino 0:65fd8b1cbf86 398
adelino 0:65fd8b1cbf86 399 zecom[10] = (color >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 400 zecom[11] = color & 0xFF;
adelino 0:65fd8b1cbf86 401
adelino 0:65fd8b1cbf86 402 put_gfx_Commande(zecom, 12);
adelino 0:65fd8b1cbf86 403
adelino 0:65fd8b1cbf86 404 wait_gfx_ack();
adelino 0:65fd8b1cbf86 405 }
adelino 0:65fd8b1cbf86 406 //-----------------------------------------------------------------------------
adelino 0:65fd8b1cbf86 407 void PicasoSerial::draw_triangle(UINT16 x1, UINT16 y1, UINT16 x2,
adelino 0:65fd8b1cbf86 408 UINT16 y2, UINT16 x3, UINT16 y3,Color color)
adelino 0:65fd8b1cbf86 409 {
adelino 0:65fd8b1cbf86 410 unsigned char zecom [16] = "";
adelino 0:65fd8b1cbf86 411
adelino 0:65fd8b1cbf86 412 zecom[0] = (CMD_TRIANGLE >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 413 zecom[1] = CMD_TRIANGLE & 0xFF;
adelino 0:65fd8b1cbf86 414
adelino 0:65fd8b1cbf86 415 // coord X1[msb:Lsb]
adelino 0:65fd8b1cbf86 416 zecom[2] = (x1 >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 417 zecom[3] = (x1) & 0xFF;
adelino 0:65fd8b1cbf86 418
adelino 0:65fd8b1cbf86 419 // coord Y1[msb:Lsb]
adelino 0:65fd8b1cbf86 420 zecom[4] = (y1 >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 421 zecom[5] = (y1) & 0xFF;
adelino 0:65fd8b1cbf86 422
adelino 0:65fd8b1cbf86 423 // coord X2[msb:lsb]
adelino 0:65fd8b1cbf86 424 zecom[6] = (x2 >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 425 zecom[7] = (x2) & 0xFF;
adelino 0:65fd8b1cbf86 426
adelino 0:65fd8b1cbf86 427 // coord Y2[msb:lsb]
adelino 0:65fd8b1cbf86 428 zecom[8] = (y2 >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 429 zecom[9] = (y2) & 0xFF;
adelino 0:65fd8b1cbf86 430
adelino 0:65fd8b1cbf86 431 //cord X3[msb:lsb]
adelino 0:65fd8b1cbf86 432 zecom[10] = (x3 >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 433 zecom[11] = (x3) & 0xFF;
adelino 0:65fd8b1cbf86 434
adelino 0:65fd8b1cbf86 435 //cord Y3[msb:lsb]
adelino 0:65fd8b1cbf86 436 zecom[12] = (y3 >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 437 zecom[13] = (y3) & 0xFF;
adelino 0:65fd8b1cbf86 438
adelino 0:65fd8b1cbf86 439 zecom[14] = (color >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 440 zecom[15] = color & 0xFF;
adelino 0:65fd8b1cbf86 441
adelino 0:65fd8b1cbf86 442 put_gfx_Commande(zecom, 16);
adelino 0:65fd8b1cbf86 443
adelino 0:65fd8b1cbf86 444 wait_gfx_ack();
adelino 0:65fd8b1cbf86 445 }
adelino 0:65fd8b1cbf86 446 //-----------------------------------------------------------------------------------
adelino 0:65fd8b1cbf86 447 void PicasoSerial::draw_filled_triangle(UINT16 x1, UINT16 y1, UINT16 x2,
adelino 0:65fd8b1cbf86 448 UINT16 y2, UINT16 x3, UINT16 y3,Color color)
adelino 0:65fd8b1cbf86 449 {
adelino 0:65fd8b1cbf86 450 unsigned char zecom [16] = "";
adelino 0:65fd8b1cbf86 451
adelino 0:65fd8b1cbf86 452 zecom[0] = (CMD_FILLED_TRIANGLE >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 453 zecom[1] = CMD_FILLED_TRIANGLE & 0xFF;
adelino 0:65fd8b1cbf86 454
adelino 0:65fd8b1cbf86 455 // coord X1[msb:Lsb]
adelino 0:65fd8b1cbf86 456 zecom[2] = (x1 >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 457 zecom[3] = (x1) & 0xFF;
adelino 0:65fd8b1cbf86 458
adelino 0:65fd8b1cbf86 459 // coord Y1[msb:Lsb]
adelino 0:65fd8b1cbf86 460 zecom[4] = (y1 >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 461 zecom[5] = (y1) & 0xFF;
adelino 0:65fd8b1cbf86 462
adelino 0:65fd8b1cbf86 463 // coord X2[msb:lsb]
adelino 0:65fd8b1cbf86 464 zecom[6] = (x2 >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 465 zecom[7] = (x2) & 0xFF;
adelino 0:65fd8b1cbf86 466
adelino 0:65fd8b1cbf86 467 // coord Y2[msb:lsb]
adelino 0:65fd8b1cbf86 468 zecom[8] = (y2 >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 469 zecom[9] = (y2) & 0xFF;
adelino 0:65fd8b1cbf86 470
adelino 0:65fd8b1cbf86 471 //cord X3[msb:lsb]
adelino 0:65fd8b1cbf86 472 zecom[10] = (x3 >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 473 zecom[11] = (x3) & 0xFF;
adelino 0:65fd8b1cbf86 474
adelino 0:65fd8b1cbf86 475 //cord Y3[msb:lsb]
adelino 0:65fd8b1cbf86 476 zecom[12] = (y3 >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 477 zecom[13] = (y3) & 0xFF;
adelino 0:65fd8b1cbf86 478
adelino 0:65fd8b1cbf86 479 zecom[14] = (color >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 480 zecom[15] = color & 0xFF;
adelino 0:65fd8b1cbf86 481
adelino 0:65fd8b1cbf86 482 put_gfx_Commande(zecom, 16);
adelino 0:65fd8b1cbf86 483
adelino 0:65fd8b1cbf86 484 wait_gfx_ack();
adelino 0:65fd8b1cbf86 485 }
adelino 0:65fd8b1cbf86 486 //----------------------------------------------------------------------
adelino 0:65fd8b1cbf86 487 void PicasoSerial::draw_filled_rectangle(UINT16 x1, UINT16 y1, UINT16 x2,
adelino 0:65fd8b1cbf86 488 UINT16 y2,Color color)
adelino 0:65fd8b1cbf86 489 {
adelino 0:65fd8b1cbf86 490 unsigned char zecom [12] = "";
adelino 0:65fd8b1cbf86 491
adelino 0:65fd8b1cbf86 492 zecom[0] = (CMD_FILLED_RECT >> 8)&0xFF;
adelino 0:65fd8b1cbf86 493 zecom[1] = (CMD_FILLED_RECT & 0xFF);
adelino 0:65fd8b1cbf86 494
adelino 0:65fd8b1cbf86 495 // coord X1[msb:Lsb]
adelino 0:65fd8b1cbf86 496 zecom[2] = (x1 >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 497 zecom[3] = (x1) & 0xFF;
adelino 0:65fd8b1cbf86 498
adelino 0:65fd8b1cbf86 499 // coord Y1[msb:Lsb]
adelino 0:65fd8b1cbf86 500 zecom[4] = (y1 >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 501 zecom[5] = (y1) & 0xFF;
adelino 0:65fd8b1cbf86 502
adelino 0:65fd8b1cbf86 503 // coord X2[msb:lsb]
adelino 0:65fd8b1cbf86 504 zecom[6] = (x2 >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 505 zecom[7] = (x2) & 0xFF;
adelino 0:65fd8b1cbf86 506
adelino 0:65fd8b1cbf86 507 // coord Y2[msb:lsb]
adelino 0:65fd8b1cbf86 508 zecom[8] = (y2 >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 509 zecom[9] = (y2) & 0xFF;
adelino 0:65fd8b1cbf86 510
adelino 0:65fd8b1cbf86 511 // color
adelino 0:65fd8b1cbf86 512 zecom[10] = (color >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 513 zecom[11] = color & 0xFF;
adelino 0:65fd8b1cbf86 514
adelino 0:65fd8b1cbf86 515 put_gfx_Commande(zecom, 12);
adelino 0:65fd8b1cbf86 516
adelino 0:65fd8b1cbf86 517 wait_gfx_ack();
adelino 0:65fd8b1cbf86 518 }
adelino 0:65fd8b1cbf86 519 //----------------------------------------------------------------
adelino 0:65fd8b1cbf86 520 void PicasoSerial::draw_rectangle(UINT16 x1, UINT16 y1, UINT16 x2,
adelino 0:65fd8b1cbf86 521 UINT16 y2,Color color)
adelino 0:65fd8b1cbf86 522 {
adelino 0:65fd8b1cbf86 523 unsigned char zecom [12] = "";
adelino 0:65fd8b1cbf86 524
adelino 0:65fd8b1cbf86 525 zecom[0] = (CMD_RECT >> 8)&0xFF;
adelino 0:65fd8b1cbf86 526 zecom[1] = (CMD_RECT & 0xFF);
adelino 0:65fd8b1cbf86 527
adelino 0:65fd8b1cbf86 528 // coord X1[msb:Lsb]
adelino 0:65fd8b1cbf86 529 zecom[2] = (x1 >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 530 zecom[3] = (x1) & 0xFF;
adelino 0:65fd8b1cbf86 531
adelino 0:65fd8b1cbf86 532 // coord Y1[msb:Lsb]
adelino 0:65fd8b1cbf86 533 zecom[4] = (y1 >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 534 zecom[5] = (y1) & 0xFF;
adelino 0:65fd8b1cbf86 535
adelino 0:65fd8b1cbf86 536 // coord X2[msb:lsb]
adelino 0:65fd8b1cbf86 537 zecom[6] = (x2 >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 538 zecom[7] = (x2) & 0xFF;
adelino 0:65fd8b1cbf86 539
adelino 0:65fd8b1cbf86 540 // coord Y2[msb:lsb]
adelino 0:65fd8b1cbf86 541 zecom[8] = (y2 >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 542 zecom[9] = (y2) & 0xFF;
adelino 0:65fd8b1cbf86 543
adelino 0:65fd8b1cbf86 544 // color
adelino 0:65fd8b1cbf86 545 zecom[10] = (color >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 546 zecom[11] = color & 0xFF;
adelino 0:65fd8b1cbf86 547
adelino 0:65fd8b1cbf86 548 put_gfx_Commande(zecom, 12);
adelino 0:65fd8b1cbf86 549
adelino 0:65fd8b1cbf86 550 wait_gfx_ack();
adelino 0:65fd8b1cbf86 551 }
adelino 0:65fd8b1cbf86 552 //-----------------------------------------------------------------------------
adelino 0:65fd8b1cbf86 553 void PicasoSerial::draw_panel(UINT16 state, UINT16 x1, UINT16 y1, UINT16 width,
adelino 0:65fd8b1cbf86 554 UINT16 height,Color color)
adelino 0:65fd8b1cbf86 555 {
adelino 0:65fd8b1cbf86 556 unsigned char zecom [10] = "";
adelino 0:65fd8b1cbf86 557
adelino 0:65fd8b1cbf86 558 zecom[0] = (CMD_PANEL >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 559 zecom[1] = (CMD_PANEL & 0xFF);
adelino 0:65fd8b1cbf86 560
adelino 0:65fd8b1cbf86 561 // coord state[msb:Lsb]0 recessed, 1 raised
adelino 0:65fd8b1cbf86 562 zecom[2] = (state >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 563 zecom[3] = (state) & 0xFF;
adelino 0:65fd8b1cbf86 564
adelino 0:65fd8b1cbf86 565 // coord X1[msb:Lsb]
adelino 0:65fd8b1cbf86 566 zecom[4] = (x1 >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 567 zecom[5] = (x1) & 0xFF;
adelino 0:65fd8b1cbf86 568
adelino 0:65fd8b1cbf86 569 // coord X1[msb:Lsb]
adelino 0:65fd8b1cbf86 570 zecom[6] = (y1 >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 571 zecom[7] = (y1) & 0xFF;
adelino 0:65fd8b1cbf86 572
adelino 0:65fd8b1cbf86 573 // coord width[msb:Lsb]
adelino 0:65fd8b1cbf86 574 zecom[8] = (width >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 575 zecom[9] = (width) & 0xFF;
adelino 0:65fd8b1cbf86 576
adelino 0:65fd8b1cbf86 577 // coord height[msb:lsb]
adelino 0:65fd8b1cbf86 578 zecom[10] = (height >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 579 zecom[11] = (height) & 0xFF;
adelino 0:65fd8b1cbf86 580
adelino 0:65fd8b1cbf86 581 // color
adelino 0:65fd8b1cbf86 582 zecom[12] = (color >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 583 zecom[13] = color & 0xFF;
adelino 0:65fd8b1cbf86 584
adelino 0:65fd8b1cbf86 585 put_gfx_Commande(zecom, 14);
adelino 0:65fd8b1cbf86 586
adelino 0:65fd8b1cbf86 587 wait_gfx_ack();
adelino 0:65fd8b1cbf86 588 }
adelino 0:65fd8b1cbf86 589 //----------------------------------------------------------------
adelino 0:65fd8b1cbf86 590 void PicasoSerial::draw_pixel(UINT16 x1, UINT16 y1,Color color)
adelino 0:65fd8b1cbf86 591 {
adelino 0:65fd8b1cbf86 592 unsigned char zecom [8] = "";
adelino 0:65fd8b1cbf86 593
adelino 0:65fd8b1cbf86 594 zecom[0] = (CMD_PIXEL >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 595 zecom[1] = CMD_PIXEL & 0xFF;
adelino 0:65fd8b1cbf86 596
adelino 0:65fd8b1cbf86 597 // coord X1[msb:Lsb]
adelino 0:65fd8b1cbf86 598 zecom[2] = (x1 >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 599 zecom[3] = (x1) & 0xFF;
adelino 0:65fd8b1cbf86 600
adelino 0:65fd8b1cbf86 601 // coord Y1[msb:Lsb]
adelino 0:65fd8b1cbf86 602 zecom[4] = (y1 >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 603 zecom[5] = (y1) & 0xFF;
adelino 0:65fd8b1cbf86 604
adelino 0:65fd8b1cbf86 605 // color
adelino 0:65fd8b1cbf86 606 zecom[6] = (color >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 607 zecom[7] = color & 0xFF;
adelino 0:65fd8b1cbf86 608
adelino 0:65fd8b1cbf86 609 put_gfx_Commande(zecom, 8);
adelino 0:65fd8b1cbf86 610
adelino 0:65fd8b1cbf86 611 wait_gfx_ack();
adelino 0:65fd8b1cbf86 612 }
adelino 0:65fd8b1cbf86 613 //-------------------------------------------------------------------------------------
adelino 0:65fd8b1cbf86 614 void PicasoSerial::draw_slider(UINT16 mode, UINT16 x1, UINT16 y1, UINT16 x2, UINT16 y2,
adelino 0:65fd8b1cbf86 615 Color color, UINT16 scale, UINT16 value)
adelino 0:65fd8b1cbf86 616 {
adelino 0:65fd8b1cbf86 617 unsigned char zecom [18] = "";
adelino 0:65fd8b1cbf86 618
adelino 0:65fd8b1cbf86 619 zecom[0] = (CMD_SLIDER >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 620 zecom[1] = CMD_SLIDER & 0xFF;
adelino 0:65fd8b1cbf86 621
adelino 0:65fd8b1cbf86 622 //mode
adelino 0:65fd8b1cbf86 623 zecom[2] = (mode >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 624 zecom[3] = (mode) & 0xFF;
adelino 0:65fd8b1cbf86 625
adelino 0:65fd8b1cbf86 626 // coord X1[msb:Lsb]
adelino 0:65fd8b1cbf86 627 zecom[4] = (x1 >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 628 zecom[5] = (x1) & 0xFF;
adelino 0:65fd8b1cbf86 629
adelino 0:65fd8b1cbf86 630 // coord Y1[msb:Lsb]
adelino 0:65fd8b1cbf86 631 zecom[6] = (y1 >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 632 zecom[7] = (y1) & 0xFF;
adelino 0:65fd8b1cbf86 633
adelino 0:65fd8b1cbf86 634 // coord X2[msb:Lsb]
adelino 0:65fd8b1cbf86 635 zecom[8] = (x2 >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 636 zecom[9] = (x2) & 0xFF;
adelino 0:65fd8b1cbf86 637
adelino 0:65fd8b1cbf86 638 // coord Y2[msb:Lsb]
adelino 0:65fd8b1cbf86 639 zecom[10] = (y2 >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 640 zecom[11] = (y2) & 0xFF;
adelino 0:65fd8b1cbf86 641
adelino 0:65fd8b1cbf86 642 // color
adelino 0:65fd8b1cbf86 643 zecom[12] = (color >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 644 zecom[13] = color & 0xFF;
adelino 0:65fd8b1cbf86 645
adelino 0:65fd8b1cbf86 646 // scale
adelino 0:65fd8b1cbf86 647 zecom[14] = (scale >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 648 zecom[15] = scale & 0xFF;
adelino 0:65fd8b1cbf86 649
adelino 0:65fd8b1cbf86 650 //value
adelino 0:65fd8b1cbf86 651 zecom[16] = (value >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 652 zecom[17] = value & 0xFF;
adelino 0:65fd8b1cbf86 653
adelino 0:65fd8b1cbf86 654 put_gfx_Commande(zecom, 18);
adelino 0:65fd8b1cbf86 655
adelino 0:65fd8b1cbf86 656 wait_gfx_ack();
adelino 0:65fd8b1cbf86 657 }
adelino 0:65fd8b1cbf86 658 //----------------------------------------------------------------------------------
adelino 0:65fd8b1cbf86 659 void PicasoSerial::draw_button(string str, UINT16 x1, UINT16 y1,Font font,
adelino 0:65fd8b1cbf86 660 State state,Color button_color,Color text_color)
adelino 0:65fd8b1cbf86 661 {
adelino 0:65fd8b1cbf86 662 int i = 0;
adelino 0:65fd8b1cbf86 663
adelino 0:65fd8b1cbf86 664 int taille = 0;
adelino 0:65fd8b1cbf86 665 unsigned char zecom [200] = "";
adelino 0:65fd8b1cbf86 666
adelino 0:65fd8b1cbf86 667 // cherche taille
adelino 0:65fd8b1cbf86 668 /*
adelino 0:65fd8b1cbf86 669 while (*s) {
adelino 0:65fd8b1cbf86 670 size++;
adelino 0:65fd8b1cbf86 671 s++;
adelino 0:65fd8b1cbf86 672
adelino 0:65fd8b1cbf86 673 }
adelino 0:65fd8b1cbf86 674
adelino 0:65fd8b1cbf86 675 s = s - size;
adelino 0:65fd8b1cbf86 676 */
adelino 0:65fd8b1cbf86 677 taille=str.size();
adelino 0:65fd8b1cbf86 678
adelino 0:65fd8b1cbf86 679 zecom[0] = (CMD_BUTTON >> 8)&0xFF;
adelino 0:65fd8b1cbf86 680 zecom[1] = CMD_BUTTON & 0xFF;
adelino 0:65fd8b1cbf86 681
adelino 0:65fd8b1cbf86 682 //etat 0 depressed, 1 raised
adelino 0:65fd8b1cbf86 683 zecom[2] = (state >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 684 zecom[3] = state & 0xFF;
adelino 0:65fd8b1cbf86 685
adelino 0:65fd8b1cbf86 686 // coord X1[msb:Lsb]
adelino 0:65fd8b1cbf86 687 zecom[4] = (x1 >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 688 zecom[5] = (x1) & 0xFF;
adelino 0:65fd8b1cbf86 689
adelino 0:65fd8b1cbf86 690 // coord Y1[msb:Lsb]
adelino 0:65fd8b1cbf86 691 zecom[6] = (y1 >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 692 zecom[7] = (y1) & 0xFF;
adelino 0:65fd8b1cbf86 693
adelino 0:65fd8b1cbf86 694 // button color
adelino 0:65fd8b1cbf86 695 zecom[8] = (button_color >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 696 zecom[9] = button_color & 0xFF;
adelino 0:65fd8b1cbf86 697
adelino 0:65fd8b1cbf86 698 //text color
adelino 0:65fd8b1cbf86 699 zecom[10] = (text_color >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 700 zecom[11] = text_color & 0xFF;
adelino 0:65fd8b1cbf86 701
adelino 0:65fd8b1cbf86 702 // font id
adelino 0:65fd8b1cbf86 703 zecom[12] = (font >> 8)&0xFF;
adelino 0:65fd8b1cbf86 704 zecom[13] = font & 0xFF;
adelino 0:65fd8b1cbf86 705
adelino 0:65fd8b1cbf86 706 //txtWidth
adelino 0:65fd8b1cbf86 707 zecom[14] = 0x00;
adelino 0:65fd8b1cbf86 708 zecom[15] = 0x01;
adelino 0:65fd8b1cbf86 709
adelino 0:65fd8b1cbf86 710 //txtHeight
adelino 0:65fd8b1cbf86 711 zecom[16] = 0x00;
adelino 0:65fd8b1cbf86 712 zecom[17] = 0x01;
adelino 0:65fd8b1cbf86 713
adelino 0:65fd8b1cbf86 714
adelino 0:65fd8b1cbf86 715 //le text
adelino 0:65fd8b1cbf86 716 for (i = 0; i < taille; i++) {
adelino 0:65fd8b1cbf86 717 zecom[18 + i] = str[i];
adelino 0:65fd8b1cbf86 718 }
adelino 0:65fd8b1cbf86 719
adelino 0:65fd8b1cbf86 720 //terminate
adelino 0:65fd8b1cbf86 721 zecom[18 + taille] = 0x00;
adelino 0:65fd8b1cbf86 722
adelino 0:65fd8b1cbf86 723 put_gfx_Commande(zecom, 19 + taille);
adelino 0:65fd8b1cbf86 724
adelino 0:65fd8b1cbf86 725 wait_gfx_ack();
adelino 0:65fd8b1cbf86 726 }
adelino 0:65fd8b1cbf86 727 //-------------------------------------------------
adelino 0:65fd8b1cbf86 728 void PicasoSerial::gfx_move_to(UINT16 x1, UINT16 y1)
adelino 0:65fd8b1cbf86 729 {
adelino 0:65fd8b1cbf86 730 unsigned char zecom [6] = "";
adelino 0:65fd8b1cbf86 731
adelino 0:65fd8b1cbf86 732 //move origine
adelino 0:65fd8b1cbf86 733 zecom[0] = (CMD_MOVE_ORIGIN >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 734 zecom[1] = (CMD_MOVE_ORIGIN)& 0xFF;
adelino 0:65fd8b1cbf86 735
adelino 0:65fd8b1cbf86 736 // coord X1[msb:Lsb]
adelino 0:65fd8b1cbf86 737 zecom[2] = (x1 >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 738 zecom[3] = (x1) & 0xFF;
adelino 0:65fd8b1cbf86 739
adelino 0:65fd8b1cbf86 740 // coord Y1[msb:Lsb]
adelino 0:65fd8b1cbf86 741 zecom[4] = (y1 >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 742 zecom[5] = (y1) & 0xFF;
adelino 0:65fd8b1cbf86 743
adelino 0:65fd8b1cbf86 744 put_gfx_Commande(zecom, 6);
adelino 0:65fd8b1cbf86 745
adelino 0:65fd8b1cbf86 746 wait_gfx_ack();
adelino 0:65fd8b1cbf86 747 }
adelino 0:65fd8b1cbf86 748 //----------------------------------------------
adelino 0:65fd8b1cbf86 749 void PicasoSerial::text_foreground(Color color)
adelino 0:65fd8b1cbf86 750 {
adelino 0:65fd8b1cbf86 751 UINT8 rep = 0;
adelino 0:65fd8b1cbf86 752
adelino 0:65fd8b1cbf86 753 unsigned char zecom [4] = "";
adelino 0:65fd8b1cbf86 754
adelino 0:65fd8b1cbf86 755 zecom[0] = (CMD_TEXT_FOREGROUND >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 756 zecom[1] = CMD_TEXT_FOREGROUND & 0xFF;
adelino 0:65fd8b1cbf86 757
adelino 0:65fd8b1cbf86 758 zecom[2] = (color >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 759 zecom[3] = color & 0xFF;
adelino 0:65fd8b1cbf86 760
adelino 0:65fd8b1cbf86 761 put_gfx_Commande(zecom, 4); // ack?
adelino 0:65fd8b1cbf86 762
adelino 0:65fd8b1cbf86 763 wait_gfx_ack();
adelino 0:65fd8b1cbf86 764
adelino 0:65fd8b1cbf86 765 rep = get_gfx_char(); //previous color msb
adelino 0:65fd8b1cbf86 766
adelino 0:65fd8b1cbf86 767 rep = get_gfx_char(); //previous color lsb
adelino 0:65fd8b1cbf86 768 }
adelino 0:65fd8b1cbf86 769 //---------------------------------------------
adelino 0:65fd8b1cbf86 770 void PicasoSerial::text_backround(Color color)
adelino 0:65fd8b1cbf86 771 {
adelino 0:65fd8b1cbf86 772 UINT8 rep = 0;
adelino 0:65fd8b1cbf86 773
adelino 0:65fd8b1cbf86 774 unsigned char zecom [4] = "";
adelino 0:65fd8b1cbf86 775
adelino 0:65fd8b1cbf86 776 zecom[0] = (CMD_TEXT_BACKROUND >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 777 zecom[1] = CMD_TEXT_BACKROUND & 0xFF;
adelino 0:65fd8b1cbf86 778
adelino 0:65fd8b1cbf86 779 zecom[2] = (color >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 780 zecom[3] = color & 0xFF;
adelino 0:65fd8b1cbf86 781
adelino 0:65fd8b1cbf86 782 put_gfx_Commande(zecom, 4);
adelino 0:65fd8b1cbf86 783
adelino 0:65fd8b1cbf86 784 wait_gfx_ack();
adelino 0:65fd8b1cbf86 785
adelino 0:65fd8b1cbf86 786 rep = get_gfx_char(); //previous color msb
adelino 0:65fd8b1cbf86 787
adelino 0:65fd8b1cbf86 788 rep = get_gfx_char(); //previous color lsb
adelino 0:65fd8b1cbf86 789 }
adelino 0:65fd8b1cbf86 790 //-------------------------------------------
adelino 0:65fd8b1cbf86 791 void PicasoSerial::text_setFont(Font _font)
adelino 0:65fd8b1cbf86 792 {
adelino 0:65fd8b1cbf86 793 UINT8 rep = 0;
adelino 0:65fd8b1cbf86 794
adelino 0:65fd8b1cbf86 795 unsigned char zecom [4] = "";
adelino 0:65fd8b1cbf86 796
adelino 0:65fd8b1cbf86 797 zecom[0] = (CMD_TEXT_SET_FONT >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 798 zecom[1] = CMD_TEXT_SET_FONT & 0xFF;
adelino 0:65fd8b1cbf86 799
adelino 0:65fd8b1cbf86 800 zecom[2] = (_font >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 801 zecom[3] = _font & 0xFF;
adelino 0:65fd8b1cbf86 802
adelino 0:65fd8b1cbf86 803 put_gfx_Commande(zecom, 4);
adelino 0:65fd8b1cbf86 804
adelino 0:65fd8b1cbf86 805 wait_gfx_ack();
adelino 0:65fd8b1cbf86 806
adelino 0:65fd8b1cbf86 807 rep = get_gfx_char();
adelino 0:65fd8b1cbf86 808
adelino 0:65fd8b1cbf86 809 rep = get_gfx_char();
adelino 0:65fd8b1cbf86 810 }
adelino 0:65fd8b1cbf86 811 //----------------------------------------
adelino 0:65fd8b1cbf86 812 void PicasoSerial::text_putstring(string str)
adelino 0:65fd8b1cbf86 813 {
adelino 0:65fd8b1cbf86 814 int i = 0;
adelino 0:65fd8b1cbf86 815 UINT8 rep = 0;
adelino 0:65fd8b1cbf86 816 int taille = 0;
adelino 0:65fd8b1cbf86 817 unsigned char zecom [500] = "";
adelino 0:65fd8b1cbf86 818
adelino 0:65fd8b1cbf86 819
adelino 0:65fd8b1cbf86 820 // cherche taille
adelino 0:65fd8b1cbf86 821 /*
adelino 0:65fd8b1cbf86 822 while (*s) {
adelino 0:65fd8b1cbf86 823 size++;
adelino 0:65fd8b1cbf86 824 s++;
adelino 0:65fd8b1cbf86 825
adelino 0:65fd8b1cbf86 826 }
adelino 0:65fd8b1cbf86 827
adelino 0:65fd8b1cbf86 828 s = s - size;
adelino 0:65fd8b1cbf86 829 */
adelino 0:65fd8b1cbf86 830 taille=str.size();
adelino 0:65fd8b1cbf86 831 //
adelino 0:65fd8b1cbf86 832 zecom[0] = (CMD_PUT_STRING >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 833 zecom[1] = CMD_PUT_STRING & 0xFF;
adelino 0:65fd8b1cbf86 834
adelino 0:65fd8b1cbf86 835
adelino 0:65fd8b1cbf86 836 //le text
adelino 0:65fd8b1cbf86 837 for (i = 0; i <taille; i++) {
adelino 0:65fd8b1cbf86 838 zecom[2 + i] = str[i];
adelino 0:65fd8b1cbf86 839 }
adelino 0:65fd8b1cbf86 840
adelino 0:65fd8b1cbf86 841 //terminate
adelino 0:65fd8b1cbf86 842 zecom[2 + taille] = 0x00;
adelino 0:65fd8b1cbf86 843
adelino 0:65fd8b1cbf86 844 put_gfx_Commande(zecom, 3 + taille);
adelino 0:65fd8b1cbf86 845
adelino 0:65fd8b1cbf86 846 wait_gfx_ack();
adelino 0:65fd8b1cbf86 847
adelino 0:65fd8b1cbf86 848 rep = get_gfx_char();
adelino 0:65fd8b1cbf86 849
adelino 0:65fd8b1cbf86 850 rep = get_gfx_char();
adelino 0:65fd8b1cbf86 851 }
adelino 0:65fd8b1cbf86 852 //------------------------------------------------------------------------
adelino 0:65fd8b1cbf86 853 void PicasoSerial::draw_string(string str, UINT16 x, UINT16 y,Font _font,
adelino 0:65fd8b1cbf86 854 Color text_color,Color color_bckg)
adelino 0:65fd8b1cbf86 855 {
adelino 0:65fd8b1cbf86 856 text_backround(color_bckg);
adelino 0:65fd8b1cbf86 857
adelino 0:65fd8b1cbf86 858 text_foreground(text_color);
adelino 0:65fd8b1cbf86 859
adelino 0:65fd8b1cbf86 860 text_setFont(_font);
adelino 0:65fd8b1cbf86 861
adelino 0:65fd8b1cbf86 862 gfx_move_to(x, y);
adelino 0:65fd8b1cbf86 863
adelino 0:65fd8b1cbf86 864 text_putstring(str);
adelino 0:65fd8b1cbf86 865
adelino 0:65fd8b1cbf86 866 }
adelino 0:65fd8b1cbf86 867 //------------------------------------------------------------------------
adelino 0:65fd8b1cbf86 868 void PicasoSerial::draw_diamond(UINT16 x1, UINT16 y1, UINT16 x2,UINT16 y2,
adelino 0:65fd8b1cbf86 869 UINT16 x3,UINT16 y3,
adelino 0:65fd8b1cbf86 870 UINT16 x4,UINT16 y4,Color color)
adelino 0:65fd8b1cbf86 871 {
adelino 0:65fd8b1cbf86 872 unsigned char zecom [22] = "";
adelino 0:65fd8b1cbf86 873 UINT16 nb=0x0004;
adelino 0:65fd8b1cbf86 874
adelino 0:65fd8b1cbf86 875 zecom[0] = (CMD_POLYGON >> 8)&0xFF;
adelino 0:65fd8b1cbf86 876 zecom[1] = (CMD_POLYGON & 0xFF);
adelino 0:65fd8b1cbf86 877
adelino 0:65fd8b1cbf86 878 //n=4
adelino 0:65fd8b1cbf86 879 zecom[2]=(nb >> 8)&0xFF;
adelino 0:65fd8b1cbf86 880 zecom[3]=(nb & 0xFF);
adelino 0:65fd8b1cbf86 881
adelino 0:65fd8b1cbf86 882 // coord X1[msb:Lsb]
adelino 0:65fd8b1cbf86 883 zecom[4] = (x1 >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 884 zecom[5] = (x1) & 0xFF;
adelino 0:65fd8b1cbf86 885
adelino 0:65fd8b1cbf86 886 // coord X2[msb:Lsb]
adelino 0:65fd8b1cbf86 887 zecom[6] = (x2 >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 888 zecom[7] = (x2) & 0xFF;
adelino 0:65fd8b1cbf86 889
adelino 0:65fd8b1cbf86 890 // coord X3[msb:lsb]
adelino 0:65fd8b1cbf86 891 zecom[8] = (x3 >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 892 zecom[9] = (x3) & 0xFF;
adelino 0:65fd8b1cbf86 893
adelino 0:65fd8b1cbf86 894 //// coord X4[msb:lsb]
adelino 0:65fd8b1cbf86 895 zecom[10] = (x4 >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 896 zecom[11] = (x4) & 0xFF;
adelino 0:65fd8b1cbf86 897
adelino 0:65fd8b1cbf86 898 // coord Y1[msb:lsb]
adelino 0:65fd8b1cbf86 899 zecom[12] = (y1 >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 900 zecom[13] = (y1) & 0xFF;
adelino 0:65fd8b1cbf86 901
adelino 0:65fd8b1cbf86 902 // coord Y2[msb:lsb]
adelino 0:65fd8b1cbf86 903 zecom[14] = (y2 >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 904 zecom[15] = (y2) & 0xFF;
adelino 0:65fd8b1cbf86 905
adelino 0:65fd8b1cbf86 906 // coord Y3[msb:lsb]
adelino 0:65fd8b1cbf86 907 zecom[16] = (y3 >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 908 zecom[17] = (y3) & 0xFF;
adelino 0:65fd8b1cbf86 909
adelino 0:65fd8b1cbf86 910 // coord Y4[msb:lsb]
adelino 0:65fd8b1cbf86 911 zecom[18] = (y4 >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 912 zecom[19] = (y4) & 0xFF;
adelino 0:65fd8b1cbf86 913
adelino 0:65fd8b1cbf86 914 // color
adelino 0:65fd8b1cbf86 915 zecom[20] = (color >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 916 zecom[21] = color & 0xFF;
adelino 0:65fd8b1cbf86 917
adelino 0:65fd8b1cbf86 918 put_gfx_Commande(zecom, 22);
adelino 0:65fd8b1cbf86 919
adelino 0:65fd8b1cbf86 920 wait_gfx_ack();
adelino 0:65fd8b1cbf86 921 }
adelino 0:65fd8b1cbf86 922 //------------------------------------------------------------------------------
adelino 0:65fd8b1cbf86 923 void PicasoSerial::draw_filled_diamond(UINT16 x1,UINT16 y1,UINT16 x2,UINT16 y2,
adelino 0:65fd8b1cbf86 924 UINT16 x3,UINT16 y3, UINT16 x4,UINT16 y4,Color color)
adelino 0:65fd8b1cbf86 925 {
adelino 0:65fd8b1cbf86 926 unsigned char zecom [22] = "";
adelino 0:65fd8b1cbf86 927 UINT16 nb=0x0004;
adelino 0:65fd8b1cbf86 928
adelino 0:65fd8b1cbf86 929 zecom[0] = (CMD_FILLED_POLYGON >> 8)&0xFF;
adelino 0:65fd8b1cbf86 930 zecom[1] = (CMD_FILLED_POLYGON & 0xFF);
adelino 0:65fd8b1cbf86 931
adelino 0:65fd8b1cbf86 932 //n=4
adelino 0:65fd8b1cbf86 933 zecom[2]=(nb >> 8)&0xFF;
adelino 0:65fd8b1cbf86 934 zecom[3]=(nb & 0xFF);
adelino 0:65fd8b1cbf86 935
adelino 0:65fd8b1cbf86 936 // coord X1[msb:Lsb]
adelino 0:65fd8b1cbf86 937 zecom[4] = (x1 >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 938 zecom[5] = (x1) & 0xFF;
adelino 0:65fd8b1cbf86 939
adelino 0:65fd8b1cbf86 940 // coord X2[msb:Lsb]
adelino 0:65fd8b1cbf86 941 zecom[6] = (x2 >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 942 zecom[7] = (x2) & 0xFF;
adelino 0:65fd8b1cbf86 943
adelino 0:65fd8b1cbf86 944 // coord X3[msb:lsb]
adelino 0:65fd8b1cbf86 945 zecom[8] = (x3 >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 946 zecom[9] = (x3) & 0xFF;
adelino 0:65fd8b1cbf86 947
adelino 0:65fd8b1cbf86 948 //// coord X4[msb:lsb]
adelino 0:65fd8b1cbf86 949 zecom[10] = (x4 >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 950 zecom[11] = (x4) & 0xFF;
adelino 0:65fd8b1cbf86 951
adelino 0:65fd8b1cbf86 952 // coord Y1[msb:lsb]
adelino 0:65fd8b1cbf86 953 zecom[12] = (y1 >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 954 zecom[13] = (y1) & 0xFF;
adelino 0:65fd8b1cbf86 955
adelino 0:65fd8b1cbf86 956 // coord Y2[msb:lsb]
adelino 0:65fd8b1cbf86 957 zecom[14] = (y2 >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 958 zecom[15] = (y2) & 0xFF;
adelino 0:65fd8b1cbf86 959
adelino 0:65fd8b1cbf86 960 // coord Y3[msb:lsb]
adelino 0:65fd8b1cbf86 961 zecom[16] = (y3 >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 962 zecom[17] = (y3) & 0xFF;
adelino 0:65fd8b1cbf86 963
adelino 0:65fd8b1cbf86 964 // coord Y4[msb:lsb]
adelino 0:65fd8b1cbf86 965 zecom[18] = (y4 >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 966 zecom[19] = (y4) & 0xFF;
adelino 0:65fd8b1cbf86 967
adelino 0:65fd8b1cbf86 968 // color
adelino 0:65fd8b1cbf86 969 zecom[20] = (color >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 970 zecom[21] = color & 0xFF;
adelino 0:65fd8b1cbf86 971
adelino 0:65fd8b1cbf86 972 put_gfx_Commande(zecom, 22);
adelino 0:65fd8b1cbf86 973
adelino 0:65fd8b1cbf86 974 wait_gfx_ack();
adelino 0:65fd8b1cbf86 975 }
adelino 0:65fd8b1cbf86 976 //---------------------------------------------
adelino 0:65fd8b1cbf86 977 void PicasoSerial::draw_ellipse(UINT16 xc, UINT16 yc, UINT16 xrad,
adelino 0:65fd8b1cbf86 978 UINT16 yrad,Color color)
adelino 0:65fd8b1cbf86 979 {
adelino 0:65fd8b1cbf86 980 unsigned char zecom [12] = "";
adelino 0:65fd8b1cbf86 981
adelino 0:65fd8b1cbf86 982 zecom[0] = (CMD_ELLIPSE >> 8)&0xFF;
adelino 0:65fd8b1cbf86 983 zecom[1] = (CMD_ELLIPSE & 0xFF);
adelino 0:65fd8b1cbf86 984
adelino 0:65fd8b1cbf86 985 // coord Xc[msb:Lsb]
adelino 0:65fd8b1cbf86 986 zecom[2] = (xc >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 987 zecom[3] = (xc) & 0xFF;
adelino 0:65fd8b1cbf86 988
adelino 0:65fd8b1cbf86 989 // coord Yc[msb:Lsb]
adelino 0:65fd8b1cbf86 990 zecom[4] = (yc >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 991 zecom[5] = (yc) & 0xFF;
adelino 0:65fd8b1cbf86 992
adelino 0:65fd8b1cbf86 993 // coord Xrad[msb:lsb]
adelino 0:65fd8b1cbf86 994 zecom[6] = (xrad >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 995 zecom[7] = (xrad) & 0xFF;
adelino 0:65fd8b1cbf86 996
adelino 0:65fd8b1cbf86 997 // coord Yrad[msb:lsb]
adelino 0:65fd8b1cbf86 998 zecom[8] = (yrad >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 999 zecom[9] = (yrad) & 0xFF;
adelino 0:65fd8b1cbf86 1000
adelino 0:65fd8b1cbf86 1001 // color
adelino 0:65fd8b1cbf86 1002 zecom[10] = (color >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 1003 zecom[11] = color & 0xFF;
adelino 0:65fd8b1cbf86 1004
adelino 0:65fd8b1cbf86 1005 put_gfx_Commande(zecom, 12);
adelino 0:65fd8b1cbf86 1006
adelino 0:65fd8b1cbf86 1007 wait_gfx_ack();
adelino 0:65fd8b1cbf86 1008 }
adelino 0:65fd8b1cbf86 1009 //----------------------------------
adelino 0:65fd8b1cbf86 1010 void PicasoSerial::draw_filled_ellipse(UINT16 xc, UINT16 yc, UINT16 xrad,
adelino 0:65fd8b1cbf86 1011 UINT16 yrad,Color color)
adelino 0:65fd8b1cbf86 1012 {
adelino 0:65fd8b1cbf86 1013 unsigned char zecom [12] = "";
adelino 0:65fd8b1cbf86 1014
adelino 0:65fd8b1cbf86 1015 zecom[0] = (CMD_FILLED_ELLIPSE >> 8)&0xFF;
adelino 0:65fd8b1cbf86 1016 zecom[1] = (CMD_FILLED_ELLIPSE & 0xFF);
adelino 0:65fd8b1cbf86 1017
adelino 0:65fd8b1cbf86 1018 // coord Xc[msb:Lsb]
adelino 0:65fd8b1cbf86 1019 zecom[2] = (xc >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 1020 zecom[3] = (xc) & 0xFF;
adelino 0:65fd8b1cbf86 1021
adelino 0:65fd8b1cbf86 1022 // coord Yc[msb:Lsb]
adelino 0:65fd8b1cbf86 1023 zecom[4] = (yc >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 1024 zecom[5] = (yc) & 0xFF;
adelino 0:65fd8b1cbf86 1025
adelino 0:65fd8b1cbf86 1026 // coord Xrad[msb:lsb]
adelino 0:65fd8b1cbf86 1027 zecom[6] = (xrad >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 1028 zecom[7] = (xrad) & 0xFF;
adelino 0:65fd8b1cbf86 1029
adelino 0:65fd8b1cbf86 1030 // coord Yrad[msb:lsb]
adelino 0:65fd8b1cbf86 1031 zecom[8] = (yrad >> 8)& 0xFF;
adelino 0:65fd8b1cbf86 1032 zecom[9] = (yrad) & 0xFF;
adelino 0:65fd8b1cbf86 1033
adelino 0:65fd8b1cbf86 1034 // color
adelino 0:65fd8b1cbf86 1035 zecom[10] = (color >> 8) & 0xFF;
adelino 0:65fd8b1cbf86 1036 zecom[11] = color & 0xFF;
adelino 0:65fd8b1cbf86 1037
adelino 0:65fd8b1cbf86 1038 put_gfx_Commande(zecom, 12);
adelino 0:65fd8b1cbf86 1039
adelino 0:65fd8b1cbf86 1040 wait_gfx_ack();
adelino 0:65fd8b1cbf86 1041 }
adelino 0:65fd8b1cbf86 1042 //****************************************************************
adelino 0:65fd8b1cbf86 1043 // fin fichier