Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: Picaso_4DGL-32PTU_main.cpp
- Revision:
- 2:81eaaa491a02
- Parent:
- 1:e2337e2653e1
- Child:
- 3:dcfbceb81fef
diff -r e2337e2653e1 -r 81eaaa491a02 Picaso_4DGL-32PTU_main.cpp
--- a/Picaso_4DGL-32PTU_main.cpp Thu Sep 08 13:40:36 2016 +0000
+++ b/Picaso_4DGL-32PTU_main.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"
@@ -54,9 +66,9 @@
#if DEBUGMODE
pc.printf("Start Demo...\n\r");
wait_ms(1000);
- //mainDemo();
+ mainDemo();
//textDemo();
- graphicsDemo();
+ //graphicsDemo();
#endif
}
@@ -117,84 +129,88 @@
void TFT_4DGL :: baudrate(long speed) { // set screen baud rate
char command[4]= "";
- command[0] = BAUDRATE_MSB;
- command[1] = BAUDRATE_LSB;
+ command[0] = (BAUDRATE >> (8*1)) & 0xff;
+ command[1] = (BAUDRATE >> (8*0)) & 0xff;
switch (speed) {
case 300 :
- command[2] = BAUD_300_MSB;
- command[3] = BAUD_300_LSB;
+ command[2] = (BAUD_300 >> (8*1)) & 0xff;
+ command[3] = (BAUD_300 >> (8*0)) & 0xff;
break;
case 600 :
- command[2] = BAUD_600_MSB;
- command[3] = BAUD_600_LSB;
+ command[2] = (BAUD_600 >> (8*1)) & 0xff;
+ command[3] = (BAUD_600 >> (8*0)) & 0xff;
break;
case 1200 :
- command[2] = BAUD_1200_MSB;
- command[3] = BAUD_1200_LSB;
+ command[2] = (BAUD_1200 >> (8*1)) & 0xff;
+ command[3] = (BAUD_1200 >> (8*0)) & 0xff;
break;
case 2400 :
- command[2] = BAUD_2400_MSB;
- command[3] = BAUD_2400_LSB;
+ command[2] = (BAUD_2400 >> (8*1)) & 0xff;
+ command[3] = (BAUD_2400 >> (8*0)) & 0xff;
break;
case 4800 :
- command[2] = BAUD_4800_MSB;
- command[3] = BAUD_4800_LSB;
+ command[2] = (BAUD_4800 >> (8*1)) & 0xff;
+ command[3] = (BAUD_4800 >> (8*0)) & 0xff;
break;
case 9600 :
- command[2] = BAUD_9600_MSB;
- command[3] = BAUD_9600_LSB;
+ command[2] = (BAUD_9600 >> (8*1)) & 0xff;
+ command[3] = (BAUD_9600 >> (8*0)) & 0xff;
break;
case 14400 :
- command[2] = BAUD_14400_MSB;
- command[3] = BAUD_14400_LSB;
+ command[2] = (BAUD_14400 >> (8*1)) & 0xff;
+ command[3] = (BAUD_14400 >> (8*0)) & 0xff;
break;
case 19200 :
- command[2] = BAUD_19200_MSB;
- command[3] = BAUD_19200_LSB;
+ command[2] = (BAUD_19200 >> (8*1)) & 0xff;
+ command[3] = (BAUD_19200 >> (8*0)) & 0xff;
+ break;
+ case 31250 :
+ command[2] = (BAUD_31250 >> (8*1)) & 0xff;
+ command[3] = (BAUD_31250 >> (8*0)) & 0xff;
break;
case 38400 :
- command[2] = BAUD_38400_MSB;
- command[3] = BAUD_38400_LSB;
+ command[2] = (BAUD_38400 >> (8*1)) & 0xff;
+ command[3] = (BAUD_38400 >> (8*0)) & 0xff;
break;
case 56000 :
- command[2] = BAUD_56000_MSB;
- command[3] = BAUD_56000_LSB;
+ command[2] = (BAUD_56000 >> (8*1)) & 0xff;
+ command[3] = (BAUD_56000 >> (8*0)) & 0xff;
break;
case 57600 :
- command[2] = BAUD_57600_MSB;
- command[3] = BAUD_57600_LSB;
+ command[2] = (BAUD_57600 >> (8*1)) & 0xff;
+ command[3] = (BAUD_57600 >> (8*0)) & 0xff;
break;
case 115200 :
- command[2] = BAUD_115200_MSB;
- command[3] = BAUD_115200_LSB;
+ command[2] = (BAUD_115200 >> (8*1)) & 0xff;
+ command[3] = (BAUD_115200 >> (8*0)) & 0xff;
break;
case 128000 :
- command[2] = BAUD_128000_MSB;
- command[3] = BAUD_128000_LSB;
+ command[2] = (BAUD_128000 >> (8*1)) & 0xff;
+ command[3] = (BAUD_128000 >> (8*0)) & 0xff;
break;
case 256000 :
- command[2] = BAUD_256000_MSB;
- command[3] = BAUD_256000_LSB;
+ command[2] = (BAUD_256000 >> (8*1)) & 0xff;
+ command[3] = (BAUD_256000 >> (8*0)) & 0xff;
break;
case 300000 :
- command[2] = BAUD_300000_MSB;
- command[3] = BAUD_300000_LSB;
+ command[2] = (BAUD_300000 >> (8*1)) & 0xff;
+ command[3] = (BAUD_300000 >> (8*0)) & 0xff;
break;
case 375000 :
- command[2] = BAUD_375000_MSB;
- command[3] = BAUD_375000_LSB;
+ command[2] = (BAUD_375000 >> (8*1)) & 0xff;
+ command[3] = (BAUD_375000 >> (8*0)) & 0xff;
break;
case 500000 :
- command[2] = BAUD_500000_MSB;
- command[3] = BAUD_500000_LSB;
+ command[2] = (BAUD_500000 >> (8*1)) & 0xff;
+ command[3] = (BAUD_500000 >> (8*0)) & 0xff;
break;
case 600000 :
- command[2] = BAUD_600000_MSB;
- command[3] = BAUD_600000_LSB;
+ command[2] = (BAUD_600000 >> (8*1)) & 0xff;
+ command[3] = (BAUD_600000 >> (8*0)) & 0xff;
break;
default :
- command[2] = BAUD_9600_MSB;
- command[3] = BAUD_9600_LSB;
+ command[2] = (BAUD_9600 >> (8*1)) & 0xff;
+ command[3] = (BAUD_9600 >> (8*0)) & 0xff;
speed = 9600;
break;
}
@@ -246,28 +262,28 @@
//**************************************************************************
void TFT_4DGL :: screenOrientation(char c) { // select screen orientation
char command[4] = "";
- command[0] = ORIENTATION_MSB;
- command[1] = ORIENTATION_LSB;
+ command[0] = (ORIENTATION >> (8*1)) & 0xff;
+ command[1] = (ORIENTATION >> (8*0)) & 0xff;
switch (c) {
case 1 :
- command[2] = LANDSCAPE_MSB;
- command[3] = LANDSCAPE_LSB;
+ command[2] = (LANDSCAPE >> (8*1)) & 0xff;
+ command[3] = (LANDSCAPE >> (8*0)) & 0xff;
currentOrientation = 1;
break;
case 2 :
- command[2] = LANDSCAPE_R_MSB;
- command[3] = LANDSCAPE_R_LSB;
+ command[2] = (LANDSCAPE_R >> (8*1)) & 0xff;
+ command[3] = (LANDSCAPE_R >> (8*0)) & 0xff;
currentOrientation = 2;
break;
case 3 :
- command[2] = PORTRAIT_MSB;
- command[3] = PORTRAIT_LSB;
+ command[2] = (PORTRAIT >> (8*1)) & 0xff;
+ command[3] = (PORTRAIT >> (8*0)) & 0xff;
currentOrientation = 3;
break;
case 4 :
- command[2] = PORTRAIT_R_MSB;
- command[3] = PORTRAIT_R_LSB;
+ command[2] = (PORTRAIT_R >> (8*1)) & 0xff;
+ command[3] = (PORTRAIT_R >> (8*0)) & 0xff;
currentOrientation = 4;
break;
}