<?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>Button release and button press event</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/14494/button-release-and-button-press-event</link><description>I am using the ble_uart_app on the dev kit with the nrf52. SDK version 11.0.0. How do I get the bsp_event_handler to get fired on a button release and button push event and not just a BSP_EVENT_KEY_X. Thanks!</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 16 Jun 2016 08:52:18 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/14494/button-release-and-button-press-event" /><item><title>RE: Button release and button press event</title><link>https://devzone.nordicsemi.com/thread/55325?ContentTypeID=1</link><pubDate>Thu, 16 Jun 2016 08:52:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8bbb601c-e1cc-41b5-9500-fe6a74b4864f</guid><dc:creator>&amp;#216;yvind Karlsen</dc:creator><description>&lt;p&gt;Alternately Ole recommends using app_button in his &lt;a href="https://devzone.nordicsemi.com/question/60033/button-interrupt-problem-when-booting/"&gt;answer here&lt;/a&gt;. The BSP implementation is relatively simple, so for your application it might end up being easier to write it youself.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Button release and button press event</title><link>https://devzone.nordicsemi.com/thread/55324?ContentTypeID=1</link><pubDate>Thu, 16 Jun 2016 08:50:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ba28686d-24d1-441f-ab18-e7be0ec7b64d</guid><dc:creator>&amp;#216;yvind Karlsen</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The most elegant way is to modify bsp.h to include the events you want. Adding BSP_EVENT_KEY_0_RELEASE, BSP_EVENT_KEY_0_LONGPUSH etc. to the enumeration definition for bsp_event_t.&lt;/p&gt;
&lt;p&gt;By the way the button number is defined a bit oddly so be aware of this, to assign an event to the release event of button 1 on the nRF52 devkit I call&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;bsp_event_to_button_action_assign(0, BSP_BUTTON_ACTION_RELEASE, BSP_EVENT_KEY_0_RELEASE)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For button 2 I call:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;bsp_event_to_button_action_assign(1, BSP_BUTTON_ACTION_RELEASE, BSP_EVENT_KEY_1_RELEASE)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Øyvind&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Button release and button press event</title><link>https://devzone.nordicsemi.com/thread/55323?ContentTypeID=1</link><pubDate>Wed, 15 Jun 2016 19:25:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aec5e39a-39c2-4434-9639-88a73d12bc23</guid><dc:creator>chrishansen</dc:creator><description>&lt;p&gt;Thanks! Didn&amp;#39;t notice that function in the BSP. Now that I can add BSP_BUTTON_ACTION_RELEASE to BSP_EVENT_KEY_0 (it already has the BSP_BUTTON_ACTION_PUSH assigned in the list) what is the recommended way to determine what ACTION triggered the BSP_EVENT_KEY_0 handler?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Button release and button press event</title><link>https://devzone.nordicsemi.com/thread/55322?ContentTypeID=1</link><pubDate>Wed, 15 Jun 2016 13:23:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b795585f-4105-4892-8570-e241d201477b</guid><dc:creator>&amp;#216;yvind Karlsen</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You can assign different actions to events by calling&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;uint32_t bsp_event_to_button_action_assign	(uint32_t button, bsp_button_action_t action, bsp_event_t event)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For example&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;bsp_event_to_button_action_assign(number, BSP_BUTTON_ACTION_RELEASE, BSP_EVENT_KEY_0);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Øyvind&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>