Semaphore in ISR
macdroid53 opened this issue · 1 comments
I note in the FreeRTOS documentation it states that the xSemaphoreTake() should never be used in an ISR.
Is there a caveat to that since the ISR in example inputTest.ino has a call to that in the second line?
void receiveCallback(int slots) { if ( slots ) { xSemaphoreTake( ESP32DMX.lxDataLock, portMAX_DELAY );
Good question. The semaphore works to coordinate between the receiveDMX task and the main task. Note that receiveDMX is executed as a task, not an ISR. Internally, the RTOS RX ISR puts received data into a queue that is read by the receiveDMX task as it becomes available. You need to use some signal to avoid a partial or corrupted read by the master receiving task (not the receiveDMX task). And, that was an issue before the semaphore was added.
-edited answer 1-27-20