<?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>Reading GPIO with NRFX</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/72882/reading-gpio-with-nrfx</link><description>In Nordic&amp;#39;s Zephyr fork (sdk-zephyr) there&amp;#39;s this GPIO driver function: 
 
 
 I don&amp;#39;t think this is the entire story of querying GPIOs, though. This appears to only query the *input* GPIOs via IN, and does not read the current state of any *output* GPIOs</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 24 Mar 2021 15:05:47 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/72882/reading-gpio-with-nrfx" /><item><title>RE: Reading GPIO with NRFX</title><link>https://devzone.nordicsemi.com/thread/301728?ContentTypeID=1</link><pubDate>Wed, 24 Mar 2021 15:05:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:679a5f70-0a8c-4fd4-b3bd-e1be143bc234</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;I asked internally and got some answers:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;em&gt;&amp;quot;&lt;/em&gt;&lt;em&gt;That&amp;#39;s the way the GPIO API is defined in Zephyr. The functions &lt;code&gt;gpio_port_get*()&lt;/code&gt; and &lt;code&gt;gpio_pin_get*()&lt;/code&gt; return the state of &lt;strong&gt;input&lt;/strong&gt; pins (previously, when &lt;code&gt;gpio_pin_read()&lt;/code&gt; was available, it was described as reading &amp;quot;the data value of a single pin&amp;quot; or &amp;quot;the input state of a pin&amp;quot;). I don&amp;#39;t remember now why it was decided so when the API was reworked, but I think it could be because for some devices returning the values written to outputs might be not so straightforward as it is for nRF chips and actually the module that uses the GPIO API can store the values that is sets to outputs, if that&amp;#39;s needed, so the driver .&lt;/em&gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;em&gt;It is possible (not for all devices, but for nRF chips it is) to configure a pin as both input and output (to use &lt;code&gt;GPIO_INPUT | GPIO_OUTPUT&lt;/code&gt; in flags). Then those getting functions will return the actual state of the output pin, what normally should be what was set for that pin (unless something else is somehow able to force a different state of this pin).&lt;/em&gt;&lt;em&gt;&amp;quot;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading GPIO with NRFX</title><link>https://devzone.nordicsemi.com/thread/300225?ContentTypeID=1</link><pubDate>Tue, 16 Mar 2021 18:40:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9030a39e-227c-48c6-be37-3fa6d1eb01ec</guid><dc:creator>erik.johnson</dc:creator><description>&lt;p&gt;I actually might be wrong about the responsibility of the Zephyr driver interface after all:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/**
 * @brief Get logical level of all input pins in a port.
 ...&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Is there just no longer any way to query the state of an output pin using Zephyr&amp;#39;s drivers anymore? We used to have APIs for that in v2.1, but v2.4 doesn&amp;#39;t appear to have any method for querying an output pin any longer, only input pins.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>