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

APP_TIMER_DEF() warnings in Keil

I just ported my SDK 9.0 app timer code to SDK 10.0 which requires the use of the new APP_TIMER_DEF() macro. The problem is that is generates warnings in Keil (v5.17) that the timer ID variable I sent to the macro is declared but never referenced. The code compiles and runs fine, but I hate having warnings generated by my code. Any way to fix this?

Parents
  • You should only get that warning if a variable is declared but never referenced. Can you verify that you use the variable that you have declared? E.g. if you have declared the timer ID with APP_TIMER_DEF() you should use it somewhere, typically at lest you would create the timer using app_timer_create().

  • That's what I would have thought too, but I use the timer ID that I declared in the APP_TIMER_DEF() macro in two places: First in app_timer_create() and again in app_timer_start(). That's why this warning made no sense to me. It seems there is something strange going on either in your macro code or in how Keil is handling it. The code compiles fine (with warnings) and the timers run fine in my app, so why the warnings? Surely I can't be the only person who is seeing this?

Reply
  • That's what I would have thought too, but I use the timer ID that I declared in the APP_TIMER_DEF() macro in two places: First in app_timer_create() and again in app_timer_start(). That's why this warning made no sense to me. It seems there is something strange going on either in your macro code or in how Keil is handling it. The code compiles fine (with warnings) and the timers run fine in my app, so why the warnings? Surely I can't be the only person who is seeing this?

Children
No Data
Related