RL-RTX - use of os_tmr_create, kill & call

Could some kind person give me a code snippet showing a typical use of os_tmr_create, _kill and _call.

I can't get my head around as to how these should be used and what they can be used for. I have them sort of working but seem to get multiple instances of timers which seems wrong. Right now I just want to be able to periodically run a function, and os_tmr looks like what I should be using.

As a more general are there any larger code examples of using the RTX, I mean more complex than the Keil examples, ie. perhaps a teaching book or something. To help me move forward with more confidence.

Parents
  • No code snippet but some of the gotcha's the way the os_timers are implemented.

    1) You may not call os_tmr_create in the "callback" routine of a timer. This will manipulate the timer_queue in the middle of manipulating the timer queue.

    2) Timer_ID's are reused almost immediately if you are killing and creating (or timers timing out). If you ever use os_tmr_kill you must be sure that the timer did not time out on its own before you call kill. If this is the case you may delete a newly created timer.

Reply
  • No code snippet but some of the gotcha's the way the os_timers are implemented.

    1) You may not call os_tmr_create in the "callback" routine of a timer. This will manipulate the timer_queue in the middle of manipulating the timer queue.

    2) Timer_ID's are reused almost immediately if you are killing and creating (or timers timing out). If you ever use os_tmr_kill you must be sure that the timer did not time out on its own before you call kill. If this is the case you may delete a newly created timer.

Children
More questions in this forum