Skip to content

Commit ddf03fc

Browse files
Links2004igrr
authored andcommitted
Pulldown only possible for in 16. ( see #478 )
rename define to INPUT_PULLDOWN_16 to make it clear
1 parent 715d4ab commit ddf03fc

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

cores/esp8266/Arduino.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ void yield(void);
4848
//GPIO FUNCTIONS
4949
#define INPUT 0x00
5050
#define INPUT_PULLUP 0x02
51-
#define INPUT_PULLDOWN 0x04
51+
#define INPUT_PULLDOWN_16 0x04 // PULLDOWN only possible for pin16
5252
#define OUTPUT 0x01
5353
#define OUTPUT_OPEN_DRAIN 0x03
5454
#define WAKEUP_PULLUP 0x05

cores/esp8266/core_esp8266_wiring_digital.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,12 @@ extern void __pinMode(uint8_t pin, uint8_t mode) {
4444
GPC(pin) = (GPC(pin) & (0xF << GPCI)); //SOURCE(GPIO) | DRIVER(NORMAL) | INT_TYPE(UNCHANGED) | WAKEUP_ENABLE(DISABLED)
4545
if(mode == OUTPUT_OPEN_DRAIN) GPC(pin) |= (1 << GPCD);
4646
GPES = (1 << pin); //Enable
47-
} else if(mode == INPUT || mode == INPUT_PULLUP || mode == INPUT_PULLDOWN){
47+
} else if(mode == INPUT || mode == INPUT_PULLUP){
4848
GPF(pin) = GPFFS(GPFFS_GPIO(pin));//Set mode to GPIO
4949
GPEC = (1 << pin); //Disable
5050
GPC(pin) = (GPC(pin) & (0xF << GPCI)) | (1 << GPCD); //SOURCE(GPIO) | DRIVER(OPEN_DRAIN) | INT_TYPE(UNCHANGED) | WAKEUP_ENABLE(DISABLED)
5151
if(mode == INPUT_PULLUP) {
5252
GPF(pin) |= (1 << GPFPU); // Enable Pullup
53-
} else if(mode == INPUT_PULLDOWN) {
54-
GPF(pin) |= (1 << GPFPD); // Enable Pulldown
5553
}
5654
} else if(mode == WAKEUP_PULLUP || mode == WAKEUP_PULLDOWN){
5755
GPF(pin) = GPFFS(GPFFS_GPIO(pin));//Set mode to GPIO
@@ -67,8 +65,8 @@ extern void __pinMode(uint8_t pin, uint8_t mode) {
6765
} else if(pin == 16){
6866
GPF16 = GP16FFS(GPFFS_GPIO(pin));//Set mode to GPIO
6967
GPC16 = 0;
70-
if(mode == INPUT || mode == INPUT_PULLDOWN){
71-
if(mode == INPUT_PULLDOWN){
68+
if(mode == INPUT || mode == INPUT_PULLDOWN_16){
69+
if(mode == INPUT_PULLDOWN_16){
7270
GPF16 |= (1 << GP16FPD);//Enable Pulldown
7371
}
7472
GP16E &= ~1;

0 commit comments

Comments
 (0)