0
0
FreeRTOSprogramming~10 mins

ISR-safe API functions (FromISR suffix) in FreeRTOS - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to send a character to a queue safely from an ISR.

FreeRTOS
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
xQueueSendFromISR(queue, &[1], &xHigherPriorityTaskWoken);
Drag options to blanks, or click blank then click option'
Aitem
Bdata
Cvalue
Dcharacter
Attempts:
3 left
💡 Hint
Common Mistakes
Using a variable not declared or unrelated to the data to send.
Forgetting to pass the address of the data.
2fill in blank
medium

Complete the code to yield from an ISR if a higher priority task was woken.

FreeRTOS
if (xHigherPriorityTaskWoken [1] pdTRUE) {
    portYIELD_FROM_ISR();
}
Drag options to blanks, or click blank then click option'
A<
B!=
C>
D==
Attempts:
3 left
💡 Hint
Common Mistakes
Using inequality operator which causes incorrect behavior.
Using comparison operators like < or > which are not appropriate here.
3fill in blank
hard

Fix the error in the ISR-safe queue receive function call.

FreeRTOS
BaseType_t result = xQueueReceiveFromISR(queue, [1], NULL);
Drag options to blanks, or click blank then click option'
A&buffer
Bbuffer
C*buffer
Dbuffer[0]
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the buffer variable directly instead of its address.
Dereferencing the buffer which causes errors.
4fill in blank
hard

Fill both blanks to correctly send data from an ISR and handle task wakeup.

FreeRTOS
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
if (xQueueSendFromISR(queue, &[1], &[2]) != pdPASS) {
    // Handle error
}
Drag options to blanks, or click blank then click option'
Adata
BxHigherPriorityTaskWoken
CxTaskWoken
Dresult
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect variable names for the task wakeup flag.
Not passing the address of the data variable.
5fill in blank
hard

Fill all three blanks to create an ISR-safe queue send and yield if needed.

FreeRTOS
BaseType_t [1] = pdFALSE;
if (xQueueSendFromISR(queue, &[2], &[3]) == pdPASS) {
    portYIELD_FROM_ISR([3]);
}
Drag options to blanks, or click blank then click option'
AxHigherPriorityTaskWoken
Bdata
Dresult
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names inconsistently.
Not passing the address of the data variable.