Firmware remote update

Dependencies:   EthernetNetIf FirmwareUpdater HTTPClient mbed

Files at this revision

API Documentation at this revision

Comitter:
vinajarr
Date:
Thu Nov 13 07:22:23 2014 +0000
Commit message:
Firmware update remote

Changed in this revision

EthernetNetIf.lib Show annotated file Show diff for this revision Revisions of this file
FirmwareUpdater.lib Show annotated file Show diff for this revision Revisions of this file
HTTPClient.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/EthernetNetIf.lib	Thu Nov 13 07:22:23 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mamezu/code/EthernetNetIf/#0f6c82fcde82
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/FirmwareUpdater.lib	Thu Nov 13 07:22:23 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/shintamainjp/code/FirmwareUpdater/#851bd91fa0ae
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HTTPClient.lib	Thu Nov 13 07:22:23 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mamezu/code/HTTPClient/#62fac7f06c8d
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Nov 13 07:22:23 2014 +0000
@@ -0,0 +1,51 @@
+#include "mbed.h"
+#include "FirmwareUpdater.h"
+#include "EthernetNetIf.h"
+ 
+EthernetNetIf eth;
+FirmwareUpdater fwup("http://mbed.org/media/uploads/vinajarr/", "firm2", true); 
+ 
+DigitalOut myled(LED1);  // LED Rojo PB22   
+
+ 
+// There are 2 files for the firmware.
+//  1. firm.txt : firmware version file.
+//  2. firm.bin : firmware binary file.
+ 
+void check_newfirm() {
+    if (fwup.exist() == 0) {
+        printf("Found a new firmware.\n");
+        if (fwup.execute() == 0) {
+            printf("Update succeed.\n");
+            printf("Resetting this system...\n\n\n\n\n");
+            fwup.reset();
+        } else {
+            printf("Update failed!\n");
+        }
+    }
+    else{
+    printf("Not found a new firmware.\n");   
+    printf("actual version: %d \n",fwup.get_); 
+    }
+}
+ 
+int main(void) {
+  
+    eth.setup();
+ 
+ while(1){
+ 
+    check_newfirm();
+    
+    // Your application is here.   
+
+        myled = 1;
+        wait(0.1);
+        myled = 0;
+        wait(0.2);
+
+    }
+
+    
+    
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Nov 13 07:22:23 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/e2ac27c8e93e
\ No newline at end of file