1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-21 21:22:31 +03:00

save 192 RAM bytes when attachInterrupt unused (#4601)

This commit is contained in:
Peter Hoddie
2018-04-17 13:16:06 -07:00
committed by Develo
parent 7820fb73a5
commit 16a4f22194

View File

@ -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();
}
}
@ -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();
}
}
@ -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")));