Fix reserved pins on ESP32

This commit is contained in:
fvanroie 2023-06-14 14:46:21 +02:00
parent c1d17825e4
commit c38f2467b0

View File

@ -357,7 +357,11 @@ uint16_t Esp32Device::get_cpu_frequency()
bool Esp32Device::is_system_pin(uint8_t pin) bool Esp32Device::is_system_pin(uint8_t pin)
{ {
// Also see esp32.cpp / hasp_gpio.cpp // Also see esp32.cpp / hasp_gpio.cpp
#if defined(ESP32S2) // Arduino NUM_DIGITAL_PINS = 48 (but espressif says it only has 46) #if defined(CONFIG_IDF_TARGET_ESP32S3)
if((pin >= 22) && (pin <= 25)) return true; // unavailable
if((pin >= 26) && (pin <= 32)) return true; // integrated SPI flash
if((pin >= 33) && (pin <= 37)) return true; // octal flash or PSram
#elif defined(CONFIG_IDF_TARGET_ESP32S2) // Arduino NUM_DIGITAL_PINS = 48 (but espressif says it only has 46)
// From https://hggh.github.io/esp32/2021/01/06/ESP32-S2-pinout.html, it looks like IO26 is for PSRAM // From https://hggh.github.io/esp32/2021/01/06/ESP32-S2-pinout.html, it looks like IO26 is for PSRAM
// More info https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/_images/esp32-s2_saola1-pinout.jpg // More info https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/_images/esp32-s2_saola1-pinout.jpg
// Datasheet // Datasheet
@ -372,11 +376,7 @@ bool Esp32Device::is_system_pin(uint8_t pin)
// SPIWP = IO14 or IO38 // SPIWP = IO14 or IO38
if((pin >= 33) && (pin <= 38)) return true; // SPI flash if((pin >= 33) && (pin <= 38)) return true; // SPI flash
if(psramFound() && (pin == 26)) return true; // PSRAM. IO26 = SPICS1, the rest are shared with the flash if(psramFound() && (pin == 26)) return true; // PSRAM. IO26 = SPICS1, the rest are shared with the flash
#elif defined(ESP32S3) #elif defined(CONFIG_IDF_TARGET_ESP32)
if((pin >= 22) && (pin <= 25)) return true; // unavailable
if((pin >= 26) && (pin <= 32)) return true; // integrated SPI flash
if((pin >= 33) && (pin <= 37)) return true; // octal flash or PSram
#else
if((pin >= 6) && (pin <= 11)) return true; // integrated SPI flash if((pin >= 6) && (pin <= 11)) return true; // integrated SPI flash
#ifndef HASP_USE_GPIO37 #ifndef HASP_USE_GPIO37
if(pin == 37) return true; // unavailable if(pin == 37) return true; // unavailable