diff --git a/basic_example/Makefile b/basic_example/Makefile index 57e79c5..f3275bf 100644 --- a/basic_example/Makefile +++ b/basic_example/Makefile @@ -26,10 +26,10 @@ TARGET = app # which modules (subdirectories) of the project to include in compiling MODULES = driver user -EXTRA_INCDIR = include /usr/include /usr/include/i386-linux-gnu +EXTRA_INCDIR = include /opt/Espressif/include # libraries used in this project, mainly provided by the SDK -LIBS = c gcc hal phy net80211 lwip wpa main +LIBS = c gcc hal phy net80211 lwip wpa upgrade upgrade_ssl main # compiler flags using during compilation of source files CFLAGS = -Os -g -O2 -Wpointer-arith -Wundef -Werror -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -D__ets__ -DICACHE_FLASH @@ -101,7 +101,7 @@ $1/%.o: %.c $(Q) $(CC) $(INCDIR) $(MODULE_INCDIR) $(EXTRA_INCDIR) $(SDK_INCDIR) $(CFLAGS) -c $$< -o $$@ endef -.PHONY: all checkdirs clean +.PHONY: all checkdirs flash clean all: checkdirs $(TARGET_OUT) $(FW_FILE_1) $(FW_FILE_2) @@ -130,9 +130,7 @@ firmware: $(Q) mkdir -p $@ flash: firmware/0x00000.bin firmware/0x40000.bin - -$(ESPTOOL) --port $(ESPPORT) write_flash 0x00000 firmware/0x00000.bin - sleep 3 - -$(ESPTOOL) --port $(ESPPORT) write_flash 0x40000 firmware/0x40000.bin + -$(ESPTOOL) --port $(ESPPORT) write_flash 0x00000 firmware/0x00000.bin 0x40000 firmware/0x40000.bin clean: $(Q) rm -f $(APP_AR) diff --git a/blinky/Makefile b/blinky/Makefile index 57e79c5..f3275bf 100644 --- a/blinky/Makefile +++ b/blinky/Makefile @@ -26,10 +26,10 @@ TARGET = app # which modules (subdirectories) of the project to include in compiling MODULES = driver user -EXTRA_INCDIR = include /usr/include /usr/include/i386-linux-gnu +EXTRA_INCDIR = include /opt/Espressif/include # libraries used in this project, mainly provided by the SDK -LIBS = c gcc hal phy net80211 lwip wpa main +LIBS = c gcc hal phy net80211 lwip wpa upgrade upgrade_ssl main # compiler flags using during compilation of source files CFLAGS = -Os -g -O2 -Wpointer-arith -Wundef -Werror -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -D__ets__ -DICACHE_FLASH @@ -101,7 +101,7 @@ $1/%.o: %.c $(Q) $(CC) $(INCDIR) $(MODULE_INCDIR) $(EXTRA_INCDIR) $(SDK_INCDIR) $(CFLAGS) -c $$< -o $$@ endef -.PHONY: all checkdirs clean +.PHONY: all checkdirs flash clean all: checkdirs $(TARGET_OUT) $(FW_FILE_1) $(FW_FILE_2) @@ -130,9 +130,7 @@ firmware: $(Q) mkdir -p $@ flash: firmware/0x00000.bin firmware/0x40000.bin - -$(ESPTOOL) --port $(ESPPORT) write_flash 0x00000 firmware/0x00000.bin - sleep 3 - -$(ESPTOOL) --port $(ESPPORT) write_flash 0x40000 firmware/0x40000.bin + -$(ESPTOOL) --port $(ESPPORT) write_flash 0x00000 firmware/0x00000.bin 0x40000 firmware/0x40000.bin clean: $(Q) rm -f $(APP_AR) diff --git a/blinky/user/user_main.c b/blinky/user/user_main.c index a21c035..e0ca1d5 100644 --- a/blinky/user/user_main.c +++ b/blinky/user/user_main.c @@ -9,24 +9,21 @@ os_event_t user_procTaskQueue[user_procTaskQueueLen]; static void user_procTask(os_event_t *events); -extern uint32_t PIN_OUT; -#define CHECK_BIT(var,pos) ((var) & (1<<(pos))) - static volatile os_timer_t some_timer; void some_timerfunc(void *arg) { //Do blinky stuff - if (CHECK_BIT(PIN_OUT,2)) + if (GPIO_REG_READ(GPIO_OUT_ADDRESS) & BIT2) { - //Set GPIO2 to HIGH - gpio_output_set(BIT2, 0, BIT2, 0); + //Set GPIO2 to LOW + gpio_output_set(0, BIT2, BIT2, 0); } else { - //Set GPIO2 to LOW - gpio_output_set(0, BIT2, BIT2, 0); + //Set GPIO2 to HIGH + gpio_output_set(BIT2, 0, BIT2, 0); } } @@ -41,6 +38,9 @@ user_procTask(os_event_t *events) void ICACHE_FLASH_ATTR user_init() { + // Initialize the GPIO subsystem. + gpio_init(); + //Set GPIO2 to output mode PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO2_U, FUNC_GPIO2); diff --git a/example.Makefile b/example.Makefile index f8eacd4..8e444c3 100644 --- a/example.Makefile +++ b/example.Makefile @@ -27,7 +27,7 @@ TARGET = app # which modules (subdirectories) of the project to include in compiling MODULES = driver user -EXTRA_INCDIR = include /opt/Espressif/include/ +EXTRA_INCDIR = include /opt/Espressif/include # libraries used in this project, mainly provided by the SDK LIBS = c gcc hal phy net80211 lwip wpa upgrade upgrade_ssl main @@ -131,9 +131,7 @@ firmware: $(Q) mkdir -p $@ flash: firmware/0x00000.bin firmware/0x40000.bin - -$(ESPTOOL) --port $(ESPPORT) write_flash 0x00000 firmware/0x00000.bin - sleep 3 - -$(ESPTOOL) --port $(ESPPORT) write_flash 0x40000 firmware/0x40000.bin + -$(ESPTOOL) --port $(ESPPORT) write_flash 0x00000 firmware/0x00000.bin 0x40000 firmware/0x40000.bin clean: $(Q) rm -f $(APP_AR)