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

Using single shot timer to create repeated timers with changing intervals

I would like to use the single shot timer and when the timeout handler is called, I would like to set up the same timer again with different interval this time. Do I have to use both of the app_timer_create and app_timer_start functions, or would just using app_timer_start suffice? (In other words, I'm not sure whether the timer needs to be recreated or not).

Thank you!

Parents
  • Well you could have just tried it out, or looked at the source code for app_timer.

    Either way - if you had to re-create the timer every time you wanted to use it, then the timeout wouldn't be specified in the app_timer_start() routine, it would be in the app_timer_create() routine, because otherwise it wouldn't make sense.

    Hence app_timer_start() can be called with different timeout values each invocation.

Reply
  • Well you could have just tried it out, or looked at the source code for app_timer.

    Either way - if you had to re-create the timer every time you wanted to use it, then the timeout wouldn't be specified in the app_timer_start() routine, it would be in the app_timer_create() routine, because otherwise it wouldn't make sense.

    Hence app_timer_start() can be called with different timeout values each invocation.

Children
Related