diff --git a/tasmota/tasmota_support/support.ino b/tasmota/tasmota_support/support.ino index c38b83e89..967113554 100755 --- a/tasmota/tasmota_support/support.ino +++ b/tasmota/tasmota_support/support.ino @@ -1442,12 +1442,16 @@ void SetPin(uint32_t lpin, uint32_t gpio) { TasmotaGlobal.gpio_pin[lpin] = gpio; } +#ifdef CONFIG_IDF_TARGET_ESP32C3 +#include "driver/gpio.h" // Include needed for Arduino 3 +#endif + void DigitalWrite(uint32_t gpio_pin, uint32_t index, uint32_t state) { static uint32_t pinmode_init[2] = { 0 }; // Pins 0 to 63 !!! if (PinUsed(gpio_pin, index)) { uint32_t pin = Pin(gpio_pin, index) & 0x3F; // Fix possible overflow over 63 gpios -#if CONFIG_IDF_TARGET_ESP32C3 +#ifdef CONFIG_IDF_TARGET_ESP32C3 gpio_hold_dis((gpio_num_t)pin); // Allow state change #endif if (!bitRead(pinmode_init[pin / 32], pin % 32)) { @@ -1455,7 +1459,7 @@ void DigitalWrite(uint32_t gpio_pin, uint32_t index, uint32_t state) { pinMode(pin, OUTPUT); } digitalWrite(pin, state &1); -#if CONFIG_IDF_TARGET_ESP32C3 +#ifdef CONFIG_IDF_TARGET_ESP32C3 gpio_hold_en((gpio_num_t)pin); // Retain the state when the chip or system is reset, for example, when watchdog time-out or Deep-sleep #endif }