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

Why do I get errors from nrf_delay.h?

I have included all paths of all (.h) files including (nrf_delay.h) however I got errors as seen in the photo. What do you suggest to overcome such errors? Also, Is the following error resulting from the problem in nrf_delay.h? "E:\sendingcode\ble_app_twi\main.c(418): error: #55-D: too many arguments in invocation of macro "APP_TIMER_INIT" APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_MAX_TIMERS, APP_TIMER_OP_QUEUE_SIZE, true); "

image description

Thanks in advance.

  • APP_TIMER_INIT changed between SDK 10 and SDK 11. Count the number of arguments and then count the number of arguments you're passing. Don't worry about nrf_delay.h errors; they still haven't fixed that (it's been that way since 9.0 on Keil).

  • @Ahmed fix your invocation of APP_TIMER_INIT. You're sending in too many arguments.

  • The nrf_delay errors are a red herring. They'll pop up as errors in your IDE, but they'll never cause you not to be able to build.

    Your problem is with your invocation of APP_TIMER_INIT.

    In SDK 11, APP_TIMER_INIT only has three arguments, and according to your screenshot, you're passing in four.

    Here's the definition of APP_TIMER_INIT in app_timer.h:

    /*lint -emacro(506, APP_TIMER_INIT) */ /* Suppress "Constant value Boolean */
    #define APP_TIMER_INIT(PRESCALER, OP_QUEUES_SIZE, SCHEDULER_FUNC)                                  \
    do                                                                                             \
    {                                                                                              \
        static uint32_t APP_TIMER_BUF[CEIL_DIV(APP_TIMER_BUF_SIZE((OP_QUEUES_SIZE) + 1),           \
                                               sizeof(uint32_t))];                                 \
        uint32_t ERR_CODE = app_timer_init((PRESCALER),                                            \
                                           (OP_QUEUES_SIZE) + 1,                                   \
                                           APP_TIMER_BUF,                                          \
                                           SCHEDULER_FUNC);                                        \
        APP_ERROR_CHECK(ERR_CODE);                                                                 \
    } while (0)
    

    So you should be passing in this:

    APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, true);
    

    Not what you were passing in, which is this:

    APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_MAX_TIMERS, APP_TIMER_OP_QUEUE_SIZE, true);
    
Related