I have used a bit of code but i don't understand fully how it works and what the variables do.
This code is used for reading a encoder value and so it needed to be an interupt.
Code: Select all
void ESP_ISR callBack(Encoder & enc) {
BaseType_t pxHigherPriorityTaskWoken = pdFALSE;
static int16_t lastReading = 0;
int16_t currentReading = enc;
if (currentReading != lastReading) {
lastReading = currentReading;
xQueueSendToBackFromISR(encoderQueue, ¤tReading, &pxHigherPriorityTaskWoken);
if (pxHigherPriorityTaskWoken) {
portYIELD_FROM_ISR();
}
}
}Code: Select all
BaseType_t pxHigherPriorityTaskWoken = pdFALSE;Code: Select all
if (pxHigherPriorityTaskWoken) {
portYIELD_FROM_ISR();
}Code: Select all
xQueueSendToBackFromISR(encoderQueue, ¤tReading, &pxHigherPriorityTaskWoken);what does &pxHigherPriorityTaskWoken mean or do?
