mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-24 11:46:34 +00:00
Merge pull request #310 from codewise-nicolas/ng_fix_esp32s2_pins
Fixed the GPIO definitions for ESP32S2
This commit is contained in:
commit
316c1417ba
@ -283,11 +283,31 @@ uint16_t Esp32Device::get_cpu_frequency()
|
||||
|
||||
bool Esp32Device::is_system_pin(uint8_t pin)
|
||||
{
|
||||
if((pin >= 6) && (pin <= 11)) return true; // integrated SPI flash
|
||||
if((pin == 37) || (pin == 38)) return true; // unavailable
|
||||
if(psramFound()) {
|
||||
if((pin == 16) || (pin == 17)) return true; // PSRAM
|
||||
}
|
||||
//Also see esp32.cpp / hasp_gpio.cpp
|
||||
#if defined(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
|
||||
//More info https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/_images/esp32-s2_saola1-pinout.jpg
|
||||
//Datasheet https://www.espressif.com/sites/default/files/documentation/esp32-s2-wroom_esp32-s2-wroom-i_datasheet_en.pdf
|
||||
|
||||
//From the ESP32S2-Wroom pdf, the flash appears to be on the upper set of IO.
|
||||
//SPICS0 = IO10 or IO34 ?
|
||||
//SPICLK = IO12 or IO36
|
||||
//SPIHD = IO9 or IO33
|
||||
//SPID = IO11 or IO35
|
||||
//SPIQ = IO13 or IO37
|
||||
//SPIWP = IO14 or IO38
|
||||
if((pin >= 33) && (pin <= 38)) return true; // SPI flash
|
||||
|
||||
if(psramFound()) {
|
||||
if((pin == 26) ) return true; // PSRAM. IO26 = SPICS1, the rest are shared with the flash
|
||||
}
|
||||
#else
|
||||
if((pin >= 6) && (pin <= 11)) return true; // integrated SPI flash
|
||||
if((pin == 37) || (pin == 38)) return true; // unavailable
|
||||
if(psramFound()) {
|
||||
if((pin == 16) || (pin == 17)) return true; // PSRAM
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -781,6 +781,20 @@ bool gpioIsSystemPin(uint8_t gpio)
|
||||
#ifdef TFT_D15
|
||||
|| (gpio == TFT_D15)
|
||||
#endif
|
||||
//Cant assign the touch pins to the generic GPIO. Maybe in future if sensors are added
|
||||
#ifdef TOUCH_SDA
|
||||
|| (gpio == TOUCH_SDA)
|
||||
#endif
|
||||
#ifdef TOUCH_SCL
|
||||
|| (gpio == TOUCH_SCL)
|
||||
#endif
|
||||
#ifdef TOUCH_IRQ
|
||||
|| (gpio == TOUCH_IRQ)
|
||||
#endif
|
||||
#ifdef TOUCH_RST
|
||||
|| (gpio == TOUCH_RST)
|
||||
#endif
|
||||
|
||||
) {
|
||||
return true;
|
||||
} // if tft_espi pins
|
||||
@ -791,6 +805,8 @@ bool gpioIsSystemPin(uint8_t gpio)
|
||||
// Serial GPIOs
|
||||
// Tasmota Client GPIOs
|
||||
|
||||
//NG. Remove the checks here since the is_system_pin function does the same check. Best to keep the code in 1 place only.
|
||||
/*
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
if((gpio >= 6) && (gpio <= 11)) return true; // integrated SPI flash
|
||||
if((gpio == 37) || (gpio == 38)) return true; // unavailable
|
||||
@ -801,10 +817,12 @@ bool gpioIsSystemPin(uint8_t gpio)
|
||||
|
||||
#ifdef ARDUINO_ARCH_ESP8266
|
||||
if((gpio >= 6) && (gpio <= 11)) return true; // integrated SPI flash
|
||||
#ifndef TFT_SPI_OVERLAP
|
||||
if((gpio >= 12) && (gpio <= 14)) return true; // HSPI
|
||||
#endif
|
||||
#ifndef TFT_SPI_OVERLAP
|
||||
if((gpio >= 12) && (gpio <= 14)) return true; // HSPI
|
||||
#endif
|
||||
#endif
|
||||
*/
|
||||
|
||||
|
||||
if(haspDevice.is_system_pin(gpio)) return true;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user