Periodic Task that also call from interrupt.

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.

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.

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.

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.

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.

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.

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.

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.

Thanks a lot to you, Rasty

Periodic Task that also call from interrupt.

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.

thank you very much