From d419bdb4f72847fe7bd0dabdcc25add47d1ce01f Mon Sep 17 00:00:00 2001 From: Jindra Dolezy Date: Thu, 2 Apr 2015 00:53:25 +0200 Subject: [PATCH] Using one header file for esp8266 stuff --- espfs/espfs.c | 7 +------ espfs/heatshrink_decoder.c | 8 +------- httpd/auth.c | 10 +--------- httpd/auth.h | 2 ++ httpd/base64.c | 6 +----- httpd/httpd.c | 8 +------- httpd/httpd.h | 3 --- httpd/httpdespfs.c | 10 ++-------- httpd/httpdespfs.h | 1 - include/esp8266.h | 18 ++++++++++++++++++ user/cgi.c | 8 +------- user/cgiflash.c | 9 +-------- user/cgiwifi.c | 10 ++-------- user/io.c | 14 ++++---------- user/stdout.c | 5 +---- user/user_main.c | 4 +--- 16 files changed, 37 insertions(+), 86 deletions(-) create mode 100644 include/esp8266.h diff --git a/espfs/espfs.c b/espfs/espfs.c index 268bcac..06ae135 100644 --- a/espfs/espfs.c +++ b/espfs/espfs.c @@ -20,12 +20,7 @@ It's written for use with httpd, but doesn't need to be used as such. #ifdef __ets__ //esp build -#include "c_types.h" -#include "user_interface.h" -#include "espconn.h" -#include "mem.h" -#include "osapi.h" -#include "espmissingincludes.h" +#include #else //Test build #include diff --git a/espfs/heatshrink_decoder.c b/espfs/heatshrink_decoder.c index 87f042c..522b560 100644 --- a/espfs/heatshrink_decoder.c +++ b/espfs/heatshrink_decoder.c @@ -5,14 +5,8 @@ #ifdef __ets__ //esp build -#define _STDLIB_H_ -#define _STRING_H_ -#define _STDDEF_H -#include "espmissingincludes.h" -#include "c_types.h" -#include "mem.h" -#include "osapi.h" +#include #define memset(x,y,z) os_memset(x,y,z) #define memcpy(x,y,z) os_memcpy(x,y,z) diff --git a/httpd/auth.c b/httpd/auth.c index 5948805..1e247a0 100644 --- a/httpd/auth.c +++ b/httpd/auth.c @@ -12,17 +12,9 @@ HTTP auth implementation. Only does basic authentication for now. */ -#include -#include -#include "user_interface.h" -#include "mem.h" -#include "httpd.h" -#include "cgi.h" +#include #include "auth.h" -#include "io.h" #include "base64.h" -#include -#include "espmissingincludes.h" int ICACHE_FLASH_ATTR authBasic(HttpdConnData *connData) { const char *forbidden="401 Forbidden."; diff --git a/httpd/auth.h b/httpd/auth.h index 3bf9e36..1ef0f61 100644 --- a/httpd/auth.h +++ b/httpd/auth.h @@ -1,6 +1,8 @@ #ifndef AUTH_H #define AUTH_H +#include "httpd.h" + #ifndef HTTP_AUTH_REALM #define HTTP_AUTH_REALM "Protected" #endif diff --git a/httpd/base64.c b/httpd/base64.c index cc046ac..9d97a26 100644 --- a/httpd/base64.c +++ b/httpd/base64.c @@ -1,10 +1,6 @@ /* base64.c : base-64 / MIME encode/decode */ /* PUBLIC DOMAIN - Jon Mayo - November 13, 2003 */ -#include "c_types.h" -#include -#include -#include -#include +#include #include "base64.h" static const uint8_t base64dec_tab[256]= { diff --git a/httpd/httpd.c b/httpd/httpd.c index 3fe7df1..d5fd924 100644 --- a/httpd/httpd.c +++ b/httpd/httpd.c @@ -12,13 +12,7 @@ Esp8266 http server - core routines */ -#include "espmissingincludes.h" -#include "c_types.h" -#include "user_interface.h" -#include "espconn.h" -#include "mem.h" -#include "osapi.h" - +#include #include "httpd.h" diff --git a/httpd/httpd.h b/httpd/httpd.h index fb4778b..8ef6e72 100644 --- a/httpd/httpd.h +++ b/httpd/httpd.h @@ -1,8 +1,5 @@ #ifndef HTTPD_H #define HTTPD_H -#include -#include -#include #define HTTPDVER "0.3" diff --git a/httpd/httpdespfs.c b/httpd/httpdespfs.c index e2328a7..2eeb90c 100644 --- a/httpd/httpdespfs.c +++ b/httpd/httpdespfs.c @@ -11,15 +11,9 @@ Connector to let httpd use the espfs filesystem to serve the files in it. * ---------------------------------------------------------------------------- */ -#include "espmissingincludes.h" -#include -#include -#include "c_types.h" -#include "user_interface.h" -#include "espconn.h" -#include "mem.h" - +#include #include "httpdespfs.h" +#include "espfs.h" //This is a catch-all cgi function. It takes the url passed to it, looks up the corresponding diff --git a/httpd/httpdespfs.h b/httpd/httpdespfs.h index 8523eff..5eda335 100644 --- a/httpd/httpdespfs.h +++ b/httpd/httpdespfs.h @@ -2,7 +2,6 @@ #define HTTPDESPFS_H #include "httpd.h" -#include "espfs.h" int cgiEspFsHook(HttpdConnData *connData); int ICACHE_FLASH_ATTR cgiEspFsTemplate(HttpdConnData *connData); diff --git a/include/esp8266.h b/include/esp8266.h new file mode 100644 index 0000000..69e6c8a --- /dev/null +++ b/include/esp8266.h @@ -0,0 +1,18 @@ +// Combined include file for esp8266 + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "espmissingincludes.h" +#include "uart_hw.h" diff --git a/user/cgi.c b/user/cgi.c index 1381105..ad6a2bc 100644 --- a/user/cgi.c +++ b/user/cgi.c @@ -13,15 +13,9 @@ flash as a binary. Also handles the hit counter on the main page. */ -#include -#include -#include "user_interface.h" -#include "mem.h" -#include "httpd.h" +#include #include "cgi.h" #include "io.h" -#include -#include "espmissingincludes.h" //cause I can't be bothered to write an ioGetLed() diff --git a/user/cgiflash.c b/user/cgiflash.c index 63c21ce..91f23d8 100644 --- a/user/cgiflash.c +++ b/user/cgiflash.c @@ -12,15 +12,8 @@ Some flash handling cgi routines. Used for reading the existing flash and updati */ -#include -#include -#include "user_interface.h" -#include "mem.h" -#include "httpd.h" +#include #include "cgiflash.h" -#include "io.h" -#include -#include "espmissingincludes.h" #include "espfs.h" diff --git a/user/cgiwifi.c b/user/cgiwifi.c index d289ba6..483b501 100644 --- a/user/cgiwifi.c +++ b/user/cgiwifi.c @@ -12,14 +12,8 @@ Cgi/template routines for the /wifi url. */ -#include -#include -#include "user_interface.h" -#include "mem.h" -#include "httpd.h" -#include "cgi.h" -#include "io.h" -#include "espmissingincludes.h" +#include +#include "cgiwifi.h" //Enable this to disallow any changes in AP settings //#define DEMO_MODE diff --git a/user/io.c b/user/io.c index e2c0020..59e3c8b 100644 --- a/user/io.c +++ b/user/io.c @@ -9,13 +9,7 @@ */ -#include "c_types.h" -#include "user_interface.h" -#include "espconn.h" -#include "mem.h" -#include "osapi.h" -#include "gpio.h" -#include "espmissingincludes.h" +#include #define LEDGPIO 2 #define BTNGPIO 0 @@ -37,10 +31,10 @@ static void ICACHE_FLASH_ATTR resetBtnTimerCb(void *arg) { resetCnt++; } else { if (resetCnt>=6) { //3 sec pressed - wifi_station_disconnect(); - wifi_set_opmode(0x3); //reset to AP+STA mode + //wifi_station_disconnect(); + //wifi_set_opmode(0x3); //reset to AP+STA mode os_printf("Reset to AP mode. Restarting system...\n"); - system_restart(); + //system_restart(); } resetCnt=0; } diff --git a/user/stdout.c b/user/stdout.c index 04473cc..ce1a1b6 100644 --- a/user/stdout.c +++ b/user/stdout.c @@ -10,10 +10,7 @@ */ -#include "espmissingincludes.h" -#include "ets_sys.h" -#include "osapi.h" -#include "uart_hw.h" +#include static void ICACHE_FLASH_ATTR stdoutUartTxd(char c) { //Wait until there is room in the FIFO diff --git a/user/user_main.c b/user/user_main.c index de18066..e4f9058 100644 --- a/user/user_main.c +++ b/user/user_main.c @@ -10,9 +10,7 @@ */ -#include "espmissingincludes.h" -#include "ets_sys.h" -#include "osapi.h" +#include #include "httpd.h" #include "io.h" #include "httpdespfs.h"