Zimin Wang / Mbed 2 deprecated DDRO_Farrari

Dependencies:   mbed-rtos mbed

Fork of DDRO_Farrari by Liangzhen Lai

Revision:
4:90f2f3006498
Parent:
3:f8f27b0de752
Child:
5:7335b64894f5
--- a/main.cpp	Mon Jan 20 08:41:49 2014 +0000
+++ b/main.cpp	Mon Feb 03 22:42:30 2014 +0000
@@ -61,17 +61,27 @@
         jtag.reset();
         jtag.leaveState();
         jtag.PowerupDAP();
-        // read result
-        unsigned int result[2];
-        for (int i = 0; i < 2; ++i)
-            result[i] = jtag.readMemory(0x24000100 + i * 4);
-        // print result
-        char *resultByte = (char *)result;
-        for (int i = 0; i < 8; ++i)
-            pc.printf("%x", resultByte[i]);
-        pc.printf("\r\n");
+        char cmd;
+        while (1) {
+            printf("Type a command to continue. 'q' for 'quit' and 'g' for 'continue'.\r\n");
+            scanf("%c", &cmd);
+            if (cmd == 'q')
+                break;
+            else if (cmd == 'g') {
+                // read result from GPIO
+                unsigned int value = jtag.readMemory(0x24000100);
+                printf("value of interrupt is: %08x\r\n", value);
+                for (int i = 0; i < 2; ++i) {
+                    value = jtag.readMemory(0x24000110 + i * 4);
+                    printf("hex is: %08x\r\n", value);
+                } 
+            } else
+                printf("Unknown command: %c.\r\n", cmd);
+        }
+        
     }
-
+    
+    
     pc.printf("Powering Down\r\n");
     power_down();
     pc.printf("Done\r\n");