Skip to Content
Hands-On RTOS with Microcontrollers
book

Hands-On RTOS with Microcontrollers

by Brian Amos
May 2020
Intermediate to advanced
496 pages
13h 54m
English
Packt Publishing
Content preview from Hands-On RTOS with Microcontrollers

Task C (low priority)

Task C is responsible for blinking the blue LED, but only after the semPtr has been taken (within 200 ms of requesting it). The following excerpt has been taken from mainSemPriorityInversion.c:

while(1)  {    //'take' the semaphore with a 200mS timeout    SEGGER_SYSVIEW_PrintfHost("attempt to take semPtr");    if(xSemaphoreTake(semPtr, 200/portTICK_PERIOD_MS) == pdPASS)    {      RedLed.Off();      SEGGER_SYSVIEW_PrintfHost("received semPtr");      blinkTwice(&BlueLed);      xSemaphoreGive(semPtr);    }    else    {      //this code is called when the semaphore wasn't taken in time      SEGGER_SYSVIEW_PrintfHost("FAILED to receive "                                    "semphr in time");      RedLed.On();    }  }

TaskC() is relying on the same semaphore as TaskA(). The only difference is that TaskC() is blinking ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hands-On RTOS with Microcontrollers - Second Edition

Hands-On RTOS with Microcontrollers - Second Edition

Jim Yuill, Penn Linder

Publisher Resources

ISBN: 9781838826734Supplemental Content