diff --git a/html/home.tpl b/html/home.tpl index 7d33306..32f02e1 100644 --- a/html/home.tpl +++ b/html/home.tpl @@ -4,13 +4,86 @@

-
-

The ESP Link bridges the ESP8266 serial port to Wifi and it can - program microcontrollers over the serial port, in particular Arduinos, AVRs, and - NXP's LPC800-series ARM processors.

+
+
+
+

The ESP Link bridges the ESP8266 serial port to Wifi and it can + program microcontrollers over the serial port, in particular Arduinos, AVRs, and + NXP's LPC800-series ARM processors.

+
+
+
+
+

Wifi summary

+
+ + + + + + +
+
+

Pin assignment

+ Select one of the following signal/pin assignments to match your hardware +
+
+
+
+
+ diff --git a/html/style.css b/html/style.css index 6198f73..0765241 100644 --- a/html/style.css +++ b/html/style.css @@ -21,6 +21,24 @@ body { #aps label div { display: inline-block; margin: 0em 0.2em; + vertical-align: top; +} +fieldset.radios { + border: none; + padding-left: 0px; +} +fieldset fields { + clear: both; +} +#pin-mux input { + display: block; + margin-top: 0.4em; + float: left; +} +#pin-mux label { + display: block; + margin: 0em 0.2em 0em 2em; + width: 90%; } .pure-table td, .pure-table th { diff --git a/user/cgipins.c b/user/cgipins.c new file mode 100644 index 0000000..ade7068 --- /dev/null +++ b/user/cgipins.c @@ -0,0 +1,64 @@ + +#include +#include "cgi.h" +#include "espfs.h" + +static char *map_names[] = { + "esp-bridge", "jn-esp-v2", "esp-01" +}; +static char* map_func[] = { "reset", "isp", "conn_led", "ser_led" }; +static uint8_t map_asn[][4] = { + { 12, 13, 0, 14 }, // esp-bridge + { 12, 13, 0, 2 }, // jn-esp-v2 + { 0, 2, 12, 13 }, // esp-01 +}; + +// Cgi to return choice of pin assignments +int ICACHE_FLASH_ATTR cgiPinsGet(HttpdConnData *connData) { + char buff[1024]; + int len; + + if (connData->conn==NULL) { + return HTTPD_CGI_DONE; // Connection aborted + } + + len = os_sprintf(buff, "{ \"curr\":\"esp-bridge\", \"map\": [ "); + for (int i=0; iconn==NULL) { + return HTTPD_CGI_DONE; // Connection aborted + } + + jsonHeader(connData, 200); + return HTTPD_CGI_DONE; +} + +int ICACHE_FLASH_ATTR cgiPins(HttpdConnData *connData) { + if (connData->requestType == HTTPD_METHOD_GET) { + return cgiPinsGet(connData); + } else if (connData->requestType == HTTPD_METHOD_POST) { + return cgiPinsSet(connData); + } else { + jsonHeader(connData, 404); + return HTTPD_CGI_DONE; + } +} diff --git a/user/cgipins.h b/user/cgipins.h new file mode 100644 index 0000000..53e46cb --- /dev/null +++ b/user/cgipins.h @@ -0,0 +1,8 @@ +#ifndef CGIPINS_H +#define CGIPINS_H + +#include "httpd.h" + +int cgiPins(HttpdConnData *connData); + +#endif diff --git a/user/user_main.c b/user/user_main.c index 134653c..98aa550 100644 --- a/user/user_main.c +++ b/user/user_main.c @@ -15,6 +15,7 @@ #include "httpdespfs.h" #include "cgi.h" #include "cgiwifi.h" +#include "cgipins.h" #include "cgiflash.h" #include "auth.h" #include "espfs.h" @@ -86,6 +87,7 @@ HttpdBuiltInUrl builtInUrls[]={ {"/wifi/connect", cgiWiFiConnect, NULL}, {"/wifi/connstatus", cgiWiFiConnStatus, NULL}, {"/wifi/setmode", cgiWiFiSetMode, NULL}, + {"/pins", cgiPins, NULL}, {"*", cgiEspFsHook, NULL}, //Catch-all cgi function for the filesystem {NULL, NULL, NULL}