ESP32 hatası nasıl düzeltilir: 'GPIO' was not declared in this scope

Sorun

ESP32’de şu şekilde hızlı IO kullanıyorsunuz:

gpio_struct_include.cpp
GPIO.out_w1ts = ((uint32_t)1 << pin);

ancak derlemeye çalıştığınızda şöyle bir hata mesajı görürsünüz:

gpio_not_declared_error.txt
.pio/libdeps/esp32dev/Dali/src/DaliBus.h:84:9: error: 'GPIO' was not declared in this scope
   84 |         GPIO.out_w1ts = ((uint32_t)1 << pin);
      |         ^~~~

Çözüm

Bu sorun, Arduino-ESP32 veya ESP-IDF’nin yeni sürümlerinde ortaya çıkar. Düzeltmesi basittir: Sadece şunu ekleyin:

gpio_struct_include_fix.cpp
#include <soc/gpio_struct.h>

Check out similar posts by category: ESP32