Complete the code to create a task that must meet a strict deadline (hard real-time).
xTaskCreate(taskFunction, "Task1", configMINIMAL_STACK_SIZE, NULL, [1], NULL);
Hard real-time tasks require the highest priority to meet strict deadlines, so we use configMAX_PRIORITIES - 1.
Complete the code to delay a soft real-time task without blocking other tasks.
vTaskDelay([1]);portMAX_DELAY which blocks indefinitely.Use pdMS_TO_TICKS(100) to convert milliseconds to ticks for a non-blocking delay.
Fix the error in the code to ensure a hard real-time task does not miss its deadline.
if (xTaskGetTickCount() > [1]) { // handle deadline miss }
portMAX_DELAY which is a constant for max delay.The code should compare the current tick count to a predefined deadline to detect deadline misses.
Fill both blanks to create a soft real-time task that waits for a notification with a timeout.
if (xTaskNotifyWait(0, 0, NULL, [1]) == [2]) { // notification received }
portMAX_DELAY which waits indefinitely.pdFAIL instead of pdPASS.The task waits up to 5000 ms (pdMS_TO_TICKS(5000)) and checks if the notification was successful (pdPASS).
Fill all three blanks to define a hard real-time task that suspends itself and resumes after an interrupt.
void [1](void *pvParameters) { for (;;) { vTaskSuspend(NULL); // task resumed by [2] [3](); } }
The task named HardRealTimeTask suspends itself and is resumed by an interrupt service routine (an ISR), then calls processCriticalData().