This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

APP_BUTTON_INIT and GPIO_WAKEUP_BUTTON_CONFIG

I'm confused about the use of these two functions. I want my app to sleep immediately upon start and then wake up and do a BLE advertise when I press a button.

  1. I see that both of these functions are used in the ble_app_proximity example. Both functions take a pullup value which, in the example, is set to pull up in APP_BUTTON_INIT and to not pull up in GPIO_WAKEUP_BUTTON_CONFIG. What happens in this case?

  2. I notice in the header comments for APP_BUTTON_INIT that it does not "enable" the button. Does GPIO_WAKEUP_BUTTON_CONFIG do that?

I tried the following in my app but button_event_handler is not getting called when I press the button:

static app_button_cfg_t buttons[] =
    {
        {IO_PORT_INT_BUTTON, false, NRF_GPIO_PIN_PULLUP, button_event_handler}
    };
    APP_BUTTON_INIT(buttons, sizeof(buttons) / sizeof(buttons[0]), BUTTON_DETECTION_DELAY, false);
		GPIO_WAKEUP_BUTTON_CONFIG(IO_PORT_INT_BUTTON);

Any ideas what I might be doing wrong?

Related