How to change a Reload timer to One-shot timer in FreeRTOS

wirelessguy wrote on Wednesday, November 28, 2018:

Hi All,
In my application, I need a FreeRTOS software timer. But this timer sometimes need the one-shot timer function, sometimes need the Reload timer function.

I use the xTimerCreate to create timer with the one-shot timer configuration. Next time, I need to config this timer as the Reload timer with a new timePeriod. But from the FreeRTOS API function, I could change the reload/one-shot directly. Also has no API to get to know the timer is a Reload/one-shot timer, need a seperate parameter to maintain.

The only way to achieve my function is to delete the origianl timer and create a timer again.

Could you help if there is a good method to achieve my functions, it will be better if can use existing API directluy.

Best Regards.
Thanks.

richarddamon wrote on Wednesday, November 28, 2018:

Unless ram is very tight, or it causes some other difficulty, I would create two timers, one for the single shot mode, and one for repetative mode, and start/stop the one you want. I agree that I don’t see an API to change the mode (which might be a useful addition to the API)

wirelessguy wrote on Thursday, November 29, 2018:

@Richard Damon,
Thanks, will FreeRTOS have plan to add an API/function to support this?

richarddamon wrote on Thursday, November 29, 2018:

For that you would have to ask someone at FreeRTOS, like the other Richard (Richard Barry)

rtel wrote on Thursday, November 29, 2018:

I think it would be an easy feature to add.