Rihards Balass / 4DGL-mbed-32PTU
Revision:
11:3ebd2263f3e9
Parent:
6:a1a85f2bc04b
Child:
12:29f5ad896382
--- a/Picaso_4DGL-32PTU_main.cpp	Tue Sep 13 05:53:39 2016 +0000
+++ b/Picaso_4DGL-32PTU_main.cpp	Tue Sep 13 11:37:04 2016 +0000
@@ -30,9 +30,8 @@
     _cmd.attach(this, &PICASO_4DGL::rxCallback, Serial::RxIrq); //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     //responseBuild(10);
     
+    pc.baud(115200);
 #if DEBUGMODE
-    pc.baud(115200);
-
     pc.printf("\n\n\n");
     pc.printf("********************\n\r");
     pc.printf("PICASO_4DGL CONSTRUCTOR\n\r");
@@ -57,7 +56,7 @@
 #endif
     cls();              // clear screen
     wait_ms(1000);
-    screenOrientation(1);
+    screenMode(1);
     setFont(3);
     //graphicsDemo();
     
@@ -269,35 +268,21 @@
     index = 0;
 }
 
+
 //**************************************************************************
-void PICASO_4DGL :: screenOrientation(char c) {   // select screen orientation
-    char command[4] = "";
-    command[0] = (ORIENTATION >> (8*1)) & 0xff;
-    command[1] = (ORIENTATION >> (8*0)) & 0xff;
+short PICASO_4DGL :: getGraphicsResponse() {
+    
+    short answer = 0;
+    pc.printf("\n\r Wait for answer...");
+    while (index < 3) wait_ms(100);               // wait for screen answer
     
-    switch (c) {
-        case 1 :
-            command[2] = (LANDSCAPE >> (8*1)) & 0xff;
-            command[3] = (LANDSCAPE >> (8*0)) & 0xff;
-            currentOrientation = 1;
-            break;
-        case 2 :
-            command[2] = (LANDSCAPE_R >> (8*1)) & 0xff;
-            command[3] = (LANDSCAPE_R >> (8*0)) & 0xff;
-            currentOrientation = 2;
-            break;
-        case 3 :
-            command[2] = (PORTRAIT >> (8*1)) & 0xff;
-            command[3] = (PORTRAIT >> (8*0)) & 0xff;
-            currentOrientation = 3;
-            break;
-        case 4 :
-            command[2] = (PORTRAIT_R >> (8*1)) & 0xff;
-            command[3] = (PORTRAIT_R >> (8*0)) & 0xff;
-            currentOrientation = 4;
-            break;
+    pc.printf("\n\r INDEX = %i\n\r", index);
+    pc.printf("\n\r Answer = ");
+    for (int i = 0; i < index; i++) {
+        pc.printf("%02X ", rxBuf[i]);
     }
-    
-    writeCOMMAND(command, 4);
-    getResponse(3);
+    answer = rxBuf[1] << 8 | rxBuf[2];
+    pc.printf("\n\r");
+    index = 0;
+    return answer;
 }