<?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>Clarification on button handling via interrupts on the nrf5280 DK</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/72237/clarification-on-button-handling-via-interrupts-on-the-nrf5280-dk</link><description>Hello everyone, 
 I am simply looking for some clarification on how to correctly handle button presses on the nrf52840 DK, as there seems to be multiple ways to go about it, and I am interested in reducing power usage of the device as much as possible</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 04 Mar 2021 10:09:11 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/72237/clarification-on-button-handling-via-interrupts-on-the-nrf5280-dk" /><item><title>RE: Clarification on button handling via interrupts on the nrf5280 DK</title><link>https://devzone.nordicsemi.com/thread/297725?ContentTypeID=1</link><pubDate>Thu, 04 Mar 2021 10:09:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:67ebaacb-08fe-4609-9178-3a376f5bac45</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Hi Torossian&lt;/p&gt;
[quote user=""]1. The GPIOTE library is the core library that is responsible for setting up interrupts for the inputs/outputs on the board, and linking them with a button handler.[/quote]
&lt;p&gt;&amp;nbsp;Yes, GPIOTE library is responsible for the button interrupt sensing.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]2. The GPIOTE library can be used directly, or accessed through the abstraction libraries app_button and bsp_buttons.[/quote]
&lt;p&gt;&amp;nbsp;That is correct. But the button libraries have some debounce timers that you can ignore if you do not want to debounce to be considered for your buttons.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]3. While the app_button library uses the app_timer library to implement a debounce - with the example code using a 50ms timer, the bsp library (which is used in the Zigbee light switch examples) implements debouncing by making use of the&amp;nbsp;&lt;em&gt;ZB_SCHEDULE_APP_ALARM&amp;nbsp;&lt;/em&gt;function to call the button_handler after a 50ms delay.[/quote]
&lt;p&gt;I am not a Zigbee expert, so I cannot comment on this.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]The last one is perhaps the most important question, as the existing bsp button handler code is perfect for out application, but only on the condition that it properly implements debouncing. If it does NOT implement debouncing or I have misunderstood the nature of the library, would that mean I would have to refactor the bsp code to use app_button instead?[/quote]
&lt;p&gt;&lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v17.0.2%2Flib_bsp.html&amp;amp;cp=7_1_3_6"&gt;BSP library&lt;/a&gt;&amp;nbsp;is more suited if you are using BLE/ANT, since the buttons and LEDS are linked to some radio activity like disconnect/connect/advertise. If you intend to use buttons in a more generic way, then app_button library seems better choice in this case.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>