Hello,
I'm trying a very simple thing; to light a LED on button press. I'm using SDK 9.0.0, nRF51 and SoftDevice 110. However, button handler is not firing.
So, APP_BUTTON_INIT macro is now non-existent (documentation still refers to it though) and app_button_init() takes only 3 args, last one, whether scheduler should be used, is now omitted. This was discussed here too but did not help me in anyway. Also, I do not want to use a scheduler.
So what am I doing wrong that the handler is not firing?
Here is my code (main()):
int main(void) {
nrf_gpio_cfg_output(11); // LED
static app_button_cfg_t p_button[] = {{8, APP_BUTTON_ACTIVE_LOW, NRF_GPIO_PIN_PULLUP, button_handler}}; // Button
APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_MAX_TIMERS, APP_TIMER_OP_QUEUE_SIZE, false);
APP_GPIOTE_INIT(1);
app_button_init(p_button, sizeof(p_button) / sizeof(p_button[0]), BUTTON_DEBOUNCE_DELAY); // 50ms debounce
app_button_enable();
while(true) { /* do nothing */ }
}
And handler (very simplified):
static void button_handler(uint8_t pin_no, uint8_t button_action)
{
nrf_gpio_pin_toggle(11);
}