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

Using the Buttons Handler Module in the USBD BLE UART Example

In the usbd_ble_uart example (SDK 17.0.2), I'd like to use the buttons handler module (the same one from the BLE Blinky example), instead of the BSP BLE button events. In SDK config, I've disabled BSP_BTN_BLE_ENABLED and enabled BUTTON_ENABLED. In the Keil project, I removed the bsp references and includes, and added the ones needed for the buttons handler (app_button.h). In spite of this, I have several errors in buttons_init():

static void buttons_init(void)
{
    ret_code_t err_code;

    //The array must be static because a pointer to it will be saved in the button handler module.
    static app_button_cfg_t buttons[] =
    {
        {BSP_BUTTON_1, false, BUTTON_PULL, button_event_handler},
		{BSP_BUTTON_2, false, BUTTON_PULL, button_event_handler}
    };

    err_code = app_button_init(buttons, ARRAY_SIZE(buttons),
                               BUTTON_DETECTION_DELAY);
    APP_ERROR_CHECK(err_code);
}

BSP_BUTTON_1, BSP_BUTTON_2, BUTTON_PULL and ARRAY_SIZE are all undefined, although when I right click on them and click "Go To Definition Of ...", the correct files are opened (they're all defined in the board file and nordic_common.h).

How can I make it work? What am I missing? Based on the Blinky BLE example, I have all the necessary includes, defines and references in the project.

IDE: Keil

Chip: nRF52840

SDK: 17.0.2

Parents
  • Hello,

    Does the project compile? I have seen that Keil from time to time underlines variables like this, saying it is not defined, but yet it compiles just fine either way, without any mention of those variables.

    If it doesn't compile, can you please zip the project and upload it here so that I can try to reproduce it?

    Best regards,

    Edvin

Reply
  • Hello,

    Does the project compile? I have seen that Keil from time to time underlines variables like this, saying it is not defined, but yet it compiles just fine either way, without any mention of those variables.

    If it doesn't compile, can you please zip the project and upload it here so that I can try to reproduce it?

    Best regards,

    Edvin

Children
Related