From d8b0575d2fee773b21db798b032341a763fd7cde Mon Sep 17 00:00:00 2001 From: Jeroen Domburg Date: Fri, 10 Oct 2014 17:34:04 +0200 Subject: [PATCH] Added reset-to-ap-mode button functionality --- user/io.c | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/user/io.c b/user/io.c index 16374cc..e89689f 100644 --- a/user/io.c +++ b/user/io.c @@ -5,14 +5,40 @@ #include "osapi.h" #include "gpio.h" + +#define LEDGPIO 2 +#define BTNGPIO 0 + +static ETSTimer resetBtntimer; + void ICACHE_FLASH_ATTR ioLed(int ena) { + //gpio_output_set is overkill. ToDo: use better mactos if (ena) { - gpio_output_set(BIT2, 0, BIT2, 0); + gpio_output_set((1<=6) { //3 sec pressed + wifi_set_opmode(0x3); //reset to AP+STA mode + os_printf("Reset to AP mode. Restarting system...\n"); + system_restart(); + } + resetCnt=0; } } void ioInit() { PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO2_U, FUNC_GPIO2); -} \ No newline at end of file + PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO0_U, FUNC_GPIO0); + gpio_output_set(0, 0, (1<