KSM edits to RA8875

Dependents:   Liz_Test_Code

Revision:
91:ca5f829e6d27
Parent:
90:d113d71ae4f0
Child:
92:ce1ab76e8614
--- a/RA8875.cpp	Wed Jan 28 12:21:11 2015 +0000
+++ b/RA8875.cpp	Wed Jan 28 12:30:45 2015 +0000
@@ -61,6 +61,7 @@
     "Rectangle", "Rounded Rectangle",
     "Triangle", "Circle", "Ellipse"
 };
+uint16_t commandsUsed[256];  // track which commands are used with simple counter of number of hits.
 #else
 #define PERFORMANCE_RESET
 #define REGISTERPERFORMANCE(a)
@@ -403,6 +404,10 @@
         pc.printf("%10d uS %s\r\n", metrics[i], metricsName[i]);
     }
     pc.printf("%10d uS Idle time polling display for ready.\r\n", idletime_usec);
+    for (i=0; i<256; i++) {
+        if (commandsUsed[i])
+            pc.printf("Command %02X used %5d times.\r\n", i, commandsUsed[i])
+    }
 }
 #endif
 
@@ -428,6 +433,10 @@
 
 RetCode_t RA8875::WriteCommand(unsigned char command, unsigned int data)
 {
+#ifdef PERF_METRICS
+    if (commandsUsed[command] <= 65535)
+        commandsUsed[command]++;
+#endif
     _select(true);
     _spiwrite(0x80);            // RS:1 (Cmd/Status), RW:0 (Write)
     _spiwrite(command);