2025-01-12 18:08:57 +01:00
|
|
|
#include "graphics/driver/DisplayDriverFactory.h"
|
|
|
|
|
#include "graphics/LGFX/LGFXConfig.h"
|
2024-04-15 14:54:47 +02:00
|
|
|
#include <assert.h>
|
2024-05-16 08:38:13 +02:00
|
|
|
#if defined(LGFX_DRIVER) || defined(ARCH_PORTDUINO)
|
2025-01-12 18:08:57 +01:00
|
|
|
#include "graphics/driver/LGFXDriver.h"
|
2024-04-15 14:54:47 +02:00
|
|
|
#endif
|
2024-05-16 08:38:13 +02:00
|
|
|
#if defined(OLED_DRIVER) || defined(ARCH_PORTDUINO)
|
2025-01-12 18:08:57 +01:00
|
|
|
#include "graphics/driver/OLEDDriver.h"
|
2024-04-15 14:54:47 +02:00
|
|
|
#endif
|
2024-05-16 08:38:13 +02:00
|
|
|
#if defined(EINK_DRIVER) || defined(ARCH_PORTDUINO)
|
2025-01-12 18:08:57 +01:00
|
|
|
// TODO #include "graphics/driver/EINKDriver.h"
|
2024-04-15 14:54:47 +02:00
|
|
|
#endif
|
2025-05-06 10:44:39 +02:00
|
|
|
#if defined(USE_FRAMEBUFFER)
|
|
|
|
|
#include "graphics/driver/FBDriver.h"
|
|
|
|
|
#endif
|
2024-04-15 14:54:47 +02:00
|
|
|
#if defined(USE_X11)
|
2025-01-12 18:08:57 +01:00
|
|
|
#include "graphics/driver/X11Driver.h"
|
2024-04-15 14:54:47 +02:00
|
|
|
#endif
|
|
|
|
|
|
2024-05-16 08:38:13 +02:00
|
|
|
#ifndef ARCH_PORTDUINO
|
2024-06-24 14:55:23 +02:00
|
|
|
#ifdef LGFX_DRIVER_TEMPLATE
|
2025-01-12 18:08:57 +01:00
|
|
|
#include "graphics/LGFX/LGFX_GENERIC.h"
|
2024-06-24 14:55:23 +02:00
|
|
|
#endif
|
2024-04-15 14:54:47 +02:00
|
|
|
#ifdef T_HMI
|
2025-01-12 18:08:57 +01:00
|
|
|
#include "graphics/LGFX/LGFX_T_HMI.h"
|
2024-04-15 14:54:47 +02:00
|
|
|
#endif
|
2024-08-02 17:04:32 +02:00
|
|
|
#ifdef SENSECAP_INDICATOR
|
2025-01-12 18:08:57 +01:00
|
|
|
#include "graphics/LGFX/LGFX_INDICATOR.h"
|
2024-08-02 17:04:32 +02:00
|
|
|
#endif
|
2024-10-24 01:09:54 +02:00
|
|
|
#ifdef ESP_4848S040
|
2025-01-12 18:08:57 +01:00
|
|
|
#include "graphics/LGFX/LGFX_4848S040.h"
|
2024-10-24 01:09:54 +02:00
|
|
|
#endif
|
2024-11-06 20:44:16 +01:00
|
|
|
#ifdef MAKERFABS_480X480
|
2025-01-12 18:08:57 +01:00
|
|
|
#include "graphics/LGFX/LGFX_MAKERFABS480X480.h"
|
2024-11-06 20:44:16 +01:00
|
|
|
#endif
|
2024-04-15 14:54:47 +02:00
|
|
|
#ifdef T_DECK
|
2025-01-12 18:08:57 +01:00
|
|
|
#include "graphics/LGFX/LGFX_T_DECK.h"
|
2024-04-15 14:54:47 +02:00
|
|
|
#endif
|
2025-08-16 18:28:05 +02:00
|
|
|
#ifdef T_LORA_PAGER
|
|
|
|
|
#include "graphics/LGFX/LGFX_T_LORA_PAGER.h"
|
|
|
|
|
#endif
|
2024-06-20 23:07:12 +02:00
|
|
|
#ifdef PICOMPUTER_S3
|
2025-01-12 18:08:57 +01:00
|
|
|
#include "graphics/LGFX/LGFX_PICOMPUTER_S3.h"
|
2024-06-20 23:07:12 +02:00
|
|
|
#endif
|
2024-04-15 14:54:47 +02:00
|
|
|
#ifdef T_WATCH_S3
|
2025-01-12 18:08:57 +01:00
|
|
|
#include "graphics/LGFX/LGFX_T_WATCH_S3.h"
|
2024-04-15 14:54:47 +02:00
|
|
|
#endif
|
2026-01-19 00:14:42 +01:00
|
|
|
#ifdef T_WATCH_ULTRA
|
|
|
|
|
#include "graphics/LGFX/LGFX_T_WATCH_ULTRA.h"
|
|
|
|
|
#endif
|
2024-04-15 14:54:47 +02:00
|
|
|
#ifdef UNPHONE
|
2025-01-12 18:08:57 +01:00
|
|
|
#include "graphics/LGFX/LGFX_UNPHONE.h"
|
2024-04-15 14:54:47 +02:00
|
|
|
#endif
|
2025-05-01 00:34:54 +02:00
|
|
|
#ifdef ELECROW_PANEL
|
|
|
|
|
#include "graphics/LGFX/LGFX_ELECROW70.h"
|
|
|
|
|
#endif
|
2024-05-07 17:18:10 +02:00
|
|
|
#ifdef ESP32_2432S022
|
2025-01-12 18:08:57 +01:00
|
|
|
#include "graphics/LGFX/LGFX_ESP2432S022.h"
|
2024-05-07 17:18:10 +02:00
|
|
|
#endif
|
2024-04-17 20:23:57 +02:00
|
|
|
#ifdef ESP32_2432S028RV1
|
2025-01-12 18:08:57 +01:00
|
|
|
#include "graphics/LGFX/LGFX_ESP2432S028RV1.h"
|
2024-04-15 14:54:47 +02:00
|
|
|
#endif
|
2024-04-17 20:23:57 +02:00
|
|
|
#ifdef ESP32_2432S028RV2
|
2025-01-12 18:08:57 +01:00
|
|
|
#include "graphics/LGFX/LGFX_ESP2432S028RV2.h"
|
2024-04-15 14:54:47 +02:00
|
|
|
#endif
|
2025-09-01 11:58:02 +02:00
|
|
|
#ifdef JC4827W543C
|
|
|
|
|
#include "graphics/LGFX/LGFX_JC4827W543C.h"
|
|
|
|
|
#endif
|
2024-04-15 14:54:47 +02:00
|
|
|
#ifdef WT32_SC01
|
2025-01-12 18:08:57 +01:00
|
|
|
#include "graphics/LGFX/LGFX_WT_SC01PLUS.h"
|
2024-04-15 14:54:47 +02:00
|
|
|
#endif
|
|
|
|
|
#ifdef HELTEC_TRACKER
|
2025-01-12 18:08:57 +01:00
|
|
|
#include "graphics/LGFX/LGFX_HELTEC_TRACKER.h"
|
2024-04-15 14:54:47 +02:00
|
|
|
#endif
|
2026-01-19 00:14:42 +01:00
|
|
|
#ifdef HELTEC_VISION_MASTER_T190
|
|
|
|
|
#include "graphics/LGFX/LGFX_VISION_MASTER_T190.h"
|
|
|
|
|
#endif
|
2024-04-17 20:23:57 +02:00
|
|
|
#ifdef NODEMCU_32S
|
2025-01-12 18:08:57 +01:00
|
|
|
#include "graphics/LGFX/LGFX_ESPILI9341XPT2046.h"
|
2024-04-17 20:23:57 +02:00
|
|
|
#endif
|
2025-11-07 18:57:53 +08:00
|
|
|
#ifdef HELTEC_V4_TFT
|
|
|
|
|
#include "graphics/LGFX/LGFX_HELTEC_V4_TFT.h"
|
|
|
|
|
#endif
|
2024-04-15 14:54:47 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
DisplayDriverFactory::DisplayDriverFactory() {}
|
|
|
|
|
|
|
|
|
|
DisplayDriver *DisplayDriverFactory::create(uint16_t width, uint16_t height)
|
|
|
|
|
{
|
2025-05-06 10:44:39 +02:00
|
|
|
#if defined(USE_FRAMEBUFFER)
|
|
|
|
|
return &FBDriver::create(width, height);
|
|
|
|
|
#endif
|
2024-04-15 14:54:47 +02:00
|
|
|
#if defined(USE_X11)
|
|
|
|
|
return &X11Driver::create(width, height);
|
|
|
|
|
#elif defined(LGFX_DRIVER)
|
|
|
|
|
return new LGFXDriver<LGFX_DRIVER>(width, height);
|
|
|
|
|
#endif
|
2024-10-17 09:06:42 +02:00
|
|
|
ILOG_CRIT("DisplayDriverFactory: missing or wrong configuration");
|
2024-05-05 20:42:25 +02:00
|
|
|
assert(false);
|
2024-04-15 14:54:47 +02:00
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DisplayDriver *DisplayDriverFactory::create(const DisplayDriverConfig &cfg)
|
|
|
|
|
{
|
2024-05-16 08:38:13 +02:00
|
|
|
#if defined(LGFXConfig) || defined(ARCH_PORTDUINO)
|
2024-04-15 14:54:47 +02:00
|
|
|
if (cfg._device == DisplayDriverConfig::device_t::CUSTOM_TFT) {
|
|
|
|
|
// for now assume LGFX driver, but could be also TFT_eSPI if implemented
|
2024-04-17 14:09:46 +01:00
|
|
|
return new LGFXDriver<LGFXConfig>(cfg);
|
2024-04-15 14:54:47 +02:00
|
|
|
}
|
|
|
|
|
#endif
|
2024-05-16 08:38:13 +02:00
|
|
|
#if defined(OLEDConfig) || defined(ARCH_PORTDUINO)
|
2024-04-15 14:54:47 +02:00
|
|
|
if (cfg._device == DisplayDriverConfig::device_t::CUSTOM_OLED) {
|
2024-04-17 14:09:46 +01:00
|
|
|
// TODO return new OLEDDriver<OLEDConfig>(cfg);
|
2024-04-15 14:54:47 +02:00
|
|
|
}
|
|
|
|
|
#endif
|
2024-05-16 08:38:13 +02:00
|
|
|
#if defined(EINKConfig) || defined(ARCH_PORTDUINO)
|
2024-04-15 14:54:47 +02:00
|
|
|
if (cfg._device == DisplayDriverConfig::device_t::CUSTOM_EINK) {
|
2024-04-17 14:09:46 +01:00
|
|
|
// TODO return new EINKDriver<EINKConfig>(cfg);
|
2024-04-15 14:54:47 +02:00
|
|
|
}
|
|
|
|
|
#endif
|
2025-05-06 10:44:39 +02:00
|
|
|
#if defined(USE_FRAMEBUFFER)
|
|
|
|
|
if (cfg._device == DisplayDriverConfig::device_t::FB) {
|
|
|
|
|
return &FBDriver::create(cfg.width(), cfg.height());
|
|
|
|
|
}
|
|
|
|
|
#endif
|
2024-04-17 14:09:46 +01:00
|
|
|
#if defined(USE_X11)
|
2024-04-15 14:54:47 +02:00
|
|
|
if (cfg._device == DisplayDriverConfig::device_t::X11) {
|
|
|
|
|
return &X11Driver::create(cfg.width(), cfg.height());
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
switch (cfg._device) {
|
2024-05-16 08:38:13 +02:00
|
|
|
#ifndef ARCH_PORTDUINO
|
2024-04-15 14:54:47 +02:00
|
|
|
#if !defined(LGFX_DRIVER)
|
|
|
|
|
#error "LGFX_DRIVER must be defined!"
|
|
|
|
|
#endif
|
|
|
|
|
#if defined(T_HMI)
|
|
|
|
|
case DisplayDriverConfig::device_t::THMI:
|
|
|
|
|
return new LGFXDriver<LGFX_T_HMI>(cfg.width(), cfg.height());
|
|
|
|
|
break;
|
|
|
|
|
#elif defined(T_DECK)
|
|
|
|
|
case DisplayDriverConfig::device_t::TDECK:
|
|
|
|
|
return new LGFXDriver<LGFX_TDECK>(cfg.width(), cfg.height());
|
|
|
|
|
break;
|
2025-08-16 18:28:05 +02:00
|
|
|
#elif defined(T_LORA_PAGER)
|
|
|
|
|
case DisplayDriverConfig::device_t::TLORA_PAGER:
|
|
|
|
|
return new LGFXDriver<LGFX_TLORA_PAGER>(cfg.width(), cfg.height());
|
|
|
|
|
break;
|
2024-08-02 17:04:32 +02:00
|
|
|
#elif defined(SENSECAP_INDICATOR)
|
|
|
|
|
case DisplayDriverConfig::device_t::INDICATOR:
|
|
|
|
|
return new LGFXDriver<LGFX_INDICATOR>(cfg.width(), cfg.height());
|
|
|
|
|
break;
|
2024-10-24 01:09:54 +02:00
|
|
|
#elif defined(ESP_4848S040)
|
|
|
|
|
case DisplayDriverConfig::device_t::ESP4848S040:
|
|
|
|
|
return new LGFXDriver<LGFX_4848S040>(cfg.width(), cfg.height());
|
|
|
|
|
break;
|
2024-11-06 20:44:16 +01:00
|
|
|
#elif defined(MAKERFABS_480X480)
|
|
|
|
|
case DisplayDriverConfig::device_t::MAKERFABS480X480:
|
|
|
|
|
return new LGFXDriver<LGFX_MAKERFABS480X480>(cfg.width(), cfg.height());
|
|
|
|
|
break;
|
2024-06-20 23:07:12 +02:00
|
|
|
#elif defined(PICOMPUTER_S3)
|
|
|
|
|
case DisplayDriverConfig::device_t::BPICOMPUTER_S3:
|
|
|
|
|
return new LGFXDriver<LGFX_PICOMPUTER_S3>(cfg.width(), cfg.height());
|
|
|
|
|
break;
|
2024-04-15 14:54:47 +02:00
|
|
|
#elif defined(TWATCH_S3)
|
|
|
|
|
case DisplayDriverConfig::device_t::TWATCH_S3:
|
|
|
|
|
return new LGFXDriver<LGFX_TWATCH_S3>(cfg.width(), cfg.height());
|
|
|
|
|
break;
|
2026-01-19 00:14:42 +01:00
|
|
|
#elif defined(TWATCH_ULTRA)
|
|
|
|
|
case DisplayDriverConfig::device_t::TWATCH_ULTRA:
|
|
|
|
|
return new LGFXDriver<LGFX_TWATCH_ULTRA>(cfg.width(), cfg.height());
|
|
|
|
|
break;
|
2024-04-15 14:54:47 +02:00
|
|
|
#elif defined(UNPHONE)
|
2024-05-02 19:33:59 +02:00
|
|
|
case DisplayDriverConfig::device_t::UNPHONE_V9:
|
|
|
|
|
return new LGFXDriver<LGFX_UNPHONE_V9>(cfg.width(), cfg.height());
|
2024-04-15 14:54:47 +02:00
|
|
|
break;
|
2025-05-01 00:34:54 +02:00
|
|
|
#elif defined(ELECROW_PANEL)
|
|
|
|
|
case DisplayDriverConfig::device_t::ELECROW_ADV:
|
|
|
|
|
return new LGFXDriver<LGFX_ELECROW70>(cfg.width(), cfg.height());
|
|
|
|
|
break;
|
2024-04-15 14:54:47 +02:00
|
|
|
#elif defined(HELTEC_TRACKER)
|
|
|
|
|
case DisplayDriverConfig::device_t::HELTEC_TRACKER:
|
|
|
|
|
// return new LGFXDriver<LGFX_HELTEC_TRACKER>(cfg.width(), cfg.height());
|
|
|
|
|
break;
|
2026-01-19 00:14:42 +01:00
|
|
|
#elif defined(HELTEC_VISION_MASTER_T190)
|
|
|
|
|
case DisplayDriverConfig::device_t::VISION_MASTER_T190:
|
|
|
|
|
return new LGFXDriver<LGFX_VISION_MASTER_T190>(cfg.width(), cfg.height());
|
|
|
|
|
break;
|
2024-04-15 14:54:47 +02:00
|
|
|
#elif defined(WT_SC01_PLUS)
|
|
|
|
|
case DisplayDriverConfig::device_t::WT32_SC01_PLUS:
|
|
|
|
|
return new LGFXDriver<LGFX_WT_SC01_PLUS>(cfg.width(), cfg.height());
|
|
|
|
|
break;
|
|
|
|
|
#elif defined(ESP2432S028RV1)
|
|
|
|
|
case DisplayDriverConfig::device_t::ESP2432S028RV1:
|
|
|
|
|
return new LGFXDriver<LGFX_ESP2432S028RV1>(cfg.width(), cfg.height());
|
|
|
|
|
break;
|
|
|
|
|
#elif defined(ESP2432S028RV2)
|
|
|
|
|
case DisplayDriverConfig::device_t::ESP2432S028RV2:
|
|
|
|
|
return new LGFXDriver<LGFX_ESP2432S028RV2>(cfg.width(), cfg.height());
|
|
|
|
|
break;
|
2025-09-01 11:58:02 +02:00
|
|
|
#elif defined(JC4827W543C)
|
|
|
|
|
case DisplayDriverConfig::device_t::ESPJC4827W543C:
|
|
|
|
|
return new LGFXDriver<LGFX_JC4827W543C>(cfg.width(), cfg.height());
|
|
|
|
|
break;
|
2024-04-15 14:54:47 +02:00
|
|
|
#endif
|
2025-05-06 10:44:39 +02:00
|
|
|
#elif defined(USE_FRAMEBUFFER)
|
|
|
|
|
case DisplayDriverConfig::device_t::FB:
|
|
|
|
|
return &FBDriver::create(cfg.width(), cfg.height());
|
|
|
|
|
break;
|
2024-04-15 14:54:47 +02:00
|
|
|
#elif defined(USE_X11)
|
|
|
|
|
case DisplayDriverConfig::device_t::X11:
|
|
|
|
|
return &X11Driver::create(cfg.width(), cfg.height());
|
|
|
|
|
break;
|
2025-11-07 18:57:53 +08:00
|
|
|
#elif defined(HELTEC_V4_TFT)
|
|
|
|
|
case DisplayDriverConfig::device_t::HELTECV4_TFT:
|
|
|
|
|
return new LGFXDriver<LGFX_HELTEC_V4_TFT>(cfg.width(), cfg.height());
|
|
|
|
|
break;
|
2024-04-15 14:54:47 +02:00
|
|
|
#endif
|
|
|
|
|
default:
|
2024-10-17 09:06:42 +02:00
|
|
|
ILOG_CRIT("LGFX device_t config not implemented: %d", cfg._device);
|
2024-05-05 20:42:25 +02:00
|
|
|
assert(false);
|
2024-04-15 14:54:47 +02:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|