{"id":1908,"date":"2015-01-09T22:11:40","date_gmt":"2015-01-09T22:11:40","guid":{"rendered":"http:\/\/41j.com\/blog\/?p=1908"},"modified":"2015-03-06T04:42:18","modified_gmt":"2015-03-06T04:42:18","slug":"esp8266-gpio-input-configuration","status":"publish","type":"post","link":"https:\/\/41j.com\/blog\/2015\/01\/esp8266-gpio-input-configuration\/","title":{"rendered":"esp8266 GPIO input configuration"},"content":{"rendered":"<p>The following code, when used in user_init() will enable the internal pullup on GPIO0 and read it&#8217;s value. Unfortunately GPIO0 (and GPIO2) when held low at boot put the device into a non-running mode (firmware update), I&#8217;ve also been unsuccessful in using the internal pulldowns on these pins. This means these pins can not be used for user mode selection at boot, using the internal pullup\/down resistors. And unfortunately, those are the only GPIOs available on the simplest modules. It maybe possible if an external pulldown is installed.<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\ngpio_init();\r\nPIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO0_U, FUNC_GPIO0);\r\nPIN_PULLUP_EN(PERIPHS_IO_MUX_GPIO0_U);\r\nos_delay_us(10000);\r\nint config = GPIO_INPUT_GET(0);\/\/GPIO_ID_PIN(PERIPHS_IO_MUX_GPIO0_U));\r\nchar buffer&#x5B;30];\r\nos_sprintf(buffer,&quot;config: %d&quot;,config);\r\n<\/pre>\n<p><\/p>\n<h4>This is a continuation of my notes on the esp8266 microcontroller, you can find a complete list of my esp8266 posts <a href=\"http:\/\/41j.com\/blog\/2015\/01\/esp8266-notes-summary\/\">here<\/a><\/h4>\n","protected":false},"excerpt":{"rendered":"<p>The following code, when used in user_init() will enable the internal pullup on GPIO0 and read it&#8217;s value. Unfortunately GPIO0 (and GPIO2) when held low at boot put the device into a non-running mode (firmware update), I&#8217;ve also been unsuccessful in using the internal pulldowns on these pins. This means these pins can not be [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[1],"tags":[],"class_list":["post-1908","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p1RRoU-uM","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts\/1908","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/comments?post=1908"}],"version-history":[{"count":2,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts\/1908\/revisions"}],"predecessor-version":[{"id":2212,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts\/1908\/revisions\/2212"}],"wp:attachment":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/media?parent=1908"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/categories?post=1908"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/tags?post=1908"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}