{"id":710,"date":"2020-08-13T22:50:03","date_gmt":"2020-08-13T14:50:03","guid":{"rendered":"https:\/\/www.iotch.xyz\/?p=710"},"modified":"2020-08-13T22:50:03","modified_gmt":"2020-08-13T14:50:03","slug":"esp8266-gpio%e6%8e%a5%e5%8f%a3%e4%bd%bf%e7%94%a8","status":"publish","type":"post","link":"https:\/\/www.iotch.xyz\/?p=710","title":{"rendered":"ESP8266\u2014\u2014GPIO\u63a5\u53e3\u4f7f\u7528"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\">\u4e00\u3001GPIO\u529f\u80fd\u9009\u62e9<\/h1>\n\n\n\n<p><strong>GPIO<\/strong> \u76f8\u5173\u63a5\u53e3\u4f4d\u4e8e \/ESP8266_NONOS_SDK\/include\/<strong>eagle_soc.h<\/strong>\u548c<strong>gpio.h<\/strong>\u3002<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>\u7ba1\u811a\u529f\u80fd\u9009\u62e9\u5b8f\u5b9a\u4e49\uff1aPIN_FUNC_SELECT(PIN_NAME,FUNC)<\/strong><\/p><\/blockquote>\n\n\n\n<p>\u4ee58266\u7684MTDI\u4e3a\u4f8b\uff0c\u8bf4\u660eGPIO\u529f\u80fd\u7684\u9009\u62e9\u3002<br><strong>\u529f\u80fd\u9009\u62e9\u5bc4\u5b58\u5668PERIPHS_IO_MUX_MTDI_U(\u4e0d\u540c\u7684GPIO\uff0c\u8be5\u5bc4\u5b58\u5668\u4e0d\u540c)<\/strong><br>PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDI_U,FUNC_GPIO12);<br>\u6b64\u5904\u7684FUNC_GPIO12=3\u3002<br>\u4e0d\u540c\u7684PIN\u811a\uff0c\u914d\u7f6e\u4e0d\u540c\u3002<br>\u914d\u7f6e\u7684\u65f6\u5019\uff0c\u8bf7\u53c2\u8003 <a href=\"https:\/\/links.jianshu.com\/go?to=https%3A%2F%2Fpan.baidu.com%2Fs%2F175fuV_SuP-bh3G89UCYizg\" target=\"_blank\" rel=\"noreferrer noopener\" rel=\"nofollow\" >ESP8266_Pin_List_xxxxxx.xlsx<\/a>[vt4t] \u8868\u683c\uff0c\u5728\u8be5\u8868\u683c\u7684Digital Die Pin List\u9875\u4e2d\u53ef\u4ee5\u67e5\u5230\u901a\u7528\u7684GPIO\u4ee5\u53ca\u590d\u7528\u529f\u80fd\uff0c\u5728Reg\u9875\u53ef\u4ee5\u67e5\u9605\u5230GPIO\u529f\u80fd\u9009\u62e9\u76f8\u5173\u7684\u5bc4\u5b58\u5668\u3002<br><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"\/\/upload-images.jianshu.io\/upload_images\/6793005-913f677d93593444.png?imageMogr2\/auto-orient\/strip|imageView2\/2\/w\/1200\" alt=\"\"\/><\/figure>\n\n\n\n<p>Digital Die Pin List\u9875<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>Digital Die Pin List\u8be5\u9875\u4e2dFUNCTION\u4e0b\u62c9\u9009\u62e9\u9879\u5c31\u662f\u529f\u80fd\u7684\u914d\u7f6e\u9009\u9879\u3002\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u5982\u679c\u9700\u8981\u914d\u7f6e\u4e3aFUNCTION3\uff0c\u5e94\u8be5\u5f80\u5bc4\u5b58\u5668\u5bf9\u5e94\u7684\u4f4d\u4e2d\u51992\uff0c\u5982\u679c\u9700\u8981\u914d\u7f6e\u4e3aFUNCTION2\uff0c\u5e94\u8be5\u5f80\u5bc4\u5b58\u5668\u5bf9\u5e94\u7684\u4f4d\u4e2d\u51991\uff0c\u4ee5\u6b64\u7c7b\u63a8\u3002<\/p><\/blockquote>\n\n\n\n<h1 class=\"wp-block-heading\">\u4e8c\u3001GPIO\u5c5e\u6027\u8bbe\u7f6e<\/h1>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>\u8bbe\u7f6eGPIO\u5c5e\u6027\u51fd\u6570\uff1agpio_output_set<\/strong><\/p><\/blockquote>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"\/\/upload-images.jianshu.io\/upload_images\/6793005-77ded6298e47976b.png?imageMogr2\/auto-orient\/strip|imageView2\/2\/w\/721\" alt=\"\"\/><\/figure>\n\n\n\n<p>gpio_output_set<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">2.1 GPIO\u8f93\u51fa<\/h2>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>GPIO\u8f93\u51fa\u5b8f\u5b9a\u4e49\uff1aGPIO_OUTPUT_SET(gpio_no, bit_value)<\/strong><\/p><\/blockquote>\n\n\n\n<p>\u4ee58266\u7684MTDI\u4e3a\u4f8b\uff0c\u8bf4\u660eGPIO\u8f93\u51fa\u529f\u80fd\u3002<br><strong>\u914d\u7f6eMTDI\u8f93\u51fa\u9ad8\u7535\u5e73<\/strong><br>GPIO_OUTPUT_SET(GPIO_ID_PIN(12), 1);<br><strong>\u914d\u7f6eMTDI\u8f93\u51fa\u4f4e\u7535\u5e73<\/strong><br>GPIO_OUTPUT_SET(GPIO_ID_PIN(12), 0);<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">2.2 GPIO\u8f93\u5165<\/h2>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>GPIO\u8f93\u5165\u76f8\u5173\u5b8f\uff1a<br>GPIO_DIS_OUTPUT(gpio_no)<br>GPIO_INPUT_GET(gpio_no)<\/strong><\/p><\/blockquote>\n\n\n\n<p>\u4ee58266\u7684MTDI\u4e3a\u4f8b\uff0c\u8bf4\u660eGPIO\u8f93\u5165\u529f\u80fd\u3002<br><strong>\u914d\u7f6eMTDI\u4e3a\u8f93\u5165\u6a21\u5f0f<\/strong><br>GPIO_DIS_OUTPUT(GPIO_ID_PIN(12));<br><strong>\u83b7\u53d6MTDI\u7ba1\u811a\u7684\u7535\u5e73\u72b6\u6001<\/strong><br>Uint8 level=0;<br>level=GPIO_INPUT_GET(GPIO_ID_PIN(12))\uff1b<br>\u5982\u679cMTDI\u7684\u7535\u5e73\u4e3a\u9ad8\u7535\u5e73\uff0c\u90a3\u4e48GPIO_INPUT_GET\u7684\u8fd4\u56de\u503c\u4e3a1\uff0c level=1;<br>\u5982\u679cMTDI\u7684\u7535\u5e73\u4e3a\u4f4e\u7535\u5e73\uff0c\u90a3\u4e48GPIO_INPUT_GET\u7684\u8fd4\u56de\u503c\u4e3a0\uff0c level=0;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">2.3 GPIO\u4e0a\u62c9<\/h2>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>GPIO\u8f93\u5165\u76f8\u5173\u5b8f\uff1a<br>PIN_PULLUP_EN(PIN_NAME)<br>PIN_PULLUP_DIS(PIN_NAME)<\/strong><\/p><\/blockquote>\n\n\n\n<p>\u4ee58266\u7684MTDI\u4e3a\u4f8b\uff0c\u8bf4\u660eGPIO\u4e0a\u62c9\u529f\u80fd\u3002<br><strong>\u5f00\u542f\u4e0a\u62c9<\/strong><br>PIN_PULLUP_EN(PERIPHS_IO_MUX_MTDI_U);<br>\u8be5\u8bed\u53e5\u4f5c\u7528\u662f\u5411PERIPHS_IO_MUX_MTDI_U\u7684\u7b2c7\u4f4d\u51991\u3002\u8be5\u4f4d\u7f6e1\u8868\u793a\u4f7f\u80fdMTDI\u7684\u4e0a\u62c9\u529f\u80fd\u3002<br><strong>\u5173\u95ed\u4e0a\u62c9<\/strong><br>PIN_PULLUP_DIS(PERIPHS_IO_MUX_MTDI_U);<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">\u4e09\u3001GPIO\u4e2d\u65ad<\/h1>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>GPIO\u4e2d\u65ad\u76f8\u5173\u5b8f\uff1a<br>ETS_GPIO_INTR_ENABLE() \/\/\u5f00 GPIO \u4e2d\u65ad<br>ETS_GPIO_INTR_DISABLE() \/\/\u5173 GPIO \u4e2d\u65ad<br>ETS_GPIO_INTR_ATTACH(func, arg) \/\/\u6ce8\u518c GPIO \u4e2d\u65ad\u5904\u7406\u51fd\u6570<\/strong><\/p><\/blockquote>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>GPIO\u4e2d\u65ad\u76f8\u5173\u51fd\u6570\uff1agpio_pin_intr_state_set<\/strong><\/p><\/blockquote>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"\/\/upload-images.jianshu.io\/upload_images\/6793005-5f0914f3f1647c69.png?imageMogr2\/auto-orient\/strip|imageView2\/2\/w\/720\" alt=\"\"\/><\/figure>\n\n\n\n<p>gpio_pin_intr_state_set<\/p>\n\n\n\n<p>\u4f5c\u8005\uff1aLeung_ManWah<br>\u94fe\u63a5\uff1a<a href=\"https:\/\/www.jianshu.com\/p\/ec424a87ded0\" target=\"_blank\" rel=\"noreferrer noopener\" rel=\"nofollow\" >https:\/\/www.jianshu.com\/p\/ec424a87ded0<\/a><br>\u6765\u6e90\uff1a\u7b80\u4e66<br>\u8457\u4f5c\u6743\u5f52\u4f5c\u8005\u6240\u6709\u3002\u5546\u4e1a\u8f6c\u8f7d\u8bf7\u8054\u7cfb\u4f5c\u8005\u83b7\u5f97\u6388\u6743\uff0c\u975e\u5546\u4e1a\u8f6c\u8f7d\u8bf7\u6ce8\u660e\u51fa\u5904\u3002<\/p>\n<button class=\"simplefavorite-button\" data-postid=\"710\" data-siteid=\"1\" data-groupid=\"1\" data-favoritecount=\"0\" style=\"\">\u6536\u85cf <i class=\"sf-icon-star-empty\"><\/i><\/button>","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001GPIO\u529f\u80fd\u9009\u62e9 GPIO \u76f8\u5173\u63a5\u53e3\u4f4d\u4e8e \/ESP8266_NONOS_SDK\/include\/eagle_soc.h\u548cgpi &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,10],"tags":[],"class_list":["post-710","post","type-post","status-publish","format-standard","hentry","category-arduino","category-10"],"_links":{"self":[{"href":"https:\/\/www.iotch.xyz\/index.php?rest_route=\/wp\/v2\/posts\/710","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.iotch.xyz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.iotch.xyz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.iotch.xyz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.iotch.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=710"}],"version-history":[{"count":0,"href":"https:\/\/www.iotch.xyz\/index.php?rest_route=\/wp\/v2\/posts\/710\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.iotch.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=710"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.iotch.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=710"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.iotch.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=710"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}