syncEventGroupTask1 and Task2BIT_0 for Task1 and BIT_1 for Task2BIT_0 | BIT_1 to be set before printing a synchronization messagesyncEventGroupTask1 and Task2BIT_0 for Task1 and BIT_1 for Task2BIT_0 | BIT_1 to be set before printing a synchronization messagesyncEventGroup using xEventGroupCreate().Use xEventGroupCreate() to create the event group and assign it to syncEventGroup.
BIT_0 as (1 << 0) and BIT_1 as (1 << 1). Then create two tasks named Task1 and Task2 using xTaskCreate() with empty task functions for now.Use #define to define bits and xTaskCreate() to create tasks with empty functions.
In Task1, set BIT_0 in syncEventGroup using xEventGroupSetBits(). Then wait for both BIT_0 and BIT_1 to be set using xEventGroupWaitBits(). Do the same in Task2 but set BIT_1. Use pdFALSE to avoid clearing bits on exit, pdTRUE to wait for all bits, and portMAX_DELAY to wait indefinitely.
Use xEventGroupSetBits() to set the bit and xEventGroupWaitBits() to wait for both bits without clearing them on exit and blocking indefinitely.
Task1, print "Task1 synchronized!". After waiting in Task2, print "Task2 synchronized!". Use printf() for printing.Use printf() to print the exact messages after waiting for synchronization.
bits after xEventGroupWaitBits() returns?
EventBits_t bits; bits = xEventGroupWaitBits(eventGroup, BIT_0 | BIT_1, pdTRUE, pdFALSE, portMAX_DELAY);Assume BIT_0 and BIT_1 are both set in
eventGroup before the call.EventGroupHandle_t eventGroup = xEventGroupCreate();
void Task1(void *pvParameters) {
xEventGroupWaitBits(eventGroup, BIT_0, pdFALSE, pdTRUE, portMAX_DELAY);
// Task code
}
void Task2(void *pvParameters) {
xEventGroupSetBits(eventGroup, BIT_0);
}xEventGroupWaitBits() call correctly waits for both bits before continuing?Pass the test and this pattern moves unknown