Rihards Balass / 4DGL-mbed-32PTU
Revision:
2:81eaaa491a02
Parent:
1:e2337e2653e1
Child:
3:dcfbceb81fef
--- a/Picaso_4DGL-32PTU_graphics.cpp	Thu Sep 08 13:40:36 2016 +0000
+++ b/Picaso_4DGL-32PTU_graphics.cpp	Fri Sep 09 06:17:05 2016 +0000
@@ -1,7 +1,19 @@
 //
-// TFT_4DGL is a class to drive 4D Systems TFT touch screens with Picaso processor
+//  Picaso_4DGL-32PTU is a class to drive 4D Systems TFT touch screens with PICASO processor
+//  Tested with NUCLEO L152RE development board
+//  Copyright (C) <2016> Rihards Balass <rihards.balass@gmail.com>
 //
-// Copyright (C) <2016> Rihards Balass
+// Picaso_4DGL-32PTU is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Picaso_4DGL-32PTU is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You can see GNU General Public License at <http://www.gnu.org/licenses/>.
 //
 
 #include "mbed.h"
@@ -25,8 +37,8 @@
 
     char command[2] = "";
     
-    command[0] = CLS_MSB;
-    command[1] = CLS_LSB;
+    command[0] = (CLS >> (8*1)) & 0xff;
+    command[1] = (CLS >> (8*0)) & 0xff;
     
     writeCOMMAND(command, 2);
 }
@@ -35,16 +47,16 @@
 // The Change Colour command changes all oldColour pixels to newColour 
 // within the clipping window area.
 //**************************************************************************
-void TFT_4DGL :: changeColor(char oldM, char oldL, char newM, char newL) {
+void TFT_4DGL :: changeColor(short oldColor, short newColor) {
     
     char command[6] = "";
     
-    command[0] = CHANGE_COLOR_MSB;
-    command[1] = CHANGE_COLOR_LSB;
-    command[2] = oldM;
-    command[3] = oldL;
-    command[4] = newM;
-    command[5] = newL;
+    command[0] = (CHANGE_COLOR >> (8*1)) & 0xff;
+    command[1] = (CHANGE_COLOR >> (8*0)) & 0xff;
+    command[2] = (oldColor >> (8*1)) & 0xff;
+    command[3] = (oldColor >> (8*0)) & 0xff;
+    command[4] = (newColor >> (8*1)) & 0xff;
+    command[5] = (newColor >> (8*0)) & 0xff;
     
     writeCOMMAND(command, 6);
 }
@@ -53,20 +65,20 @@
 // The Draw Circle command draws a circle with centre point x, y 
 // with radius r using the specified colour.
 //**************************************************************************
-void TFT_4DGL :: drawCircle(short x, short y, short r, char colorM, char colorL) {
+void TFT_4DGL :: drawCircle(short x, short y, short r, short color) {
     
     char command[10] = "";
     
-    command[0] = DRAW_CIRCLE_MSB;
-    command[1] = DRAW_CIRCLE_LSB;
+    command[0] = (DRAW_CIRCLE >> (8*1)) & 0xff;
+    command[1] = (DRAW_CIRCLE >> (8*0)) & 0xff;
     command[2] = (x >> (8*1)) & 0xff;
     command[3] = (x >> (8*0)) & 0xff;
     command[4] = (y >> (8*1)) & 0xff;
     command[5] = (y >> (8*0)) & 0xff;
     command[6] = (r >> (8*1)) & 0xff;
     command[7] = (r >> (8*0)) & 0xff;
-    command[8] = colorM;
-    command[9] = colorL;
+    command[8] = (color >> (8*1)) & 0xff;
+    command[9] = (color >> (8*0)) & 0xff;
     
     writeCOMMAND(command, 10);
 }