bsp button no release event after connect to the nRFConnect.

Hi,

I want to use the bsp button to our project, so I tested on the example "ble_app_blinky",

I modified the app button to bsp button,  add two custom events to the bsp_event_t enum in the bsp.h, and then test, 

Before connect to the android App nRF Connect, the bsp button can work ok, BSP_BUTTON_ACTION_PUSH , BSP_BUTTON_ACTION_RELEASE, BSP_BUTTON_ACTION_LONG_PUSH are all work ok. 

After connect to the nRF Connect, there are problem,  only BSP_BUTTON_ACTION_PUSH can work, BSP_BUTTON_ACTION_RELEASE and LONG_PUSH  can not work.

Attached the code, would you please help me to review?  why it can only detect push event,  can not detect release and long push event after conncet to the App ?  Thank you very much.

Best wishes,

Susan

  • Hi,

    I tested you code, but I see all events on the log, even after connecting with nRF Connect on Android:

    <info> app: button short released
    <info> app: button released state: 0
    <info> app: button short pressed
    <info> app: button pressed state: 1
    <info> app: button long pressed 
    <info> app: button short released
    <info> app: button released state: 0
    <info> app: Connected
    <info> app: button short pressed
    <info> app: button pressed state: 1
    <info> app: button short released
    <info> app: button released state: 0
    <info> app: button short pressed
    <info> app: button pressed state: 1
    <info> app: button long pressed 
    <info> app: button short released
    <info> app: button released state: 0

    Did you do something else after connecting?

    Have you tried the code with the unmodified ble_app_blinky example?

    Best regards,
    Jørgen

  • Hi Jorgen,

    Thanks for your quick reply, I didn't do anything after connecting, only click the CONNECT button in the nRF Connect.
    I have tried the code with the unmodified ble_app_blinky example, app button works ok, it has release event after connection. 
    I found if I add bsp_btn_ble.c file to the project, it will cause this problem. But I didn't include this file to the main.c. if I removed bsp_btn_ble.c from this project, it has release event after connection.  Remove bsp_btn_ble.c from my projext can solve this problem, but I don't know reason, could you please tell me? 
    Best wishes,
    Susan
  • bsp_btn_ble is using the same button ID that you use in your application (0). The button actions are reconfigured in connection_buttons_configure(), which is called on a CONNECTED event.

    You should not use the same button in your application and bsp_btn_ble at the same time, as this may break the flow in the library.

  • Hi Jorgen,

    I see, thank you for your detailed explanation.

    Best wishes, 

    Susan

Related