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

How to remove BSP to implement long press and short press on the same button through app_button instead?

I recently found that BSP doesn't allow you to differentiate between long press and short press on the same button. I also found the posts to implement the long/short press on the same button with app_button on the forums. I am having issues removing all references to bsp and adding the app_button.c. What functions do I have to change/remove to transition to app_button?

I am using SDK 14.2 on nRF52832.

Parents Reply Children
  • embedded_newbie said:
    As far as I can see, when I remove it, functions with erase_bonds get messed up.

     It's probably because these functions use the bsp library. Try to modify the functions so that they don't make use of bsp at all.

  • Hi, so let me be a bit more detailed with my issue. I want to use the buttons for two sets of functions - one for connection, disconnection, erase bonds, whitelist etc (like in the ble_hid_keyboard example) and for the other set I want to integrate media controls with the same button.

    The way the example is structured is that there is an advertising_buttons_configure() and a connection_buttons_configure() in bsp_btn_ble.c . The button_event_handler() in my main.c function using app_button I was able to write only for the media keys. I cannot figure out how to integrate advertising mode and connection mode and the code associated with that.

    This is what I have so far, I have some more code for button_event_handler which details how my keys work but this isn't compiling in itself. I'm not able to completely disassociate bsp library from the main function which I have attached.

    3288.main_working.c

  • embedded_newbie said:
    This is what I have so far, I have some more code for button_event_handler which details how my keys work but this isn't compiling in itself.

    Why are you not able to compile it? I just enabled app_gpiote in sdk_config and it was fine.

Related