Bird
0
0

You want to design a system where Task A waits for either event bit 0x01 or 0x02 to be set by Task B without clearing them on exit. Which call to xEventGroupWaitBits() achieves this?

hard📝 Application Q8 of 15
FreeRTOS - Design Patterns for RTOS
You want to design a system where Task A waits for either event bit 0x01 or 0x02 to be set by Task B without clearing them on exit. Which call to xEventGroupWaitBits() achieves this?
AxEventGroupWaitBits(xEventGroup, 0x03, pdTRUE, pdFALSE, portMAX_DELAY);
BxEventGroupWaitBits(xEventGroup, 0x03, pdFALSE, pdTRUE, portMAX_DELAY);
CxEventGroupWaitBits(xEventGroup, 0x03, pdTRUE, pdTRUE, portMAX_DELAY);
DxEventGroupWaitBits(xEventGroup, 0x03, pdFALSE, pdFALSE, portMAX_DELAY);
Step-by-Step Solution
Solution:
  1. Step 1: Understand parameters for waiting on bits

    To wait for either bit 0x01 or 0x02, waitForAllBits must be false (pdFALSE).
  2. Step 2: Match parameters to requirement

    xEventGroupWaitBits(xEventGroup, 0x03, pdFALSE, pdFALSE, portMAX_DELAY); sets waitForAllBits to pdFALSE and clears bits on exit to pdFALSE, which fits the requirement.
  3. Final Answer:

    xEventGroupWaitBits(xEventGroup, 0x03, pdFALSE, pdFALSE, portMAX_DELAY); -> Option D
  4. Quick Check:

    waitForAllBits false waits for any bit [OK]
Quick Trick: Use waitForAllBits = pdFALSE to wait for any bit [OK]
Common Mistakes:
  • Setting waitForAllBits true to wait for any bit
  • Confusing clear on exit parameter
  • Using wrong bit mask

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes