Enthernet Code
Enthernet Code
How to Fetch and Display Data from DHT22 Sensor on AVR32UC with Zephyr OS?
hello @Dtynin did u wrap ur queue operations with mutex locks. something like this 👇
SemaphoreHandle_t xMutex;

xMutex = xSemaphoreCreateMutex();

void readSensorTask(void *pvParameters) {
sensor_data_t sensorData;
for (;;) {

if (xSemaphoreTake(xMutex, portMAX_DELAY)) {
xQueueSend(sensorQueue, &sensorData, portMAX_DELAY);
xSemaphoreGive(xMutex);
}
vTaskDelay(pdMS_TO_TICKS(1000));
}
}

void processDataTask(void *pvParameters) {
sensor_data_t sensorData;
for (;;) {
if (xSemaphoreTake(xMutex, portMAX_DELAY)) {
if (xQueueReceive(sensorQueue, &sensorData, portMAX_DELAY)) {

}
xSemaphoreGive(xMutex);
}
vTaskDelay(pdMS_TO_TICKS(10000));
}
}
SemaphoreHandle_t xMutex;

xMutex = xSemaphoreCreateMutex();

void readSensorTask(void *pvParameters) {
sensor_data_t sensorData;
for (;;) {

if (xSemaphoreTake(xMutex, portMAX_DELAY)) {
xQueueSend(sensorQueue, &sensorData, portMAX_DELAY);
xSemaphoreGive(xMutex);
}
vTaskDelay(pdMS_TO_TICKS(1000));
}
}

void processDataTask(void *pvParameters) {
sensor_data_t sensorData;
for (;;) {
if (xSemaphoreTake(xMutex, portMAX_DELAY)) {
if (xQueueReceive(sensorQueue, &sensorData, portMAX_DELAY)) {

}
xSemaphoreGive(xMutex);
}
vTaskDelay(pdMS_TO_TICKS(10000));
}
}
11 replies