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?

Parents
  • app_button is used for button handling as long as the device is in system on. When you put the device into system off, you can specifically enable which pins you want to use as wake-up pins, which is the use of the second macro.

    There is a separate function in app_button's API to enable it, app_button_enable(). If you can't see your button handler called, and are sure you have set it up correctly with regard to active high/low and pull-up/-down, this is most likely the missing piece.

Reply
  • app_button is used for button handling as long as the device is in system on. When you put the device into system off, you can specifically enable which pins you want to use as wake-up pins, which is the use of the second macro.

    There is a separate function in app_button's API to enable it, app_button_enable(). If you can't see your button handler called, and are sure you have set it up correctly with regard to active high/low and pull-up/-down, this is most likely the missing piece.

Children
No Data
Related