xEventGroupWait of reset Bits

I can wait bits in enentgroup fixed time. example

uxBits = xEventGroupWaitBits(EventgroupHandle,  myBit, pdFALSE, pdFALSE, 1000);
 if (!(uxBits & myBit)){
    //spent 1 sec but myBit doesn't set 
}

But now I want to wait clear bit event. How I can do it? I have got not good solution only:

counter = 0;
do{
	uxBits = xEventGroupGetBits(EventgroupHandle);
	osDelay(1);
	counter++;
}while((counter < 1000) && (uxBitsSysState & OD07L_MOTORSMAIN_WORK_MSK));
if (counter >= 1000){
    //spent 1 sec but myBit doesn't reset 
}

xEventGroupClearBits

xEventGroupClearBits is not xEventGroupWating of Clear Bits. I need function with xTicksToWait.

I think you can only block waiting for bits to be set, not cleared.

I found myself wondering about this exact thing as well. Currently, @rtel is right, but can it not be done? Or, if Iā€™m missing some other better alternative to event groups that keep track of non-unary events not inherently tied to any tasks, let me know.

1 Like

FreeRTOS intentionally has a minimal set of primitives, each having a fairly well defined usage. QueueSets and EventGroups are the only two that I can think of that allow a task to block on multiple things that is not tied to the task (which would add the task-notification system).

It is also possible to define a communications system of you own that uses some simple FreeRTOS primative as a base, with the more complicated logic wrapped around it. Because this is in general possible, there is less need to add more complicated system into FreeRTOS itself, especially since many of these more complicated systems often need slight tweaks to match the exact program requirements.

2 Likes