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/

Revision:
1:a74e42cf52b2
Parent:
0:65fd8b1cbf86
diff -r 65fd8b1cbf86 -r a74e42cf52b2 PicasoSerial.cpp
--- a/PicasoSerial.cpp	Sun Jul 06 10:36:27 2014 +0000
+++ b/PicasoSerial.cpp	Sun Apr 05 13:54:48 2015 +0000
@@ -59,7 +59,7 @@
     UINT8 msb = 0;
     UINT8 lsb = 0;
 
-   // TouchEvent res = EVENT_NO_ACTIVITY;
+    // TouchEvent res = EVENT_NO_ACTIVITY;
     UINT16 temp=0;
 
     unsigned char zecom[4] = "";
@@ -79,23 +79,22 @@
     lsb = get_gfx_char();
 
     temp=(msb << 8) + lsb;
-    
-    switch(temp)
-    {
+
+    switch(temp) {
         case 0:
-        return EVENT_NO_ACTIVITY;
-        
-        //
+            return EVENT_NO_ACTIVITY;
+
+            //
         case 1:
-        return EVENT_PRESS;
-        
-        //
+            return EVENT_PRESS;
+
+            //
         case 2:
-        return EVENT_RELEASE;
-        
-        //
+            return EVENT_RELEASE;
+
+            //
         case 3:
-        return EVENT_MOVE;
+            return EVENT_MOVE;
     }
 
     return EVENT_NO_ACTIVITY;
@@ -174,7 +173,7 @@
 {
     gfx_reset();
 
-    gfx_set_BackGroundColor(BLUE);
+    gfx_set_BackGroundColor(WHITE);
 
     touch_detect_region(0, 0, 240, 320);
     //
@@ -196,7 +195,7 @@
 //-------------------------------------------------
 void PicasoSerial::put_gfx_char(unsigned char data)
 {
-   
+
     while (this->writeable()==0); // buffer plein ?
 
     this->putc(data);
@@ -207,7 +206,7 @@
     while (this->readable()==0); // attendre data
 
     //return mySerial.getc();
-    
+
     return this->getc();
 }
 //----------------------------------------------------------------------
@@ -260,6 +259,20 @@
             break;
 
             //
+        case 128000:
+            zecom[2] = (GFX_BAUD_128000 >> 8) & 0xFF;
+            zecom[3] = GFX_BAUD_128000 & 0xFF;
+            mbaud = speed;
+
+            break;
+            //
+        case 256000:
+            zecom[2] = (GFX_BAUD_256000 >> 8) & 0xFF;
+            zecom[3] = GFX_BAUD_256000 & 0xFF;
+            mbaud = speed;
+            break;
+
+
         default:
             zecom[2] = (GFX_BAUD_9600 >> 8) & 0xFF;
             zecom[3] = GFX_BAUD_9600 & 0xFF;
@@ -675,7 +688,7 @@
     s = s - size;
     */
     taille=str.size();
-    
+
     zecom[0] = (CMD_BUTTON >> 8)&0xFF;
     zecom[1] = CMD_BUTTON & 0xFF;
 
@@ -865,20 +878,20 @@
 
 }
 //------------------------------------------------------------------------
- void PicasoSerial::draw_diamond(UINT16 x1, UINT16 y1, UINT16 x2,UINT16 y2,
-                                        UINT16 x3,UINT16 y3, 
-                                        UINT16 x4,UINT16 y4,Color color)
+void PicasoSerial::draw_diamond(UINT16 x1, UINT16 y1, UINT16 x2,UINT16 y2,
+                                UINT16 x3,UINT16 y3,
+                                UINT16 x4,UINT16 y4,Color color)
 {
     unsigned char zecom [22] = "";
     UINT16 nb=0x0004;
 
     zecom[0] = (CMD_POLYGON >> 8)&0xFF;
     zecom[1] = (CMD_POLYGON & 0xFF);
-    
+
     //n=4
     zecom[2]=(nb >> 8)&0xFF;
     zecom[3]=(nb & 0xFF);
-    
+
     // coord X1[msb:Lsb]
     zecom[4] = (x1 >> 8)& 0xFF;
     zecom[5] = (x1) & 0xFF;
@@ -890,7 +903,7 @@
     // coord X3[msb:lsb]
     zecom[8] = (x3 >> 8)& 0xFF;
     zecom[9] = (x3) & 0xFF;
-    
+
     //// coord X4[msb:lsb]
     zecom[10] = (x4 >> 8)& 0xFF;
     zecom[11] = (x4) & 0xFF;
@@ -898,7 +911,7 @@
     // coord Y1[msb:lsb]
     zecom[12] = (y1 >> 8) & 0xFF;
     zecom[13] = (y1) & 0xFF;
-    
+
     // coord Y2[msb:lsb]
     zecom[14] = (y2 >> 8) & 0xFF;
     zecom[15] = (y2) & 0xFF;
@@ -906,11 +919,11 @@
     // coord Y3[msb:lsb]
     zecom[16] = (y3 >> 8) & 0xFF;
     zecom[17] = (y3) & 0xFF;
-    
+
     // coord Y4[msb:lsb]
     zecom[18] = (y4 >> 8) & 0xFF;
     zecom[19] = (y4) & 0xFF;
-    
+
     // color
     zecom[20] = (color >> 8) & 0xFF;
     zecom[21] = color & 0xFF;
@@ -921,18 +934,18 @@
 }
 //------------------------------------------------------------------------------
 void PicasoSerial::draw_filled_diamond(UINT16 x1,UINT16 y1,UINT16 x2,UINT16 y2,
-                                        UINT16 x3,UINT16 y3, UINT16 x4,UINT16 y4,Color color)
+                                       UINT16 x3,UINT16 y3, UINT16 x4,UINT16 y4,Color color)
 {
     unsigned char zecom [22] = "";
     UINT16 nb=0x0004;
 
     zecom[0] = (CMD_FILLED_POLYGON >> 8)&0xFF;
     zecom[1] = (CMD_FILLED_POLYGON & 0xFF);
-    
+
     //n=4
     zecom[2]=(nb >> 8)&0xFF;
     zecom[3]=(nb & 0xFF);
-    
+
     // coord X1[msb:Lsb]
     zecom[4] = (x1 >> 8)& 0xFF;
     zecom[5] = (x1) & 0xFF;
@@ -944,7 +957,7 @@
     // coord X3[msb:lsb]
     zecom[8] = (x3 >> 8)& 0xFF;
     zecom[9] = (x3) & 0xFF;
-    
+
     //// coord X4[msb:lsb]
     zecom[10] = (x4 >> 8)& 0xFF;
     zecom[11] = (x4) & 0xFF;
@@ -952,7 +965,7 @@
     // coord Y1[msb:lsb]
     zecom[12] = (y1 >> 8) & 0xFF;
     zecom[13] = (y1) & 0xFF;
-    
+
     // coord Y2[msb:lsb]
     zecom[14] = (y2 >> 8) & 0xFF;
     zecom[15] = (y2) & 0xFF;
@@ -960,11 +973,11 @@
     // coord Y3[msb:lsb]
     zecom[16] = (y3 >> 8) & 0xFF;
     zecom[17] = (y3) & 0xFF;
-    
+
     // coord Y4[msb:lsb]
     zecom[18] = (y4 >> 8) & 0xFF;
     zecom[19] = (y4) & 0xFF;
-    
+
     // color
     zecom[20] = (color >> 8) & 0xFF;
     zecom[21] = color & 0xFF;
@@ -974,14 +987,14 @@
     wait_gfx_ack();
 }
 //---------------------------------------------
