diff --git a/App/idf_component.yml b/App/idf_component.yml index 4dbbcb52..7b143f95 100644 --- a/App/idf_component.yml +++ b/App/idf_component.yml @@ -9,7 +9,7 @@ dependencies: espressif/esp_io_expander: "1.0.1" espressif/esp_io_expander_tca95xx_16bit: "1.0.1" espressif/esp_lcd_st7701: - version: "1.1.1" + version: "1.1.3" rules: - if: "target in [esp32s3, esp32p4]" espressif/esp_lcd_st7796: diff --git a/Boards/CYD-2432S024C/Source/hal/YellowDisplay.cpp b/Boards/CYD-2432S024C/Source/hal/YellowDisplay.cpp index 27ace208..b30d7d75 100644 --- a/Boards/CYD-2432S024C/Source/hal/YellowDisplay.cpp +++ b/Boards/CYD-2432S024C/Source/hal/YellowDisplay.cpp @@ -32,5 +32,6 @@ std::shared_ptr createDisplay() { configuration->mirrorX = true; configuration->backlightDutyFunction = driver::pwmbacklight::setBacklightDuty; - return std::make_shared(std::move(configuration)); + auto display = std::make_shared(std::move(configuration)); + return std::reinterpret_pointer_cast(display); } diff --git a/Boards/CYD-2432S032C/Source/CYD2432S032C.cpp b/Boards/CYD-2432S032C/Source/CYD2432S032C.cpp index a90fb644..f313b2e8 100644 --- a/Boards/CYD-2432S032C/Source/CYD2432S032C.cpp +++ b/Boards/CYD-2432S032C/Source/CYD2432S032C.cpp @@ -14,7 +14,7 @@ bool initBoot() { // This display has a weird glitch with gamma during boot, which results in uneven dark gray colours. // Setting gamma curve index to 0 doesn't work at boot for an unknown reason, so we set the curve index to 1: - tt::kernel::subscribeSystemEvent(tt::kernel::SystemEvent::BootInitLvglEnd, [](auto event) { + tt::kernel::subscribeSystemEvent(tt::kernel::SystemEvent::BootSplash, [](auto) { auto display = tt::hal::findFirstDevice(tt::hal::Device::Type::Display); assert(display != nullptr); tt::lvgl::lock(portMAX_DELAY); diff --git a/Boards/CYD-2432S032C/Source/hal/CydDisplay.cpp b/Boards/CYD-2432S032C/Source/hal/CydDisplay.cpp index c0466f6f..ed6b00a0 100644 --- a/Boards/CYD-2432S032C/Source/hal/CydDisplay.cpp +++ b/Boards/CYD-2432S032C/Source/hal/CydDisplay.cpp @@ -35,5 +35,6 @@ std::shared_ptr createDisplay() { configuration->backlightDutyFunction = driver::pwmbacklight::setBacklightDuty; - return std::make_shared(std::move(configuration)); + auto display = std::make_shared(std::move(configuration)); + return std::reinterpret_pointer_cast(display); } diff --git a/Boards/CYD-4848S040C/CMakeLists.txt b/Boards/CYD-4848S040C/CMakeLists.txt index c5f6eb49..ae2c58a5 100644 --- a/Boards/CYD-4848S040C/CMakeLists.txt +++ b/Boards/CYD-4848S040C/CMakeLists.txt @@ -3,5 +3,5 @@ file(GLOB_RECURSE SOURCE_FILES Source/*.c*) idf_component_register( SRCS ${SOURCE_FILES} INCLUDE_DIRS "Source" - REQUIRES Tactility esp_lvgl_port esp_lcd esp_lcd_st7701 esp_lcd_panel_io_additions GT911 PwmBacklight driver vfs fatfs + REQUIRES Tactility EspLcdCompat esp_lcd_st7701 esp_lcd_panel_io_additions GT911 PwmBacklight driver vfs fatfs ) diff --git a/Boards/CYD-4848S040C/Source/hal/CydDisplay.cpp b/Boards/CYD-4848S040C/Source/hal/CydDisplay.cpp index ac9f3e8e..2ad2ceb9 100644 --- a/Boards/CYD-4848S040C/Source/hal/CydDisplay.cpp +++ b/Boards/CYD-4848S040C/Source/hal/CydDisplay.cpp @@ -1,19 +1,17 @@ #include "CydDisplay.h" -#include "PwmBacklight.h" #include +#include #include #include #include #include #include -#include #include #include -#include -#define TAG "cyd_display" +constexpr auto TAG = "ST7701"; static const st7701_lcd_init_cmd_t st7701_lcd_init_cmds[] = { // {cmd, { data }, data_size, delay_ms} @@ -58,9 +56,7 @@ static const st7701_lcd_init_cmd_t st7701_lcd_init_cmds[] = { {0x29, (uint8_t[]) {0x00}, 0, 0}, //Display On }; -bool CydDisplay::start() { - TT_LOG_I(TAG, "Starting"); - +bool CydDisplay::createIoHandle(esp_lcd_panel_io_handle_t& outHandle) { spi_line_config_t line_config = { .cs_io_type = IO_TYPE_GPIO, .cs_gpio_num = GPIO_NUM_39, @@ -68,11 +64,13 @@ bool CydDisplay::start() { .scl_gpio_num = GPIO_NUM_48, .sda_io_type = IO_TYPE_GPIO, .sda_gpio_num = GPIO_NUM_47, - .io_expander = NULL, + .io_expander = nullptr, }; esp_lcd_panel_io_3wire_spi_config_t panel_io_config = ST7701_PANEL_IO_3WIRE_SPI_CONFIG(line_config, 0); - ESP_ERROR_CHECK(esp_lcd_new_panel_io_3wire_spi(&panel_io_config, &ioHandle)); + return esp_lcd_new_panel_io_3wire_spi(&panel_io_config, &outHandle) == ESP_OK; +} +bool CydDisplay::createPanelHandle(esp_lcd_panel_io_handle_t ioHandle, esp_lcd_panel_handle_t& panelHandle) { const esp_lcd_rgb_panel_config_t rgb_config = { .clk_src = LCD_CLK_SRC_DEFAULT, .timings = { @@ -179,7 +177,11 @@ bool CydDisplay::start() { TT_LOG_E(TAG, "Failed to turn display on"); } - const lvgl_port_display_cfg_t disp_cfg = { + return true; +} + +lvgl_port_display_cfg_t CydDisplay::getLvglPortDisplayConfig(esp_lcd_panel_io_handle_t ioHandle, esp_lcd_panel_handle_t panelHandle) { + return { .io_handle = ioHandle, .panel_handle = panelHandle, .control_handle = nullptr, @@ -204,44 +206,29 @@ bool CydDisplay::start() { .direct_mode = false } }; +} - const lvgl_port_display_rgb_cfg_t rgb_cfg = { +lvgl_port_display_rgb_cfg_t CydDisplay::getLvglPortDisplayRgbConfig(esp_lcd_panel_io_handle_t ioHandle, esp_lcd_panel_handle_t panelHandle) { + return { .flags = { .bb_mode = true, .avoid_tearing = false } }; - - displayHandle = lvgl_port_add_disp_rgb(&disp_cfg, &rgb_cfg); - TT_LOG_I(TAG, "Finished"); - return displayHandle != nullptr; } -bool CydDisplay::stop() { - assert(displayHandle != nullptr); +std::shared_ptr _Nullable CydDisplay::getTouchDevice() { + if (touchDevice == nullptr) { + auto configuration = std::make_unique( + I2C_NUM_0, + 480, + 480 + ); - lvgl_port_remove_disp(displayHandle); - - if (esp_lcd_panel_del(panelHandle) != ESP_OK) { - return false; + touchDevice = std::make_shared(std::move(configuration)); } - if (esp_lcd_panel_io_del(ioHandle) != ESP_OK) { - return false; - } - - displayHandle = nullptr; - return true; -} - -std::shared_ptr _Nullable CydDisplay::createTouch() { - auto configuration = std::make_unique( - I2C_NUM_0, - 480, - 480 - ); - - return std::make_shared(std::move(configuration)); + return touchDevice; } void CydDisplay::setBacklightDuty(uint8_t backlightDuty) { @@ -249,5 +236,6 @@ void CydDisplay::setBacklightDuty(uint8_t backlightDuty) { } std::shared_ptr createDisplay() { - return std::make_shared(); + auto display = std::make_shared(); + return std::reinterpret_pointer_cast(display); } diff --git a/Boards/CYD-4848S040C/Source/hal/CydDisplay.h b/Boards/CYD-4848S040C/Source/hal/CydDisplay.h index 8418afed..724aa100 100644 --- a/Boards/CYD-4848S040C/Source/hal/CydDisplay.h +++ b/Boards/CYD-4848S040C/Source/hal/CydDisplay.h @@ -1,32 +1,33 @@ #pragma once -#include "Tactility/hal/display/DisplayDevice.h" -#include +#include #include -class CydDisplay : public tt::hal::display::DisplayDevice { +class CydDisplay final : public EspLcdDisplay { -private: + std::shared_ptr _Nullable touchDevice; - esp_lcd_panel_io_handle_t ioHandle = nullptr; - esp_lcd_panel_handle_t panelHandle = nullptr; - lv_display_t* displayHandle = nullptr; + bool createIoHandle(esp_lcd_panel_io_handle_t& outHandle) override; + + bool createPanelHandle(esp_lcd_panel_io_handle_t ioHandle, esp_lcd_panel_handle_t& panelHandle) override; + + lvgl_port_display_cfg_t getLvglPortDisplayConfig(esp_lcd_panel_io_handle_t ioHandle, esp_lcd_panel_handle_t panelHandle) override; + + bool isRgbPanel() const override { return true; } + + lvgl_port_display_rgb_cfg_t getLvglPortDisplayRgbConfig(esp_lcd_panel_io_handle_t ioHandle, esp_lcd_panel_handle_t panelHandle) override; public: - std::string getName() const final { return "ST7701S"; } - std::string getDescription() const final { return "RGB Display"; } + std::string getName() const override { return "ST7701S"; } - bool start() override; + std::string getDescription() const override { return "ST7701S RGB display"; } - bool stop() override; - - std::shared_ptr _Nullable createTouch() override; + std::shared_ptr _Nullable getTouchDevice() override; void setBacklightDuty(uint8_t backlightDuty) override; - bool supportsBacklightDuty() const override { return true; } - lv_display_t* _Nullable getLvglDisplay() const override { return displayHandle; } + bool supportsBacklightDuty() const override { return true; } }; std::shared_ptr createDisplay(); diff --git a/Drivers/CST816S/CMakeLists.txt b/Drivers/CST816S/CMakeLists.txt index b1ab94a8..108babc4 100644 --- a/Drivers/CST816S/CMakeLists.txt +++ b/Drivers/CST816S/CMakeLists.txt @@ -1,5 +1,5 @@ idf_component_register( SRC_DIRS "Source" INCLUDE_DIRS "Source" - REQUIRES Tactility esp_lvgl_port esp_lcd_touch esp_lcd_touch_cst816s driver + REQUIRES Tactility EspLcdCompat esp_lcd_touch_cst816s driver ) diff --git a/Drivers/CST816S/Source/Cst816Touch.h b/Drivers/CST816S/Source/Cst816Touch.h index 1bec3472..a926c347 100644 --- a/Drivers/CST816S/Source/Cst816Touch.h +++ b/Drivers/CST816S/Source/Cst816Touch.h @@ -1,9 +1,8 @@ #pragma once -#include -#include +#include -class Cst816sTouch final : public tt::hal::touch::TouchDevice { +class Cst816sTouch final : public EspLcdTouch { public: @@ -54,16 +53,18 @@ private: void cleanup(); + bool createIoHandle(esp_lcd_panel_io_handle_t& ioHandle) override; + + bool createTouchHandle(esp_lcd_panel_io_handle_t ioHandle, const esp_lcd_touch_config_t& configuration, esp_lcd_touch_handle_t& touchHandle) override; + + esp_lcd_touch_config_t createEspLcdTouchConfig() override; + public: explicit Cst816sTouch(std::unique_ptr inConfiguration) : configuration(std::move(inConfiguration)) { assert(configuration != nullptr); } - std::string getName() const final { return "CST816S"; } - std::string getDescription() const final { return "I2C touch driver"; } - - bool start(lv_display_t* display) override; - bool stop() override; - lv_indev_t* _Nullable getLvglIndev() override { return deviceHandle; } + std::string getName() const override { return "CST816S"; } + std::string getDescription() const override { return "CST816S I2C touch driver"; } }; diff --git a/Drivers/CST816S/Source/Cst816sTouch.cpp b/Drivers/CST816S/Source/Cst816sTouch.cpp index 14a02221..a7088f4b 100644 --- a/Drivers/CST816S/Source/Cst816sTouch.cpp +++ b/Drivers/CST816S/Source/Cst816sTouch.cpp @@ -1,25 +1,18 @@ #include "Cst816Touch.h" -#include - -#include -#include -#include #include -#include -#define TAG "cst816s" +bool Cst816sTouch::createIoHandle(esp_lcd_panel_io_handle_t& ioHandle) { + constexpr esp_lcd_panel_io_i2c_config_t touch_io_config = ESP_LCD_TOUCH_IO_I2C_CST816S_CONFIG(); + return esp_lcd_new_panel_io_i2c((esp_lcd_i2c_bus_handle_t)configuration->port, &touch_io_config, &ioHandle) == ESP_OK; +} -bool Cst816sTouch::start(lv_display_t* display) { - TT_LOG_I(TAG, "Starting"); - const esp_lcd_panel_io_i2c_config_t touch_io_config = ESP_LCD_TOUCH_IO_I2C_CST816S_CONFIG(); +bool Cst816sTouch::createTouchHandle(esp_lcd_panel_io_handle_t ioHandle, const esp_lcd_touch_config_t& touchConfiguration, esp_lcd_touch_handle_t& touchHandle) { + return esp_lcd_touch_new_i2c_cst816s(ioHandle, &touchConfiguration, &touchHandle) == ESP_OK; +} - if (esp_lcd_new_panel_io_i2c((esp_lcd_i2c_bus_handle_t)configuration->port, &touch_io_config, &ioHandle) != ESP_OK) { - TT_LOG_E(TAG, "Touch I2C IO init failed"); - return false; - } - - esp_lcd_touch_config_t config = { +esp_lcd_touch_config_t Cst816sTouch::createEspLcdTouchConfig() { + return { .x_max = configuration->xMax, .y_max = configuration->yMax, .rst_gpio_num = configuration->pinReset, @@ -38,47 +31,4 @@ bool Cst816sTouch::start(lv_display_t* display) { .user_data = nullptr, .driver_data = nullptr }; - - if (esp_lcd_touch_new_i2c_cst816s(ioHandle, &config, &touchHandle) != ESP_OK) { - TT_LOG_E(TAG, "Driver init failed"); - cleanup(); - return false; - } - - const lvgl_port_touch_cfg_t touch_cfg = { - .disp = display, - .handle = touchHandle, - }; - - deviceHandle = lvgl_port_add_touch(&touch_cfg); - if (deviceHandle == nullptr) { - TT_LOG_E(TAG, "Adding touch failed"); - cleanup(); - return false; - } - - TT_LOG_I(TAG, "Finished"); - return true; -} - -bool Cst816sTouch::stop() { - cleanup(); - return true; -} - -void Cst816sTouch::cleanup() { - if (deviceHandle != nullptr) { - lv_indev_delete(deviceHandle); - deviceHandle = nullptr; - } - - if (touchHandle != nullptr) { - esp_lcd_touch_del(touchHandle); - touchHandle = nullptr; - } - - if (ioHandle != nullptr) { - esp_lcd_panel_io_del(ioHandle); - ioHandle = nullptr; - } } diff --git a/Drivers/EspLcdCompat/Source/EspLcdDisplay.cpp b/Drivers/EspLcdCompat/Source/EspLcdDisplay.cpp index 52600c17..6abadde5 100644 --- a/Drivers/EspLcdCompat/Source/EspLcdDisplay.cpp +++ b/Drivers/EspLcdCompat/Source/EspLcdDisplay.cpp @@ -7,7 +7,7 @@ #include #include -constexpr char* TAG = "EspLcdDisplay"; +constexpr const char* TAG = "EspLcdDisplay"; EspLcdDisplay::~EspLcdDisplay() { if (nativeDisplay != nullptr && nativeDisplay.use_count() > 1) { @@ -59,7 +59,13 @@ bool EspLcdDisplay::startLvgl() { } lvglPortDisplayConfig = getLvglPortDisplayConfig(ioHandle, panelHandle); - lvglDisplay = lvgl_port_add_disp(&lvglPortDisplayConfig); + + if (isRgbPanel()) { + auto rgb_config = getLvglPortDisplayRgbConfig(ioHandle, panelHandle); + lvglDisplay = lvgl_port_add_disp_rgb(&lvglPortDisplayConfig, &rgb_config); + } else { + lvglDisplay = lvgl_port_add_disp(&lvglPortDisplayConfig); + } auto touch_device = getTouchDevice(); if (touch_device != nullptr) { diff --git a/Drivers/EspLcdCompat/Source/EspLcdDisplay.h b/Drivers/EspLcdCompat/Source/EspLcdDisplay.h index 8ef2d55c..f888c23a 100644 --- a/Drivers/EspLcdCompat/Source/EspLcdDisplay.h +++ b/Drivers/EspLcdCompat/Source/EspLcdDisplay.h @@ -4,6 +4,7 @@ #include #include +#include #include class EspLcdDisplay : tt::hal::display::DisplayDevice { @@ -25,6 +26,10 @@ protected: virtual lvgl_port_display_cfg_t getLvglPortDisplayConfig(esp_lcd_panel_io_handle_t ioHandle, esp_lcd_panel_handle_t panelHandle) = 0; + virtual bool isRgbPanel() const { return false; } + + virtual lvgl_port_display_rgb_cfg_t getLvglPortDisplayRgbConfig(esp_lcd_panel_io_handle_t ioHandle, esp_lcd_panel_handle_t panelHandle) { tt_crash("Not supported"); } + public: ~EspLcdDisplay() override; diff --git a/Drivers/EspLcdCompat/Source/EspLcdNativeTouch.cpp b/Drivers/EspLcdCompat/Source/EspLcdNativeTouch.cpp index d40f4b18..3e387f68 100644 --- a/Drivers/EspLcdCompat/Source/EspLcdNativeTouch.cpp +++ b/Drivers/EspLcdCompat/Source/EspLcdNativeTouch.cpp @@ -2,7 +2,7 @@ #include -constexpr char* TAG = "EspLcdNativeTouch"; +constexpr const char* TAG = "EspLcdNativeTouch"; bool EspLcdNativeTouch::getTouchedPoints(uint16_t* x, uint16_t* y, uint16_t* _Nullable strength, uint8_t* pointCount, uint8_t maxPointCount) { if (esp_lcd_touch_read_data(handle) != ESP_OK) { diff --git a/Drivers/EspLcdCompat/Source/EspLcdTouch.cpp b/Drivers/EspLcdCompat/Source/EspLcdTouch.cpp index 8f1db3a6..f0f33641 100644 --- a/Drivers/EspLcdCompat/Source/EspLcdTouch.cpp +++ b/Drivers/EspLcdCompat/Source/EspLcdTouch.cpp @@ -4,7 +4,7 @@ #include #include -constexpr char* TAG = "EspLcdTouch"; +constexpr const char* TAG = "EspLcdTouch"; bool EspLcdTouch::start() { if (!createIoHandle(ioHandle) != ESP_OK) { diff --git a/Drivers/GT911/Source/Gt911Touch.cpp b/Drivers/GT911/Source/Gt911Touch.cpp index e29b845e..b2959a9e 100644 --- a/Drivers/GT911/Source/Gt911Touch.cpp +++ b/Drivers/GT911/Source/Gt911Touch.cpp @@ -5,7 +5,6 @@ #include #include -#include #define TAG "GT911" diff --git a/Drivers/ILI934x/CMakeLists.txt b/Drivers/ILI934x/CMakeLists.txt index ac5bb4bf..ec97215b 100644 --- a/Drivers/ILI934x/CMakeLists.txt +++ b/Drivers/ILI934x/CMakeLists.txt @@ -1,5 +1,5 @@ idf_component_register( SRC_DIRS "Source" INCLUDE_DIRS "Source" - REQUIRES Tactility esp_lvgl_port esp_lcd esp_lcd_ili9341 driver + REQUIRES Tactility EspLcdCompat esp_lcd_ili9341 driver ) diff --git a/Drivers/ILI934x/Source/Ili934xDisplay.cpp b/Drivers/ILI934x/Source/Ili934xDisplay.cpp index 90d23224..71f7aa0a 100644 --- a/Drivers/ILI934x/Source/Ili934xDisplay.cpp +++ b/Drivers/ILI934x/Source/Ili934xDisplay.cpp @@ -6,11 +6,9 @@ #include #include -#define TAG "ili934x" - -bool Ili934xDisplay::start() { - TT_LOG_I(TAG, "Starting"); +constexpr const char* TAG = "ILI934x"; +bool Ili934xDisplay::createIoHandle(esp_lcd_panel_io_handle_t& outHandle) { const esp_lcd_panel_io_spi_config_t panel_io_config = { .cs_gpio_num = configuration->csPin, .dc_gpio_num = configuration->dcPin, @@ -35,11 +33,10 @@ bool Ili934xDisplay::start() { } }; - if (esp_lcd_new_panel_io_spi(configuration->spiBusHandle, &panel_io_config, &ioHandle) != ESP_OK) { - TT_LOG_E(TAG, "Failed to create panel"); - return false; - } + return esp_lcd_new_panel_io_spi(configuration->spiBusHandle, &panel_io_config, &outHandle) == ESP_OK; +} +bool Ili934xDisplay::createPanelHandle(esp_lcd_panel_io_handle_t ioHandle, esp_lcd_panel_handle_t& panelHandle) { const esp_lcd_panel_dev_config_t panel_config = { .reset_gpio_num = configuration->resetPin, .rgb_ele_order = configuration->rgbElementOrder, @@ -86,18 +83,15 @@ bool Ili934xDisplay::start() { return false; } - uint32_t buffer_size; - if (configuration->bufferSize == 0) { - buffer_size = configuration->horizontalResolution * configuration->verticalResolution / 10; - } else { - buffer_size = configuration->bufferSize; - } + return true; +} - const lvgl_port_display_cfg_t disp_cfg = { +lvgl_port_display_cfg_t Ili934xDisplay::getLvglPortDisplayConfig(esp_lcd_panel_io_handle_t ioHandle, esp_lcd_panel_handle_t panelHandle) { + return { .io_handle = ioHandle, .panel_handle = panelHandle, .control_handle = nullptr, - .buffer_size = buffer_size, + .buffer_size = configuration->bufferSize, .double_buffer = false, .trans_size = 0, .hres = configuration->horizontalResolution, @@ -118,28 +112,6 @@ bool Ili934xDisplay::start() { .direct_mode = false } }; - - displayHandle = lvgl_port_add_disp(&disp_cfg); - - TT_LOG_I(TAG, "Finished"); - return displayHandle != nullptr; -} - -bool Ili934xDisplay::stop() { - assert(displayHandle != nullptr); - - lvgl_port_remove_disp(displayHandle); - - if (esp_lcd_panel_del(panelHandle) != ESP_OK) { - return false; - } - - if (esp_lcd_panel_io_del(ioHandle) != ESP_OK) { - return false; - } - - displayHandle = nullptr; - return true; } /** @@ -174,7 +146,7 @@ void Ili934xDisplay::setGammaCurve(uint8_t index) { gamma_curve }; - if (esp_lcd_panel_io_tx_param(ioHandle , LCD_CMD_GAMSET, param, 1) != ESP_OK) { + if (esp_lcd_panel_io_tx_param(getIoHandle() , LCD_CMD_GAMSET, param, 1) != ESP_OK) { TT_LOG_E(TAG, "Failed to set gamma"); } } diff --git a/Drivers/ILI934x/Source/Ili934xDisplay.h b/Drivers/ILI934x/Source/Ili934xDisplay.h index 3034dac4..3fff9162 100644 --- a/Drivers/ILI934x/Source/Ili934xDisplay.h +++ b/Drivers/ILI934x/Source/Ili934xDisplay.h @@ -9,7 +9,9 @@ #include #include -class Ili934xDisplay final : public tt::hal::display::DisplayDevice { +#include + +class Ili934xDisplay final : public EspLcdDisplay { public: @@ -41,8 +43,12 @@ public: invertColor(invertColor), bufferSize(bufferSize), rgbElementOrder(rgbElementOrder), - touch(std::move(touch)) - {} + touch(std::move(touch) + ) { + if (this->bufferSize == 0) { + this->bufferSize = horizontalResolution * verticalResolution / 10; + } + } esp_lcd_spi_bus_handle_t spiBusHandle; gpio_num_t csPin; @@ -65,9 +71,12 @@ public: private: std::unique_ptr configuration; - esp_lcd_panel_io_handle_t ioHandle = nullptr; - esp_lcd_panel_handle_t panelHandle = nullptr; - lv_display_t* displayHandle = nullptr; + + bool createIoHandle(esp_lcd_panel_io_handle_t& outHandle); + + bool createPanelHandle(esp_lcd_panel_io_handle_t ioHandle, esp_lcd_panel_handle_t& panelHandle); + + lvgl_port_display_cfg_t getLvglPortDisplayConfig(esp_lcd_panel_io_handle_t ioHandle, esp_lcd_panel_handle_t panelHandle); public: @@ -75,25 +84,21 @@ public: assert(configuration != nullptr); } - std::string getName() const final { return "ILI934x"; } - std::string getDescription() const final { return "ILI934x display"; } + std::string getName() const override { return "ILI934x"; } - bool start() final; + std::string getDescription() const override { return "ILI934x display"; } - bool stop() final; + std::shared_ptr _Nullable getTouchDevice() override { return configuration->touch; } - std::shared_ptr _Nullable createTouch() final { return configuration->touch; } - - void setBacklightDuty(uint8_t backlightDuty) final { + void setBacklightDuty(uint8_t backlightDuty) override { if (configuration->backlightDutyFunction != nullptr) { configuration->backlightDutyFunction(backlightDuty); } } - bool supportsBacklightDuty() const final { return configuration->backlightDutyFunction != nullptr; } + bool supportsBacklightDuty() const override { return configuration->backlightDutyFunction != nullptr; } - void setGammaCurve(uint8_t index) final; - uint8_t getGammaCurveCount() const final { return 4; }; + void setGammaCurve(uint8_t index) override; - lv_display_t* _Nullable getLvglDisplay() const final { return displayHandle; } + uint8_t getGammaCurveCount() const override { return 4; }; }; diff --git a/Drivers/ST7789/Source/St7789Display.cpp b/Drivers/ST7789/Source/St7789Display.cpp index 28b84ce1..b3ac49f1 100644 --- a/Drivers/ST7789/Source/St7789Display.cpp +++ b/Drivers/ST7789/Source/St7789Display.cpp @@ -92,7 +92,6 @@ bool St7789Display::createPanelHandle(esp_lcd_panel_io_handle_t ioHandle, esp_lc return false; } - TT_LOG_I(TAG, "Finished"); return true; }