Hi all,
i am using a semaphore and one task and ISR communicate with that.
In my app, as suggested in FreeRTOS doc, the ISR always give the semaphore and the task always take it. however, the first interaction of the task the semaphore is already given by the creation function and not by the ISR.
This cause not correct exectution.
I noticed that in the creation (vSemaphoreCreateBinary) the semaphore is automatically "given" (xSemaphoreGive).
This problem is easily solvable by "taking" the semaphore just after creation, but it might be a good idea to have a parameter in vSemaphoreCreateBinary in order for the developer to choose if the created semapore should be given or not. or at least document this.
Your suggestion is valid but it would have to be done in a way that was backward compatible. Maybe maintain the original function to create the semaphore and introduce a new function that has the extra parameter.