This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Long button press event with bsp_event_to_button_action_assign

Hello everyone,

I tried to add the long press event into my bsp_event_handler without success. I get the normal button press event, but the long button press event is not working. I am using the 17.1 SDK.

In the initialization phase I am calling the functions:

    err_code = bsp_event_to_button_action_assign(BUTTON_1 , BSP_BUTTON_ACTION_LONG_PUSH,  BSP_EVENT_LONG_KEY_0);
    err_code = bsp_init(BSP_INIT_LEDS | BSP_INIT_BUTTONS, bsp_event_handler); 

My bsp_event_handler looks like:

static void bsp_event_handler(bsp_event_t event)
{
    ret_code_t err_code;
    switch (event)
    {
        case BSP_EVENT_LONG_KEY_0:
        NRF_LOG_INFO("LONG BUTTON PRESS!");
        break;

        case BSP_EVENT_KEY_0:
        NRF_LOG_INFO("BUTTON PRESS!");
        break;
    }
}

 within the enum bsp_event_t I added the additional event  "BSP_EVENT_LONG_KEY_0 ".

From my point of view I considered everything, but it is not working. Do you can support me at this point? Any ideas what could be the problem?

Best regards

Hani

Parents
  • I solved the issue now. I get the pressing event. My next problem is that the standart button configuration is with a pull up button. I changed within the pca100400.h the parameter #define BUTTON_PULL to NRF_GPIO_PIN_PULLDOWN.

    The problem is now that the button press event is reversed. When I press the button I get the release event if I release the button I get a pressed button. Is there somewhere else a location where I have to modify the button configuration?

Reply
  • I solved the issue now. I get the pressing event. My next problem is that the standart button configuration is with a pull up button. I changed within the pca100400.h the parameter #define BUTTON_PULL to NRF_GPIO_PIN_PULLDOWN.

    The problem is now that the button press event is reversed. When I press the button I get the release event if I release the button I get a pressed button. Is there somewhere else a location where I have to modify the button configuration?

Children
No Data
Related