<?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 normal press and long press detect</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/44322/button-normal-press-and-long-press-detect</link><description>Hi, 
 I need some clarification about how to differentiate the normal press and long press detect for a single button to assign awake and sleep mode. 
 I am using nRF52832 SDK15.3 in segger embedded studio . 
 Is there any predefined code for sleep and</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 07 Mar 2019 12:20:23 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/44322/button-normal-press-and-long-press-detect" /><item><title>RE: Button normal press and long press detect</title><link>https://devzone.nordicsemi.com/thread/174797?ContentTypeID=1</link><pubDate>Thu, 07 Mar 2019 12:20:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:14deb626-2269-452d-8d30-60fac84babbb</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;It either means that the chip does not enter sleep because it is in debug interface mode, or that you have a pin that wakes it up again as soon as it goes to sleep. In other words, you need to test this without having the debugger attached, and go over your pin configurations.&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Button normal press and long press detect</title><link>https://devzone.nordicsemi.com/thread/174697?ContentTypeID=1</link><pubDate>Thu, 07 Mar 2019 04:40:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6d5b8445-6913-4dfb-95f5-43dfdad375f2</guid><dc:creator>Sunil vignesh</dc:creator><description>&lt;p&gt;Vidar Are you there?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Button normal press and long press detect</title><link>https://devzone.nordicsemi.com/thread/174186?ContentTypeID=1</link><pubDate>Tue, 05 Mar 2019 09:18:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5e5ea65f-4e5c-4a41-8ba4-7d70e6a587cb</guid><dc:creator>Sunil vignesh</dc:creator><description>&lt;p&gt;Coming back to your code which you given from the link&lt;/p&gt;
&lt;p&gt;i changed the value as&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;#define USE_BSP 1&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;and&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void bsp_event_handler(bsp_event_t event)
{
    uint32_t err_code;
    switch (event)
    {
        case BT0_SHORT_PUSH:
            NRF_LOG_INFO(&amp;quot;Short button press&amp;quot;);
            printf(&amp;quot;\r\n Short button press.\r\n&amp;quot;);
		 
            break;
        
        case BT0_LONG_PUSH:
            NRF_LOG_INFO(&amp;quot;Long button press&amp;quot;);
		printf(&amp;quot;\r\n Long button press.\r\n&amp;quot;);	 
			sleep_mode_enter(); 
            break;

        default:
            break;
    }
}

