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

nAN-36 + nRF51822 PCA10028 APP_BUTTON_INIT [SOLVED]

in the code below, the keil IDE is flagging with red squiggly APP_BUTTON_INIT, claiming that it is an undefined symbol. It also says that this implicit declaration of 'APP_BUTTON_INIT' is not valid for c99

I called out the proper GPIOTE function before this and I have the "app_button.h" included. I dont know what to do this has been driving me crazy.

    static void buttons_init(void)
{   
    // Note: Array must be static because a pointer to it will be saved in the Button handler
    //       module.	
    static app_button_cfg_t buttons[] =
    {
        {WAKEUP_BUTTON_PIN, false, BUTTON_PULL, NULL},
        {LEDBUTTON_BUTTON_PIN_NO, false, BUTTON_PULL, button_event_handler}
    };

    APP_BUTTON_INIT(buttons, sizeof(buttons) / sizeof(buttons[0]), BUTTON_DETECTION_DELAY, true);
			
}

TL;DR ANSWER Below:

The Correct solution was to replace

APP_BUTTON_INIT(buttons, sizeof(buttons) / sizeof(buttons[0]), BUTTON_DETECTION_DELAY, true);

with

app_button_init(buttons, sizeof(buttons) / sizeof(buttons[0]), BUTTON_DETECTION_DELAY);

differences Note: the method is lower case, and the last parameter within said method is no longer defined.

  • I just spent an entire day updating my project from SDK 7.1 components to 8.0. I ran into this and a number of other issues I still haven't resolved. Nordic should really publish a thorough migration app note for major releases like this.

    I found nAN-36 to be one of the most informative and useful documents Nordic publishes on developing applications for the nRF51. It should be updated along with the Github example or replaced with something just as comprehensive encompassing SDK 8.0 and implementation via IAR (not just Keil).

Related