How to fix ESP32 error: 'GPIO' was not declared in this scope

Problem

You are using fast IO on the ESP32 like this:

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

but when you try to compile it, you see an error message such as

.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);
      |         ^~~~

Solution

This issue occurs with never versions of either Arduino-ESP32 or ESP-IDF. Fixing it is simple: Just include

#include <soc/gpio_struct.h>