FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [November 2016 Threads] trigger timer before periode expirationPosted by po220 on November 11, 2016 Hi
I'm using a periodic timer
Timer1 = xTimerCreate("Timer1", 10000, pdTRUE, (void *)0, Timer1Callback) ;
xTimerStart(Timer1, 0) ;
How can I force the timer to expire immediately ?
15:10 pm => Timer1 start
15:20 pm => Timer1 should execute the callback function
and me, at 15;12 pm, I need to execute the callback function, with(top solution) or whithout reset of the timer.
I do not see any solution here
http://www.freertos.org/FreeRTOS-Software-Timer-API-Functions.html
Thanks in advance
trigger timer before periode expirationPosted by rtel on November 11, 2016 If you don't want to reset the timer, just call the timer callback
function as any other function. Otherwise you would have to stop the
timer then restart it with a new timeout time (or just change its period
so it expires at the new desired time, which effectively does the same
thing).
trigger timer before periode expirationPosted by po220 on November 11, 2016 Thank for your answer
What happens by calling the callback directly?
Timer1Callback(Timer1) ;
The timer don't restarts for a complete new period.
No risk of disrupting timer normal operation ? or I need make a
xTimerReset( Timer1,0); just before the Timer1Callback(Timer1) ?
thanks
trigger timer before periode expirationPosted by rtel on November 11, 2016 Timer callback functions are just standard C functions, and can be
called by another task (in which case the function runs in the context
of the calling task). As all you are doing is calling a C function it
will not change the software timer, which will continue and expire just
as it would have done otherwise.
trigger timer before periode expirationPosted by po220 on November 11, 2016 Ok
xTimerReset( Timer1,0);
Timer1Callback(Timer1) ;
Is therefore a good solution ?
How to prevent the callback function from calling 2 times ? Semaphore ?
Thanks
trigger timer before periode expirationPosted by davedoors on November 11, 2016 Im confused. What are you trying to do?
15:10 pm => Timer1 start
15:20 pm => Timer1 should execute the callback function
and me, at 15;12 pm, I need to execute the callback function, with(top solution) or whithout reset of the timer.
So you thought the timer should expire at 15:20, but something happened that means it now needs to expire at 15:12. Do you want it to execute at 15:20 as well? If so just call the callback function at 15:12 from a task. If you dont want it to execute at 15:20 as well just stop the time then call the callback from a atsk.
trigger timer before periode expirationPosted by po220 on November 11, 2016 I need
15:10 => timer execute callback function
15:12 => execute callback function "manualy"
15:22 =>timer execute callback function
15:32 =>timer execute callback function
....
trigger timer before periode expirationPosted by po220 on November 11, 2016 My solution, if you confirm.
~~~
xTimerReset(Timer1,0);
while(xTaskGetHandle("Tache1") != NULL) vTaskDelay(10) ; //Wait for callback function end.
Timer1Callback(Timer1) ;
~~~
the callback fonction create the "Tache1" task.
It's OK for you ?
Thanks
trigger timer before periode expirationPosted by rtel on November 11, 2016 You could perform the reset of the timer from the timer callback
function itself. That way if you manually execute the callback function
the timer will automatically reset at that point.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|