Run multiple binaries on your mbed.

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
paulg
Date:
Wed May 29 21:23:11 2013 +0000
Parent:
0:4ea2252690b9
Commit message:
Added X command to do a software reset.; Modified 1, 2 and 3 commands to use a software reset. This removes the need for a wire jumper.; Tested on Mbed LPC1768.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 4ea2252690b9 -r 68f8899ed1ea main.cpp
--- a/main.cpp	Wed May 29 20:06:47 2013 +0000
+++ b/main.cpp	Wed May 29 21:23:11 2013 +0000
@@ -47,10 +47,13 @@
  * Ver  Date    By  Details
  * 0.00 27May13 PG  File created.
  * 1.00 29May13 PG  Initial release.
+ * 1.10 29May13 PG  Added X command to do a software reset.
+ *                  Modified 1, 2 and 3 commands to use a software reset. This
+ *                  removes the need for a wire jumper. Tested on Mbed LPC1768.
  *
  ******************************************************************************/
 
-#define VERSION "1.00"
+#define VERSION "1.10"
 #define MYNAME "app1.bin"   //edit to desired name before compiling & downloading
 #define RSTPIN p9
 
@@ -67,6 +70,7 @@
 void listDir(char*);
 int renameFile(char*, char*);
 void resetMbed(void);
+void resetMbed2(void);
 
 Serial pc(USBTX, USBRX);
 LocalFileSystem local("local");
@@ -103,7 +107,8 @@
                     sprintf(&arg1[7], MYNAME);
                     remove(arg1);
                     copyFile("/local/app1.mbd", "/local/app1.bin");
-                    resetMbed();
+//                    resetMbed();
+                    resetMbed2();
                 }
                 break; 
 
@@ -115,7 +120,8 @@
                     sprintf(&arg1[7], MYNAME);
                     remove(arg1);
                     copyFile("/local/app2.mbd", "/local/app2.bin");
-                    resetMbed();
+//                    resetMbed();
+                    resetMbed2();
                 }
                 break; 
 
@@ -127,7 +133,8 @@
                     sprintf(&arg1[7], MYNAME);
                     remove(arg1);
                     copyFile("/local/app3.mbd", "/local/app3.bin");
-                    resetMbed();
+//                    resetMbed();
+                    resetMbed2();
                 }
                 break; 
 
@@ -185,6 +192,10 @@
                 resetMbed();
                 break;
 
+             case 'X':        //reset mbed module using software
+                resetMbed2();
+                break;
+
             case '?':        //print help
                 printHelps();
                 break;
@@ -368,5 +379,15 @@
     rst = 0;
 }
 
+// Doing it with software - thanks to Erik Olieman for suggesting this
+
+extern "C" void mbed_reset();
+
+void resetMbed2(void) {
+    
+    printf("Resetting mbed module...\n");
+    mbed_reset();
+}
+
 // END of main.cpp