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:
- 3:dcfbceb81fef
- Parent:
- 2:81eaaa491a02
- Child:
- 4:50511ed54ab4
--- a/Picaso_4DGL-32PTU_main.cpp Fri Sep 09 06:17:05 2016 +0000
+++ b/Picaso_4DGL-32PTU_main.cpp Fri Sep 09 10:19:54 2016 +0000
@@ -25,7 +25,7 @@
#define LONG_WAIT 2000
//******************************************************************************************************
-TFT_4DGL :: TFT_4DGL(PinName tx, PinName rx, PinName rst) : pc(USBTX, USBRX), _cmd(tx, rx), _rst(rst) { // Constructor
+PICASO_4DGL :: PICASO_4DGL(PinName tx, PinName rx, PinName rst) : pc(USBTX, USBRX), _cmd(tx, rx), _rst(rst) { // Constructor
responseBuild(10, '0');
@@ -34,7 +34,7 @@
pc.printf("\n\n\n");
pc.printf("********************\n\r");
- pc.printf("TFT_4DGL CONSTRUCTOR\n\r");
+ pc.printf("PICASO_4DGL CONSTRUCTOR\n\r");
pc.printf("********************\n\r");
#endif
@@ -43,45 +43,41 @@
//reset();
#if DEBUGMODE
pc.printf("Wait 3 seconds for startup...\n\r");
- wait_ms(1000);
- pc.printf("2\n\r");
- wait_ms(1000);
- pc.printf("1\n\r");
- wait_ms(1000);
-#else
+#endif
wait_ms(3000);
-#endif
- //autobaud(); // send autobaud command
+
#if DEBUGMODE
pc.printf("set baudrate to 9600...\n\r");
#endif
- baudrate(9600); // set the initial baudrate to 256kbps - fastest supported by uLCD-32PT
+ baudrate(115200);
+
#if DEBUGMODE
pc.printf("clear screen...\n\r");
#endif
cls(); // clear screen
+ wait_ms(1000);
screenOrientation(1);
setFont(3);
+ //graphicsDemo();
#if DEBUGMODE
pc.printf("Start Demo...\n\r");
wait_ms(1000);
- mainDemo();
+ //mainDemo();
//textDemo();
- //graphicsDemo();
+ graphicsDemo();
#endif
-
}
//******************************************************************************************************
-void TFT_4DGL :: responseBuild(int size, char c) {
+void PICASO_4DGL :: responseBuild(int size, char c) {
response[size] = c;
respLen = 0;
}
//******************************************************************************************************
-void TFT_4DGL :: writeBYTE(char c) { // send a BYTE command to screen
+void PICASO_4DGL :: writeBYTE(char c) { // send a BYTE command to screen
_cmd.putc(c);
@@ -94,13 +90,13 @@
}
//******************************************************************************************************
-void TFT_4DGL :: freeBUFFER(void) { // Clear serial buffer before writing command
+void PICASO_4DGL :: freeBUFFER(void) { // Clear serial buffer before writing command
while (_cmd.readable()) _cmd.getc(); // clear buffer garbage
}
//******************************************************************************************************
-void TFT_4DGL :: writeCOMMAND(char *command, int number) { // send several BYTES making a command and return an answer
+void PICASO_4DGL :: writeCOMMAND(char *command, int number) { // send several BYTES making a command and return an answer
#if DEBUGMODE
pc.printf("\n\r");
@@ -115,7 +111,7 @@
}
//**************************************************************************
-void TFT_4DGL :: reset() { // Reset Screen
+void PICASO_4DGL :: reset() { // Reset Screen
_rst = 0; // put RESET pin to low
wait_ms(TEMPO); // wait a few milliseconds for command reception
@@ -126,7 +122,7 @@
}
//**************************************************************************
-void TFT_4DGL :: baudrate(long speed) { // set screen baud rate
+void PICASO_4DGL :: baudrate(long speed) { // set screen baud rate
char command[4]= "";
command[0] = (BAUDRATE >> (8*1)) & 0xff;
@@ -238,7 +234,7 @@
}
//**************************************************************************
-void TFT_4DGL :: getResponse() {
+void PICASO_4DGL :: getResponse() {
while (!_cmd.readable()) wait_ms(TEMPO); // wait for screen answer
@@ -247,20 +243,21 @@
}
switch (resp) {
case ACK :
- resp = 1;
+ pc.printf("\n\r Answer received : ACK");
break;
case NACK :
- resp = -1;
+ pc.printf("\n\r Answer received : NACK");
break;
default :
- resp = 0;
+ pc.printf("\n\r Answer received : UNKNOWN");
break;
}
- pc.printf("\n\r Answer received : %d\n\r", resp);
+
+
}
//**************************************************************************
-void TFT_4DGL :: screenOrientation(char c) { // select screen orientation
+void PICASO_4DGL :: screenOrientation(char c) { // select screen orientation
char command[4] = "";
command[0] = (ORIENTATION >> (8*1)) & 0xff;
command[1] = (ORIENTATION >> (8*0)) & 0xff;