Skip to content

Flash both images in one go, invert blinky really blink and remove need to define PIN_OUT #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 22, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions basic_example/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)
Expand Down
10 changes: 4 additions & 6 deletions blinky/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)
Expand Down
16 changes: 8 additions & 8 deletions blinky/user/user_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand All @@ -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);

Expand Down
6 changes: 2 additions & 4 deletions example.Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down