&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;just called sleep_mode_enter(); in the LONG_PUSH event&lt;/p&gt;
&lt;p&gt;system getting&amp;nbsp; restarted&amp;nbsp; not when to off state&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Button normal press and long press detect</title><link>https://devzone.nordicsemi.com/thread/174175?ContentTypeID=1</link><pubDate>Tue, 05 Mar 2019 08:59:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:62c23314-b9e8-45fc-9379-220d22029773</guid><dc:creator>Sunil vignesh</dc:creator><description>&lt;p&gt;Vidar, Now i didn&amp;#39;t change anything&lt;/p&gt;
&lt;p&gt;freshly opened &lt;strong&gt;ble_app_uart&amp;nbsp; (from sdk15.3)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;In bsp_btn_ble.c&amp;nbsp; file&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static uint32_t connection_buttons_configure()
{
    uint32_t err_code;

    err_code = bsp_event_to_button_action_assign(BTN_ID_SLEEP,
                                                 BTN_ACTION_SLEEP,
                                                 BSP_EVENT_DEFAULT);
    RETURN_ON_ERROR_NOT_INVALID_PARAM(err_code);

    err_code = bsp_event_to_button_action_assign(BTN_ID_WHITELIST_OFF,
                                                 BTN_ACTION_WHITELIST_OFF,
                                                 BSP_EVENT_WHITELIST_OFF);
    RETURN_ON_ERROR_NOT_INVALID_PARAM(err_code);


    err_code = bsp_event_to_button_action_assign(BTN_ID_DISCONNECT,
                                                 BTN_ACTION_DISCONNECT,
                                                 BSP_EVENT_DISCONNECT);
    RETURN_ON_ERROR_NOT_INVALID_PARAM(err_code);

    return NRF_SUCCESS;
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;is changed to&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static uint32_t connection_buttons_configure()
{
    uint32_t err_code;

    err_code = bsp_event_to_button_action_assign(BTN_ID_SLEEP,
                                                 BTN_ACTION_SLEEP,
                                                 BSP_EVENT_DEFAULT);
    RETURN_ON_ERROR_NOT_INVALID_PARAM(err_code);

    err_code = bsp_event_to_button_action_assign(BTN_ID_WHITELIST_OFF,
                                                 BTN_ACTION_WHITELIST_OFF,
                                                 BSP_EVENT_WHITELIST_OFF);
    RETURN_ON_ERROR_NOT_INVALID_PARAM(err_code);


    err_code = bsp_event_to_button_action_assign(BTN_ID_DISCONNECT,
                                                 BTN_ACTION_DISCONNECT,
                                                 BSP_EVENT_SLEEP);
    RETURN_ON_ERROR_NOT_INVALID_PARAM(err_code);

    return NRF_SUCCESS;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;getting restarted&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Button normal press and long press detect</title><link>https://devzone.nordicsemi.com/thread/174167?ContentTypeID=1</link><pubDate>Tue, 05 Mar 2019 08:13:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fdeff357-bf6a-4ceb-82ad-a2dee151ad86</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;The implementations include code for using both BSP and button handling library, see #ifdefs. I have tested it with SDK 15.2.0&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Button normal press and long press detect</title><link>https://devzone.nordicsemi.com/thread/174156?ContentTypeID=1</link><pubDate>Tue, 05 Mar 2019 07:51:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a2c13e25-7b89-4c72-992b-fb12530fcdf0</guid><dc:creator>Sunil vignesh</dc:creator><description>&lt;p&gt;Hi, Vidar&lt;/p&gt;
&lt;p&gt;i have used the code when i press the button 1 . short press arrived&lt;/p&gt;
&lt;p&gt;but during long press no log came it shows only short press ..?!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;and one more thing&lt;/p&gt;
&lt;p&gt;as per &lt;strong&gt;ble_app_uart &lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;uses BSP_BLE_ module&amp;nbsp; link .&amp;nbsp; &lt;a href="https://www.nordicsemi.com/DocLib/Content/SDK_Doc/nRF5_SDK/v15-3-0/examples_bsp_btn_ble"&gt;here&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;as it is but i need is &lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;current status&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; button&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; action &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; event&lt;/p&gt;
&lt;p&gt;connected&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; long push &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;a class="el" href="https://www.nordicsemi.com/DocLib/Content/SDK_Doc/nRF5_SDK/v15-3-0/group__bsp#ggad026454d14088f6f37bd2ba15fe816dfa080e5a2f7e4d93b3ac7e1f7d5b93f09c"&gt;BSP_EVENT_SLEEP&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;not connected&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; long push &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;a class="el" href="https://www.nordicsemi.com/DocLib/Content/SDK_Doc/nRF5_SDK/v15-3-0/group__bsp#ggad026454d14088f6f37bd2ba15fe816dfa080e5a2f7e4d93b3ac7e1f7d5b93f09c"&gt;BSP_EVENT_SLEEP&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;sleep&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; long push &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;a class="el" href="https://www.nordicsemi.com/DocLib/Content/SDK_Doc/nRF5_SDK/v15-3-0/group__bsp#ggad026454d14088f6f37bd2ba15fe816dfaf55c58522aacfa472afe9168ea879d23"&gt;BSP_EVENT_WAKEUP&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;shall we change it like this???&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Button normal press and long press detect</title><link>https://devzone.nordicsemi.com/thread/174034?ContentTypeID=1</link><pubDate>Mon, 04 Mar 2019 14:20:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:87f82ac1-c2e1-4ee6-9531-c6cf5e2a24cd</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Sorry, here&amp;#39;s the link I was referring to:&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/43506/how-to-use-bsp_button_action_push-and-bsp_button_action_long_push-on-the-same-button-with-two-different-functions"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/43506/how-to-use-bsp_button_action_push-and-bsp_button_action_long_push-on-the-same-button-with-two-different-functions&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You don&amp;#39;t need to a button to enter System ON mode, just let the program return to your main loop. You can, however,&amp;nbsp; use a &amp;quot;long&amp;quot; button press to make the program enter System OFF.&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Button normal press and long press detect</title><link>https://devzone.nordicsemi.com/thread/174025?ContentTypeID=1</link><pubDate>Mon, 04 Mar 2019 14:09:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:060ea2fc-e3de-4762-bec7-c43aa006e9df</guid><dc:creator>Sunil vignesh</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;i didn&amp;#39;t receive any link please resend it.&lt;/p&gt;
&lt;p&gt;when long press the button&amp;nbsp; system get into sleep mode or (system OFF)&lt;/p&gt;
&lt;p&gt;when the press the button with normal delay system get ON mode&lt;/p&gt;
&lt;p&gt;is it possible.&lt;/p&gt;
&lt;p&gt;any code reference is there?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Button normal press and long press detect</title><link>https://devzone.nordicsemi.com/thread/173978?ContentTypeID=1</link><pubDate>Mon, 04 Mar 2019 12:50:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f51447a3-5c7a-400b-b128-3b0cac06dd69</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Please see my answer in this thread for some suggestions on how you can differentiate between long and short button presses. What kind of sleep mode did you have in mind, system OFF or System ON mode?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>