I am using the ble_uart_app on the dev kit with the nrf52. SDK version 11.0.0. How do I get the bsp_event_handler to get fired on a button release and button push event and not just a BSP_EVENT_KEY_X. Thanks!
I am using the ble_uart_app on the dev kit with the nrf52. SDK version 11.0.0. How do I get the bsp_event_handler to get fired on a button release and button push event and not just a BSP_EVENT_KEY_X. Thanks!
Hi,
You can assign different actions to events by calling
uint32_t bsp_event_to_button_action_assign (uint32_t button, bsp_button_action_t action, bsp_event_t event)
For example
bsp_event_to_button_action_assign(number, BSP_BUTTON_ACTION_RELEASE, BSP_EVENT_KEY_0);
Best regards,
Øyvind
Hi,
The most elegant way is to modify bsp.h to include the events you want. Adding BSP_EVENT_KEY_0_RELEASE, BSP_EVENT_KEY_0_LONGPUSH etc. to the enumeration definition for bsp_event_t.
By the way the button number is defined a bit oddly so be aware of this, to assign an event to the release event of button 1 on the nRF52 devkit I call
bsp_event_to_button_action_assign(0, BSP_BUTTON_ACTION_RELEASE, BSP_EVENT_KEY_0_RELEASE)
For button 2 I call:
bsp_event_to_button_action_assign(1, BSP_BUTTON_ACTION_RELEASE, BSP_EVENT_KEY_1_RELEASE)
Best regards,
Øyvind
Hi,
The most elegant way is to modify bsp.h to include the events you want. Adding BSP_EVENT_KEY_0_RELEASE, BSP_EVENT_KEY_0_LONGPUSH etc. to the enumeration definition for bsp_event_t.
By the way the button number is defined a bit oddly so be aware of this, to assign an event to the release event of button 1 on the nRF52 devkit I call
bsp_event_to_button_action_assign(0, BSP_BUTTON_ACTION_RELEASE, BSP_EVENT_KEY_0_RELEASE)
For button 2 I call:
bsp_event_to_button_action_assign(1, BSP_BUTTON_ACTION_RELEASE, BSP_EVENT_KEY_1_RELEASE)
Best regards,
Øyvind