Hi, I’m starting in the FreeRTOS world and I need help. I want create a semaphore and use in many files to prevents concurrency problem. But I dont know how is the best practice to do this. I think to create a library that control the semaphores. Something like this:
<SemaphoresUtils.cpp>
static SemaphoreHandle_t semaphoreUart0;void semaphoreUart0Create() {
semaphoreUart0 = xSemaphoreCreateMutex();
}void semaphoreUart0Take()
{
xSemaphoreTake(semaphoreUart0, portMAX_DELAY);
}void semaphoreUart0Give()
{
xSemaphoreGive(semaphoreUart0);
}
So, I will use this functions (semaphoreUart0Take() and emaphoreUart0Give()) in all my code. Its a good way to work?