Hi All,
I have created a custom board header file based off of the pca10040.h file. I have customised this to support 10 buttons and 2 leds. I have also extended the array app_button_cfg_t app_buttons[BUTTONS_NUMBER] in bsp.c to support the 10 buttons and bsp_event_t to include BSP_EVENT_KEY_8 and BSP_EVENT_KEY_9. I have also set the number of GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS to 10 in sdk_gonfig.h. My code is based on extending the ble_app_template to include a custom service and this all works.
I have setup a timer with a notification interval of 20ms (50Hz) to send 4 bytes during each notification. The first 2 bytes are analog data and the last two bytes are button states from 9 buttons.
Before enabling the notifications from a central device, the bsp_event_handler catches every button press perfectly (checked it on a scope). However, when i enable notifications at this data rate, i am unable to catch the disconnect button (long press) or any of the 9 other buttons properly, or at all.
What can i do to resolve this?
Cheers,
Zoran
SDK 15.2, RIGADO BMD-300 nrf52832
static void bsp_event_handler(bsp_event_t event) { ret_code_t err_code; switch (event) { case BSP_EVENT_SLEEP: sleep_mode_enter(); break; // BSP_EVENT_SLEEP case BSP_EVENT_DISCONNECT: err_code = sd_ble_gap_disconnect(m_conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION); if (err_code != NRF_ERROR_INVALID_STATE) { APP_ERROR_CHECK(err_code); } break; // BSP_EVENT_DISCONNECT case BSP_EVENT_WHITELIST_OFF: if (m_conn_handle == BLE_CONN_HANDLE_INVALID) { err_code = ble_advertising_restart_without_whitelist(&m_advertising); if (err_code != NRF_ERROR_INVALID_STATE) { APP_ERROR_CHECK(err_code); } } break; // BSP_EVENT_KEY_0 case BSP_EVENT_KEY_1: value[2] = value[2] ^ 0x01; break; // GL1 button pressed case BSP_EVENT_KEY_2: value[2] = value[2] ^ 0x02; break; // GL2 button pressed case BSP_EVENT_KEY_3: value[2] = value[2] ^ 0x04; break; // GL3 button pressed case BSP_EVENT_KEY_4: value[2] = value[2] ^ 0x08; break; // GL4 button pressed case BSP_EVENT_KEY_5: value[2] = value[2] ^ 0x10; break; // GL5 button pressed case BSP_EVENT_KEY_6: value[2] = value[2] ^ 0x20; nrf_gpio_pin_toggle(LED_2); break; // GL6 button pressed case BSP_EVENT_KEY_7: value[2] = value[2] ^ 0x40; break; // Safety button pressed case BSP_EVENT_KEY_8: value[2] = value[2] ^ 0x80; nrf_gpio_pin_toggle(LED_2); break; // button pressed case BSP_EVENT_KEY_9: value[3] = value[3] ^ 0x01; break; // button pressed default: break; } }