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] [July 2016 Threads] Periodic Task that also call from interrupt.Posted by valeriv on July 26, 2016 Hello to all.
I have GUI task that it's main purpose to redraw windows and to react on pressing buttons.
So I thought that the best way redraw window every 200 miliseconds (vTaskDelay(200)), and also I want to call it from Keyboard Interrupt.
I redraw window periodicly, because the data on it can be changed. So, I can't use vTaskSuspend.
Help me, please, how can i do this ?
Thanks in advance
Valerie
Periodic Task that also call from interrupt.Posted by valeriv on July 26, 2016 I think, may be, the gui task after redraw window will set itself to suspend state.
And resume it from timer every 200 mili and from the keyboard interrupt.
???
Periodic Task that also call from interrupt.Posted by valeriv on July 26, 2016 If I will run the gui Task in loop with Delay(200) , how can I break the DELAING state from keyboard interrupt ?
Periodic Task that also call from interrupt.Posted by davedoors on July 26, 2016 From a task you can use http://www.freertos.org/xTaskAbortDelay.html but I'm not sure if there is a FromISR version.
Periodic Task that also call from interrupt.Posted by rasty1 on July 26, 2016 I'd recoment to use semaphore with Delay option instead of vTaskDelay.
If you need to interrupt, just give a semaphore.
Periodic Task that also call from interrupt.Posted by valeriv on July 26, 2016 Hi Dave, thanks for your answer. But I really don't see FromISR version.
How I can check if it is right solution for my problem ?
Periodic Task that also call from interrupt.Posted by valeriv on July 26, 2016 Hi, Rasty.
Can you, please, give me an example of your solution.
If I understand right, the gui task take semaphore in the end of it's loop..
In keyboard interrupt I can give semaphore back.
What about call gui task every 200 mili ? Return semaphore from timer ?
Can you explain your solution again ?
Periodic Task that also call from interrupt.Posted by rasty1 on July 26, 2016 I hope that I understand correcly the problem.
You have to redraw screen each 200 ms. Sometimes trigger extra redraw from Interrupt or other context.
while (1)
{
xSemaphoreTake(sem, 200);
// will leave xSemaphoreTake after 200 msecs (with error) or earlier if sem is given.
redraw();
}
from other task/interrupt
xSemaphoreGive(sem)
Periodic Task that also call from interrupt.Posted by valeriv on July 27, 2016 Thanks a lot to you, Rasty
Periodic Task that also call from interrupt.Posted by rtel on July 27, 2016 You can also do the same thing in a more efficient way using a direct to
task notification in place of a semaphore.
http://www.freertos.org/RTOSTaskNotificationAsCounting_Semaphore.html
Periodic Task that also call from interrupt.Posted by valeriv on July 28, 2016
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|