<?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>How to create double push button interrupt on NRF51DK</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/14242/how-to-create-double-push-button-interrupt-on-nrf51dk</link><description>Hello Everyone, 
 I wrote the simple software for long push 3 sec and long long push for 5 sec and it is working fine as expected but can anyone suggest me how to create simple logic for double push button interrupt because am trying to create those</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 02 Jun 2016 12:13:34 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/14242/how-to-create-double-push-button-interrupt-on-nrf51dk" /><item><title>RE: How to create double push button interrupt on NRF51DK</title><link>https://devzone.nordicsemi.com/thread/54395?ContentTypeID=1</link><pubDate>Thu, 02 Jun 2016 12:13:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:60b9c098-3732-4f92-aa0b-ec5af2b8591b</guid><dc:creator>MARTIN FR</dc:creator><description>&lt;p&gt;thank you for your kind suggestions and i will try like your idea&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create double push button interrupt on NRF51DK</title><link>https://devzone.nordicsemi.com/thread/54394?ContentTypeID=1</link><pubDate>Thu, 02 Jun 2016 12:09:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b8c18747-e122-4817-823b-3343f79c6b70</guid><dc:creator>Jorge</dc:creator><description>&lt;p&gt;So I think the easy way is to put a flag when you press one time to true, but before this put a if(flag) call your function.&lt;/p&gt;
&lt;p&gt;If you want to have a time to press the second time, like only call your function if you press the same button 2 times within 5 seconds. After putting the flag to true you should start a timer with 5 seconds, and on the time handler when it finishes to put the flag = false. this way if you press within 5 seconds your function is called, if you press 2 times with 6 seconds apart then nothing happens.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create double push button interrupt on NRF51DK</title><link>https://devzone.nordicsemi.com/thread/54393?ContentTypeID=1</link><pubDate>Thu, 02 Jun 2016 11:51:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7338f72a-94fb-4ce9-b63d-2ac61d29e6b9</guid><dc:creator>MARTIN FR</dc:creator><description>&lt;p&gt;am using similar to second case push two times in a row continuously&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create double push button interrupt on NRF51DK</title><link>https://devzone.nordicsemi.com/thread/54392?ContentTypeID=1</link><pubDate>Thu, 02 Jun 2016 11:16:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8f949049-6312-47a0-87ee-71f583ff1236</guid><dc:creator>Jorge</dc:creator><description>&lt;p&gt;by a flag I mean a variable that you state true when the case you want happens, and then on the main function you just scan for this flag and start the functions you want. But which of the two is your case?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create double push button interrupt on NRF51DK</title><link>https://devzone.nordicsemi.com/thread/54391?ContentTypeID=1</link><pubDate>Thu, 02 Jun 2016 10:52:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fdf611ab-a686-4b74-b64f-1133862bff8a</guid><dc:creator>MARTIN FR</dc:creator><description>&lt;p&gt;Thank you so much for your kind reply i am using SDK10, and Sotdevice 110 you mean i have use flags on both button handler and timer handler?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create double push button interrupt on NRF51DK</title><link>https://devzone.nordicsemi.com/thread/54390?ContentTypeID=1</link><pubDate>Thu, 02 Jun 2016 09:53:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5a11ef49-d6e0-4e68-b61d-4143953e5a09</guid><dc:creator>Jorge</dc:creator><description>&lt;p&gt;what you mean by double push? do you mean push two buttons, or push the button two times in a row?&lt;/p&gt;
&lt;p&gt;If it&amp;#39;s the first case, you can put a flag on your button press handler and do what you want if both flags are on.&lt;/p&gt;
&lt;p&gt;For the second case you can put a flag on your button handler and start a timer, then on the timer handler another flag signaling the end of the time for the double push, and if you press the button inside the time you configured on the timer (so, without setting the flag of the timer) you go to the function you want to execute.&lt;/p&gt;
&lt;p&gt;You also should say which softevice and SDK you are using;)&lt;/p&gt;
&lt;p&gt;Hope this helps,&lt;/p&gt;
&lt;p&gt;Jorge Costa&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>