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

SDK 7.2, APP_BUTTON_RELEASE

Hi, I'm not used to the bsp.c so my question could be silly. I hope you could understand.

When I used SDK 6.1, the example about button_event_handler function had a parameter

related to the button_action.

static void button_event_handler(uint8_t pin_no, uint8_t button_action) { //SDK 6.1

        if(APP_BUTTON_PUSH) { }

        else if(APP_BUTTON_RELEASE) { }

}

Whereas, the SDK 7.2 (which I'm currently using) does not have that parameter.

static void button_event_handler(bsp_event_t event){ //SDK 7.2

       switch (event) {  }

}

I found that app_button.c has the control statement

to configure whether it is pressed or released.

image description

Using SDK 7.2, how can I control the event with the button actions

without editing the given API?

-Regards, Mango922

Parents
  • If you don't want to use the "advanced" BSP you can add BSP_SIMPLE as a Define under Preprocessor Symbols under the C/C++ tab at Options for target.

    Then you need to add the functions buttons_init() and button_event_handler() to main.c.

    Also remember to add app_button_enable(); at an appropriate place, for example in main().

    In case I have forgot somthing, I have attached my project, I ran it on an nRF51 DK with SDK 7.2.0 and SoftDevice S110 7.1.0.

    If you enter debug mode, and put a breakpoint in button_event_handler() you should be able to get button presses and releases.

    ble_app_hids_keyboard_BSP.rar

Reply
  • If you don't want to use the "advanced" BSP you can add BSP_SIMPLE as a Define under Preprocessor Symbols under the C/C++ tab at Options for target.

    Then you need to add the functions buttons_init() and button_event_handler() to main.c.

    Also remember to add app_button_enable(); at an appropriate place, for example in main().

    In case I have forgot somthing, I have attached my project, I ran it on an nRF51 DK with SDK 7.2.0 and SoftDevice S110 7.1.0.

    If you enter debug mode, and put a breakpoint in button_event_handler() you should be able to get button presses and releases.

    ble_app_hids_keyboard_BSP.rar

Children
Related