From ceed6f1d27f70e8cf6ca23f1e3c887db2e4e2719 Mon Sep 17 00:00:00 2001 From: Ken Van Hoeylandt Date: Tue, 14 Jul 2026 00:27:20 +0200 Subject: [PATCH] Migrate crowpanel-basic-28 --- .../elecrow-crowpanel-basic-28/CMakeLists.txt | 5 +- .../Source/Configuration.cpp | 21 -------- .../Source/devices/Display.cpp | 49 ------------------- .../Source/devices/Display.h | 17 ------- .../device.properties | 2 + .../devicetree.yaml | 2 + .../elecrow,crowpanel-basic-28.dts | 32 +++++++++--- .../{Source => source}/module.cpp | 0 8 files changed, 32 insertions(+), 96 deletions(-) delete mode 100644 Devices/elecrow-crowpanel-basic-28/Source/Configuration.cpp delete mode 100644 Devices/elecrow-crowpanel-basic-28/Source/devices/Display.cpp delete mode 100644 Devices/elecrow-crowpanel-basic-28/Source/devices/Display.h rename Devices/elecrow-crowpanel-basic-28/{Source => source}/module.cpp (100%) diff --git a/Devices/elecrow-crowpanel-basic-28/CMakeLists.txt b/Devices/elecrow-crowpanel-basic-28/CMakeLists.txt index e9d973e08..a832a83a2 100644 --- a/Devices/elecrow-crowpanel-basic-28/CMakeLists.txt +++ b/Devices/elecrow-crowpanel-basic-28/CMakeLists.txt @@ -1,7 +1,6 @@ -file(GLOB_RECURSE SOURCE_FILES Source/*.c*) +file(GLOB_RECURSE SOURCE_FILES source/*.c*) idf_component_register( SRCS ${SOURCE_FILES} - INCLUDE_DIRS "Source" - REQUIRES Tactility esp_lvgl_port ILI934x XPT2046 PwmBacklight driver + REQUIRES TactilityKernel driver ) diff --git a/Devices/elecrow-crowpanel-basic-28/Source/Configuration.cpp b/Devices/elecrow-crowpanel-basic-28/Source/Configuration.cpp deleted file mode 100644 index f413f9d3e..000000000 --- a/Devices/elecrow-crowpanel-basic-28/Source/Configuration.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "PwmBacklight.h" -#include "devices/Display.h" - -#include - -using namespace tt::hal; - -static bool initBoot() { - return driver::pwmbacklight::init(GPIO_NUM_27); -} - -static DeviceVector createDevices() { - return { - createDisplay(), - }; -} - -extern const Configuration hardwareConfiguration = { - .initBoot = initBoot, - .createDevices = createDevices -}; diff --git a/Devices/elecrow-crowpanel-basic-28/Source/devices/Display.cpp b/Devices/elecrow-crowpanel-basic-28/Source/devices/Display.cpp deleted file mode 100644 index 1ba08b7dc..000000000 --- a/Devices/elecrow-crowpanel-basic-28/Source/devices/Display.cpp +++ /dev/null @@ -1,49 +0,0 @@ -#include "Display.h" - -#include -#include - -#include - -std::shared_ptr createTouch() { - auto configuration = std::make_unique( - LCD_SPI_HOST, - TOUCH_PIN_CS, - LCD_HORIZONTAL_RESOLUTION, - LCD_VERTICAL_RESOLUTION, - false, - true, - false - ); - - return std::make_shared(std::move(configuration)); -} - -std::shared_ptr createDisplay() { - Ili934xDisplay::Configuration panel_configuration = { - .horizontalResolution = LCD_HORIZONTAL_RESOLUTION, - .verticalResolution = LCD_VERTICAL_RESOLUTION, - .gapX = 0, - .gapY = 0, - .swapXY = false, - .mirrorX = true, - .mirrorY = false, - .invertColor = false, - .swapBytes = true, - .bufferSize = LCD_BUFFER_SIZE, - .touch = createTouch(), - .backlightDutyFunction = driver::pwmbacklight::setBacklightDuty, - .resetPin = GPIO_NUM_NC, - .rgbElementOrder = LCD_RGB_ELEMENT_ORDER_BGR - }; - - auto spi_configuration = std::make_shared(Ili934xDisplay::SpiConfiguration { - .spiHostDevice = LCD_SPI_HOST, - .csPin = LCD_PIN_CS, - .dcPin = LCD_PIN_DC, - .pixelClockFrequency = 40'000'000, - .transactionQueueDepth = 10 - }); - - return std::make_shared(panel_configuration, spi_configuration, true); -} diff --git a/Devices/elecrow-crowpanel-basic-28/Source/devices/Display.h b/Devices/elecrow-crowpanel-basic-28/Source/devices/Display.h deleted file mode 100644 index 6dfd79a91..000000000 --- a/Devices/elecrow-crowpanel-basic-28/Source/devices/Display.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -#include -#include -#include - -constexpr auto LCD_SPI_HOST = SPI2_HOST; -constexpr auto LCD_PIN_CS = GPIO_NUM_15; -constexpr auto TOUCH_PIN_CS = GPIO_NUM_33; -constexpr auto LCD_PIN_DC = GPIO_NUM_2; // RS -constexpr auto LCD_HORIZONTAL_RESOLUTION = 240; -constexpr auto LCD_VERTICAL_RESOLUTION = 320; -constexpr auto LCD_BUFFER_HEIGHT = LCD_VERTICAL_RESOLUTION / 10; -constexpr auto LCD_BUFFER_SIZE = LCD_HORIZONTAL_RESOLUTION * LCD_BUFFER_HEIGHT; -constexpr auto LCD_SPI_TRANSFER_SIZE_LIMIT = LCD_BUFFER_SIZE * LV_COLOR_DEPTH / 8; - -std::shared_ptr createDisplay(); diff --git a/Devices/elecrow-crowpanel-basic-28/device.properties b/Devices/elecrow-crowpanel-basic-28/device.properties index acc1405a4..770406ae2 100644 --- a/Devices/elecrow-crowpanel-basic-28/device.properties +++ b/Devices/elecrow-crowpanel-basic-28/device.properties @@ -7,6 +7,8 @@ hardware.target=ESP32 hardware.flashSize=4MB hardware.spiRam=false +dependencies.useDeprecatedHal=false + storage.userDataLocation=SD display.size=2.8" diff --git a/Devices/elecrow-crowpanel-basic-28/devicetree.yaml b/Devices/elecrow-crowpanel-basic-28/devicetree.yaml index 61fa12e3b..ec0480924 100644 --- a/Devices/elecrow-crowpanel-basic-28/devicetree.yaml +++ b/Devices/elecrow-crowpanel-basic-28/devicetree.yaml @@ -1,3 +1,5 @@ dependencies: - Platforms/platform-esp32 + - Drivers/ili9341-module + - Drivers/xpt2046-module dts: elecrow,crowpanel-basic-28.dts diff --git a/Devices/elecrow-crowpanel-basic-28/elecrow,crowpanel-basic-28.dts b/Devices/elecrow-crowpanel-basic-28/elecrow,crowpanel-basic-28.dts index e3a53374b..58945c75a 100644 --- a/Devices/elecrow-crowpanel-basic-28/elecrow,crowpanel-basic-28.dts +++ b/Devices/elecrow-crowpanel-basic-28/elecrow,crowpanel-basic-28.dts @@ -7,8 +7,9 @@ #include #include #include -#include -#include +#include +#include +#include / { compatible = "root"; @@ -32,6 +33,15 @@ pin-scl = <&gpio0 21 GPIO_FLAG_NONE>; }; + display_backlight { + compatible = "espressif,esp32-ledc-backlight"; + // Off by default so display power-on won't show the screen from before the last power loss. + // The display backlight is turned on during the boot process. + status = "disabled"; + pin-backlight = <&gpio0 27 GPIO_FLAG_NONE>; + frequency-hz = <40000>; + }; + spi0 { compatible = "espressif,esp32-spi"; host = ; @@ -41,13 +51,23 @@ pin-miso = <&gpio0 12 GPIO_FLAG_NONE>; pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>; max-transfer-size = <65536>; - + display@0 { - compatible = "display-placeholder"; + compatible = "ilitek,ili9341"; + horizontal-resolution = <240>; + vertical-resolution = <320>; + mirror-x; + bgr-order; + pixel-clock-hz = <40000000>; + pin-dc = <&gpio0 2 GPIO_FLAG_NONE>; + backlight = <&display_backlight>; }; touch@1 { - compatible = "pointer-placeholder"; + compatible = "xptek,xpt2046"; + x-max = <240>; + y-max = <320>; + mirror-x; }; }; @@ -58,7 +78,7 @@ pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>; pin-miso = <&gpio0 19 GPIO_FLAG_NONE>; pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>; - + sdcard@0 { compatible = "espressif,esp32-sdspi"; frequency-khz = <20000>; diff --git a/Devices/elecrow-crowpanel-basic-28/Source/module.cpp b/Devices/elecrow-crowpanel-basic-28/source/module.cpp similarity index 100% rename from Devices/elecrow-crowpanel-basic-28/Source/module.cpp rename to Devices/elecrow-crowpanel-basic-28/source/module.cpp