Skip to content

Commit

Permalink
Add Elecrow ESP-Terminal SPI and RGB
Browse files Browse the repository at this point in the history
  • Loading branch information
fvanroie committed Jul 18, 2023
1 parent 8c8a7eb commit a790679
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ jobs:
out: d1-r32-espduino32
- env: d1-r32-unoshield_ili9486_adc
out: d1-r32-espduino32
- out: waveshare
env: "esp32-one_ili9486 -e esp32-one_st7796"
- out: dustinwatts
env: "freetouchdeck_4MB -e freetouchdeck_8MB -e esp32-touchdown"
- out: elecrow
env: "esp-terminal-rgb_16MB -e esp-terminal-spi_16MB"
- out: globalsecurity
env: gs-t3e_16MB
- out: lanbon
Expand All @@ -52,6 +52,8 @@ jobs:
env: "panlee-zw3d95ce01s-ar-4848_16MB -e panlee-zw3d95ce01s-ur-4848_16MB"
- out: sunton
env: "esp32-2432s028r_4MB -e esp32-3248s035c_4MB -e esp32-3248s035r_4MB -e sunton-4827s043c_16MB -e sunton-8048s043c_16MB -e sunton-8048s050c_16MB -e sunton-8048s070c_16MB"
- out: waveshare
env: "esp32-one_ili9486 -e esp32-one_st7796"
- out: wireless-tag
env: "wt32-sc01_4MB -e wt32-sc01_16MB -e wt-86-32-3zw1 -e wt32-sc01-plus_8MB -e wt32-sc01-plus_16MB"
- out: yeacreate
Expand Down
28 changes: 18 additions & 10 deletions src/drv/tft/tft_driver_lovyangfx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ static uint32_t _read_panel_id(lgfx::Bus_SPI* bus, int32_t pin_cs, uint32_t cmd
return res;
}

#if defined(ESP32S2) || defined(ESP32S3)
#if defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3)
static lgfx::Bus_Parallel16* init_parallel_16_bus(Preferences* prefs, int8_t data_pins[], uint8_t num)
{
lgfx::Bus_Parallel16* bus = new lgfx::v1::Bus_Parallel16();
Expand Down Expand Up @@ -85,7 +85,7 @@ static lgfx::Bus_Parallel16* init_parallel_16_bus(Preferences* prefs, int8_t dat
LOG_DEBUG(TAG_TFT, F("%s - %d"), __FILE__, __LINE__);
return bus;
}
#endif // ESP32S2
#endif // ESP32S2/S3

static lgfx::Bus_Parallel8* init_parallel_8_bus(Preferences* prefs, int8_t data_pins[], uint8_t num)
{
Expand Down Expand Up @@ -223,9 +223,17 @@ static void configure_panel(lgfx::Panel_Device* panel, Preferences* prefs)
#else
cfg.rgb_order = prefs->getBool("rgb_order", false); // true if the red and blue of the panel are swapped
#endif
cfg.dlen_16bit = prefs->getBool("dlen_16bit", false); // true for panels that send data length in 16-bit units
cfg.bus_shared = prefs->getBool("bus_shared", true); // true if the bus is shared with the SD card
// (bus control is performed with drawJpgFile etc.)

bool dlen_16bit = false;
#if defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3)
if(panel->getBus()) {
lgfx::v1::bus_type_t bus_type = panel->getBus()->busType();
if(bus_type == lgfx::v1::bus_parallel16) dlen_16bit = true;
}
#endif
cfg.dlen_16bit = prefs->getBool("dlen_16bit", dlen_16bit); // true for panels that send data length in 16-bit units
cfg.bus_shared = prefs->getBool("bus_shared", true); // true if the bus is shared with the SD card
// (bus control is performed with drawJpgFile etc.)
panel->config(cfg);
}

Expand All @@ -240,7 +248,7 @@ lgfx::IBus* _init_bus(Preferences* preferences)
for(uint8_t i = 0; i < 16; i++) {
snprintf(key, sizeof(key), "d%d", i + 1);
data_pins[i] = preferences->getInt(key, data_pins[i]);
LOG_DEBUG(TAG_TFT, F("D%d: %d"), i + 1, data_pins[i]);
LOG_DEBUG(TAG_TFT, F("D%d: %d"), i, data_pins[i]);
}

LOG_DEBUG(TAG_TFT, F("%s - %d"), __FILE__, __LINE__);
Expand All @@ -252,13 +260,13 @@ lgfx::IBus* _init_bus(Preferences* preferences)
}

LOG_DEBUG(TAG_TFT, F("%s - %d"), __FILE__, __LINE__);
#if defined(ESP32S2)
#if defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3)
if(is_16bit) {
is_8bit = false;
LOG_VERBOSE(TAG_TFT, F("16-bit TFT bus"));
return init_parallel_16_bus(preferences, data_pins, 16);
} else
#endif // ESP32S2
#endif // ESP32S2/S3
if(is_8bit) {
is_16bit = false;
LOG_VERBOSE(TAG_TFT, F("8-bit TFT bus"));
Expand Down Expand Up @@ -1012,7 +1020,7 @@ void LovyanGfx::show_info()
tftPinInfo(F("TFT_D7"), cfg.pin_d7);
}

#if defined(ESP32S2) || defined(ESP32S3)
#if defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3)
if(bus_type == lgfx::v1::bus_parallel16) {
LOG_VERBOSE(TAG_TFT, F("Interface : Parallel 16bit"));
auto bus = (lgfx::v1::Bus_Parallel16*)panel->getBus();
Expand Down Expand Up @@ -1144,7 +1152,7 @@ bool LovyanGfx::is_driver_pin(uint8_t pin)
pin == cfg.pin_d7)
return true;

#if defined(ESP32S2) || defined(ESP32S3)
#if defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3)
} else if(bus_type == lgfx::v1::bus_parallel16) {
auto bus = (lgfx::v1::Bus_Parallel16*)panel->getBus();
auto cfg = bus->config(); // Get the structure for bus configuration.
Expand Down

0 comments on commit a790679

Please sign in to comment.