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.

Related