Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Loading

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. ???

Attachments

alternate (733 bytes)

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 ?

Attachments

alternate (890 bytes)

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

thank you very much


[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]


Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner