This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Button normal press and long press detect

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 awake system?

Parents Reply
  • Coming back to your code which you given from the link

    i changed the value as

    #define USE_BSP 1

    and

    void bsp_event_handler(bsp_event_t event)
    {
        uint32_t err_code;
        switch (event)
        {
            case BT0_SHORT_PUSH:
                NRF_LOG_INFO("Short button press");
                printf("\r\n Short button press.\r\n");
    		 
                break;
            
            case BT0_LONG_PUSH:
                NRF_LOG_INFO("Long button press");
    		printf("\r\n Long button press.\r\n");	 
    			sleep_mode_enter(); 
                break;
    
            default:
                break;
        }
    }
    
    

    just called sleep_mode_enter(); in the LONG_PUSH event

    system getting  restarted  not when to off state

Children
Related