ESP8266 Developer Zone The Official ESP8266 Forum 2015-09-22T23:13:46+08:00 https://bbs.espressif.com:443/feed.php?f=7&t=1140 2015-09-22T23:13:46+08:00 2015-09-22T23:13:46+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1140&p=3806#p3806 <![CDATA[Re: Determine direction of GPIO pin]]>
kolban wrote:
[...]is there a way to determine the current input and output direction of a given pin?
The "direction" register is at offset 0x0c, given by GPIO_ENABLE_ADDRESS. The value resulting from GPIO_REG_READ(GPIO_ENABLE_ADDRESS) will have 1s in bit positions corresponding to pins that are outputs. This assumes, of course, that the IO MUX is set for the bit to be a GPIO.

Statistics: Posted by dkinzer — Tue Sep 22, 2015 11:13 pm


]]>
2015-09-22T20:55:55+08:00 2015-09-22T20:55:55+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1140&p=3803#p3803 <![CDATA[Re: Determine direction of GPIO pin]]> Thanks for the response. I looked at GPIO_PIN_CONFIG_GET(x) and it appears to be an expression evaluation. Do you know of any docs on how to use these functions? I have a feeling that the methods I have been using (such as gpio_output_set and gpio_input_get) are high level wrappers and the functions in eagle_soc.h are lower level. If I can learn how these work, I'll write them up for the community.

Neil

Statistics: Posted by kolban — Tue Sep 22, 2015 8:55 pm


]]>
2015-09-22T15:23:59+08:00 2015-09-22T15:23:59+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1140&p=3800#p3800 <![CDATA[Re: Determine direction of GPIO pin]]> Statistics: Posted by tve — Tue Sep 22, 2015 3:23 pm


]]>
2015-09-22T11:42:32+08:00 2015-09-22T11:42:32+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1140&p=3797#p3797 <![CDATA[Determine direction of GPIO pin]]>
For example, if I want to know whether GPIO0 is an input or an output pin ... is that possible?

Statistics: Posted by kolban — Tue Sep 22, 2015 11:42 am


]]>