I need taskA to waits for both taskB and taskC to finish before continuing.
I am trying to use FreeRTOS’ notifications for this but unsure how to use xTaskNotifyWait to wait for not one notification but two before reseting notifications and carrying on with taskA.
My current idea is this:
//Task B
xTaskNotify(taskA, (1<<0), eSetBits); // set 0th bit HIGH
// Task C
xTaskNotify(taskB, (1<<1), eSetBits); // set 1st bit HIGH
// Task A
while(ulNotifiedValue != 5)
{
xTaskNotifyWait(0, 0, &ulNotifiedValue, (TickType_t)portMAX_DELAY);
}
// reset notification value
ulNotifiedValue = 0
// contiunue with taskA...
However, this seems to block at xTaskNotifyWait indefinitely.
Ah I thought ulNotifiedValue = 0 would do the trick but I think you’re right.
Sadly ulTaskNotifyValueClear is not available on ESP32 currently, so will have to try and update library.
Alternatively you could assemble/collect the bits in a local variable and set the ulBitsToClearOnExit argument of xTaskNotifyWait to the complete bitmask (3).