<?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>add or remove button in overlay file</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/85854/add-or-remove-button-in-overlay-file</link><description>Hi, 
 
 Using VisualStudioCode/NRF Connect: Im looking into the sample &amp;#39;button&amp;#39;. (this because i like to add GPIO-pins to connect to an interrupt) 
 In the button example an interrupt means is used on a button, so thats fine. 
 Now i would like to add</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 18 Mar 2022 12:56:30 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/85854/add-or-remove-button-in-overlay-file" /><item><title>RE: add or remove button in overlay file</title><link>https://devzone.nordicsemi.com/thread/358867?ContentTypeID=1</link><pubDate>Fri, 18 Mar 2022 12:56:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:99758e5b-1d20-4bc4-b8ac-74cf77c23e80</guid><dc:creator>TF mulder</dc:creator><description>&lt;p&gt;Ok clear,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks for the help.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: add or remove button in overlay file</title><link>https://devzone.nordicsemi.com/thread/358856?ContentTypeID=1</link><pubDate>Fri, 18 Mar 2022 12:44:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:70763972-bb1b-461f-beb3-c6eaab21c8c1</guid><dc:creator>Priyanka</dc:creator><description>&lt;p&gt;So if you wish to disable a button, you could try disabling the gpio pin assigned to the buttons. This can be don in the overlay file.&lt;/p&gt;
&lt;p&gt;Take a look at the &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fug_nrf5340_dk%2FUG%2Fdk%2Fhw_buttons_leds.html&amp;amp;cp=3_0_4_3_6"&gt;Buttons and LEDs&lt;/a&gt; for the nRF5340DK. Also, if you wish to use those gpio pins, I think you might have to physically remove the buttons maybe. But there are a lot of other gpio pins &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f603.svg" title="Smiley"&gt;&amp;#x1f603;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;-Priyanka&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: add or remove button in overlay file</title><link>https://devzone.nordicsemi.com/thread/358837?ContentTypeID=1</link><pubDate>Fri, 18 Mar 2022 11:47:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ba93a2c8-7dc1-44a6-a05d-0cf6b42f3b9c</guid><dc:creator>TF mulder</dc:creator><description>&lt;p&gt;Ah Ok..,&amp;nbsp; &amp;nbsp;yes a gpio-pin of a button i would like to use for something else&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: add or remove button in overlay file</title><link>https://devzone.nordicsemi.com/thread/358831?ContentTypeID=1</link><pubDate>Fri, 18 Mar 2022 11:24:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7b2fa072-449c-4087-a0c7-dce625234fe9</guid><dc:creator>Priyanka</dc:creator><description>&lt;p&gt;Why do you wish to disable the button? Do you want to use the gpio pin assigned to the button?&lt;/p&gt;
&lt;p&gt;-Priyanka&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: add or remove button in overlay file</title><link>https://devzone.nordicsemi.com/thread/358820?ContentTypeID=1</link><pubDate>Fri, 18 Mar 2022 10:39:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dd212e37-b0d4-4092-80ed-abb2b29fb940</guid><dc:creator>TF mulder</dc:creator><description>&lt;p&gt;Thank you Priyanka,&lt;/p&gt;
&lt;p&gt;That works.&lt;/p&gt;
&lt;p&gt;And what if i would like to remove one of the 4- original buttons,&amp;nbsp; &amp;nbsp;is it possible to remove a button with the overlay file ?&amp;nbsp; &amp;nbsp; (or disable a button)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best Regards,&lt;/p&gt;
&lt;p&gt;Theo&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: add or remove button in overlay file</title><link>https://devzone.nordicsemi.com/thread/358637?ContentTypeID=1</link><pubDate>Thu, 17 Mar 2022 12:21:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4bd6d8fd-0ee2-4796-b3e2-7cc034b05f93</guid><dc:creator>Priyanka</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You should be able to define more buttons similar to how the other 4 buttons are defines in the &lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/main/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts#L52"&gt;devicetree&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;For eg,&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;
button5: button_5 {
               gpios = &amp;lt;&amp;amp;gpio0 PIN_NUMBER (GPIO_PULL_UP | GPIO_ACTIVE_LOW)&amp;gt;;
               label = &amp;quot;Push button switch 5&amp;quot;;
                  };
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Priyanka&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: add or remove button in overlay file</title><link>https://devzone.nordicsemi.com/thread/358277?ContentTypeID=1</link><pubDate>Tue, 15 Mar 2022 16:09:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2f447635-c944-4cad-9e24-60e6b9763e6f</guid><dc:creator>TF mulder</dc:creator><description>&lt;p&gt;Hi Priyanka,&lt;/p&gt;
&lt;p&gt;Thanks for the answer.&lt;/p&gt;
&lt;p&gt;But it is not exactly what I mean,&amp;nbsp; &amp;nbsp;I would like to use MORE then 4 buttons , so lets say adding a 5-th button. Can that be done in the overlay file ?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best Regards,&lt;/p&gt;
&lt;p&gt;Theo&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: add or remove button in overlay file</title><link>https://devzone.nordicsemi.com/thread/358274?ContentTypeID=1</link><pubDate>Tue, 15 Mar 2022 15:38:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:31396d95-bb72-41a4-9431-07b77da8f226</guid><dc:creator>Priyanka</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;As you can see, in the code, only one button is used. So if you need to add more buttons, you will have to do the change in the &lt;em&gt;main.c&lt;/em&gt; first.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In the &lt;em&gt;dts&lt;/em&gt; file, the &lt;strong&gt;sw0&lt;/strong&gt; is set to &lt;strong&gt;button0&lt;/strong&gt;, &lt;strong&gt;sw1&lt;/strong&gt; is set to &lt;strong&gt;button1&lt;/strong&gt; and so on.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1647358459756v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;So you will just have to add more &lt;em&gt;sw&lt;/em&gt; nodes in the main.c&lt;/p&gt;
&lt;p&gt;But if you need to make a change, say, change the current button to button1, you can write that in the overlay file.&lt;/p&gt;
&lt;p&gt;For eg, now you get the output at button0 and if you want that in button1, you can create the following overlay file:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/{

aliases {
		sw0 = &amp;amp;button1;
		
	};

};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;More information about writing the overlay file can be found in the &lt;a href="https://docs.zephyrproject.org/latest/guides/dts/howtos.html"&gt;Devicetree HOWTOs of Zephyr&lt;/a&gt;.&lt;a href="https://docs.zephyrproject.org/latest/guides/dts/howtos.html"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Priyanka&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>