I'm trying to add a SPI driver to the ble_app_uart_c example. For now, I'm just trying to make this driver shoot out a SPI transaction every time I click a button on the dev kit. To do this I would like some control over the buttons/leds. I'm pretty sure I understand the button event handler and different events, and I roughly understand what bsp_btn_ble_init() does based off the API reference (it allows the board to wake up from button presses and read which button actually did the waking up, yea?) - BUT I don't understand how to add my own button/LED functionality in parallel with the existing BLE code.
If I call bsp_init() for the buttons (as I do in the snippet below), the example still seems to work (as in I can connect to a peripheral over via BLE), but the LEDs aren't responding. I can't set them to any values and LED1 isn't blinking while advertising. What am I missing? I feel like there is some hidden button handler that I keep overlooking.
static void buttons_leds_init(void) { ret_code_t err_code; bsp_event_t startup_event; err_code = bsp_init(BSP_INIT_LEDS, bsp_event_handler); APP_ERROR_CHECK(err_code); err_code = bsp_init(BSP_INIT_BUTTONS, bsp_event_handler); // this seems to remove the LED blinking APP_ERROR_CHECK(err_code); err_code = bsp_btn_ble_init(NULL, &startup_event); APP_ERROR_CHECK(err_code); }
Thank you for any help! I'm new to embedded/BLE development so I apologize for silly questions.