Complete the code to define an interrupt service routine (ISR) in FreeRTOS.
void vExampleISR(void) {
BaseType_t xHigherPriorityTaskWoken = [1];
// ISR code here
}In FreeRTOS, pdFALSE is used to initialize xHigherPriorityTaskWoken to indicate no higher priority task was woken yet.
Complete the code to notify a task from an ISR in FreeRTOS.
void vExampleISR(void) {
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
vTaskNotifyGiveFromISR(taskHandle, [1]);
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
}The function vTaskNotifyGiveFromISR requires a pointer to xHigherPriorityTaskWoken to update it if a higher priority task was woken.
Fix the error in the ISR code to correctly clear the interrupt flag.
void vExampleISR(void) {
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
// Clear interrupt flag
[1];
vTaskNotifyGiveFromISR(taskHandle, &xHigherPriorityTaskWoken);
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
}Interrupt flags are usually cleared by a macro or function named in uppercase like CLEAR_INTERRUPT_FLAG() to ensure the hardware interrupt is acknowledged properly.
Fill both blanks to create a dictionary comprehension that maps interrupt names to their priority levels, only including priorities higher than 3.
interrupt_priorities = {name: level for name, level in interrupts.items() if level [1] [2]The comprehension filters interrupts with priority levels greater than 3 using level > 3.
Fill all three blanks to create a dictionary comprehension that maps task names in uppercase to their stack sizes, only for tasks with stack size greater than 1000.
task_stacks = [1]: [2] for [3], [2] in tasks.items() if [2] > 1000
The comprehension uses name as the loop variable, maps name.upper() to stack_size, and filters stack sizes greater than 1000.