Firmware remote update
Dependencies: EthernetNetIf FirmwareUpdater HTTPClient mbed
Revision 0:a3eb8d59a819, committed 2014-11-13
- Comitter:
- vinajarr
- Date:
- Thu Nov 13 07:22:23 2014 +0000
- Commit message:
- Firmware update remote
Changed in this revision
diff -r 000000000000 -r a3eb8d59a819 EthernetNetIf.lib --- /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
diff -r 000000000000 -r a3eb8d59a819 FirmwareUpdater.lib --- /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
diff -r 000000000000 -r a3eb8d59a819 HTTPClient.lib --- /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
diff -r 000000000000 -r a3eb8d59a819 main.cpp --- /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
diff -r 000000000000 -r a3eb8d59a819 mbed.bld --- /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