s3: better handling of PSRAM pins
This commit is contained in:
@@ -113,10 +113,8 @@ String PinManagerClass::getPinSpecialText(int gpio) { // special purpose PIN in
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
#if defined(CONFIG_IDF_TARGET_ESP32S3)
|
||||
// ESP32-S3
|
||||
if (gpio > 18 && gpio < 21) return (F("USB (CDC) / JTAG"));
|
||||
#if !defined(BOARD_HAS_PSRAM)
|
||||
if (gpio > 32 && gpio < 38) return (F("(optional) Octal Flash or PSRAM"));
|
||||
#else
|
||||
if (gpio > 18 && gpio < 21) return (F("USB (CDC) or JTAG"));
|
||||
#if CONFIG_SPIRAM_MODE_OCT && defined(BOARD_HAS_PSRAM)
|
||||
if (gpio > 32 && gpio < 38) return (F("(reserved) Octal PSRAM or Octal Flash"));
|
||||
#endif
|
||||
//if (gpio == 0 || gpio == 3 || gpio == 45 || gpio == 46) return (F("(strapping pin)"));
|
||||
@@ -136,7 +134,7 @@ String PinManagerClass::getPinSpecialText(int gpio) { // special purpose PIN in
|
||||
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32C3)
|
||||
// ESP32-C3
|
||||
if (gpio > 17 && gpio < 20) return (F("USB (CDC) / JTAG"));
|
||||
if (gpio > 17 && gpio < 20) return (F("USB (CDC) or JTAG"));
|
||||
//if (gpio == 2 || gpio == 8 || gpio == 9) return (F("(strapping pin)"));
|
||||
|
||||
#else
|
||||
@@ -737,12 +735,18 @@ bool PinManagerClass::isPinOk(byte gpio, bool output) const
|
||||
#if defined(CONFIG_IDF_TARGET_ESP32C3)
|
||||
// strapping pins: 2, 8, & 9
|
||||
if (gpio > 11 && gpio < 18) return false; // 11-17 SPI FLASH
|
||||
#if ARDUINO_USB_CDC_ON_BOOT == 1 || ARDUINO_USB_DFU_ON_BOOT == 1
|
||||
if (gpio > 17 && gpio < 20) return false; // 18-19 USB-JTAG
|
||||
#endif
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32S3)
|
||||
// 00 to 18 are for general use. Be careful about straping pins GPIO0 and GPIO3 - these may be pulled-up or pulled-down on your board.
|
||||
#if ARDUINO_USB_CDC_ON_BOOT == 1 || ARDUINO_USB_DFU_ON_BOOT == 1
|
||||
if (gpio > 18 && gpio < 21) return false; // 19 + 20 = USB-JTAG. Not recommended for other uses.
|
||||
#endif
|
||||
if (gpio > 21 && gpio < 33) return false; // 22 to 32: not connected + SPI FLASH
|
||||
//if (gpio > 32 && gpio < 38) return false; // 33 to 37: not available if using _octal_ SPI Flash or _octal_ PSRAM
|
||||
// #if CONFIG_SPIRAM_MODE_OCT && defined(BOARD_HAS_PSRAM)
|
||||
// if (gpio > 32 && gpio < 38) return !psramFound(); // 33 to 37: not available if using _octal_ SPI Flash or _octal_ PSRAM
|
||||
// #endif
|
||||
// 38 to 48 are for general use. Be careful about straping pins GPIO45 and GPIO46 - these may be pull-up or pulled-down on your board.
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32S2)
|
||||
// strapping pins: 0, 45 & 46
|
||||
|
||||
@@ -594,9 +594,11 @@ void WLED::setup()
|
||||
#if defined(ARDUINO_ARCH_ESP32) && defined(BOARD_HAS_PSRAM)
|
||||
//psramInit(); //WLEDMM?? softhack007: not sure if explicit init is really needed ... lets disable it here and see if that works
|
||||
#if defined(CONFIG_IDF_TARGET_ESP32S3)
|
||||
// S3: reserve GPIO 33-37 for "octal" PSRAM
|
||||
managed_pin_type pins[] = { {33, true}, {34, true}, {35, true}, {36, true}, {37, true} };
|
||||
pinManager.allocateMultiplePins(pins, sizeof(pins)/sizeof(managed_pin_type), PinOwner::SPI_RAM);
|
||||
#if CONFIG_SPIRAM_MODE_OCT && defined(BOARD_HAS_PSRAM)
|
||||
// S3: reserve GPIO 33-37 for "octal" PSRAM
|
||||
managed_pin_type pins[] = { {33, true}, {34, true}, {35, true}, {36, true}, {37, true} };
|
||||
pinManager.allocateMultiplePins(pins, sizeof(pins)/sizeof(managed_pin_type), PinOwner::SPI_RAM);
|
||||
#endif
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32S2)
|
||||
// S2: reserve GPIO 26-32 for PSRAM (may fail due to isPinOk() but that will also prevent other allocation)
|
||||
//managed_pin_type pins[] = { {26, true}, {27, true}, {28, true}, {29, true}, {30, true}, {31, true}, {32, true} };
|
||||
@@ -815,7 +817,11 @@ void WLED::setup()
|
||||
USER_PRINTLN(F("\nGPIO\t| Assigned to\t\t| Info"));
|
||||
USER_PRINTLN(F("--------|-----------------------|------------"));
|
||||
for(int pinNr = 0; pinNr < WLED_NUM_PINS; pinNr++) { // 49 = highest PIN on ESP32-S3
|
||||
#if defined(CONFIG_IDF_TARGET_ESP32S3)
|
||||
if((pinManager.isPinOk(pinNr, false)) || (pinNr > 18 && pinNr < 21)) { // softhack007: list USB pins
|
||||
#else
|
||||
if(pinManager.isPinOk(pinNr, false)) {
|
||||
#endif
|
||||
//if ((!pinManager.isPinAllocated(pinNr)) && (pinManager.getPinSpecialText(pinNr).length() == 0)) continue; // un-comment to hide no-name,unused GPIO pins
|
||||
bool is_inOut = pinManager.isPinOk(pinNr, true);
|
||||
#if 0 // for testing
|
||||
|
||||
Reference in New Issue
Block a user