<?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 Configuration</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/59535/button-configuration</link><description>Hi, 
 I need some details about the button configuration 
 
 To perform a Single Button configuration like 
 One click (BUTTON_RELEASE) 
 Double Click (BUTTON_RELEASE) 
 Button Press for 3 seconds 
 Button Press for 7 seconds. 
 
 all these configuration</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 13 May 2020 02:53:19 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/59535/button-configuration" /><item><title>RE: Button Configuration</title><link>https://devzone.nordicsemi.com/thread/249586?ContentTypeID=1</link><pubDate>Wed, 13 May 2020 02:53:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:00696eb7-8813-4bc8-bdcf-4a6063320623</guid><dc:creator>Sunil vignesh</dc:creator><description>&lt;p&gt;Thanks, I will check &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Button Configuration</title><link>https://devzone.nordicsemi.com/thread/249278?ContentTypeID=1</link><pubDate>Mon, 11 May 2020 17:11:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:402def4b-c7c6-4afe-af57-69d731905bb8</guid><dc:creator>Marjeris Romero</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The current consumption for this project will be of ~13uA.&lt;/p&gt;
&lt;p&gt;For going from SYSTEM OFF to SYSTEM ON on button release you need to configure the button as input with sense enabled.&lt;/p&gt;
&lt;p&gt;You do this by using either &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v16.0.0%2Fgroup__nrf__drv__gpiote.html&amp;amp;anchor=ga9d0fd4c061fa28b31ce0411dce063685"&gt;GPIOTE_CONFIG_IN_SENSE_LOTOHI&lt;/a&gt; or&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v16.0.0%2Fgroup__nrf__drv__gpiote.html&amp;amp;anchor=ga709371c67eaae3beb1f891a2cbf97147"&gt;GPIOTE_CONFIG_IN_SENSE_HITOLO&lt;/a&gt; depending on if you use active high or active low.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Marjeris&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Button Configuration</title><link>https://devzone.nordicsemi.com/thread/243474?ContentTypeID=1</link><pubDate>Sat, 04 Apr 2020 07:39:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1fd170a9-939a-4b32-a124-f034b1993429</guid><dc:creator>Sunil vignesh</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I am using SDK_16.0&lt;/p&gt;
&lt;p&gt;attached zip file here&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/bsp.zip"&gt;devzone.nordicsemi.com/.../bsp.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Yes, from deep SYSTEM OFF to SYSTEM ON from button release. for this i need to do in wake up button configuration ??&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Button Configuration</title><link>https://devzone.nordicsemi.com/thread/243364?ContentTypeID=1</link><pubDate>Fri, 03 Apr 2020 10:25:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:15fdf886-b9d0-4df2-96eb-0c00d603ab5b</guid><dc:creator>Marjeris Romero</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Does the code behaves as you expected? If you want me to test your code and measure current please send med a zip file with the project folder, and let me know which SDK version you are using for your project.&lt;/p&gt;
&lt;p&gt;Do you mean you want to go from System OFF to System ON from a button release? You can try to put a check on the start of your main function to check if the button is released before starting execution of your application.&lt;/p&gt;
&lt;p&gt;BR,&lt;/p&gt;
&lt;p&gt;Marjeris&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Button Configuration</title><link>https://devzone.nordicsemi.com/thread/242387?ContentTypeID=1</link><pubDate>Mon, 30 Mar 2020 11:51:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6b7b733c-3222-468f-bada-4ff4c6724937</guid><dc:creator>Sunil vignesh</dc:creator><description>&lt;p&gt;Hi msromero, have you seen this&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Button Configuration</title><link>https://devzone.nordicsemi.com/thread/242204?ContentTypeID=1</link><pubDate>Sat, 28 Mar 2020 10:29:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:13627080-d255-434b-b3aa-cba4056d5674</guid><dc:creator>Sunil vignesh</dc:creator><description>&lt;p&gt;Hi msromero,&lt;/p&gt;
&lt;p&gt;I have create the C file to run by button application&lt;/p&gt;
&lt;p&gt;please conform that the work nature or it will not affect cpu life cycle when its applied in a large program&lt;/p&gt;
&lt;p&gt;Main Code:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;lt;stdbool.h&amp;gt;
#include &amp;lt;stdint.h&amp;gt;
#include &amp;quot;boards.h&amp;quot;
#include &amp;quot;bsp.h&amp;quot;
#include &amp;quot;app_timer.h&amp;quot;
#include &amp;quot;nordic_common.h&amp;quot;
#include &amp;quot;nrf_error.h&amp;quot;
#include &amp;quot;nrf_gpio.h&amp;quot;
#include &amp;quot;blc.h&amp;quot;
#include &amp;quot;nrf_log.h&amp;quot;
#include &amp;quot;nrf_log_ctrl.h&amp;quot;
#include &amp;quot;nrf_log_default_backends.h&amp;quot;


