ESP8266 / Mbed 2 deprecated ESP8266-Firmware-Update-To-Espressif

Dependencies:   BufferedSerial mbed

Fork of ESPQuickFlash by Christopher Haster

Files at this revision

API Documentation at this revision

Comitter:
mbedAustin
Date:
Mon Apr 18 21:23:56 2016 +0000
Parent:
0:d84cdaf22096
Commit message:
Updated example to use 2wire board (Seeed Grove serial WiFi module) and ask for user input between files.

Changed in this revision

BufferedSerial.lib Show annotated file Show diff for this revision Revisions of this file
esp_command.h 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
--- a/BufferedSerial.lib	Mon Apr 18 20:36:49 2016 +0000
+++ b/BufferedSerial.lib	Mon Apr 18 21:23:56 2016 +0000
@@ -1,1 +1,1 @@
-http://developer.mbed.org/users/sam_grove/code/BufferedSerial/#9ee15ae3d1a3
+http://developer.mbed.org/users/sam_grove/code/BufferedSerial/#a0d37088b405
--- a/esp_command.h	Mon Apr 18 20:36:49 2016 +0000
+++ b/esp_command.h	Mon Apr 18 21:23:56 2016 +0000
@@ -36,12 +36,11 @@
 class ESPCommand {
 private:
     SLIPPacket<SERIAL> _slip;
-    DigitalOut _reset;
-    DigitalOut _prog;
+    DigitalIn _button;
     
 public:
-    ESPCommand(PinName tx, PinName rx, PinName reset, PinName prog) : 
-            _slip(tx, rx), _reset(reset, 1), _prog(prog, 1) {}
+    ESPCommand(PinName tx, PinName rx, PinName button) : 
+            _slip(tx, rx), _button(button){}
     
 private:
     bool command_start(char cmd, uint16_t len) {
@@ -87,21 +86,15 @@
     }
 
     bool sync_frame() {
-        // Reset board
-        _reset = 0;
-        _prog = 1;
-        wait_ms(250);
-        _reset = 1;
-        wait_ms(250);
-        _reset = 0;
-        _prog = 0;
-        wait_ms(250);
-        _reset = 1;
-        wait_ms(250);
         
         // Flush serial line
         _slip.flush();
         
+        printf("\r\nPower cycle ESP, put into FW Update mode, push user button\r\n");
+        int temp_button = _button;
+        while( temp_button == _button){;} // wait for button press
+        printf("\r\nContinuing Now\r\n");
+        
         // Send sync frame
         uint32_t x = 0;
         
--- a/main.cpp	Mon Apr 18 20:36:49 2016 +0000
+++ b/main.cpp	Mon Apr 18 21:23:56 2016 +0000
@@ -16,7 +16,7 @@
 
 
 int main() {
-    ESPCommand<BufferedSerial> esp(D1, D0, D2, D3);
+    ESPCommand<BufferedSerial> esp(D1, D0, PTC6); // Change PTC6 to user button on your platform
     led_blue = 1;
     led_green = 1;
     
--- a/mbed.bld	Mon Apr 18 20:36:49 2016 +0000
+++ b/mbed.bld	Mon Apr 18 21:23:56 2016 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/cbbeb26dbd92
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/082adc85693f
\ No newline at end of file