Updated serial prints for debugging

Dependents:   mbedica_on_yehowshua mbedica

Files at this revision

API Documentation at this revision

Comitter:
zrussell3
Date:
Mon Dec 10 17:58:38 2018 +0000
Parent:
5:8acc50389659
Commit message:
Added checks for serial output

Changed in this revision

uVGAIII.h Show annotated file Show diff for this revision Revisions of this file
uVGAIII_Graphics.cpp Show annotated file Show diff for this revision Revisions of this file
uVGAIII_Text.cpp Show annotated file Show diff for this revision Revisions of this file
uVGAIII_main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/uVGAIII.h	Mon Mar 24 19:54:56 2014 +0000
+++ b/uVGAIII.h	Mon Dec 10 17:58:38 2018 +0000
@@ -22,11 +22,11 @@
 
 // Debug Verbose on terminal enabled
 #ifndef DEBUGMODE
-#define DEBUGMODE 1
+#define DEBUGMODE 0 // Default value 1, setting to 0 
 #endif
 
 // Common WAIT value in millisecond
-#define TEMPO 5
+#define TEMPO 5 // Original value = 5
 
 // 4DGL Functions values
 // Graphic Commands values
@@ -373,6 +373,7 @@
 * @return the color value of the pixel
 */
     int  read_pixel(int x, int y);
+    
 /**
 *  Copy an area of a screen
 * @param xs x-coordinate of the top left corner of the area to be copied 
--- a/uVGAIII_Graphics.cpp	Mon Mar 24 19:54:56 2014 +0000
+++ b/uVGAIII_Graphics.cpp	Mon Dec 10 17:58:38 2018 +0000
@@ -23,6 +23,7 @@
 
 //**************************************************************************
 void uVGAIII :: cls() {  // clear screen
+    
     char command[2] = "";
     command[0] = ( CLS >> 8 ) & 0xFF;
     command[1] = CLS & 0xFF;
--- a/uVGAIII_Text.cpp	Mon Mar 24 19:54:56 2014 +0000
+++ b/uVGAIII_Text.cpp	Mon Dec 10 17:58:38 2018 +0000
@@ -372,8 +372,9 @@
 void uVGAIII :: putc(char c)      // place char at current cursor position
                                    //used by virtual printf function _putc
 {
-
+#if DEBUGMODE
     pc.printf("\nCursor position: %d, %d",current_row,current_col);
+#endif
     if(c<0x20) {
         if(c=='\n') {
             current_col = 0;
--- a/uVGAIII_main.cpp	Mon Mar 24 19:54:56 2014 +0000
+++ b/uVGAIII_main.cpp	Mon Dec 10 17:58:38 2018 +0000
@@ -39,9 +39,10 @@
     pc.printf("uVGAIII CONSTRUCTOR\n");
     pc.printf("********************\n");
 #endif
+
     _cmd.baud(9600);
     _rst = 1;    // put RESET pin to high to start TFT screen
-
+    
     reset();
     cls();           // clear screen
     speversion();    // get SPE version information
@@ -60,7 +61,7 @@
 void uVGAIII :: writeBYTE(char c) { // send a BYTE command to screen
 
     _cmd.putc(c);
-    wait_ms(1);
+    wait_ms(100); // changed FROM 1 to 100
 
 #if DEBUGMODE
     pc.printf("   Char sent : 0x%02X\n",c);
@@ -81,20 +82,24 @@
     pc.printf("\n");
     pc.printf("New COMMAND : 0x%02X%02X\n", command[0], command[1]);
 #endif
+
     int i, resp = 0;
     freeBUFFER();
-
+    
+    // Changed wait on following line FROM 100 to 400
     for (i = 0; i < commNum; i++) {writeBYTE(command[i]); wait_ms(100);} // send command to serial port
-
+    
     for (i = 0; i < respNum; i++) {
-       while (!_cmd.readable()) wait_ms(TEMPO);              // wait for screen answer
+       while (!_cmd.readable()){ wait_ms(TEMPO); }              // wait for screen answer
         if (_cmd.readable()) {
            resp = _cmd.getc();           // read response if any
+           
 #if DEBUGMODE
            pc.printf("response = 0x%02X\n",resp);
 #endif
         }
     }
+    
     return resp;
 }
 
@@ -121,8 +126,9 @@
     command[1] = SPEVERSION & 0xFF;
 
     spe = readVERSION(command, 2);
-    
+#if DEBUGMODE    
     pc.printf("spe:%d\n",spe);
+#endif
 }
 
 //**************************************************************************
@@ -133,8 +139,9 @@
     command[1] = PMMCVERSION & 0xFF;
 
     pmmc = readVERSION(command, 2);
-    
+#if DEBUGMODE    
     pc.printf("pmmc:%d\n",pmmc);
+#endif
 }
 
 //**************************************************************************
@@ -256,7 +263,9 @@
     while (_cmd.readable() && resp < ARRAY_SIZE(response)) {
         temp = _cmd.getc();
         response[resp] = (char)temp;
+#if DEBUGMODE
         pc.printf("response = 0x%02X\n",response[resp]);
+#endif
         resp++;
     }
     switch (resp) {