{"action":"created","issue":{"url":"https://api.github.com/repos/esp8266/Arduino/issues/519","labels_url":"https://api.github.com/repos/esp8266/Arduino/issues/519/labels{/name}","comments_url":"https://api.github.com/repos/esp8266/Arduino/issues/519/comments","events_url":"https://api.github.com/repos/esp8266/Arduino/issues/519/events","html_url":"https://github.com/esp8266/Arduino/issues/519","id":93767572,"number":519,"title":"Cannot access GPIO15 -- No FUNCTION_3 switch in extern void __pinMode(uint8_t pin, uint8_t mode) {","user":{"login":"drmpf","id":5945337,"avatar_url":"https://avatars.githubusercontent.com/u/5945337?v=3","gravatar_id":"","url":"https://api.github.com/users/drmpf","html_url":"https://github.com/drmpf","followers_url":"https://api.github.com/users/drmpf/followers","following_url":"https://api.github.com/users/drmpf/following{/other_user}","gists_url":"https://api.github.com/users/drmpf/gists{/gist_id}","starred_url":"https://api.github.com/users/drmpf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drmpf/subscriptions","organizations_url":"https://api.github.com/users/drmpf/orgs","repos_url":"https://api.github.com/users/drmpf/repos","events_url":"https://api.github.com/users/drmpf/events{/privacy}","received_events_url":"https://api.github.com/users/drmpf/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-07-08T11:33:07Z","updated_at":"2015-07-09T06:36:28Z","closed_at":null,"body":"I am trying to use GPIO15 on the OMILEX DEV BOARD (the one with the relay)\r\nBut cannot read that pin.\r\ndefault function appears to be MTDO,  and there is no FUNCTION_3 switch in the \r\nextern void __pinMode(uint8_t pin, uint8_t mode)  \r\nmethod to make this pin accessible as GPIO in stable release 1.6.4-673-g8cd3697\r\n\r\nI need two digital inputs and have all ready used GPIO4 as one and am using GPIO16 for ADC,\r\nCannot use GPIO0 or 2 as my be shorted to gnd on power up by external switch\r\nGPIO5 on this board drives the relay and TX/RX use the other two GPIO's\r\n\r\n```\r\nextern void __pinMode(uint8_t pin, uint8_t mode) {\r\n  if(pin < 16){\r\n    if(mode == SPECIAL){\r\n      GPC(pin) = (GPC(pin) & (0xF << GPCI)); //SOURCE(GPIO) | DRIVER(NORMAL) | INT_TYPE(UNCHANGED) | WAKEUP_ENABLE(DISABLED)\r\n      GPEC = (1 << pin); //Disable\r\n      GPF(pin) = GPFFS(GPFFS_BUS(pin));//Set mode to BUS (RX0, TX0, TX1, SPI, HSPI or CLK depending in the pin)\r\n      if(pin == 3) GPF(pin) |= (1 << GPFPU);//enable pullup on RX\r\n    } else if(mode & FUNCTION_0){\r\n      GPC(pin) = (GPC(pin) & (0xF << GPCI)); //SOURCE(GPIO) | DRIVER(NORMAL) | INT_TYPE(UNCHANGED) | WAKEUP_ENABLE(DISABLED)\r\n      GPEC = (1 << pin); //Disable\r\n      GPF(pin) = GPFFS((mode >> 4) & 0x07);\r\n      if(pin == 13 && mode == FUNCTION_4) GPF(pin) |= (1 << GPFPU);//enable pullup on RX\r\n    }  else if(mode == OUTPUT || mode == OUTPUT_OPEN_DRAIN){\r\n      GPF(pin) = GPFFS(GPFFS_GPIO(pin));//Set mode to GPIO\r\n      GPC(pin) = (GPC(pin) & (0xF << GPCI)); //SOURCE(GPIO) | DRIVER(NORMAL) | INT_TYPE(UNCHANGED) | WAKEUP_ENABLE(DISABLED)\r\n      if(mode == OUTPUT_OPEN_DRAIN) GPC(pin) |= (1 << GPCD);\r\n      GPES = (1 << pin); //Enable\r\n    } else if(mode == INPUT || mode == INPUT_PULLUP || mode == INPUT_PULLDOWN){\r\n      GPF(pin) = GPFFS(GPFFS_GPIO(pin));//Set mode to GPIO\r\n      GPEC = (1 << pin); //Disable\r\n      GPC(pin) = (GPC(pin) & (0xF << GPCI)) | (1 << GPCD); //SOURCE(GPIO) | DRIVER(OPEN_DRAIN) | INT_TYPE(UNCHANGED) | WAKEUP_ENABLE(DISABLED)\r\n      if(mode == INPUT_PULLUP) {\r\n          GPF(pin) |= (1 << GPFPU);  // Enable  Pullup\r\n      } else if(mode == INPUT_PULLDOWN) {\r\n          GPF(pin) |= (1 << GPFPD);  // Enable  Pulldown\r\n      }\r\n    }\r\n  } else if(pin == 16){\r\n    GPF16 = GP16FFS(GPFFS_GPIO(pin));//Set mode to GPIO\r\n    GPC16 = 0;\r\n    if(mode == INPUT || mode == INPUT_PULLDOWN){\r\n      if(mode == INPUT_PULLDOWN){\r\n        GPF16 |= (1 << GP16FPD);//Enable Pulldown\r\n      }\r\n      GP16E &= ~1;\r\n    } else if(mode == OUTPUT){\r\n      GP16E |= 1;\r\n    }\r\n  }\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/esp8266/Arduino/issues/comments/119840292","html_url":"https://github.com/esp8266/Arduino/issues/519#issuecomment-119840292","issue_url":"https://api.github.com/repos/esp8266/Arduino/issues/519","id":119840292,"user":{"login":"igrr","id":4349050,"avatar_url":"https://avatars.githubusercontent.com/u/4349050?v=3","gravatar_id":"","url":"https://api.github.com/users/igrr","html_url":"https://github.com/igrr","followers_url":"https://api.github.com/users/igrr/followers","following_url":"https://api.github.com/users/igrr/following{/other_user}","gists_url":"https://api.github.com/users/igrr/gists{/gist_id}","starred_url":"https://api.github.com/users/igrr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/igrr/subscriptions","organizations_url":"https://api.github.com/users/igrr/orgs","repos_url":"https://api.github.com/users/igrr/repos","events_url":"https://api.github.com/users/igrr/events{/privacy}","received_events_url":"https://api.github.com/users/igrr/received_events","type":"User","site_admin":false},"created_at":"2015-07-09T06:36:28Z","updated_at":"2015-07-09T06:36:28Z","body":"There is an external pull down resistor connected to GPIO15 (check your\nboard schematics), so the behavior you describe makes sense.\n\nOn Thu, Jul 9, 2015, 09:33 drmpf <notifications@github.com> wrote:\n\n> Ok thanks for that ,\n> I now have gpio 12 to 14 working INPUT_PULLUP and gpio 16 working\n> INPUT_PULLDOWN\n> BUT\n> gpio 15 is still not behaving. It seems to latch the last value\n> I have set it as\n> pinMode(15,INPUT_PULLUP);\n> but initially shows up LOW\n> if I short it to +3V3, it goes HIGH and stays HIGH when I remove the short.\n> but if I then short it to GND it goes LOW and stays LOW when I remove the\n> short\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/esp8266/Arduino/issues/519#issuecomment-119839441>.\n>\n"}}