diff --git a/cores/esp8266/Arduino.h b/cores/esp8266/Arduino.h index 61e5711a4..c712bf756 100644 --- a/cores/esp8266/Arduino.h +++ b/cores/esp8266/Arduino.h @@ -48,7 +48,7 @@ void yield(void); //GPIO FUNCTIONS #define INPUT 0x00 #define INPUT_PULLUP 0x02 -#define INPUT_PULLDOWN 0x04 +#define INPUT_PULLDOWN_16 0x04 // PULLDOWN only possible for pin16 #define OUTPUT 0x01 #define OUTPUT_OPEN_DRAIN 0x03 #define WAKEUP_PULLUP 0x05 diff --git a/cores/esp8266/core_esp8266_wiring_digital.c b/cores/esp8266/core_esp8266_wiring_digital.c index aad2dfa3e..5654e5f12 100644 --- a/cores/esp8266/core_esp8266_wiring_digital.c +++ b/cores/esp8266/core_esp8266_wiring_digital.c @@ -44,14 +44,12 @@ extern void __pinMode(uint8_t pin, uint8_t mode) { GPC(pin) = (GPC(pin) & (0xF << GPCI)); //SOURCE(GPIO) | DRIVER(NORMAL) | INT_TYPE(UNCHANGED) | WAKEUP_ENABLE(DISABLED) if(mode == OUTPUT_OPEN_DRAIN) GPC(pin) |= (1 << GPCD); GPES = (1 << pin); //Enable - } else if(mode == INPUT || mode == INPUT_PULLUP || mode == INPUT_PULLDOWN){ + } else if(mode == INPUT || mode == INPUT_PULLUP){ GPF(pin) = GPFFS(GPFFS_GPIO(pin));//Set mode to GPIO GPEC = (1 << pin); //Disable GPC(pin) = (GPC(pin) & (0xF << GPCI)) | (1 << GPCD); //SOURCE(GPIO) | DRIVER(OPEN_DRAIN) | INT_TYPE(UNCHANGED) | WAKEUP_ENABLE(DISABLED) if(mode == INPUT_PULLUP) { GPF(pin) |= (1 << GPFPU); // Enable Pullup - } else if(mode == INPUT_PULLDOWN) { - GPF(pin) |= (1 << GPFPD); // Enable Pulldown } } else if(mode == WAKEUP_PULLUP || mode == WAKEUP_PULLDOWN){ GPF(pin) = GPFFS(GPFFS_GPIO(pin));//Set mode to GPIO @@ -67,8 +65,8 @@ extern void __pinMode(uint8_t pin, uint8_t mode) { } else if(pin == 16){ GPF16 = GP16FFS(GPFFS_GPIO(pin));//Set mode to GPIO GPC16 = 0; - if(mode == INPUT || mode == INPUT_PULLDOWN){ - if(mode == INPUT_PULLDOWN){ + if(mode == INPUT || mode == INPUT_PULLDOWN_16){ + if(mode == INPUT_PULLDOWN_16){ GPF16 |= (1 << GP16FPD);//Enable Pulldown } GP16E &= ~1;