Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

What will happen if app_timer_init() is called multiple times?

Looking at the code in SDK 15.0.0 I think app timer library will be reinitialized. Is there a way by which I can check it the library is already initialized and initialize it only if required?

Parents
  • Hi,

    You are correct that the library will be reinitialized if you call app_timer_init() and it was previously initialized.

    I am afraid you will have to keep track of initialization state in the application, as there is no tracking inside the library. However, usually you would initialize the module at startup, and re-initialize only in situations where re-initialization is what you want to do.

    Regards,
    Terje

     

Reply
  • Hi,

    You are correct that the library will be reinitialized if you call app_timer_init() and it was previously initialized.

    I am afraid you will have to keep track of initialization state in the application, as there is no tracking inside the library. However, usually you would initialize the module at startup, and re-initialize only in situations where re-initialization is what you want to do.

    Regards,
    Terje

     

Children
Related