<?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>Proper use of DTS files to describe GPIOs in Zephyr?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/87298/proper-use-of-dts-files-to-describe-gpios-in-zephyr</link><description>I started off my project with the Zigbee light_bulb sample, and I added some new functionality that needs to manipulate various GPIOs. These GPIOs are neither buttons/keys nor LEDs. I added the definitions to $PROJECT_DIR/boards/nrf52840dongle_nrf52840</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 27 Apr 2022 08:54:41 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/87298/proper-use-of-dts-files-to-describe-gpios-in-zephyr" /><item><title>RE: Proper use of DTS files to describe GPIOs in Zephyr?</title><link>https://devzone.nordicsemi.com/thread/365126?ContentTypeID=1</link><pubDate>Wed, 27 Apr 2022 08:54:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:380b86ba-0caf-4da8-9c64-10e579d94fa9</guid><dc:creator>Einarh</dc:creator><description>&lt;p&gt;2. hm, the only thing I can think of is that Segger might define DTC_OVERLAY_FILE for you, since the build system won&amp;#39;t keep looking for an overlay file if this variable is defined. As I said I would try to add your overlay file to DTC_OVERLAY_FILE.&lt;/p&gt;
&lt;p&gt;3. I don&amp;#39;t think there&amp;#39;s a straight forward way to use &amp;quot;gpiocus_0&amp;quot; instead of &amp;quot;gpiocus0&amp;quot; to access your node, but you can look through the Devicetree API to see if you find a function that suits your needs. As I said you can input the label property, which you can name whatever you want, directly into the device_get_binding function if you find that cleaner.&lt;/p&gt;
&lt;p&gt;-Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Proper use of DTS files to describe GPIOs in Zephyr?</title><link>https://devzone.nordicsemi.com/thread/365020?ContentTypeID=1</link><pubDate>Tue, 26 Apr 2022 17:02:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e1a5c61a-83e0-4288-a9e8-f2f3068f2123</guid><dc:creator>mytzyiay</dc:creator><description>&lt;p&gt;For #2: the build system normally does detect overlays under boards/, but that doesn&amp;#39;t work under Segger.&amp;nbsp; Maybe I&amp;#39;m importing the project incorrectly?&lt;/p&gt;
&lt;p&gt;For #3: is there a way I can omit the &amp;quot;gpiocus0&amp;quot; label entirely and just reference &amp;quot;gpiocus_0&amp;quot; from the C code?&amp;nbsp; It&amp;#39;s annoying having two slightly different names pointing to the same node -- an unnecessary layer of abstraction (at least in my use case).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Proper use of DTS files to describe GPIOs in Zephyr?</title><link>https://devzone.nordicsemi.com/thread/364941?ContentTypeID=1</link><pubDate>Tue, 26 Apr 2022 12:11:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1c35636a-48e2-43cb-be20-12415bf15470</guid><dc:creator>Einarh</dc:creator><description>&lt;p&gt;Hello&lt;/p&gt;
&lt;p&gt;1. The &lt;a href="http://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/guides/dts/intro.html#important-properties"&gt;&lt;em&gt;compatible&lt;/em&gt; property&lt;/a&gt; is there to help the build system find the right binding for the hardware node. If you only want to define a basic gpio input, then the &amp;quot;gpio-keys&amp;quot; binding is the most basic binding you&amp;#39;ll get and works just fine. Otherwise, there are many bindings defined in dts/bindings/gpio/ in your Zephyr install, among them &amp;quot;nordic, nrf-gpio&amp;quot;, maybe that could work for your application? I would recommend having a look at these binding define files to get an idea of how they differ. You could also define your own binding, but unless you want very specific functionality that isn&amp;#39;t available in the already defined ones, I don&amp;#39;t think it will be necessary.&lt;/p&gt;
&lt;p&gt;2. This sounds strange to me, the build system should be able to detect overlay files in the boards/ directory. You could try to set the CMake variable DTC_OVERLAY_FILE manually to contain your overlay file as described&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/guides/dts/howtos.html#set-devicetree-overlays"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;3. Yes, there are many helper functions in&amp;nbsp;&lt;a href="http://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/reference/devicetree/api.html"&gt;Zephyr&amp;#39;s Devicetree API&lt;/a&gt;&amp;nbsp;that you can use to obtain the node identifier. For your node you could for example use DT_NODELABEL(gpiocus0). You can also input the label property directly into the device_get_binding function, in your case device_get_binding(&amp;quot;Custom gpio 28&amp;quot;) I believe. The aliases are commonly used just to make the code more readable.&lt;/p&gt;
&lt;p&gt;4. Yes this is a good point, many newcomers to Zephyr seem to have trouble with the devicetree.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>