void clock_initialization()
{
    NRF_CLOCK-&amp;gt;LFCLKSRC            = (CLOCK_LFCLKSRC_SRC_Xtal &amp;lt;&amp;lt; CLOCK_LFCLKSRC_SRC_Pos);
    NRF_CLOCK-&amp;gt;EVENTS_LFCLKSTARTED = 0;
    NRF_CLOCK-&amp;gt;TASKS_LFCLKSTART    = 1;

    while (NRF_CLOCK-&amp;gt;EVENTS_LFCLKSTARTED == 0)
    {
        // Do nothing.
    }
}


int main(void)
{   bool erase_bonds;
    clock_initialization();
  
    uint32_t err_code = app_timer_init();
    APP_ERROR_CHECK(err_code);

    APP_ERROR_CHECK(NRF_LOG_INIT(NULL));
    NRF_LOG_DEFAULT_BACKENDS_INIT();
    err_code = blc_init();
    APP_ERROR_CHECK(err_code);
    NRF_LOG_INFO(&amp;quot;BSP example started.&amp;quot;);
    


    while (true)
    {
        NRF_LOG_FLUSH();
        __SEV();
        __WFE();
        __WFE();
        // no implementation needed
    }
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;BLC.h&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#ifndef BLC_H__
#define BLC_H__

#include &amp;lt;stdint.h&amp;gt;
#include &amp;lt;stdbool.h&amp;gt;
#include &amp;quot;boards.h&amp;quot;
#include &amp;quot;app_button.h&amp;quot;


uint32_t blc_init(void);

#endif&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;BLC.c&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;
#include &amp;quot;blc.h&amp;quot;
#include &amp;quot;boards.h&amp;quot;
#include &amp;quot;bsp_config.h&amp;quot;
#include &amp;quot;app_timer.h&amp;quot;
#include &amp;quot;app_button.h&amp;quot;
#include &amp;quot;app_error.h&amp;quot;
#include &amp;quot;nrf_log.h&amp;quot;


char flag = 0;
bool first_click = false;
APP_TIMER_DEF(m_button_action);

#define BUTTON_STATE_POLL_INTERVAL_MS  100UL

#define LONG_PRESS(MS)    (uint32_t)(MS)/BUTTON_STATE_POLL_INTERVAL_MS 



void button_timeout_handler(void * p_context)
{ 
     uint32_t err_code;
     static uint32_t cnt;

     if (app_button_is_pushed(0))
     {
         cnt++;
          NRF_LOG_INFO(&amp;quot;cnt: %d&amp;quot;,cnt);

         if ( cnt &amp;gt;= LONG_PRESS(1300))
         {
             cnt = 0;
             bsp_board_leds_off();
                  bsp_board_led_on(BSP_LED_INDICATE_USER_LED3);
                  bsp_board_led_on(BSP_LED_INDICATE_USER_LED4);
             NRF_LOG_INFO(&amp;quot;Long Button press&amp;quot;);
             flag = 0;
         }
         else
         {
              err_code = app_timer_start(m_button_action, 
                                         APP_TIMER_TICKS(BUTTON_STATE_POLL_INTERVAL_MS),
                                         NULL);
              APP_ERROR_CHECK(err_code);
              NRF_LOG_INFO(&amp;quot;timer&amp;quot;);
         }
     }
     else
     {
         if (cnt &amp;gt;= 4 )
         {
          
          }

          else
          {
          if(flag == 2)
             {
                  bsp_board_leds_off();
                  bsp_board_led_on(BSP_LED_INDICATE_USER_LED2);
                  NRF_LOG_INFO(&amp;quot;double click&amp;quot;);
                  first_click = true;
        
              }
            else if((flag == 1)&amp;amp;&amp;amp; (first_click == true))
              {
                   bsp_board_leds_off();
                  bsp_board_led_on(BSP_LED_INDICATE_USER_LED1);
                  NRF_LOG_INFO(&amp;quot;single click&amp;quot;);
      
              }
          }
          cnt = 0; // reset counter variable
                    

            flag = 0;

            }
}

void button_callback(uint8_t pin_no, uint8_t button_action)
{
      uint32_t err_code;

      
      if ((pin_no == BUTTON_1) &amp;amp;&amp;amp; (button_action == APP_BUTTON_PUSH))
      {
          err_code = app_timer_start(m_button_action, 
                                     APP_TIMER_TICKS(450),
                                     NULL);
          APP_ERROR_CHECK(err_code);
           flag++;

      }
     /* else if ((pin_no == BUTTON_1 ) &amp;amp;&amp;amp; (button_action == APP_BUTTON_RELEASE))
      {
        app_timer_stop_all();
        cnt = 0;
      }*/
}


uint32_t blc_init()
{
  uint32_t err_code = NRF_SUCCESS;

  static app_button_cfg_t  button_cfg;

      button_cfg.pin_no         = BUTTON_1;
      button_cfg.button_handler = button_callback;
      button_cfg.pull_cfg       = NRF_GPIO_PIN_PULLUP;
      button_cfg.active_state   = APP_BUTTON_ACTIVE_LOW;
      bsp_board_init(BSP_INIT_LEDS);
      err_code = app_button_init(&amp;amp;button_cfg, 1, 100);
      if (err_code == NRF_SUCCESS)
      {      
      err_code = app_button_enable();
      }
      
      if (err_code == NRF_SUCCESS)
      {

      /*Enable an app timer instance to detect long button press*/
      err_code = app_timer_create(&amp;amp;m_button_action, APP_TIMER_MODE_SINGLE_SHOT, button_timeout_handler);
      APP_ERROR_CHECK(err_code);
      }
       return err_code;
 }&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;function of the code:&lt;/p&gt;
&lt;p&gt;First:&lt;/p&gt;
&lt;p&gt;Double click to access single click&lt;/p&gt;
&lt;p&gt;long press for 1.2 sec&lt;/p&gt;
&lt;p&gt;single click and double click function&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;i want it to assign the same button for wake up and the wake up function must appear only when button is release .&lt;/p&gt;
&lt;p&gt;how to assign for this&lt;/p&gt;
&lt;p&gt;i will try buttonless dfu and i will reply&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Button Configuration</title><link>https://devzone.nordicsemi.com/thread/242151?ContentTypeID=1</link><pubDate>Fri, 27 Mar 2020 15:03:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:721e94a6-7a19-40c2-9706-e5700920ac3a</guid><dc:creator>Marjeris Romero</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Why don&amp;#39;t disable the DFU button in the bootloader? Try to use the &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/ble_sdk_app_buttonless_dfu.html"&gt;Buttonless DFU template application example&lt;/a&gt; in the SDK instead.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Button Configuration</title><link>https://devzone.nordicsemi.com/thread/242145?ContentTypeID=1</link><pubDate>Fri, 27 Mar 2020 14:41:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b3820367-6dd6-4529-9eea-ded50730376e</guid><dc:creator>Marjeris Romero</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;BSP module uses the app_button library. But the board support package (BSP) includes more things like control of LEDS, buttons, etc, are is mostly intended to be used with nordic development kits.&lt;/p&gt;
&lt;p&gt;BSP have single push and long push, but it doesn&amp;#39;t have support for double push.&lt;/p&gt;
&lt;p&gt;I think you will need to make something custom using app_button and app_timer. You can look into the BSP module to see how it generates long pushes so you have a starting guide&lt;/p&gt;
&lt;p&gt;With app_button you will get events for both pushes and releases, so you can start a timer and stop it after each release, or when you detect more than 1 push inside one given interval.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Marjeris&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Button Configuration</title><link>https://devzone.nordicsemi.com/thread/242142?ContentTypeID=1</link><pubDate>Fri, 27 Mar 2020 14:36:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2a2492c8-ff95-4d09-a212-3acf3440974a</guid><dc:creator>Sunil vignesh</dc:creator><description>&lt;p&gt;i have a question that my application run with bootloader and hardware i have only one button.&lt;/p&gt;
&lt;p&gt;If i wakeup the device with pressing the button .it enter into DFU because that pin assigned as DFU button&lt;/p&gt;
&lt;p&gt;so. is it possible to have CONNECTION LIKE THIS&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1585319771350v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;P0.12 as OUTPUT&lt;/p&gt;
&lt;p&gt;P0.13 as INPUT&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;when the controller receive command from the app as DFU&lt;/p&gt;
&lt;p&gt;the Pin&lt;/p&gt;
&lt;p&gt;P0.12 will get high&lt;/p&gt;
&lt;p&gt;and P0.13 will get high and enter into DFU process&lt;/p&gt;
&lt;p&gt;this will work ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Button Configuration</title><link>https://devzone.nordicsemi.com/thread/242141?ContentTypeID=1</link><pubDate>Fri, 27 Mar 2020 14:35:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:07070b37-76a5-48b3-9f4a-278129762af9</guid><dc:creator>Sunil vignesh</dc:creator><description>&lt;p&gt;hi&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>