From 884b600db6424ed117425bf1a45ff8c105737b4a Mon Sep 17 00:00:00 2001 From: Markus Sattler Date: Tue, 21 Apr 2015 19:46:23 +0200 Subject: [PATCH] add INPUT_PULLDOWN support --- hardware/esp8266com/esp8266/cores/esp8266/Arduino.h | 1 + .../esp8266/cores/esp8266/core_esp8266_wiring_digital.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/hardware/esp8266com/esp8266/cores/esp8266/Arduino.h b/hardware/esp8266com/esp8266/cores/esp8266/Arduino.h index 257dc3767..1057240db 100644 --- a/hardware/esp8266com/esp8266/cores/esp8266/Arduino.h +++ b/hardware/esp8266com/esp8266/cores/esp8266/Arduino.h @@ -46,6 +46,7 @@ void yield(void); #define INPUT 0x0 #define OUTPUT 0x1 #define INPUT_PULLUP 0x2 +#define INPUT_PULLDOWN 0x3 #define OUTPUT_OPEN_DRAIN 0x4 #define PI 3.1415926535897932384626433832795 diff --git a/hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_wiring_digital.c b/hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_wiring_digital.c index ab17f7ef3..ca63d01ac 100644 --- a/hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_wiring_digital.c +++ b/hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_wiring_digital.c @@ -81,7 +81,12 @@ extern void __pinMode(uint8_t pin, uint8_t mode) { PIN_PULLUP_DIS(mux); } else if(mode == INPUT_PULLUP) { gpio_output_set(0, 0, 0, 1 << pin); + PIN_PULLDWN_DIS(mux); PIN_PULLUP_EN(mux); + } else if(mode == INPUT_PULLDOWN) { + gpio_output_set(0, 0, 0, 1 << pin); + PIN_PULLUP_DIS(mux); + PIN_PULLDWN_EN(mux); } else if(mode == OUTPUT) { gpio_output_set(0, 0, 1 << pin, 0); } else if(mode == OUTPUT_OPEN_DRAIN) {