Skip to content

Commit

Permalink
save 192 RAM bytes when attachInterrupt unused
Browse files Browse the repository at this point in the history
  • Loading branch information
phoddie committed Jan 30, 2018
1 parent 4bafbe5 commit aaa0987
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions cores/esp8266/core_esp8266_wiring_digital.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ extern void ICACHE_RAM_ATTR __attachInterruptArg(uint8_t pin, voidFuncPtr userFu
GPC(pin) &= ~(0xF << GPCI);//INT mode disabled
GPIEC = (1 << pin); //Clear Interrupt for this pin
GPC(pin) |= ((mode & 0xF) << GPCI);//INT mode "mode"
ETS_GPIO_INTR_ATTACH(interrupt_handler, &interrupt_reg);
ETS_GPIO_INTR_ENABLE();
}
}
Expand All @@ -180,7 +181,8 @@ extern void ICACHE_RAM_ATTR __detachInterrupt(uint8_t pin) {
handler->mode = 0;
handler->fn = 0;
handler->arg = 0;
ETS_GPIO_INTR_ENABLE();
if (interrupt_reg)
ETS_GPIO_INTR_ENABLE();
}
}

Expand All @@ -197,9 +199,6 @@ void initPins() {
for (int i = 12; i <= 16; ++i) {
pinMode(i, INPUT);
}

ETS_GPIO_INTR_ATTACH(interrupt_handler, &interrupt_reg);
ETS_GPIO_INTR_ENABLE();
}

extern void pinMode(uint8_t pin, uint8_t mode) __attribute__ ((weak, alias("__pinMode")));
Expand Down

0 comments on commit aaa0987

Please sign in to comment.