Просмотр исходного кода

Add synchronization for GPIO pin map access

SybexXx 3 дней назад
Родитель
Сommit
a3cbdf54a9
1 измененных файлов с 2 добавлено и 0 удалено
  1. 2 0
      code/components/jomjol_controlGPIO/server_GPIO.h

+ 2 - 0
code/components/jomjol_controlGPIO/server_GPIO.h

@@ -8,6 +8,7 @@
 #include <esp_http_server.h>
 #include <map>
 #include <string>
+#include <mutex>
 #include "driver/gpio.h"
 #include "freertos/queue.h"
 #include "freertos/semphr.h"
@@ -96,6 +97,7 @@ private:
     std::string _configFile;
     httpd_handle_t _httpServer;
     std::map<gpio_num_t, GpioPin*> *gpioMap = NULL;
+    std::mutex _mapMutex;
     QueueHandle_t _eventQueue = NULL;
     TaskHandle_t _workerTask = NULL;
     SemaphoreHandle_t _workerStopped = NULL;