<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Devicetree GPIO direction</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/82331/devicetree-gpio-direction</link><description>Hello, is it possible to set gpio direction (input/output) from devicetree? 
 I haven&amp;#39;t found any gpio flags to do this in the gpio.h located in dt-bindings folder.</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 02 Dec 2021 14:22:02 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/82331/devicetree-gpio-direction" /><item><title>RE: Devicetree GPIO direction</title><link>https://devzone.nordicsemi.com/thread/341726?ContentTypeID=1</link><pubDate>Thu, 02 Dec 2021 14:22:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f6317350-d61c-4458-9502-1807a3df9684</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;There is no property for this in the binding for nRF GPIO, as you can see here:&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.7.1/zephyr/reference/devicetree/bindings/gpio/nordic,nrf-gpio.html"&gt;nordic,nrf-gpio&lt;/a&gt;. It should be possible to have a property to indicate this, and you can see cases of something&amp;nbsp;similar with&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.7.1/zephyr/reference/devicetree/bindings/gpio/litex,gpio.html"&gt;litex,gpio&lt;/a&gt;&amp;nbsp;where they indicate that the port is output, or&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.7.1/zephyr/reference/devicetree/bindings/gpio/xlnx,xlnx,xps-gpio-1.00.a.html"&gt;xlnx,xps-gpio-1.00.a&lt;/a&gt;&amp;nbsp;where they have properties to indicate whether all GPIOs are input or output.&amp;nbsp;However, you&amp;nbsp;would not be able to use nordic,nrf-gpio&amp;nbsp;with this, so you would have to create your own node.&lt;/p&gt;
&lt;p&gt;This will not actually configure or set the pin as input or output.&amp;nbsp;You would have to get the property from the devicetree and then use it as an input when you configure the pin with&amp;nbsp;gpio_pin_configure(). It would be simpler to just directly set it when configuring it with&amp;nbsp;gpio_pin_configure() instead of going through devicetree.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>