library to modify and read program variable in runtime from a serial console. You can reset as well the mbed from the console without pushing buttons. Handy for debugging from the online compiler as you can change the behavior of the program without need to recompile each time.

Revision:
3:cf43e6de918e
Parent:
2:a59207652720
Child:
4:4be2eaf872df
--- a/VarStore.cpp	Mon Aug 25 10:45:03 2014 +0000
+++ b/VarStore.cpp	Mon Aug 25 11:07:49 2014 +0000
@@ -116,7 +116,7 @@
 void VarStore::Worker(void const *args)
 {
     VarStore *MyThis=(VarStore *)args;
-    char c, *ret="";// not NULL to start in no error state
+    char c, *ret=STR_OK;// not NULL to start in no error state
     
     int ci_counter=0;
     char Cs[CI_SZ];
@@ -155,7 +155,7 @@
         if(ret==NULL) {
             Thread::wait(100);
             MyThis->pc->printf(" error setting/getting var \n");
-            ret="";
+            ret=STR_OK;
         }
         Thread::wait(100);
     } // While
@@ -185,6 +185,10 @@
             case 'r':
                 mbed_reset();
                 return NULL;
+            case 'w':
+                strtok(str,":");
+                Thread::wait(atoi(strtok(NULL,":")));
+                return STR_OK;
         };
     }
     return NULL;