- void PicasoSerial::draw_ellipse(UINT16 xc, UINT16 yc, UINT16 xrad,
-                            UINT16 yrad,Color color)
+void PicasoSerial::draw_ellipse(UINT16 xc, UINT16 yc, UINT16 xrad,
+                                UINT16 yrad,Color color)
 {
     unsigned char zecom [12] = "";
-    
+
     zecom[0] = (CMD_ELLIPSE >> 8)&0xFF;
     zecom[1] = (CMD_ELLIPSE & 0xFF);
-    
+
     // coord Xc[msb:Lsb]
     zecom[2] = (xc >> 8)& 0xFF;
     zecom[3] = (xc) & 0xFF;
@@ -993,7 +1006,7 @@
     // coord Xrad[msb:lsb]
     zecom[6] = (xrad >> 8)& 0xFF;
     zecom[7] = (xrad) & 0xFF;
-    
+
     // coord Yrad[msb:lsb]
     zecom[8] = (yrad >> 8)& 0xFF;
     zecom[9] = (yrad) & 0xFF;
@@ -1008,13 +1021,13 @@
 }
 //----------------------------------
 void PicasoSerial::draw_filled_ellipse(UINT16 xc, UINT16 yc, UINT16 xrad,
-                            UINT16 yrad,Color color)
+                                       UINT16 yrad,Color color)
 {
-      unsigned char zecom [12] = "";
-    
+    unsigned char zecom [12] = "";
+
     zecom[0] = (CMD_FILLED_ELLIPSE >> 8)&0xFF;
     zecom[1] = (CMD_FILLED_ELLIPSE & 0xFF);
-    
+
     // coord Xc[msb:Lsb]
     zecom[2] = (xc >> 8)& 0xFF;
     zecom[3] = (xc) & 0xFF;
@@ -1026,7 +1039,7 @@
     // coord Xrad[msb:lsb]
     zecom[6] = (xrad >> 8)& 0xFF;
     zecom[7] = (xrad) & 0xFF;
-    
+
     // coord Yrad[msb:lsb]
     zecom[8] = (yrad >> 8)& 0xFF;
     zecom[9] = (yrad) & 0xFF;