I am using the buttonless DFU template to run my own program which uses some of the buttons on the dev kit. For some reason, my button configuration is being overlapped somewhere, making button 1 disconnect the dev kit from my mobile device after a long hold, and button 4 enter DFU mode alongside the normal functionality I want. I never configured this myself and am wondering where else the button is being configured from. Is there somewhere I should be looking within my project which will point me in the right direction?
#define DRAW_BUTTON BSP_BUTTON_0
#define STAT_BUTTON BSP_BUTTON_1
#define PRESS_BUTTON BSP_BUTTON_2
#define ACCLRM_BUTTON BSP_BUTTON_3
static void button_event_handler(uint8_t pin_no, uint8_t button_action)
{
ret_code_t err_code;
switch (pin_no)
{
case DRAW_BUTTON:
record_draw();
break;
case STAT_BUTTON:
check_status();
break;
case ACCLRM_BUTTON:
read_acclrm();
break;
case PRESS_BUTTON:
read_pressure();
break;
default:
APP_ERROR_HANDLER(pin_no);
break;
}
}
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_0, false, BUTTON_PULL, button_event_handler},
{BSP_BUTTON_1, false, BUTTON_PULL, button_event_handler},
{BSP_BUTTON_2, false, BUTTON_PULL, button_event_handler},
{BSP_BUTTON_3, false, BUTTON_PULL, button_event_handler},
};
err_code = app_button_init(buttons, ARRAY_SIZE(buttons),
BUTTON_DETECTION_DELAY);
APP_ERROR_CHECK(err_code);
err_code = app_button_enable();
APP_ERROR_CHECK(err_code);
}int main(void)
{
bool erase_bonds;
ret_code_t err_code;
log_init();
// Initialize the async SVCI interface to bootloader before any interrupts are enabled.
err_code = ble_dfu_buttonless_async_svci_init();
APP_ERROR_CHECK(err_code);
timers_init();
power_management_init();
//buttons_leds_init(&erase_bonds);
buttons_init();
ble_stack_init();
peer_manager_init();
gap_params_init();
gatt_init();
services_init();
advertising_init();
conn_params_init();
NRF_LOG_INFO("Buttonless DFU Application started.");
// Start execution.
application_timers_start();
rtc_config();
twi_init();
nrf_drv_rtc_disable(&rtc);
nrf_drv_rtc_tick_disable(&rtc);
advertising_start(erase_bonds);
// Enter main loop.
for (;;)
{
idle_state_handle();
}
}
int main(void)
{
bool erase_bonds;
ret_code_t err_code;
log_init();
// Initialize the async SVCI interface to bootloader before any interrupts are enabled.
err_code = ble_dfu_buttonless_async_svci_init();
APP_ERROR_CHECK(err_code);
leds_init();
timers_init();
power_management_init();
//buttons_leds_init(&erase_bonds);
buttons_init();
ble_stack_init();
peer_manager_init();
gap_params_init();
gatt_init();
services_init();
advertising_init();
conn_params_init();
NRF_LOG_INFO("Buttonless DFU Application started.");
// Start execution.
application_timers_start();
rtc_config();
twi_init();
nrf_drv_rtc_disable(&rtc);
nrf_drv_rtc_tick_disable(&rtc);
advertising_start(erase_bonds);
// Enter main loop.
for (;;)
{
idle_state_handle();
}
}