mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +03:00
Pulldown only possible for in 16. ( see #478 )
rename define to INPUT_PULLDOWN_16 to make it clear
This commit is contained in:
parent
715d4ab722
commit
ddf03fc92b
@ -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
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user