<?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>about button long press and short press detect</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/16258/about-button-long-press-and-short-press-detect</link><description>Hi, I want to detect long and short press in same button. Define &amp;quot;BUTTON_DETECTION_DELAY&amp;quot; can detect one delay. Let me know to detect more than two delays. 
 The same question closed as &amp;quot;the question is answered, right answer was accepted&amp;quot; by Petter</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 08 Sep 2016 22:16:43 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/16258/about-button-long-press-and-short-press-detect" /><item><title>RE: about button long press and short press detect</title><link>https://devzone.nordicsemi.com/thread/62138?ContentTypeID=1</link><pubDate>Thu, 08 Sep 2016 22:16:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0331d799-6e4c-45d1-a507-5f0cfa700af5</guid><dc:creator>Roger Clark</dc:creator><description>&lt;p&gt;Just to add a little to Ole&amp;#39;s answer&lt;/p&gt;
&lt;p&gt;You will still need to debounce the button.&lt;/p&gt;
&lt;p&gt;Just starting a timer when you get an external interrupt when the button has changed, will suffer from debounce and you code will keep telling you that you have a short press.&lt;/p&gt;
&lt;p&gt;You first need to debounce the button and only start the app_timer when the button is in a stable &amp;quot;Pushed&amp;quot; state&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: about button long press and short press detect</title><link>https://devzone.nordicsemi.com/thread/62132?ContentTypeID=1</link><pubDate>Thu, 08 Sep 2016 21:52:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:60dd8561-e84f-4567-b08a-88a6eef75e04</guid><dc:creator>gortok</dc:creator><description>&lt;p&gt;I&amp;#39;ve written an answer here: &lt;a href="https://devzone.nordicsemi.com/question/68412/recording-time-for-which-the-button-is-pressed/#68415"&gt;devzone.nordicsemi.com/.../&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: about button long press and short press detect</title><link>https://devzone.nordicsemi.com/thread/62137?ContentTypeID=1</link><pubDate>Thu, 08 Sep 2016 15:05:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2bb7f936-a5cf-42e3-ba10-dc28d3ba7350</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;Regarding &lt;a href="https://devzone.nordicsemi.com/question/94100/request-an-example-about-one-button-long-press-and-short-press/"&gt;this&lt;/a&gt; question:&lt;/p&gt;
&lt;p&gt;The only example that shows long press and short press is the bsp module in the latest SDK. For example see bsp_button_event_handler(..) in bsp.c in SDK12. This uses more or less the same technique as I described in my answer (app_timer_start/app_timer_stop).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: about button long press and short press detect</title><link>https://devzone.nordicsemi.com/thread/62136?ContentTypeID=1</link><pubDate>Thu, 08 Sep 2016 14:56:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3ded7e39-0de2-4449-a6ee-3a0a43e71040</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/question/60033/button-interrupt-problem-when-booting/?answer=60480#post-id-60480"&gt;Here&lt;/a&gt; is an example on app_button alone (no short or long press detection).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: about button long press and short press detect</title><link>https://devzone.nordicsemi.com/thread/62135?ContentTypeID=1</link><pubDate>Thu, 08 Sep 2016 14:53:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:259cb8b5-fcc0-42e6-9722-13dd016c3a09</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;As Roger said the &lt;code&gt;BUTTON_DETECTION_DELAY&lt;/code&gt; is intended for debouncing delay which is used to ensure that the input level is stable before reading the value (do a search on google on &amp;quot;button debouncing&amp;quot; for more info about debouncing).&lt;/p&gt;
&lt;p&gt;If you intend to distinguish between short press and long press you should use app_timer. For example start a timer with a certain timeout when the button is pushed and stop it when the button is released. If the timer has timed out it is a short push, if it has timed out it is a long push.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: about button long press and short press detect</title><link>https://devzone.nordicsemi.com/thread/62131?ContentTypeID=1</link><pubDate>Thu, 08 Sep 2016 14:36:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3ed2215a-ef2a-4ccd-8005-fc4e5dba90bd</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;Can&amp;#39;t find any closed question from Sep 25 &amp;#39;14 related to this topic, what was the title or which topic was the question about?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: about button long press and short press detect</title><link>https://devzone.nordicsemi.com/thread/62134?ContentTypeID=1</link><pubDate>Thu, 08 Sep 2016 11:29:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2116c592-037a-4c6c-bd15-9cda6fb6b6e0</guid><dc:creator>Roger Clark</dc:creator><description>&lt;p&gt;The definition you are referring to appears to be used by the call to app_button_init()&lt;/p&gt;
&lt;p&gt;This uses a timer to debounce one or more buttons&lt;/p&gt;
&lt;p&gt;If you want to have different debounce times, you could use multiple timers, but this seems somewhat wasteful, or you could just write your own debounce function&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: about button long press and short press detect</title><link>https://devzone.nordicsemi.com/thread/62133?ContentTypeID=1</link><pubDate>Wed, 07 Sep 2016 12:56:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:192d7649-02e9-4d5c-9d03-345e69a8e67c</guid><dc:creator>ehitil</dc:creator><description>&lt;p&gt;nrf51822 qfaa sdk use 7.3&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>