diff --git a/Boards/CYD-2432S024C/Source/CYD2432S024C.h b/Boards/CYD-2432S024C/Source/CYD2432S024C.h deleted file mode 100644 index 6fe759fe..00000000 --- a/Boards/CYD-2432S024C/Source/CYD2432S024C.h +++ /dev/null @@ -1,6 +0,0 @@ -#pragma once - -#include - -// Capacitive touch version of the 2.4" yellow board -extern const tt::hal::Configuration cyd_2432s024c_config; diff --git a/Boards/CYD-2432S024C/Source/CYD2432S024C.cpp b/Boards/CYD-2432S024C/Source/Configuration.cpp similarity index 82% rename from Boards/CYD-2432S024C/Source/CYD2432S024C.cpp rename to Boards/CYD-2432S024C/Source/Configuration.cpp index d4daa65b..1a467822 100644 --- a/Boards/CYD-2432S024C/Source/CYD2432S024C.cpp +++ b/Boards/CYD-2432S024C/Source/Configuration.cpp @@ -1,14 +1,22 @@ -#include "CYD2432S024C.h" #include "devices/Display.h" #include "devices/SdCard.h" +#include #include #include -#define CYD_SPI_TRANSFER_SIZE_LIMIT (TWODOTFOUR_LCD_DRAW_BUFFER_SIZE * LV_COLOR_DEPTH / 8) - static bool initBoot() { - return driver::pwmbacklight::init(TWODOTFOUR_LCD_PIN_BACKLIGHT); + // Set the RGB LED Pins to output and turn them off + ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_4, GPIO_MODE_OUTPUT)); // Red + ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_16, GPIO_MODE_OUTPUT)); // Green + ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_17, GPIO_MODE_OUTPUT)); // Blue + + // 0 on, 1 off + ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_4, 1)); // Red + ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_16, 1)); // Green + ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_17, 1)); // Blue + + return driver::pwmbacklight::init(LCD_PIN_BACKLIGHT); } static tt::hal::DeviceVector createDevices() { @@ -18,7 +26,7 @@ static tt::hal::DeviceVector createDevices() { }; } -const tt::hal::Configuration cyd_2432s024c_config = { +extern const tt::hal::Configuration hardwareConfiguration = { .initBoot = initBoot, .createDevices = createDevices, .i2c = { @@ -72,7 +80,7 @@ const tt::hal::Configuration cyd_2432s024c_config = { .data6_io_num = GPIO_NUM_NC, .data7_io_num = GPIO_NUM_NC, .data_io_default_level = false, - .max_transfer_sz = CYD_SPI_TRANSFER_SIZE_LIMIT, + .max_transfer_sz = LCD_SPI_TRANSFER_SIZE_LIMIT, .flags = 0, .isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO, .intr_flags = 0 diff --git a/Boards/CYD-2432S024C/Source/devices/Display.cpp b/Boards/CYD-2432S024C/Source/devices/Display.cpp index 2713e343..cca60c3a 100644 --- a/Boards/CYD-2432S024C/Source/devices/Display.cpp +++ b/Boards/CYD-2432S024C/Source/devices/Display.cpp @@ -16,21 +16,30 @@ static std::shared_ptr createTouch() { } 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 touch = createTouch(); + 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 + }); - auto configuration = std::make_unique( - TWODOTFOUR_LCD_SPI_HOST, - TWODOTFOUR_LCD_PIN_CS, - TWODOTFOUR_LCD_PIN_DC, - TWODOTFOUR_LCD_HORIZONTAL_RESOLUTION, - TWODOTFOUR_LCD_VERTICAL_RESOLUTION, - touch - ); - - configuration->mirrorX = true; - configuration->backlightDutyFunction = driver::pwmbacklight::setBacklightDuty; - - auto display = std::make_shared(std::move(configuration)); - return std::reinterpret_pointer_cast(display); + return std::make_shared(panel_configuration, spi_configuration, true); } diff --git a/Boards/CYD-2432S024C/Source/devices/Display.h b/Boards/CYD-2432S024C/Source/devices/Display.h index 7be4a3d3..f030fafa 100644 --- a/Boards/CYD-2432S024C/Source/devices/Display.h +++ b/Boards/CYD-2432S024C/Source/devices/Display.h @@ -1,17 +1,19 @@ #pragma once -#include "Tactility/hal/display/DisplayDevice.h" +#include +#include +#include #include -#define TWODOTFOUR_LCD_PIN_BACKLIGHT GPIO_NUM_27 - // Display -#define TWODOTFOUR_LCD_SPI_HOST SPI2_HOST -#define TWODOTFOUR_LCD_HORIZONTAL_RESOLUTION 240 -#define TWODOTFOUR_LCD_VERTICAL_RESOLUTION 320 -#define TWODOTFOUR_LCD_DRAW_BUFFER_HEIGHT (TWODOTFOUR_LCD_VERTICAL_RESOLUTION / 10) -#define TWODOTFOUR_LCD_DRAW_BUFFER_SIZE (TWODOTFOUR_LCD_HORIZONTAL_RESOLUTION * TWODOTFOUR_LCD_DRAW_BUFFER_HEIGHT) -#define TWODOTFOUR_LCD_PIN_CS GPIO_NUM_15 -#define TWODOTFOUR_LCD_PIN_DC GPIO_NUM_2 +constexpr auto LCD_PIN_BACKLIGHT = GPIO_NUM_27; +constexpr auto LCD_SPI_HOST = SPI2_HOST; +constexpr auto LCD_PIN_CS = GPIO_NUM_15; +constexpr auto LCD_PIN_DC = GPIO_NUM_2; +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/Boards/CYD-2432S028R/Source/CYD2432S028R.h b/Boards/CYD-2432S028R/Source/CYD2432S028R.h deleted file mode 100644 index cce4ae22..00000000 --- a/Boards/CYD-2432S028R/Source/CYD2432S028R.h +++ /dev/null @@ -1,6 +0,0 @@ -#pragma once - -#include - -// Resistive touch version of the 2.8" yellow board -extern const tt::hal::Configuration cyd_2432s028r_config; diff --git a/Boards/CYD-2432S028RV3/Source/CYD2432S028RV3.cpp b/Boards/CYD-2432S028R/Source/Configuration.cpp similarity index 92% rename from Boards/CYD-2432S028RV3/Source/CYD2432S028RV3.cpp rename to Boards/CYD-2432S028R/Source/Configuration.cpp index 7095aea8..7c88c72f 100644 --- a/Boards/CYD-2432S028RV3/Source/CYD2432S028RV3.cpp +++ b/Boards/CYD-2432S028R/Source/Configuration.cpp @@ -1,22 +1,22 @@ -#include "CYD2432S028RV3.h" #include "devices/Display.h" #include "devices/SdCard.h" + +#include #include #include -#include using namespace tt::hal; static bool initBoot() { // Set the RGB LED Pins to output and turn them off - ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_4, GPIO_MODE_OUTPUT)); //Red - ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_16, GPIO_MODE_OUTPUT)); //Green - ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_17, GPIO_MODE_OUTPUT)); //Blue + ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_4, GPIO_MODE_OUTPUT)); // Red + ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_16, GPIO_MODE_OUTPUT)); // Green + ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_17, GPIO_MODE_OUTPUT)); // Blue - // 0 on, 1 off... yep it's backwards. - ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_4, 1)); //Red - ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_16, 1)); //Green - ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_17, 1)); //Blue + // 0 on, 1 off + ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_4, 1)); // Red + ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_16, 1)); // Green + ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_17, 1)); // Blue return driver::pwmbacklight::init(LCD_PIN_BACKLIGHT); } @@ -28,7 +28,7 @@ static DeviceVector createDevices() { }; } -const Configuration cyd_2432s028rv3_config = { +extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .createDevices = createDevices, .i2c = { diff --git a/Boards/CYD-2432S028R/Source/devices/Display.cpp b/Boards/CYD-2432S028R/Source/devices/Display.cpp index dea602b6..1664b7c4 100644 --- a/Boards/CYD-2432S028R/Source/devices/Display.cpp +++ b/Boards/CYD-2432S028R/Source/devices/Display.cpp @@ -3,52 +3,47 @@ #include #include -constexpr auto* TAG = "CYD"; - static std::shared_ptr createTouch() { auto configuration = std::make_unique( - CYD_TOUCH_MOSI_PIN, - CYD_TOUCH_MISO_PIN, - CYD_TOUCH_SCK_PIN, - CYD_TOUCH_CS_PIN, - CYD2432S028R_LCD_HORIZONTAL_RESOLUTION, // 240 - CYD2432S028R_LCD_VERTICAL_RESOLUTION, // 320 + TOUCH_MOSI_PIN, + TOUCH_MISO_PIN, + TOUCH_SCK_PIN, + TOUCH_CS_PIN, + LCD_HORIZONTAL_RESOLUTION, + LCD_VERTICAL_RESOLUTION, false, // swapXY true, // mirrorX false // mirrorY ); - // Allocate the driver - auto touch = std::make_shared(std::move(configuration)); - - // Start the driver - if (!touch->start()) { - ESP_LOGE(TAG, "Touch driver start failed"); - return nullptr; - } - - return touch; + return std::make_shared(std::move(configuration)); } std::shared_ptr createDisplay() { - auto touch = createTouch(); + 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 configuration = std::make_unique( - CYD2432S028R_LCD_SPI_HOST, - CYD2432S028R_LCD_PIN_CS, - CYD2432S028R_LCD_PIN_DC, - CYD2432S028R_LCD_HORIZONTAL_RESOLUTION, - CYD2432S028R_LCD_VERTICAL_RESOLUTION, - touch, - false, // swapXY - true, // mirrorX - false, // mirrorY - false, - CYD2432S028R_LCD_DRAW_BUFFER_SIZE - ); + 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 + }); - configuration->backlightDutyFunction = driver::pwmbacklight::setBacklightDuty; - - auto display = std::make_shared(std::move(configuration)); - return std::reinterpret_pointer_cast(display); + return std::make_shared(panel_configuration, spi_configuration, true); } diff --git a/Boards/CYD-2432S028R/Source/devices/Display.h b/Boards/CYD-2432S028R/Source/devices/Display.h index 1fbc536a..75b1c355 100644 --- a/Boards/CYD-2432S028R/Source/devices/Display.h +++ b/Boards/CYD-2432S028R/Source/devices/Display.h @@ -1,22 +1,28 @@ #pragma once -#include "Tactility/hal/display/DisplayDevice.h" +#include +#include +#include #include // Display -#define CYD2432S028R_LCD_SPI_HOST SPI2_HOST -#define CYD2432S028R_LCD_HORIZONTAL_RESOLUTION 240 -#define CYD2432S028R_LCD_VERTICAL_RESOLUTION 320 -#define CYD2432S028R_LCD_DRAW_BUFFER_HEIGHT (CYD2432S028R_LCD_VERTICAL_RESOLUTION / 10) -#define CYD2432S028R_LCD_DRAW_BUFFER_SIZE (CYD2432S028R_LCD_HORIZONTAL_RESOLUTION * CYD2432S028R_LCD_DRAW_BUFFER_HEIGHT) -#define CYD2432S028R_LCD_PIN_CS GPIO_NUM_15 -#define CYD2432S028R_LCD_PIN_DC GPIO_NUM_2 +constexpr auto LCD_SPI_HOST = SPI2_HOST; +constexpr auto LCD_PIN_CS = GPIO_NUM_15; +constexpr auto LCD_PIN_DC = GPIO_NUM_2; +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; + +// Display backlight (PWM) +constexpr auto LCD_PIN_BACKLIGHT = GPIO_NUM_21; // Touch (Software SPI) -#define CYD_TOUCH_MISO_PIN GPIO_NUM_39 -#define CYD_TOUCH_MOSI_PIN GPIO_NUM_32 -#define CYD_TOUCH_SCK_PIN GPIO_NUM_25 -#define CYD_TOUCH_CS_PIN GPIO_NUM_33 -#define CYD_TOUCH_IRQ_PIN GPIO_NUM_36 +constexpr auto TOUCH_MISO_PIN = GPIO_NUM_39; +constexpr auto TOUCH_MOSI_PIN = GPIO_NUM_32; +constexpr auto TOUCH_SCK_PIN = GPIO_NUM_25; +constexpr auto TOUCH_CS_PIN = GPIO_NUM_33; +constexpr auto TOUCH_IRQ_PIN = GPIO_NUM_36; std::shared_ptr createDisplay(); diff --git a/Boards/CYD-2432S028RV3/Source/CYD2432S028RV3.h b/Boards/CYD-2432S028RV3/Source/CYD2432S028RV3.h deleted file mode 100644 index cf26f42b..00000000 --- a/Boards/CYD-2432S028RV3/Source/CYD2432S028RV3.h +++ /dev/null @@ -1,6 +0,0 @@ -#pragma once - -#include - -// Resistive touch version of the 2.8" yellow board version 3 -extern const tt::hal::Configuration cyd_2432s028rv3_config; diff --git a/Boards/CYD-2432S028R/Source/CYD2432S028R.cpp b/Boards/CYD-2432S028RV3/Source/Configuration.cpp similarity index 84% rename from Boards/CYD-2432S028R/Source/CYD2432S028R.cpp rename to Boards/CYD-2432S028RV3/Source/Configuration.cpp index d8fd8726..7c88c72f 100644 --- a/Boards/CYD-2432S028R/Source/CYD2432S028R.cpp +++ b/Boards/CYD-2432S028RV3/Source/Configuration.cpp @@ -1,29 +1,24 @@ -#include "CYD2432S028R.h" #include "devices/Display.h" #include "devices/SdCard.h" + +#include #include #include -#include - -// SPI Transfer -#define CYD_SPI_TRANSFER_SIZE_LIMIT (CYD2432S028R_LCD_DRAW_BUFFER_SIZE * LV_COLOR_DEPTH / 8) -// Display backlight (PWM) -#define CYD2432S028R_LCD_PIN_BACKLIGHT GPIO_NUM_21 using namespace tt::hal; static bool initBoot() { - //Set the RGB Led Pins to output and turn them off - ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_4, GPIO_MODE_OUTPUT)); //Red - ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_16, GPIO_MODE_OUTPUT)); //Green - ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_17, GPIO_MODE_OUTPUT)); //Blue + // Set the RGB LED Pins to output and turn them off + ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_4, GPIO_MODE_OUTPUT)); // Red + ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_16, GPIO_MODE_OUTPUT)); // Green + ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_17, GPIO_MODE_OUTPUT)); // Blue - //0 on, 1 off... yep it's backwards. - ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_4, 1)); //Red - ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_16, 1)); //Green - ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_17, 1)); //Blue + // 0 on, 1 off + ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_4, 1)); // Red + ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_16, 1)); // Green + ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_17, 1)); // Blue - return driver::pwmbacklight::init(CYD2432S028R_LCD_PIN_BACKLIGHT); + return driver::pwmbacklight::init(LCD_PIN_BACKLIGHT); } static DeviceVector createDevices() { @@ -33,7 +28,7 @@ static DeviceVector createDevices() { }; } -const Configuration cyd_2432s028r_config = { +extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .createDevices = createDevices, .i2c = { @@ -71,7 +66,7 @@ const Configuration cyd_2432s028r_config = { .data6_io_num = GPIO_NUM_NC, .data7_io_num = GPIO_NUM_NC, .data_io_default_level = false, - .max_transfer_sz = CYD_SPI_TRANSFER_SIZE_LIMIT, + .max_transfer_sz = LCD_SPI_TRANSFER_SIZE_LIMIT, .flags = 0, .isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO, .intr_flags = 0 diff --git a/Boards/CYD-2432S028RV3/Source/devices/Display.cpp b/Boards/CYD-2432S028RV3/Source/devices/Display.cpp index f4231499..7a9c9484 100644 --- a/Boards/CYD-2432S028RV3/Source/devices/Display.cpp +++ b/Boards/CYD-2432S028RV3/Source/devices/Display.cpp @@ -11,23 +11,14 @@ static std::shared_ptr createTouch() { TOUCH_MISO_PIN, TOUCH_SCK_PIN, TOUCH_CS_PIN, - LCD_HORIZONTAL_RESOLUTION, // 240 - LCD_VERTICAL_RESOLUTION, // 320 + LCD_HORIZONTAL_RESOLUTION, + LCD_VERTICAL_RESOLUTION, false, // swapXY true, // mirrorX false // mirrorY ); - // Allocate the driver - auto touch = std::make_shared(std::move(configuration)); - - // Start the driver - if (!touch->start()) { - ESP_LOGE(TAG, "Touch driver start failed"); - return nullptr; - } - - return touch; + return std::make_shared(std::move(configuration)); } std::shared_ptr createDisplay() { @@ -50,7 +41,7 @@ std::shared_ptr createDisplay() { .spiHostDevice = LCD_SPI_HOST, .csPin = LCD_PIN_CS, .dcPin = LCD_PIN_DC, - .pixelClockFrequency = 80'000'000, + .pixelClockFrequency = 62'500'000, .transactionQueueDepth = 10 }); diff --git a/Boards/CYD-2432S032C/Source/CYD2432S032C.h b/Boards/CYD-2432S032C/Source/CYD2432S032C.h deleted file mode 100644 index 854ef337..00000000 --- a/Boards/CYD-2432S032C/Source/CYD2432S032C.h +++ /dev/null @@ -1,6 +0,0 @@ -#pragma once - -#include - -// Capacitive touch version of the 2.4" yellow board -extern const tt::hal::Configuration cyd_2432S032c_config; diff --git a/Boards/CYD-2432S032C/Source/CYD2432S032C.cpp b/Boards/CYD-2432S032C/Source/Configuration.cpp similarity index 80% rename from Boards/CYD-2432S032C/Source/CYD2432S032C.cpp rename to Boards/CYD-2432S032C/Source/Configuration.cpp index 69ffebf1..e3eec843 100644 --- a/Boards/CYD-2432S032C/Source/CYD2432S032C.cpp +++ b/Boards/CYD-2432S032C/Source/Configuration.cpp @@ -1,17 +1,27 @@ -#include "CYD2432S032C.h" -#include "Tactility/lvgl/LvglSync.h" #include "devices/Display.h" #include "devices/SdCard.h" +#include #include +#include #include bool initBoot() { - if (!driver::pwmbacklight::init(GPIO_NUM_27)) { + if (!driver::pwmbacklight::init(LCD_PIN_BACKLIGHT)) { return false; } + // Set the RGB LED Pins to output and turn them off + ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_4, GPIO_MODE_OUTPUT)); // Red + ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_16, GPIO_MODE_OUTPUT)); // Green + ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_17, GPIO_MODE_OUTPUT)); // Blue + + // 0 on, 1 off + ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_4, 1)); // Red + ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_16, 1)); // Green + ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_17, 1)); // Blue + // 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::BootSplash, [](auto) { @@ -32,7 +42,7 @@ static tt::hal::DeviceVector createDevices() { }; } -const tt::hal::Configuration cyd_2432S032c_config = { +extern const tt::hal::Configuration hardwareConfiguration = { .initBoot = initBoot, .createDevices = createDevices, .i2c = { @@ -55,6 +65,7 @@ const tt::hal::Configuration cyd_2432S032c_config = { } }, .spi { + // Display tt::hal::spi::Configuration { .device = SPI2_HOST, .dma = SPI_DMA_CH_AUTO, @@ -69,7 +80,7 @@ const tt::hal::Configuration cyd_2432S032c_config = { .data6_io_num = GPIO_NUM_NC, .data7_io_num = GPIO_NUM_NC, .data_io_default_level = false, - .max_transfer_sz = 0, + .max_transfer_sz = LCD_SPI_TRANSFER_SIZE_LIMIT, .flags = 0, .isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO, .intr_flags = 0 @@ -78,6 +89,7 @@ const tt::hal::Configuration cyd_2432S032c_config = { .isMutable = false, .lock = tt::lvgl::getSyncLock() // esp_lvgl_port owns the lock for the display }, + // SD card tt::hal::spi::Configuration { .device = SPI3_HOST, .dma = SPI_DMA_CH_AUTO, diff --git a/Boards/CYD-2432S032C/Source/devices/Display.cpp b/Boards/CYD-2432S032C/Source/devices/Display.cpp index 33e67cd5..f771c1dd 100644 --- a/Boards/CYD-2432S032C/Source/devices/Display.cpp +++ b/Boards/CYD-2432S032C/Source/devices/Display.cpp @@ -7,34 +7,38 @@ static std::shared_ptr createTouch() { auto configuration = std::make_unique( I2C_NUM_0, - 240, - 320 + LCD_HORIZONTAL_RESOLUTION, + LCD_VERTICAL_RESOLUTION ); 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 = true, + .mirrorX = true, + .mirrorY = true, + .invertColor = true, + .swapBytes = true, + .bufferSize = LCD_BUFFER_SIZE, + .touch = createTouch(), + .backlightDutyFunction = driver::pwmbacklight::setBacklightDuty, + .resetPin = GPIO_NUM_NC, + .rgbElementOrder = LCD_RGB_ELEMENT_ORDER_RGB + }; - auto touch = createTouch(); + 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 + }); - auto configuration = std::make_unique( - SPI2_HOST, - GPIO_NUM_15, - GPIO_NUM_2, - 240, - 320, - touch, - true, - true, - true, - true, - 0, - LCD_RGB_ELEMENT_ORDER_RGB - ); - - configuration->backlightDutyFunction = driver::pwmbacklight::setBacklightDuty; - - auto display = std::make_shared(std::move(configuration)); - return std::reinterpret_pointer_cast(display); + return std::make_shared(panel_configuration, spi_configuration, true); } diff --git a/Boards/CYD-2432S032C/Source/devices/Display.h b/Boards/CYD-2432S032C/Source/devices/Display.h index 344191d6..541c3498 100644 --- a/Boards/CYD-2432S032C/Source/devices/Display.h +++ b/Boards/CYD-2432S032C/Source/devices/Display.h @@ -1,6 +1,19 @@ #pragma once #include +#include +#include #include +// Display +constexpr auto LCD_SPI_HOST = SPI2_HOST; +constexpr auto LCD_PIN_CS = GPIO_NUM_15; +constexpr auto LCD_PIN_DC = GPIO_NUM_2; +constexpr auto LCD_PIN_BACKLIGHT = GPIO_NUM_27; +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/Boards/CYD-4848S040C/Source/CYD4848S040C.h b/Boards/CYD-4848S040C/Source/CYD4848S040C.h deleted file mode 100644 index e66e1d65..00000000 --- a/Boards/CYD-4848S040C/Source/CYD4848S040C.h +++ /dev/null @@ -1,6 +0,0 @@ -#pragma once - -#include - -// Capacitive touch version of the 4" square yellow board -extern const tt::hal::Configuration cyd_4848s040c_config; diff --git a/Boards/CYD-4848S040C/Source/CYD4848S040C.cpp b/Boards/CYD-4848S040C/Source/Configuration.cpp similarity index 93% rename from Boards/CYD-4848S040C/Source/CYD4848S040C.cpp rename to Boards/CYD-4848S040C/Source/Configuration.cpp index 6d19a855..a8bb1830 100644 --- a/Boards/CYD-4848S040C/Source/CYD4848S040C.cpp +++ b/Boards/CYD-4848S040C/Source/Configuration.cpp @@ -1,10 +1,9 @@ -#include "CYD4848S040C.h" - -#include "Tactility/kernel/SystemEvents.h" -#include "Tactility/lvgl/LvglSync.h" #include "devices/St7701Display.h" #include "devices/SdCard.h" +#include +#include +#include #include using namespace tt::hal; @@ -20,7 +19,7 @@ static DeviceVector createDevices() { }; } -const Configuration cyd_4848s040c_config = { +extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .createDevices = createDevices, .i2c = { diff --git a/Boards/CYD-8048S043C/Source/CYD8048S043C.h b/Boards/CYD-8048S043C/Source/CYD8048S043C.h deleted file mode 100644 index ab154c71..00000000 --- a/Boards/CYD-8048S043C/Source/CYD8048S043C.h +++ /dev/null @@ -1,6 +0,0 @@ -#pragma once - -#include - -// Capacitive touch version of the 4.3" yellow board -extern const tt::hal::Configuration cyd_8048s043c_config; diff --git a/Boards/CYD-8048S043C/Source/CYD8048S043C.cpp b/Boards/CYD-8048S043C/Source/Configuration.cpp similarity index 95% rename from Boards/CYD-8048S043C/Source/CYD8048S043C.cpp rename to Boards/CYD-8048S043C/Source/Configuration.cpp index 7e26ee29..266447e1 100644 --- a/Boards/CYD-8048S043C/Source/CYD8048S043C.cpp +++ b/Boards/CYD-8048S043C/Source/Configuration.cpp @@ -1,8 +1,9 @@ -#include "CYD8048S043C.h" // Don't remove, or we get a linker error ("undefined reference to `cyd_8048s043c_config'" - GCC bug?) #include "PwmBacklight.h" #include "devices/Display.h" #include "devices/SdCard.h" +#include + using namespace tt::hal; static bool initBoot() { @@ -17,7 +18,7 @@ static DeviceVector createDevices() { }; } -const Configuration cyd_8048s043c_config = { +extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .createDevices = createDevices, .i2c = { diff --git a/Boards/CYD-E32R28T/Source/E32R28T.cpp b/Boards/CYD-E32R28T/Source/Configuration.cpp similarity index 86% rename from Boards/CYD-E32R28T/Source/E32R28T.cpp rename to Boards/CYD-E32R28T/Source/Configuration.cpp index 7e2985d1..3a0e573a 100644 --- a/Boards/CYD-E32R28T/Source/E32R28T.cpp +++ b/Boards/CYD-E32R28T/Source/Configuration.cpp @@ -1,13 +1,12 @@ -#include "E32R28T.h" #include "devices/SdCard.h" #include "devices/Display.h" + +#include #include #include -#define CYD_SPI_TRANSFER_SIZE_LIMIT (240 * 320 / 4 * 2) - static bool initBoot() { - return driver::pwmbacklight::init(CYD_BACKLIGHT_PIN); + return driver::pwmbacklight::init(LCD_BACKLIGHT_PIN); } static tt::hal::DeviceVector createDevices() { @@ -17,7 +16,7 @@ static tt::hal::DeviceVector createDevices() { }; } -const tt::hal::Configuration cyd_e32r28t_config = { +extern const tt::hal::Configuration hardwareConfiguration = { .initBoot = initBoot, .createDevices = createDevices, .i2c = {}, @@ -36,7 +35,7 @@ const tt::hal::Configuration cyd_e32r28t_config = { .data6_io_num = GPIO_NUM_NC, .data7_io_num = GPIO_NUM_NC, .data_io_default_level = false, - .max_transfer_sz = CYD_SPI_TRANSFER_SIZE_LIMIT, + .max_transfer_sz = LCD_SPI_TRANSFER_SIZE_LIMIT, .flags = 0, .isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO, .intr_flags = 0 @@ -59,7 +58,7 @@ const tt::hal::Configuration cyd_e32r28t_config = { .data6_io_num = GPIO_NUM_NC, .data7_io_num = GPIO_NUM_NC, .data_io_default_level = false, - .max_transfer_sz = CYD_SPI_TRANSFER_SIZE_LIMIT, + .max_transfer_sz = 0, .flags = 0, .isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO, .intr_flags = 0 diff --git a/Boards/CYD-E32R28T/Source/E32R28T.h b/Boards/CYD-E32R28T/Source/E32R28T.h deleted file mode 100644 index f3545923..00000000 --- a/Boards/CYD-E32R28T/Source/E32R28T.h +++ /dev/null @@ -1,6 +0,0 @@ -#pragma once - -#include - -// Resistive touch version of the waveshare 2.8" yellow board -extern const tt::hal::Configuration cyd_e32r28t_config; diff --git a/Boards/CYD-E32R28T/Source/devices/Display.cpp b/Boards/CYD-E32R28T/Source/devices/Display.cpp index 68b00820..9ba75bde 100644 --- a/Boards/CYD-E32R28T/Source/devices/Display.cpp +++ b/Boards/CYD-E32R28T/Source/devices/Display.cpp @@ -7,12 +7,12 @@ static std::shared_ptr createTouch() { auto config = std::make_unique( - CYD_TOUCH_MOSI_PIN, - CYD_TOUCH_MISO_PIN, - CYD_TOUCH_SCK_PIN, - CYD_TOUCH_CS_PIN, - CYD_DISPLAY_HORIZONTAL_RESOLUTION, - CYD_DISPLAY_VERTICAL_RESOLUTION, + TOUCH_MOSI_PIN, + TOUCH_MISO_PIN, + TOUCH_SCK_PIN, + TOUCH_CS_PIN, + LCD_HORIZONTAL_RESOLUTION, + LCD_VERTICAL_RESOLUTION, false, true, false @@ -22,20 +22,30 @@ static std::shared_ptr createTouch() { } std::shared_ptr createDisplay() { - auto configuration = std::make_unique( - CYD_DISPLAY_SPI_HOST, - CYD_DISPLAY_PIN_CS, - CYD_DISPLAY_PIN_DC, - CYD_DISPLAY_HORIZONTAL_RESOLUTION, - CYD_DISPLAY_VERTICAL_RESOLUTION, - createTouch(), - false, - true, - false, - false, - 0, - LCD_RGB_ELEMENT_ORDER_BGR - ); - configuration->backlightDutyFunction = driver::pwmbacklight::setBacklightDuty; - return std::make_shared(std::move(configuration)); + 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/Boards/CYD-E32R28T/Source/devices/Display.h b/Boards/CYD-E32R28T/Source/devices/Display.h index 31c73d55..b8cca620 100644 --- a/Boards/CYD-E32R28T/Source/devices/Display.h +++ b/Boards/CYD-E32R28T/Source/devices/Display.h @@ -1,25 +1,28 @@ #pragma once #include +#include +#include #include // Display -#define CYD_DISPLAY_SPI_HOST SPI2_HOST -#define CYD_DISPLAY_PIN_CS GPIO_NUM_15 -#define CYD_DISPLAY_PIN_DC GPIO_NUM_2 -#define CYD_DISPLAY_HORIZONTAL_RESOLUTION 240 -#define CYD_DISPLAY_VERTICAL_RESOLUTION 320 -#define CYD_DISPLAY_DRAW_BUFFER_HEIGHT (CYD_DISPLAY_VERTICAL_RESOLUTION / 10) -#define CYD_DISPLAY_DRAW_BUFFER_SIZE (CYD_DISPLAY_HORIZONTAL_RESOLUTION * CYD_DISPLAY_DRAW_BUFFER_HEIGHT) +constexpr auto LCD_SPI_HOST = SPI2_HOST; +constexpr auto LCD_PIN_CS = GPIO_NUM_15; +constexpr auto LCD_PIN_DC = GPIO_NUM_2; +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; // Touch (Software SPI) -#define CYD_TOUCH_MISO_PIN GPIO_NUM_39 -#define CYD_TOUCH_MOSI_PIN GPIO_NUM_32 -#define CYD_TOUCH_SCK_PIN GPIO_NUM_25 -#define CYD_TOUCH_CS_PIN GPIO_NUM_33 -#define CYD_TOUCH_IRQ_PIN GPIO_NUM_36 +constexpr auto TOUCH_MISO_PIN = GPIO_NUM_39; +constexpr auto TOUCH_MOSI_PIN = GPIO_NUM_32; +constexpr auto TOUCH_SCK_PIN = GPIO_NUM_25; +constexpr auto TOUCH_CS_PIN = GPIO_NUM_33; +constexpr auto TOUCH_IRQ_PIN = GPIO_NUM_36; // Backlight -#define CYD_BACKLIGHT_PIN GPIO_NUM_21 +constexpr auto LCD_BACKLIGHT_PIN = GPIO_NUM_21; std::shared_ptr createDisplay(); diff --git a/Boards/CYD-JC2432W328C/Source/JC2432W328C.cpp b/Boards/CYD-JC2432W328C/Source/Configuration.cpp similarity index 98% rename from Boards/CYD-JC2432W328C/Source/JC2432W328C.cpp rename to Boards/CYD-JC2432W328C/Source/Configuration.cpp index 275d4e77..324147ad 100644 --- a/Boards/CYD-JC2432W328C/Source/JC2432W328C.cpp +++ b/Boards/CYD-JC2432W328C/Source/Configuration.cpp @@ -1,4 +1,3 @@ -#include "JC2432W328C.h" #include "devices/Display.h" #include "devices/SdCard.h" @@ -29,7 +28,7 @@ static DeviceVector createDevices() { }; } -const Configuration cyd_jc2432w328c_config = { +extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .createDevices = createDevices, .i2c = { diff --git a/Boards/CYD-JC2432W328C/Source/JC2432W328C.h b/Boards/CYD-JC2432W328C/Source/JC2432W328C.h deleted file mode 100644 index 9ab9788c..00000000 --- a/Boards/CYD-JC2432W328C/Source/JC2432W328C.h +++ /dev/null @@ -1,6 +0,0 @@ -#pragma once - -#include - -// Capacitive touch version of the 2.8" yellow board -extern const tt::hal::Configuration cyd_jc2432w328c_config; diff --git a/Boards/CYD-JC2432W328C/Source/devices/Display.cpp b/Boards/CYD-JC2432W328C/Source/devices/Display.cpp index ebf43413..64018d02 100644 --- a/Boards/CYD-JC2432W328C/Source/devices/Display.cpp +++ b/Boards/CYD-JC2432W328C/Source/devices/Display.cpp @@ -34,7 +34,7 @@ std::shared_ptr createDisplay() { .spiHostDevice = LCD_SPI_HOST, .csPin = LCD_PIN_CS, .dcPin = LCD_PIN_DC, - .pixelClockFrequency = 80'000'000, + .pixelClockFrequency = 62'500'000, .transactionQueueDepth = 10 }); diff --git a/Boards/CYD-JC8048W550C/Source/JC8048W550C.cpp b/Boards/CYD-JC8048W550C/Source/Configuration.cpp similarity index 95% rename from Boards/CYD-JC8048W550C/Source/JC8048W550C.cpp rename to Boards/CYD-JC8048W550C/Source/Configuration.cpp index 1339f199..9d418c9f 100644 --- a/Boards/CYD-JC8048W550C/Source/JC8048W550C.cpp +++ b/Boards/CYD-JC8048W550C/Source/Configuration.cpp @@ -1,8 +1,9 @@ -#include "JC8048W550C.h" // Don't remove, or we get a linker error ("undefined reference to `cyd_jc8048w550c_config'" - GCC bug?) #include "PwmBacklight.h" #include "devices/Display.h" #include "devices/SdCard.h" +#include + using namespace tt::hal; static bool initBoot() { @@ -16,7 +17,7 @@ static DeviceVector createDevices() { }; } -const Configuration cyd_jc8048w550c_config = { +extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .createDevices = createDevices, .i2c = { diff --git a/Boards/CYD-JC8048W550C/Source/JC8048W550C.h b/Boards/CYD-JC8048W550C/Source/JC8048W550C.h deleted file mode 100644 index b50ad560..00000000 --- a/Boards/CYD-JC8048W550C/Source/JC8048W550C.h +++ /dev/null @@ -1,6 +0,0 @@ -#pragma once - -#include - -// Capacitive touch version of the 5" black board -extern const tt::hal::Configuration cyd_jc8048w550c_config; diff --git a/Boards/ElecrowCrowpanelAdvance28/Source/CrowPanelAdvance28.cpp b/Boards/ElecrowCrowpanelAdvance28/Source/Configuration.cpp similarity index 98% rename from Boards/ElecrowCrowpanelAdvance28/Source/CrowPanelAdvance28.cpp rename to Boards/ElecrowCrowpanelAdvance28/Source/Configuration.cpp index 82f185e4..7704e0a7 100644 --- a/Boards/ElecrowCrowpanelAdvance28/Source/CrowPanelAdvance28.cpp +++ b/Boards/ElecrowCrowpanelAdvance28/Source/Configuration.cpp @@ -2,8 +2,8 @@ #include "devices/Display.h" #include "devices/SdCard.h" -#include #include +#include using namespace tt::hal; @@ -18,7 +18,7 @@ static DeviceVector createDevices() { }; } -extern const Configuration crowpanel_advance_28 = { +extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .createDevices = createDevices, .i2c = { diff --git a/Boards/ElecrowCrowpanelAdvance28/Source/CrowPanelAdvance28.h b/Boards/ElecrowCrowpanelAdvance28/Source/CrowPanelAdvance28.h deleted file mode 100644 index 0a1d5d50..00000000 --- a/Boards/ElecrowCrowpanelAdvance28/Source/CrowPanelAdvance28.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -#include - -extern const tt::hal::Configuration crowpanel_advance_28; diff --git a/Boards/ElecrowCrowpanelAdvance28/Source/devices/Display.cpp b/Boards/ElecrowCrowpanelAdvance28/Source/devices/Display.cpp index f65cd01c..6d0d984e 100644 --- a/Boards/ElecrowCrowpanelAdvance28/Source/devices/Display.cpp +++ b/Boards/ElecrowCrowpanelAdvance28/Source/devices/Display.cpp @@ -38,7 +38,7 @@ std::shared_ptr createDisplay() { .spiHostDevice = LCD_SPI_HOST, .csPin = LCD_PIN_CS, .dcPin = LCD_PIN_DC, - .pixelClockFrequency = 80'000'000, + .pixelClockFrequency = 62'500'000, .transactionQueueDepth = 10 }); diff --git a/Boards/ElecrowCrowpanelAdvance35/Source/CrowPanelAdvance35.cpp b/Boards/ElecrowCrowpanelAdvance35/Source/Configuration.cpp similarity index 97% rename from Boards/ElecrowCrowpanelAdvance35/Source/CrowPanelAdvance35.cpp rename to Boards/ElecrowCrowpanelAdvance35/Source/Configuration.cpp index 0ba41c17..2473c2b1 100644 --- a/Boards/ElecrowCrowpanelAdvance35/Source/CrowPanelAdvance35.cpp +++ b/Boards/ElecrowCrowpanelAdvance35/Source/Configuration.cpp @@ -1,9 +1,9 @@ -#include "PwmBacklight.h" -#include "Tactility/lvgl/LvglSync.h" #include "devices/Display.h" #include "devices/SdCard.h" #include +#include +#include #define CROWPANEL_SPI_TRANSFER_SIZE_LIMIT (CROWPANEL_LCD_HORIZONTAL_RESOLUTION * CROWPANEL_LCD_SPI_TRANSFER_HEIGHT * (LV_COLOR_DEPTH / 8)) @@ -20,7 +20,7 @@ static DeviceVector createDevices() { }; } -extern const Configuration crowpanel_advance_35 = { +extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .createDevices = createDevices, .i2c = { diff --git a/Boards/ElecrowCrowpanelAdvance35/Source/CrowPanelAdvance35.h b/Boards/ElecrowCrowpanelAdvance35/Source/CrowPanelAdvance35.h deleted file mode 100644 index 80b3523f..00000000 --- a/Boards/ElecrowCrowpanelAdvance35/Source/CrowPanelAdvance35.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -#include - -extern const tt::hal::Configuration crowpanel_advance_35; diff --git a/Boards/ElecrowCrowpanelAdvance50/Source/CrowPanelAdvance50.cpp b/Boards/ElecrowCrowpanelAdvance50/Source/Configuration.cpp similarity index 98% rename from Boards/ElecrowCrowpanelAdvance50/Source/CrowPanelAdvance50.cpp rename to Boards/ElecrowCrowpanelAdvance50/Source/Configuration.cpp index 0cb7702e..a725bc84 100644 --- a/Boards/ElecrowCrowpanelAdvance50/Source/CrowPanelAdvance50.cpp +++ b/Boards/ElecrowCrowpanelAdvance50/Source/Configuration.cpp @@ -28,7 +28,7 @@ static DeviceVector createDevices() { }; } -extern const Configuration crowpanel_advance_50 = { +extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .createDevices = createDevices, .i2c = { diff --git a/Boards/ElecrowCrowpanelAdvance50/Source/CrowPanelAdvance50.h b/Boards/ElecrowCrowpanelAdvance50/Source/CrowPanelAdvance50.h deleted file mode 100644 index 05c5e341..00000000 --- a/Boards/ElecrowCrowpanelAdvance50/Source/CrowPanelAdvance50.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -#include - -extern const tt::hal::Configuration crowpanel_advance_50; diff --git a/Boards/ElecrowCrowpanelBasic28/Source/CrowPanelBasic28.cpp b/Boards/ElecrowCrowpanelBasic28/Source/Configuration.cpp similarity index 93% rename from Boards/ElecrowCrowpanelBasic28/Source/CrowPanelBasic28.cpp rename to Boards/ElecrowCrowpanelBasic28/Source/Configuration.cpp index ba632dbd..cb99eb68 100644 --- a/Boards/ElecrowCrowpanelBasic28/Source/CrowPanelBasic28.cpp +++ b/Boards/ElecrowCrowpanelBasic28/Source/Configuration.cpp @@ -2,11 +2,9 @@ #include "devices/Display.h" #include "devices/SdCard.h" -#include #include #include - -#define CROWPANEL_SPI_TRANSFER_SIZE_LIMIT (CROWPANEL_LCD_HORIZONTAL_RESOLUTION * CROWPANEL_LCD_SPI_TRANSFER_HEIGHT * (LV_COLOR_DEPTH / 8)) +#include using namespace tt::hal; @@ -22,7 +20,7 @@ static DeviceVector createDevices() { }; } -extern const Configuration crowpanel_basic_28 = { +extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .createDevices = createDevices, .i2c = { @@ -62,7 +60,7 @@ extern const Configuration crowpanel_basic_28 = { .data6_io_num = GPIO_NUM_NC, .data7_io_num = GPIO_NUM_NC, .data_io_default_level = false, - .max_transfer_sz = CROWPANEL_SPI_TRANSFER_SIZE_LIMIT, + .max_transfer_sz = LCD_SPI_TRANSFER_SIZE_LIMIT, .flags = 0, .isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO, .intr_flags = 0 diff --git a/Boards/ElecrowCrowpanelBasic28/Source/CrowPanelBasic28.h b/Boards/ElecrowCrowpanelBasic28/Source/CrowPanelBasic28.h deleted file mode 100644 index c064daad..00000000 --- a/Boards/ElecrowCrowpanelBasic28/Source/CrowPanelBasic28.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -#include - -extern const tt::hal::Configuration crowpanel_basic_28; diff --git a/Boards/ElecrowCrowpanelBasic28/Source/devices/Display.cpp b/Boards/ElecrowCrowpanelBasic28/Source/devices/Display.cpp index 37648ee7..1ba08b7d 100644 --- a/Boards/ElecrowCrowpanelBasic28/Source/devices/Display.cpp +++ b/Boards/ElecrowCrowpanelBasic28/Source/devices/Display.cpp @@ -7,10 +7,10 @@ std::shared_ptr createTouch() { auto configuration = std::make_unique( - CROWPANEL_LCD_SPI_HOST, - CROWPANEL_TOUCH_PIN_CS, - 240, - 320, + LCD_SPI_HOST, + TOUCH_PIN_CS, + LCD_HORIZONTAL_RESOLUTION, + LCD_VERTICAL_RESOLUTION, false, true, false @@ -20,20 +20,30 @@ std::shared_ptr createTouch() { } std::shared_ptr createDisplay() { - auto touch = createTouch(); + 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 configuration = std::make_unique( - CROWPANEL_LCD_SPI_HOST, - CROWPANEL_LCD_PIN_CS, - CROWPANEL_LCD_PIN_DC, - 240, - 320, - touch - ); + 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 + }); - configuration->mirrorX = true; - configuration->backlightDutyFunction = driver::pwmbacklight::setBacklightDuty; - - auto display = std::make_shared(std::move(configuration)); - return std::reinterpret_pointer_cast(display); + return std::make_shared(panel_configuration, spi_configuration, true); } diff --git a/Boards/ElecrowCrowpanelBasic28/Source/devices/Display.h b/Boards/ElecrowCrowpanelBasic28/Source/devices/Display.h index 2c586145..6dfd79a9 100644 --- a/Boards/ElecrowCrowpanelBasic28/Source/devices/Display.h +++ b/Boards/ElecrowCrowpanelBasic28/Source/devices/Display.h @@ -1,13 +1,17 @@ #pragma once #include +#include +#include -#define CROWPANEL_LCD_SPI_HOST SPI2_HOST -#define CROWPANEL_LCD_PIN_CS GPIO_NUM_15 -#define CROWPANEL_TOUCH_PIN_CS GPIO_NUM_33 -#define CROWPANEL_LCD_PIN_DC GPIO_NUM_2 // RS -#define CROWPANEL_LCD_HORIZONTAL_RESOLUTION 320 -#define CROWPANEL_LCD_VERTICAL_RESOLUTION 240 -#define CROWPANEL_LCD_SPI_TRANSFER_HEIGHT (CROWPANEL_LCD_VERTICAL_RESOLUTION / 10) +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/Boards/ElecrowCrowpanelBasic35/Source/CrowPanelBasic35.cpp b/Boards/ElecrowCrowpanelBasic35/Source/Configuration.cpp similarity index 98% rename from Boards/ElecrowCrowpanelBasic35/Source/CrowPanelBasic35.cpp rename to Boards/ElecrowCrowpanelBasic35/Source/Configuration.cpp index 6ed02667..bf58810b 100644 --- a/Boards/ElecrowCrowpanelBasic35/Source/CrowPanelBasic35.cpp +++ b/Boards/ElecrowCrowpanelBasic35/Source/Configuration.cpp @@ -3,8 +3,8 @@ #include "devices/Display.h" #include "devices/SdCard.h" -#include #include +#include constexpr auto CROWPANEL_SPI_TRANSFER_SIZE_LIMIT = (CROWPANEL_LCD_HORIZONTAL_RESOLUTION * CROWPANEL_LCD_SPI_TRANSFER_HEIGHT * (LV_COLOR_DEPTH / 8)); @@ -22,7 +22,7 @@ static DeviceVector createDevices() { }; } -extern const Configuration crowpanel_basic_35 = { +extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .createDevices = createDevices, .i2c = { diff --git a/Boards/ElecrowCrowpanelBasic35/Source/CrowPanelBasic35.h b/Boards/ElecrowCrowpanelBasic35/Source/CrowPanelBasic35.h deleted file mode 100644 index bbd3ab01..00000000 --- a/Boards/ElecrowCrowpanelBasic35/Source/CrowPanelBasic35.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -#include - -extern const tt::hal::Configuration crowpanel_basic_35; diff --git a/Boards/ElecrowCrowpanelBasic50/Source/CrowPanelBasic50.cpp b/Boards/ElecrowCrowpanelBasic50/Source/Configuration.cpp similarity index 98% rename from Boards/ElecrowCrowpanelBasic50/Source/CrowPanelBasic50.cpp rename to Boards/ElecrowCrowpanelBasic50/Source/Configuration.cpp index a556fd23..0b9287a7 100644 --- a/Boards/ElecrowCrowpanelBasic50/Source/CrowPanelBasic50.cpp +++ b/Boards/ElecrowCrowpanelBasic50/Source/Configuration.cpp @@ -1,8 +1,8 @@ #include "devices/Display.h" #include "devices/SdCard.h" -#include #include +#include using namespace tt::hal; @@ -18,7 +18,7 @@ static DeviceVector createDevices() { }; } -extern const Configuration crowpanel_basic_50 = { +extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .createDevices = createDevices, .i2c = { diff --git a/Boards/ElecrowCrowpanelBasic50/Source/CrowPanelBasic50.h b/Boards/ElecrowCrowpanelBasic50/Source/CrowPanelBasic50.h deleted file mode 100644 index b8e919e8..00000000 --- a/Boards/ElecrowCrowpanelBasic50/Source/CrowPanelBasic50.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -#include - -extern const tt::hal::Configuration crowpanel_basic_50; diff --git a/Boards/LilygoTLoraPager/Source/LilygoTloraPager.cpp b/Boards/LilygoTLoraPager/Source/Configuration.cpp similarity index 97% rename from Boards/LilygoTLoraPager/Source/LilygoTloraPager.cpp rename to Boards/LilygoTLoraPager/Source/Configuration.cpp index a2e6f48a..a555e4b8 100644 --- a/Boards/LilygoTLoraPager/Source/LilygoTloraPager.cpp +++ b/Boards/LilygoTLoraPager/Source/Configuration.cpp @@ -1,13 +1,13 @@ -#include "Tactility/lvgl/LvglSync.h" #include "devices/Display.h" #include "devices/SdCard.h" #include "devices/TpagerEncoder.h" #include "devices/TpagerKeyboard.h" #include "devices/TpagerPower.h" +#include +#include #include #include -#include #define TPAGER_SPI_TRANSFER_SIZE_LIMIT (480 * 222 * (LV_COLOR_DEPTH / 8)) @@ -35,7 +35,7 @@ static DeviceVector createDevices() { }; } -extern const Configuration lilygo_tlora_pager = { +extern const Configuration hardwareConfiguration = { .initBoot = tpagerInit, .createDevices = createDevices, .i2c = { diff --git a/Boards/LilygoTLoraPager/Source/LilygoTloraPager.h b/Boards/LilygoTLoraPager/Source/LilygoTloraPager.h deleted file mode 100644 index b3e010fe..00000000 --- a/Boards/LilygoTLoraPager/Source/LilygoTloraPager.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -#include - -extern const tt::hal::Configuration lilygo_tlora_pager; diff --git a/Boards/LilygoTdeck/Source/LilygoTdeck.cpp b/Boards/LilygoTdeck/Source/Configuration.cpp similarity index 98% rename from Boards/LilygoTdeck/Source/LilygoTdeck.cpp rename to Boards/LilygoTdeck/Source/Configuration.cpp index 4f3eaccb..640f7114 100644 --- a/Boards/LilygoTdeck/Source/LilygoTdeck.cpp +++ b/Boards/LilygoTdeck/Source/Configuration.cpp @@ -1,11 +1,11 @@ -#include -#include - #include "devices/Display.h" #include "devices/Power.h" #include "devices/Sdcard.h" #include "devices/TdeckKeyboard.h" +#include +#include + bool initBoot(); using namespace tt::hal; @@ -19,7 +19,7 @@ static std::vector> createDevices() { }; } -extern const Configuration lilygo_tdeck = { +extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .createDevices = createDevices, .i2c = { diff --git a/Boards/LilygoTdeck/Source/LilygoTdeck.h b/Boards/LilygoTdeck/Source/LilygoTdeck.h deleted file mode 100644 index 5edc402d..00000000 --- a/Boards/LilygoTdeck/Source/LilygoTdeck.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -#include - -extern const tt::hal::Configuration lilygo_tdeck; diff --git a/Boards/LilygoTdeck/Source/devices/Display.cpp b/Boards/LilygoTdeck/Source/devices/Display.cpp index be73e8ae..a724b59d 100644 --- a/Boards/LilygoTdeck/Source/devices/Display.cpp +++ b/Boards/LilygoTdeck/Source/devices/Display.cpp @@ -38,7 +38,7 @@ std::shared_ptr createDisplay() { .spiHostDevice = LCD_SPI_HOST, .csPin = LCD_PIN_CS, .dcPin = LCD_PIN_DC, - .pixelClockFrequency = 80'000'000, + .pixelClockFrequency = 62'500'000, .transactionQueueDepth = 10 }); diff --git a/Boards/LilygoTdongleS3/Source/LilygoTdongleS3.cpp b/Boards/LilygoTdongleS3/Source/Configuration.cpp similarity index 98% rename from Boards/LilygoTdongleS3/Source/LilygoTdongleS3.cpp rename to Boards/LilygoTdongleS3/Source/Configuration.cpp index 649e5241..837ff7fb 100644 --- a/Boards/LilygoTdongleS3/Source/LilygoTdongleS3.cpp +++ b/Boards/LilygoTdongleS3/Source/Configuration.cpp @@ -1,9 +1,9 @@ -#include -#include - #include "devices/Display.h" #include "devices/Sdcard.h" +#include +#include + #define TDECK_SPI_TRANSFER_SIZE_LIMIT (80 * 160 * (LV_COLOR_DEPTH / 8)) bool initBoot(); @@ -17,7 +17,7 @@ static std::vector> createDevices() { }; } -extern const Configuration lilygo_tdongle_s3 = { +extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .uiScale = UiScale::Smallest, .createDevices = createDevices, diff --git a/Boards/LilygoTdongleS3/Source/LilygoTdongleS3.h b/Boards/LilygoTdongleS3/Source/LilygoTdongleS3.h deleted file mode 100644 index f3a3d867..00000000 --- a/Boards/LilygoTdongleS3/Source/LilygoTdongleS3.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -#include - -extern const tt::hal::Configuration lilygo_tdongle_s3; diff --git a/Boards/M5stackCardputer/Source/M5stackCardputer.cpp b/Boards/M5stackCardputer/Source/Configuration.cpp similarity index 97% rename from Boards/M5stackCardputer/Source/M5stackCardputer.cpp rename to Boards/M5stackCardputer/Source/Configuration.cpp index 3a481d1b..aa2e7f33 100644 --- a/Boards/M5stackCardputer/Source/M5stackCardputer.cpp +++ b/Boards/M5stackCardputer/Source/Configuration.cpp @@ -1,4 +1,3 @@ -#include "M5stackCardputer.h" #include "InitBoot.h" #include "devices/Display.h" #include "devices/SdCard.h" @@ -6,8 +5,9 @@ #include "devices/CardputerKeyboard.h" #include "devices/CardputerPower.h" -#include +#include #include +#include using namespace tt::hal; @@ -21,7 +21,7 @@ static DeviceVector createDevices() { }; } -extern const Configuration m5stack_cardputer = { +extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .uiScale = UiScale::Smallest, .createDevices = createDevices, diff --git a/Boards/M5stackCardputer/Source/M5stackCardputer.h b/Boards/M5stackCardputer/Source/M5stackCardputer.h deleted file mode 100644 index 94c1a675..00000000 --- a/Boards/M5stackCardputer/Source/M5stackCardputer.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -#include - -extern const tt::hal::Configuration m5stack_cardputer; diff --git a/Boards/M5stackCardputer/Source/devices/Display.cpp b/Boards/M5stackCardputer/Source/devices/Display.cpp index 98544c2f..45c002e7 100644 --- a/Boards/M5stackCardputer/Source/devices/Display.cpp +++ b/Boards/M5stackCardputer/Source/devices/Display.cpp @@ -23,7 +23,7 @@ std::shared_ptr createDisplay() { .spiHostDevice = LCD_SPI_HOST, .csPin = LCD_PIN_CS, .dcPin = LCD_PIN_DC, - .pixelClockFrequency = 80'000'000, + .pixelClockFrequency = 62'500'000, .transactionQueueDepth = 10 }); diff --git a/Boards/M5stackCore2/Source/M5stackCore2.cpp b/Boards/M5stackCore2/Source/Configuration.cpp similarity index 91% rename from Boards/M5stackCore2/Source/M5stackCore2.cpp rename to Boards/M5stackCore2/Source/Configuration.cpp index 86e1e20a..2c956f5e 100644 --- a/Boards/M5stackCore2/Source/M5stackCore2.cpp +++ b/Boards/M5stackCore2/Source/Configuration.cpp @@ -1,19 +1,13 @@ -#include "M5stackCore2.h" #include "devices/Display.h" #include "devices/SdCard.h" #include "devices/Power.h" -#include +#include #include -#define CORE2_SPI_TRANSFER_SIZE_LIMIT (CORE2_LCD_DRAW_BUFFER_SIZE * LV_COLOR_DEPTH / 8) - using namespace tt::hal; -constexpr auto* TAG = "Core2"; - bool initBoot() { - TT_LOG_I(TAG, "initBoot"); return initAxp(); } @@ -25,7 +19,7 @@ static DeviceVector createDevices() { }; } -extern const Configuration m5stack_core2 = { +extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .createDevices = createDevices, .i2c = { @@ -79,7 +73,7 @@ extern const Configuration m5stack_core2 = { .data6_io_num = GPIO_NUM_NC, .data7_io_num = GPIO_NUM_NC, .data_io_default_level = false, - .max_transfer_sz = CORE2_SPI_TRANSFER_SIZE_LIMIT, + .max_transfer_sz = LCD_SPI_TRANSFER_SIZE_LIMIT, .flags = 0, .isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO, .intr_flags = 0 diff --git a/Boards/M5stackCore2/Source/M5stackCore2.h b/Boards/M5stackCore2/Source/M5stackCore2.h deleted file mode 100644 index 45b8a82b..00000000 --- a/Boards/M5stackCore2/Source/M5stackCore2.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -#include - -extern const tt::hal::Configuration m5stack_core2; diff --git a/Boards/M5stackCore2/Source/devices/Display.cpp b/Boards/M5stackCore2/Source/devices/Display.cpp index 58152553..314079ea 100644 --- a/Boards/M5stackCore2/Source/devices/Display.cpp +++ b/Boards/M5stackCore2/Source/devices/Display.cpp @@ -7,8 +7,8 @@ std::shared_ptr createTouch() { auto configuration = std::make_unique( I2C_NUM_0, GPIO_NUM_39, - CORE2_LCD_HORIZONTAL_RESOLUTION, - CORE2_LCD_VERTICAL_RESOLUTION + LCD_HORIZONTAL_RESOLUTION, + LCD_VERTICAL_RESOLUTION ); auto touch = std::make_shared(std::move(configuration)); @@ -16,21 +16,30 @@ std::shared_ptr createTouch() { } std::shared_ptr createDisplay() { - auto touch = createTouch(); + Ili934xDisplay::Configuration panel_configuration = { + .horizontalResolution = LCD_HORIZONTAL_RESOLUTION, + .verticalResolution = LCD_VERTICAL_RESOLUTION, + .gapX = 0, + .gapY = 0, + .swapXY = false, + .mirrorX = false, + .mirrorY = false, + .invertColor = true, + .swapBytes = true, + .bufferSize = LCD_BUFFER_SIZE, + .touch = createTouch(), + .backlightDutyFunction = nullptr, + .resetPin = GPIO_NUM_NC, + .rgbElementOrder = LCD_RGB_ELEMENT_ORDER_BGR + }; - auto configuration = std::make_unique( - CORE2_LCD_SPI_HOST, - CORE2_LCD_PIN_CS, - CORE2_LCD_PIN_DC, - CORE2_LCD_HORIZONTAL_RESOLUTION, - CORE2_LCD_VERTICAL_RESOLUTION, - touch, - false, - false, - false, - true - ); + 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 + }); - auto display = std::make_shared(std::move(configuration)); - return std::reinterpret_pointer_cast(display); + return std::make_shared(panel_configuration, spi_configuration, true); } diff --git a/Boards/M5stackCore2/Source/devices/Display.h b/Boards/M5stackCore2/Source/devices/Display.h index 75c13107..e359e869 100644 --- a/Boards/M5stackCore2/Source/devices/Display.h +++ b/Boards/M5stackCore2/Source/devices/Display.h @@ -1,14 +1,17 @@ #pragma once -#include "Tactility/hal/display/DisplayDevice.h" +#include +#include +#include #include -#define CORE2_LCD_SPI_HOST SPI2_HOST -#define CORE2_LCD_PIN_CS GPIO_NUM_5 -#define CORE2_LCD_PIN_DC GPIO_NUM_15 -#define CORE2_LCD_HORIZONTAL_RESOLUTION 320 -#define CORE2_LCD_VERTICAL_RESOLUTION 240 -#define CORE2_LCD_DRAW_BUFFER_HEIGHT (CORE2_LCD_VERTICAL_RESOLUTION / 10) -#define CORE2_LCD_DRAW_BUFFER_SIZE (CORE2_LCD_HORIZONTAL_RESOLUTION * CORE2_LCD_DRAW_BUFFER_HEIGHT) +constexpr auto LCD_SPI_HOST = SPI2_HOST; +constexpr auto LCD_PIN_CS = GPIO_NUM_5; +constexpr auto LCD_PIN_DC = GPIO_NUM_15; +constexpr auto LCD_HORIZONTAL_RESOLUTION = 320; +constexpr auto LCD_VERTICAL_RESOLUTION = 240; +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/Boards/M5stackCore2/Source/devices/SdCard.h b/Boards/M5stackCore2/Source/devices/SdCard.h index 5cb65a73..6f5443c7 100644 --- a/Boards/M5stackCore2/Source/devices/SdCard.h +++ b/Boards/M5stackCore2/Source/devices/SdCard.h @@ -1,6 +1,6 @@ #pragma once -#include "Tactility/hal/sdcard/SdCardDevice.h" +#include using tt::hal::sdcard::SdCardDevice; diff --git a/Boards/M5stackCoreS3/Source/M5stackCoreS3.cpp b/Boards/M5stackCoreS3/Source/Configuration.cpp similarity index 96% rename from Boards/M5stackCoreS3/Source/M5stackCoreS3.cpp rename to Boards/M5stackCoreS3/Source/Configuration.cpp index dc843a52..b5742a9e 100644 --- a/Boards/M5stackCoreS3/Source/M5stackCoreS3.cpp +++ b/Boards/M5stackCoreS3/Source/Configuration.cpp @@ -1,13 +1,11 @@ -#include "M5stackCoreS3.h" #include "InitBoot.h" #include "devices/Display.h" #include "devices/SdCard.h" -#include -#include +#include #include - -#define CORES3_TRANSACTION_SIZE (CORES3_LCD_DRAW_BUFFER_SIZE * LV_COLOR_DEPTH / 8) +#include +#include using namespace tt::hal; @@ -21,7 +19,7 @@ static DeviceVector createDevices() { }; } -const Configuration m5stack_cores3 = { +extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .createDevices = createDevices, .i2c = { @@ -109,7 +107,7 @@ const Configuration m5stack_cores3 = { .data6_io_num = GPIO_NUM_NC, .data7_io_num = GPIO_NUM_NC, .data_io_default_level = false, - .max_transfer_sz = CORES3_TRANSACTION_SIZE, + .max_transfer_sz = LCD_SPI_TRANSFER_SIZE_LIMIT, .flags = 0, .isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO, .intr_flags = 0 diff --git a/Boards/M5stackCoreS3/Source/M5stackCoreS3.h b/Boards/M5stackCoreS3/Source/M5stackCoreS3.h deleted file mode 100644 index 120c7697..00000000 --- a/Boards/M5stackCoreS3/Source/M5stackCoreS3.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -#include - -extern const tt::hal::Configuration m5stack_cores3; diff --git a/Boards/M5stackCoreS3/Source/devices/Display.cpp b/Boards/M5stackCoreS3/Source/devices/Display.cpp index 42105e71..b7350d11 100644 --- a/Boards/M5stackCoreS3/Source/devices/Display.cpp +++ b/Boards/M5stackCoreS3/Source/devices/Display.cpp @@ -20,8 +20,8 @@ static std::shared_ptr createTouch() { // Note for future changes: Reset pin is 48 and interrupt pin is 47 auto configuration = std::make_unique( I2C_NUM_0, - 320, - 240 + LCD_HORIZONTAL_RESOLUTION, + LCD_VERTICAL_RESOLUTION ); auto touch = std::make_shared(std::move(configuration)); @@ -29,23 +29,30 @@ static std::shared_ptr createTouch() { } std::shared_ptr createDisplay() { - auto touch = createTouch(); + Ili934xDisplay::Configuration panel_configuration = { + .horizontalResolution = LCD_HORIZONTAL_RESOLUTION, + .verticalResolution = LCD_VERTICAL_RESOLUTION, + .gapX = 0, + .gapY = 0, + .swapXY = false, + .mirrorX = false, + .mirrorY = false, + .invertColor = true, + .swapBytes = true, + .bufferSize = LCD_BUFFER_SIZE, + .touch = createTouch(), + .backlightDutyFunction = ::setBacklightDuty, + .resetPin = GPIO_NUM_NC, + .rgbElementOrder = LCD_RGB_ELEMENT_ORDER_BGR + }; - auto configuration = std::make_unique( - SPI3_HOST, - GPIO_NUM_3, - GPIO_NUM_35, - 320, - 240, - touch, - false, - false, - false, - true - ); + 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 + }); - configuration->backlightDutyFunction = ::setBacklightDuty; - - auto display = std::make_shared(std::move(configuration)); - return std::reinterpret_pointer_cast(display); + return std::make_shared(panel_configuration, spi_configuration, true); } diff --git a/Boards/M5stackCoreS3/Source/devices/Display.h b/Boards/M5stackCoreS3/Source/devices/Display.h index b180a5fb..04caf646 100644 --- a/Boards/M5stackCoreS3/Source/devices/Display.h +++ b/Boards/M5stackCoreS3/Source/devices/Display.h @@ -1,14 +1,17 @@ #pragma once #include +#include +#include // Display -#define CORES3_LCD_SPI_HOST SPI3_HOST -#define CORES3_LCD_PIN_CS GPIO_NUM_3 -#define CORES3_LCD_PIN_DC GPIO_NUM_35 -#define CORES3_LCD_HORIZONTAL_RESOLUTION 320 -#define CORES3_LCD_VERTICAL_RESOLUTION 240 -#define CORES3_LCD_DRAW_BUFFER_HEIGHT (CORES3_LCD_VERTICAL_RESOLUTION / 10) -#define CORES3_LCD_DRAW_BUFFER_SIZE (CORES3_LCD_HORIZONTAL_RESOLUTION * CORES3_LCD_DRAW_BUFFER_HEIGHT) +constexpr auto LCD_SPI_HOST = SPI3_HOST; +constexpr auto LCD_PIN_CS = GPIO_NUM_3; +constexpr auto LCD_PIN_DC = GPIO_NUM_35; +constexpr auto LCD_HORIZONTAL_RESOLUTION = 320; +constexpr auto LCD_VERTICAL_RESOLUTION = 240; +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/Boards/M5stackStickCPlus/Source/M5StackStickCPlus.cpp b/Boards/M5stackStickCPlus/Source/Configuration.cpp similarity index 97% rename from Boards/M5stackStickCPlus/Source/M5StackStickCPlus.cpp rename to Boards/M5stackStickCPlus/Source/Configuration.cpp index 65eacdff..6ee25488 100644 --- a/Boards/M5stackStickCPlus/Source/M5StackStickCPlus.cpp +++ b/Boards/M5stackStickCPlus/Source/Configuration.cpp @@ -1,9 +1,9 @@ -#include "M5StackStickCPlus.h" #include "devices/Display.h" #include "devices/Power.h" -#include +#include #include +#include using namespace tt::hal; @@ -24,7 +24,7 @@ static DeviceVector createDevices() { }; } -extern const Configuration m5stack_stickc_plus = { +extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .uiScale = UiScale::Smallest, .createDevices = createDevices, diff --git a/Boards/M5stackStickCPlus/Source/M5StackStickCPlus.h b/Boards/M5stackStickCPlus/Source/M5StackStickCPlus.h deleted file mode 100644 index 6a4d767e..00000000 --- a/Boards/M5stackStickCPlus/Source/M5StackStickCPlus.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -#include - -extern const tt::hal::Configuration m5stack_stickc_plus; diff --git a/Boards/M5stackStickCPlus2/Source/M5StackStickCPlus2.cpp b/Boards/M5stackStickCPlus2/Source/Configuration.cpp similarity index 97% rename from Boards/M5stackStickCPlus2/Source/M5StackStickCPlus2.cpp rename to Boards/M5stackStickCPlus2/Source/Configuration.cpp index 051f3c40..9c233234 100644 --- a/Boards/M5stackStickCPlus2/Source/M5StackStickCPlus2.cpp +++ b/Boards/M5stackStickCPlus2/Source/Configuration.cpp @@ -1,9 +1,9 @@ -#include "M5StackStickCPlus2.h" #include "devices/Display.h" +#include +#include #include #include -#include using namespace tt::hal; @@ -26,7 +26,7 @@ static DeviceVector createDevices() { }; } -extern const Configuration m5stack_stickc_plus2 = { +extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .uiScale = UiScale::Smallest, .createDevices = createDevices, diff --git a/Boards/M5stackStickCPlus2/Source/M5StackStickCPlus2.h b/Boards/M5stackStickCPlus2/Source/M5StackStickCPlus2.h deleted file mode 100644 index df4950d0..00000000 --- a/Boards/M5stackStickCPlus2/Source/M5StackStickCPlus2.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -#include - -extern const tt::hal::Configuration m5stack_stickc_plus2; diff --git a/Boards/Simulator/Source/Simulator.cpp b/Boards/Simulator/Source/Simulator.cpp index 51d92241..a00cca71 100644 --- a/Boards/Simulator/Source/Simulator.cpp +++ b/Boards/Simulator/Source/Simulator.cpp @@ -37,7 +37,7 @@ static std::vector> createDevices() { }; } -extern const Configuration hardware = { +extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .createDevices = createDevices, .i2c = { diff --git a/Boards/UnPhone/Source/UnPhone.cpp b/Boards/UnPhone/Source/Configuration.cpp similarity index 95% rename from Boards/UnPhone/Source/UnPhone.cpp rename to Boards/UnPhone/Source/Configuration.cpp index 895e5f2a..b100729e 100644 --- a/Boards/UnPhone/Source/UnPhone.cpp +++ b/Boards/UnPhone/Source/Configuration.cpp @@ -1,9 +1,10 @@ -#include "Tactility/lvgl/LvglSync.h" #include "UnPhoneFeatures.h" -#include "Xpt2046Power.h" #include "devices/Hx8357Display.h" #include "devices/SdCard.h" + #include +#include +#include #define UNPHONE_SPI_TRANSFER_SIZE_LIMIT (UNPHONE_LCD_HORIZONTAL_RESOLUTION * UNPHONE_LCD_SPI_TRANSFER_HEIGHT * LV_COLOR_DEPTH / 8) @@ -17,7 +18,7 @@ static tt::hal::DeviceVector createDevices() { }; } -extern const tt::hal::Configuration unPhone = { +extern const tt::hal::Configuration hardwareConfiguration = { .initBoot = initBoot, .createDevices = createDevices, .i2c = { diff --git a/Boards/UnPhone/Source/UnPhone.h b/Boards/UnPhone/Source/UnPhone.h deleted file mode 100644 index c2ac9749..00000000 --- a/Boards/UnPhone/Source/UnPhone.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -#include - -extern const tt::hal::Configuration unPhone; diff --git a/Boards/WaveshareS3Lcd13/Source/WaveshareS3Lcd13.cpp b/Boards/WaveshareS3Lcd13/Source/Configuration.cpp similarity index 98% rename from Boards/WaveshareS3Lcd13/Source/WaveshareS3Lcd13.cpp rename to Boards/WaveshareS3Lcd13/Source/Configuration.cpp index 09b35315..72f90993 100644 --- a/Boards/WaveshareS3Lcd13/Source/WaveshareS3Lcd13.cpp +++ b/Boards/WaveshareS3Lcd13/Source/Configuration.cpp @@ -1,9 +1,9 @@ #include "devices/Display.h" #include "devices/SdCard.h" -#include #include #include +#include using namespace tt::hal; @@ -18,7 +18,7 @@ static bool initBoot() { return driver::pwmbacklight::init(GPIO_NUM_20, 256); } -extern const Configuration waveshare_s3_lcd_13 = { +extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .uiScale = UiScale::Smallest, .createDevices = createDevices, diff --git a/Boards/WaveshareS3Lcd13/Source/WaveshareS3Lcd13.h b/Boards/WaveshareS3Lcd13/Source/WaveshareS3Lcd13.h deleted file mode 100644 index b3a5c491..00000000 --- a/Boards/WaveshareS3Lcd13/Source/WaveshareS3Lcd13.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -#include - -extern const tt::hal::Configuration waveshare_s3_lcd_13; diff --git a/Boards/WaveshareS3Lcd13/Source/devices/Display.cpp b/Boards/WaveshareS3Lcd13/Source/devices/Display.cpp index 34c1428d..f72283ac 100644 --- a/Boards/WaveshareS3Lcd13/Source/devices/Display.cpp +++ b/Boards/WaveshareS3Lcd13/Source/devices/Display.cpp @@ -23,7 +23,7 @@ std::shared_ptr createDisplay() { .spiHostDevice = SPI2_HOST, .csPin = GPIO_NUM_39, .dcPin = GPIO_NUM_38, - .pixelClockFrequency = 80'000'000, + .pixelClockFrequency = 62'500'000, .transactionQueueDepth = 10 }); diff --git a/Boards/WaveshareS3Touch43/Source/WaveshareS3Touch43.cpp b/Boards/WaveshareS3Touch43/Source/Configuration.cpp similarity index 98% rename from Boards/WaveshareS3Touch43/Source/WaveshareS3Touch43.cpp rename to Boards/WaveshareS3Touch43/Source/Configuration.cpp index ffc953a0..cd8b9954 100644 --- a/Boards/WaveshareS3Touch43/Source/WaveshareS3Touch43.cpp +++ b/Boards/WaveshareS3Touch43/Source/Configuration.cpp @@ -12,7 +12,7 @@ static DeviceVector createDevices() { }; } -extern const Configuration waveshare_s3_touch_43 = { +extern const Configuration hardwareConfiguration = { .uiScale = UiScale::Smallest, .createDevices = createDevices, .i2c = { diff --git a/Boards/WaveshareS3Touch43/Source/WaveshareS3Touch43.h b/Boards/WaveshareS3Touch43/Source/WaveshareS3Touch43.h deleted file mode 100644 index 29ca9e59..00000000 --- a/Boards/WaveshareS3Touch43/Source/WaveshareS3Touch43.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -#include - -extern const tt::hal::Configuration waveshare_s3_touch_43; diff --git a/Boards/WaveshareS3TouchLcd128/Source/WaveshareS3TouchLcd128.cpp b/Boards/WaveshareS3TouchLcd128/Source/Configuration.cpp similarity index 98% rename from Boards/WaveshareS3TouchLcd128/Source/WaveshareS3TouchLcd128.cpp rename to Boards/WaveshareS3TouchLcd128/Source/Configuration.cpp index 1e22c495..89300ca5 100644 --- a/Boards/WaveshareS3TouchLcd128/Source/WaveshareS3TouchLcd128.cpp +++ b/Boards/WaveshareS3TouchLcd128/Source/Configuration.cpp @@ -1,9 +1,9 @@ #include "devices/Display.h" #include "devices/SdCard.h" -#include #include #include +#include using namespace tt::hal; @@ -20,7 +20,7 @@ static bool initBoot() { return driver::pwmbacklight::init(GPIO_NUM_2, 256); } -extern const Configuration waveshare_s3_touch_lcd_128 = { +extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .uiScale = UiScale::Smallest, .createDevices = createDevices, diff --git a/Boards/WaveshareS3TouchLcd128/Source/WaveshareS3TouchLcd128.h b/Boards/WaveshareS3TouchLcd128/Source/WaveshareS3TouchLcd128.h deleted file mode 100644 index 54e24375..00000000 --- a/Boards/WaveshareS3TouchLcd128/Source/WaveshareS3TouchLcd128.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -#include - -extern const tt::hal::Configuration waveshare_s3_touch_lcd_128; diff --git a/Boards/WaveshareS3TouchLcd147/Source/WaveshareS3TouchLcd147.cpp b/Boards/WaveshareS3TouchLcd147/Source/Configuration.cpp similarity index 98% rename from Boards/WaveshareS3TouchLcd147/Source/WaveshareS3TouchLcd147.cpp rename to Boards/WaveshareS3TouchLcd147/Source/Configuration.cpp index 11c4b96d..782c60a3 100644 --- a/Boards/WaveshareS3TouchLcd147/Source/WaveshareS3TouchLcd147.cpp +++ b/Boards/WaveshareS3TouchLcd147/Source/Configuration.cpp @@ -1,9 +1,9 @@ -#include -#include - #include "devices/Display.h" #include "devices/Sdcard.h" +#include +#include + #define SPI_TRANSFER_SIZE_LIMIT (172 * 320 * (LV_COLOR_DEPTH / 8)) bool initBoot(); @@ -17,7 +17,7 @@ static std::vector> createDevices() { }; } -extern const Configuration waveshare_s3_touch_lcd_147 = { +extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .uiScale = UiScale::Smallest, .createDevices = createDevices, diff --git a/Boards/WaveshareS3TouchLcd147/Source/WaveshareS3TouchLcd147.h b/Boards/WaveshareS3TouchLcd147/Source/WaveshareS3TouchLcd147.h deleted file mode 100644 index a6653bc5..00000000 --- a/Boards/WaveshareS3TouchLcd147/Source/WaveshareS3TouchLcd147.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -#include - -extern const tt::hal::Configuration waveshare_s3_touch_lcd_147; diff --git a/Documentation/ideas.md b/Documentation/ideas.md index e49a5a84..d7c0f0b9 100644 --- a/Documentation/ideas.md +++ b/Documentation/ideas.md @@ -2,11 +2,11 @@ ## Before release -- Make better esp_lcd driver (and test all devices) -- AppInstall.cpp fails to untar large files on Cardputer (EFF large word list doesn't fit in memory). Make a buffered reader & writer. +- Convert Ili934x driver to EspLcdSpiDisplay ## Higher Priority +- Logging with a function that uses std::format - Calculator bugs (see GitHub issue) - Expose http::download() and main dispatcher to TactiltyC. - External app loading: Check the version of Tactility and check ESP target hardware to check for compatibility @@ -22,6 +22,7 @@ The latter is used for auto-selecting it as data partition. - Support direct installation of an `.app` file with `tactility.py install helloworld.app ` - Support `tactility.py target ` to remember the device IP address. +- minitar/untarFile(): "entry->metadata.path" can escape its confined path (e.g. "../something") ## Medium Priority diff --git a/Drivers/EspLcdCompat/Source/EspLcdDisplay.h b/Drivers/EspLcdCompat/Source/EspLcdDisplay.h index c2eb4980..11ca8a18 100644 --- a/Drivers/EspLcdCompat/Source/EspLcdDisplay.h +++ b/Drivers/EspLcdCompat/Source/EspLcdDisplay.h @@ -1,14 +1,13 @@ #pragma once -#include "Tactility/Lock.h" - +#include +#include #include #include #include -#include -class EspLcdDisplay : public tt::hal::display::DisplayDevice { +class TT_DEPRECATED EspLcdDisplay : public tt::hal::display::DisplayDevice { esp_lcd_panel_io_handle_t _Nullable ioHandle = nullptr; esp_lcd_panel_handle_t _Nullable panelHandle = nullptr; diff --git a/Drivers/EspLcdCompat/Source/EspLcdDisplayV2.h b/Drivers/EspLcdCompat/Source/EspLcdDisplayV2.h index 3d36b051..93d579ae 100644 --- a/Drivers/EspLcdCompat/Source/EspLcdDisplayV2.h +++ b/Drivers/EspLcdCompat/Source/EspLcdDisplayV2.h @@ -26,6 +26,8 @@ struct EspLcdConfiguration { gpio_num_t resetPin; lv_color_format_t lvglColorFormat; bool lvglSwapBytes; + lcd_rgb_element_order_t rgbElementOrder; + uint32_t bitsPerPixel; }; class EspLcdDisplayV2 : public tt::hal::display::DisplayDevice { diff --git a/Drivers/ILI934x/Source/Ili934xDisplay.cpp b/Drivers/ILI934x/Source/Ili934xDisplay.cpp index 0f767e06..5cfab783 100644 --- a/Drivers/ILI934x/Source/Ili934xDisplay.cpp +++ b/Drivers/ILI934x/Source/Ili934xDisplay.cpp @@ -1,152 +1,43 @@ #include "Ili934xDisplay.h" -#include - #include -#include #include -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, - .spi_mode = 0, - .pclk_hz = configuration->pixelClockFrequency, - .trans_queue_depth = configuration->transactionQueueDepth, - .on_color_trans_done = nullptr, - .user_ctx = nullptr, - .lcd_cmd_bits = 8, - .lcd_param_bits = 8, - .cs_ena_pretrans = 0, - .cs_ena_posttrans = 0, - .flags = { - .dc_high_on_cmd = 0, - .dc_low_on_data = 0, - .dc_low_on_param = 0, - .octal_mode = 0, - .quad_mode = 0, - .sio_mode = 0, - .lsb_first = 0, - .cs_high_active = 0 - } - }; - - return esp_lcd_new_panel_io_spi(configuration->spiHostDevice, &panel_io_config, &outHandle) == ESP_OK; +std::shared_ptr Ili934xDisplay::createEspLcdConfiguration(const Configuration& configuration) { + return std::make_shared(EspLcdConfiguration { + .horizontalResolution = configuration.horizontalResolution, + .verticalResolution = configuration.verticalResolution, + .gapX = configuration.gapX, + .gapY = configuration.gapY, + .monochrome = false, + .swapXY = configuration.swapXY, + .mirrorX = configuration.mirrorX, + .mirrorY = configuration.mirrorY, + .invertColor = configuration.invertColor, + .bufferSize = configuration.bufferSize, + .touch = configuration.touch, + .backlightDutyFunction = configuration.backlightDutyFunction, + .resetPin = configuration.resetPin, + .lvglColorFormat = LV_COLOR_FORMAT_RGB565, + .lvglSwapBytes = configuration.swapBytes, + .rgbElementOrder = configuration.rgbElementOrder, + .bitsPerPixel = 16 + }); } -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, +esp_lcd_panel_dev_config_t Ili934xDisplay::createPanelConfig(std::shared_ptr espLcdConfiguration, gpio_num_t resetPin) { + return { + .reset_gpio_num = resetPin, + .rgb_ele_order = espLcdConfiguration->rgbElementOrder, .data_endian = LCD_RGB_DATA_ENDIAN_LITTLE, - .bits_per_pixel = 16, + .bits_per_pixel = espLcdConfiguration->bitsPerPixel, .flags = { - .reset_active_high = false + .reset_active_high = 0 }, .vendor_config = nullptr }; - - if (esp_lcd_new_panel_ili9341(ioHandle, &panel_config, &panelHandle) != ESP_OK) { - TT_LOG_E(TAG, "Failed to create panel"); - return false; - } - - if (esp_lcd_panel_reset(panelHandle) != ESP_OK) { - TT_LOG_E(TAG, "Failed to reset panel"); - return false; - } - - if (esp_lcd_panel_init(panelHandle) != ESP_OK) { - TT_LOG_E(TAG, "Failed to init panel"); - return false; - } - - if (esp_lcd_panel_swap_xy(panelHandle, configuration->swapXY) != ESP_OK) { - TT_LOG_E(TAG, "Failed to swap XY "); - return false; - } - - if (esp_lcd_panel_mirror(panelHandle, configuration->mirrorX, configuration->mirrorY) != ESP_OK) { - TT_LOG_E(TAG, "Failed to set panel to mirror"); - return false; - } - - if (esp_lcd_panel_invert_color(panelHandle, configuration->invertColor) != ESP_OK) { - TT_LOG_E(TAG, "Failed to set panel to invert"); - return false; - } - - if (esp_lcd_panel_disp_on_off(panelHandle, true) != ESP_OK) { - TT_LOG_E(TAG, "Failed to turn display on"); - return false; - } - - return true; } -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 = configuration->bufferSize, - .double_buffer = false, - .trans_size = 0, - .hres = configuration->horizontalResolution, - .vres = configuration->verticalResolution, - .monochrome = false, - .rotation = { - .swap_xy = configuration->swapXY, - .mirror_x = configuration->mirrorX, - .mirror_y = configuration->mirrorY, - }, - .color_format = LV_COLOR_FORMAT_RGB565, - .flags = { - .buff_dma = true, - .buff_spiram = false, - .sw_rotate = false, - .swap_bytes = true, - .full_refresh = false, - .direct_mode = false - } - }; -} - -/** - * Note: - * The datasheet implies this should work, but it doesn't: - * https://www.digikey.com/htmldatasheets/production/1640716/0/0/1/ILI9341-Datasheet.pdf - * - * This repo claims it only has 1 curve: - * https://github.com/brucemack/hello-ili9341 - * - * I'm leaving it in as I'm not sure if it's just my hardware that's problematic. - */ -void Ili934xDisplay::setGammaCurve(uint8_t index) { - uint8_t gamma_curve; - switch (index) { - case 0: - gamma_curve = 0x01; - break; - case 1: - gamma_curve = 0x04; - break; - case 2: - gamma_curve = 0x02; - break; - case 3: - gamma_curve = 0x08; - break; - default: - return; - } - const uint8_t param[] = { - gamma_curve - }; - - if (esp_lcd_panel_io_tx_param(getIoHandle() , LCD_CMD_GAMSET, param, 1) != ESP_OK) { - TT_LOG_E(TAG, "Failed to set gamma"); - } +bool Ili934xDisplay::createPanelHandle(esp_lcd_panel_io_handle_t ioHandle, const esp_lcd_panel_dev_config_t& panelConfig, esp_lcd_panel_handle_t& panelHandle) { + return esp_lcd_new_panel_ili9341(ioHandle, &panelConfig, &panelHandle) == ESP_OK; } diff --git a/Drivers/ILI934x/Source/Ili934xDisplay.h b/Drivers/ILI934x/Source/Ili934xDisplay.h index 77a234ea..d44bde8c 100644 --- a/Drivers/ILI934x/Source/Ili934xDisplay.h +++ b/Drivers/ILI934x/Source/Ili934xDisplay.h @@ -1,107 +1,55 @@ #pragma once -#include -#include - -#include +#include #include -#include -#include #include #include -class Ili934xDisplay final : public EspLcdDisplay { +class Ili934xDisplay final : public EspLcdSpiDisplay { + + std::shared_ptr lock; public: - class Configuration { - - public: - - Configuration( - spi_host_device_t spiHostDevice, - gpio_num_t csPin, - gpio_num_t dcPin, - unsigned int horizontalResolution, - unsigned int verticalResolution, - std::shared_ptr touch, - bool swapXY = false, - bool mirrorX = false, - bool mirrorY = false, - bool invertColor = false, - uint32_t bufferSize = 0, // Size in pixel count. 0 means default, which is 1/10 of the screen size, - lcd_rgb_element_order_t rgbElementOrder = LCD_RGB_ELEMENT_ORDER_BGR - ) : spiHostDevice(spiHostDevice), - csPin(csPin), - dcPin(dcPin), - horizontalResolution(horizontalResolution), - verticalResolution(verticalResolution), - swapXY(swapXY), - mirrorX(mirrorX), - mirrorY(mirrorY), - invertColor(invertColor), - bufferSize(bufferSize), - rgbElementOrder(rgbElementOrder), - touch(std::move(touch) - ) { - if (this->bufferSize == 0) { - this->bufferSize = horizontalResolution * verticalResolution / 10; - } - } - - spi_host_device_t spiHostDevice; - gpio_num_t csPin; - gpio_num_t dcPin; - gpio_num_t resetPin = GPIO_NUM_NC; - unsigned int pixelClockFrequency = 40'000'000; // Hertz - size_t transactionQueueDepth = 10; + /** Minimal set of overrides for EspLcdConfiguration */ + struct Configuration { unsigned int horizontalResolution; unsigned int verticalResolution; - bool swapXY = false; - bool mirrorX = false; - bool mirrorY = false; - bool invertColor = false; - uint32_t bufferSize = 0; // Size in pixel count. 0 means default, which is 1/10 of the screen size - lcd_rgb_element_order_t rgbElementOrder = LCD_RGB_ELEMENT_ORDER_BGR; + int gapX; + int gapY; + bool swapXY; + bool mirrorX; + bool mirrorY; + bool invertColor; + bool swapBytes; + uint32_t bufferSize; // Pixel count, not byte count. Set to 0 for default (1/10th of display size) std::shared_ptr touch; - std::function _Nullable backlightDutyFunction = nullptr; + std::function _Nullable backlightDutyFunction; + gpio_num_t resetPin; + lcd_rgb_element_order_t rgbElementOrder; }; private: - std::unique_ptr configuration; + static std::shared_ptr createEspLcdConfiguration(const Configuration& configuration); - bool createIoHandle(esp_lcd_panel_io_handle_t& outHandle) override; + esp_lcd_panel_dev_config_t createPanelConfig(std::shared_ptr espLcdConfiguration, gpio_num_t resetPin) 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 createPanelHandle(esp_lcd_panel_io_handle_t ioHandle, const esp_lcd_panel_dev_config_t& panelConfig, esp_lcd_panel_handle_t& panelHandle) override; public: - explicit Ili934xDisplay(std::unique_ptr inConfiguration) : - EspLcdDisplay(tt::hal::spi::getLock(inConfiguration->spiHostDevice)), - configuration(std::move(inConfiguration) - ) { - assert(configuration != nullptr); + explicit Ili934xDisplay(const Configuration& configuration, const std::shared_ptr& spiConfiguration, bool hasGammaCurves) : + EspLcdSpiDisplay( + createEspLcdConfiguration(configuration), + spiConfiguration, + (hasGammaCurves ? 4 : 0) + ) + { } std::string getName() const override { return "ILI934x"; } std::string getDescription() const override { return "ILI934x display"; } - - std::shared_ptr _Nullable getTouchDevice() override { return configuration->touch; } - - void setBacklightDuty(uint8_t backlightDuty) override { - if (configuration->backlightDutyFunction != nullptr) { - configuration->backlightDutyFunction(backlightDuty); - } - } - - bool supportsBacklightDuty() const override { return configuration->backlightDutyFunction != nullptr; } - - void setGammaCurve(uint8_t index) override; - - uint8_t getGammaCurveCount() const override { return 4; }; }; diff --git a/Drivers/ST7789/Source/St7789Display.cpp b/Drivers/ST7789/Source/St7789Display.cpp index 2db16b8f..4b851d28 100644 --- a/Drivers/ST7789/Source/St7789Display.cpp +++ b/Drivers/ST7789/Source/St7789Display.cpp @@ -18,16 +18,18 @@ std::shared_ptr St7789Display::createEspLcdConfiguration(co .backlightDutyFunction = configuration.backlightDutyFunction, .resetPin = configuration.resetPin, .lvglColorFormat = LV_COLOR_FORMAT_RGB565, - .lvglSwapBytes = false + .lvglSwapBytes = false, + .rgbElementOrder = LCD_RGB_ELEMENT_ORDER_RGB, + .bitsPerPixel = 16, }); } esp_lcd_panel_dev_config_t St7789Display::createPanelConfig(std::shared_ptr espLcdConfiguration, gpio_num_t resetPin) { return { .reset_gpio_num = resetPin, - .rgb_ele_order = LCD_RGB_ELEMENT_ORDER_RGB, + .rgb_ele_order = espLcdConfiguration->rgbElementOrder, .data_endian = LCD_RGB_DATA_ENDIAN_LITTLE, - .bits_per_pixel = 16, + .bits_per_pixel = espLcdConfiguration->bitsPerPixel, .flags = { .reset_active_high = false }, diff --git a/Drivers/ST7789/Source/St7789Display.h b/Drivers/ST7789/Source/St7789Display.h index 69ac68d2..7af184f1 100644 --- a/Drivers/ST7789/Source/St7789Display.h +++ b/Drivers/ST7789/Source/St7789Display.h @@ -1,9 +1,6 @@ #pragma once -#include "Tactility/hal/spi/Spi.h" - #include -#include #include #include diff --git a/Firmware/Source/Boards.h b/Firmware/Source/Boards.h deleted file mode 100644 index 4ed55f38..00000000 --- a/Firmware/Source/Boards.h +++ /dev/null @@ -1,104 +0,0 @@ -#pragma once -#include - -#ifdef ESP_PLATFORM -#include - -// Supported hardware: -#if defined(CONFIG_TT_BOARD_LILYGO_TDECK) -#include "LilygoTdeck.h" -#define TT_BOARD_HARDWARE &lilygo_tdeck -#elif defined(CONFIG_TT_BOARD_LILYGO_TDONGLE_S3) -#include "LilygoTdongleS3.h" -#define TT_BOARD_HARDWARE &lilygo_tdongle_s3 -#elif defined(CONFIG_TT_BOARD_LILYGO_TLORA_PAGER) -#include "LilygoTloraPager.h" -#define TT_BOARD_HARDWARE &lilygo_tlora_pager -#elif defined(CONFIG_TT_BOARD_CYD_2432S024C) -#include "CYD2432S024C.h" -#define TT_BOARD_HARDWARE &cyd_2432s024c_config -#elif defined(CONFIG_TT_BOARD_CYD_2432S028R) -#include "CYD2432S028R.h" -#define TT_BOARD_HARDWARE &cyd_2432s028r_config -#elif defined(CONFIG_TT_BOARD_CYD_2432S028RV3) -#include "CYD2432S028RV3.h" -#define TT_BOARD_HARDWARE &cyd_2432s028rv3_config -#elif defined(CONFIG_TT_BOARD_CYD_E32R28T) -#include "E32R28T.h" -#define TT_BOARD_HARDWARE &cyd_e32r28t_config -#elif defined(CONFIG_TT_BOARD_CYD_2432S032C) -#include "CYD2432S032C.h" -#define TT_BOARD_HARDWARE &cyd_2432S032c_config -#elif (defined(CONFIG_TT_BOARD_ELECROW_CROWPANEL_ADVANCE_28)) -#define TT_BOARD_HARDWARE &crowpanel_advance_28 -#include "CrowPanelAdvance28.h" -#elif (defined(CONFIG_TT_BOARD_ELECROW_CROWPANEL_ADVANCE_35)) -#define TT_BOARD_HARDWARE &crowpanel_advance_35 -#include "CrowPanelAdvance35.h" -#elif (defined(CONFIG_TT_BOARD_ELECROW_CROWPANEL_ADVANCE_50)) -#define TT_BOARD_HARDWARE &crowpanel_advance_50 -#include "CrowPanelAdvance50.h" -#elif (defined(CONFIG_TT_BOARD_ELECROW_CROWPANEL_BASIC_28)) -#define TT_BOARD_HARDWARE &crowpanel_basic_28 -#include "CrowPanelBasic28.h" -#elif (defined(CONFIG_TT_BOARD_ELECROW_CROWPANEL_BASIC_35)) -#define TT_BOARD_HARDWARE &crowpanel_basic_35 -#include "CrowPanelBasic35.h" -#elif (defined(CONFIG_TT_BOARD_ELECROW_CROWPANEL_BASIC_50)) -#define TT_BOARD_HARDWARE &crowpanel_basic_50 -#include "CrowPanelBasic50.h" -#elif defined(CONFIG_TT_BOARD_M5STACK_CARDPUTER) -#include "M5stackCardputer.h" -#define TT_BOARD_HARDWARE &m5stack_cardputer -#elif defined(CONFIG_TT_BOARD_M5STACK_CORE2) -#include "M5stackCore2.h" -#define TT_BOARD_HARDWARE &m5stack_core2 -#elif defined(CONFIG_TT_BOARD_M5STACK_CORES3) -#include "M5stackCoreS3.h" -#define TT_BOARD_HARDWARE &m5stack_cores3 -#elif defined(CONFIG_TT_BOARD_M5STACK_STICKC_PLUS) -#include "M5StackStickCPlus.h" -#define TT_BOARD_HARDWARE &m5stack_stickc_plus -#elif defined(CONFIG_TT_BOARD_M5STACK_STICKC_PLUS2) -#include "M5StackStickCPlus2.h" -#define TT_BOARD_HARDWARE &m5stack_stickc_plus2 -#elif defined(CONFIG_TT_BOARD_UNPHONE) -#include "UnPhone.h" -#define TT_BOARD_HARDWARE &unPhone -#elif defined(CONFIG_TT_BOARD_CYD_JC2432W328C) -#include "JC2432W328C.h" -#define TT_BOARD_HARDWARE &cyd_jc2432w328c_config -#elif defined(CONFIG_TT_BOARD_CYD_8048S043C) -#include "CYD8048S043C.h" -#define TT_BOARD_HARDWARE &cyd_8048s043c_config -#elif defined(CONFIG_TT_BOARD_CYD_JC8048W550C) -#include "JC8048W550C.h" -#define TT_BOARD_HARDWARE &cyd_jc8048w550c_config -#elif defined(CONFIG_TT_BOARD_CYD_4848S040C) -#include "CYD4848S040C.h" -#define TT_BOARD_HARDWARE &cyd_4848s040c_config -#elif defined(CONFIG_TT_BOARD_WAVESHARE_S3_TOUCH_43) -#include "WaveshareS3Touch43.h" -#define TT_BOARD_HARDWARE &waveshare_s3_touch_43 -#elif defined(CONFIG_TT_BOARD_WAVESHARE_S3_TOUCH_LCD_147) -#include "WaveshareS3TouchLcd147.h" -#define TT_BOARD_HARDWARE &waveshare_s3_touch_lcd_147 -#elif defined(CONFIG_TT_BOARD_WAVESHARE_S3_TOUCH_LCD_128) -#include "WaveshareS3TouchLcd128.h" -#define TT_BOARD_HARDWARE &waveshare_s3_touch_lcd_128 -#elif defined(CONFIG_TT_BOARD_WAVESHARE_S3_LCD_13) -#include "WaveshareS3Lcd13.h" -#define TT_BOARD_HARDWARE &waveshare_s3_lcd_13 -#else -#define TT_BOARD_HARDWARE NULL -#error Replace TT_BOARD_HARDWARE in main.c with your own. Or copy one of the ./sdkconfig.board.* files into ./sdkconfig. -#endif - -#else // else simulator - -#include "Simulator.h" - -extern tt::hal::Configuration hardware; -#define TT_BOARD_HARDWARE &hardware - -#endif // ESP_PLATFORM diff --git a/Firmware/Source/Main.cpp b/Firmware/Source/Main.cpp index 5da5ae49..6d498b1b 100644 --- a/Firmware/Source/Main.cpp +++ b/Firmware/Source/Main.cpp @@ -1,11 +1,11 @@ -#include "Boards.h" #include #ifdef ESP_PLATFORM -#include "tt_init.h" +#include #endif -extern const tt::app::AppManifest hello_world_app; +// Each board project declares this variable +extern const tt::hal::Configuration hardwareConfiguration; extern "C" { @@ -15,7 +15,7 @@ void app_main() { * Auto-select a board based on the ./sdkconfig.board.* file * that you copied to ./sdkconfig before you opened this project. */ - .hardware = TT_BOARD_HARDWARE + .hardware = &hardwareConfiguration }; #ifdef ESP_PLATFORM diff --git a/Libraries/minitar/minitar b/Libraries/minitar/minitar index 78c254ba..23329dbf 160000 --- a/Libraries/minitar/minitar +++ b/Libraries/minitar/minitar @@ -1 +1 @@ -Subproject commit 78c254ba114f6b66d888149d4ad0eff178dceb88 +Subproject commit 23329dbf4c8237375343472952beb76f62693dda diff --git a/Tactility/Private/Tactility/hal/spi/SpiInit.h b/Tactility/Private/Tactility/hal/spi/SpiInit.h index 6e6856e3..b3858a81 100644 --- a/Tactility/Private/Tactility/hal/spi/SpiInit.h +++ b/Tactility/Private/Tactility/hal/spi/SpiInit.h @@ -1,6 +1,6 @@ #pragma once -#include "Tactility/hal/spi/Spi.h" +#include #include #include @@ -12,6 +12,6 @@ namespace tt::hal::spi { * @param[in] configurations HAL configuration for a board * @return true on success */ -bool init(const std::vector& configurations); +bool init(const std::vector& configurations); } diff --git a/Tactility/Source/app/AppInstall.cpp b/Tactility/Source/app/AppInstall.cpp index 8343eae3..7def2b9c 100644 --- a/Tactility/Source/app/AppInstall.cpp +++ b/Tactility/Source/app/AppInstall.cpp @@ -1,8 +1,5 @@ -#include "Tactility/Paths.h" - #include #include - #include #include #include @@ -10,15 +7,15 @@ #include #include #include +#include -#include +#include +#include +#include #include #include #include #include -#include -#include -#include #include #include @@ -28,22 +25,28 @@ constexpr auto* TAG = "App"; namespace tt::app { -static int untarFile(const minitar_entry* entry, const void* buf, const std::string& destinationPath) { - auto absolute_path = destinationPath + "/" + entry->metadata.path; - if (!file::findOrCreateDirectory(destinationPath, 0777)) return 1; +static bool untarFile(minitar mp, const minitar_entry* entry, const std::string& destinationPath) { + const auto absolute_path = destinationPath + "/" + entry->metadata.path; + if (!file::findOrCreateDirectory(destinationPath, 0777)) { + TT_LOG_E(TAG, "Can't find or create directory %s", destinationPath.c_str()); + return false; + } - int fd = open(absolute_path.c_str(), O_WRONLY | O_CREAT | O_EXCL | O_CLOEXEC, 0644); - if (fd < 0) return 1; - - if (write(fd, buf, entry->metadata.size) < 0) return 1; + // minitar_read_contents(&mp, &entry, file_buffer, entry.metadata.size); + if (minitar_read_contents_to_file(&mp, entry, absolute_path.c_str()) <= 0) { + TT_LOG_E(TAG, "Failed to write data to %s", absolute_path.c_str()); + return false; + } // Note: fchmod() doesn't exist on ESP-IDF and chmod() does nothing on that platform - if (chmod(absolute_path.c_str(), entry->metadata.mode) < 0) return 1; + if (chmod(absolute_path.c_str(), entry->metadata.mode) < 0) { + return false; + } - return close(fd); + return true; } -static bool untar_directory(const minitar_entry* entry, const std::string& destinationPath) { +static bool untarDirectory(const minitar_entry* entry, const std::string& destinationPath) { auto absolute_path = destinationPath + "/" + entry->metadata.path; if (!file::findOrCreateDirectory(absolute_path, 0777)) return false; return true; @@ -63,23 +66,13 @@ static bool untar(const std::string& tarPath, const std::string& destinationPath TT_LOG_I(TAG, "Extracting %s", entry.metadata.path); if (entry.metadata.type == MTAR_DIRECTORY) { if (!strcmp(entry.metadata.name, ".") || !strcmp(entry.metadata.name, "..") || !strcmp(entry.metadata.name, "/")) continue; - if (!untar_directory(&entry, destinationPath)) { + if (!untarDirectory(&entry, destinationPath)) { TT_LOG_E(TAG, "Failed to create directory %s/%s: %s", destinationPath.c_str(), entry.metadata.name, strerror(errno)); success = false; break; } } else if (entry.metadata.type == MTAR_REGULAR) { - auto file_buffer = static_cast(malloc(entry.metadata.size)); - if (!file_buffer) { - TT_LOG_E(TAG, "Failed to allocate %d bytes for file %s", entry.metadata.size, entry.metadata.path);; - success = false; - break; - } - - minitar_read_contents(&mp, &entry, file_buffer, entry.metadata.size); - int status = untarFile(&entry, file_buffer, destinationPath); - free(file_buffer); - if (status != 0) { + if (!untarFile(mp, &entry, destinationPath)) { TT_LOG_E(TAG, "Failed to extract file %s: %s", entry.metadata.path, strerror(errno)); success = false; break; diff --git a/Tactility/Source/app/apphub/AppHubApp.cpp b/Tactility/Source/app/apphub/AppHubApp.cpp index 288b92c2..0a5ee588 100644 --- a/Tactility/Source/app/apphub/AppHubApp.cpp +++ b/Tactility/Source/app/apphub/AppHubApp.cpp @@ -11,6 +11,7 @@ #include #include +#include #include namespace tt::app::apphub { diff --git a/Tactility/Source/kernel/SystemEvents.cpp b/Tactility/Source/kernel/SystemEvents.cpp index 55152a8e..ad04be49 100644 --- a/Tactility/Source/kernel/SystemEvents.cpp +++ b/Tactility/Source/kernel/SystemEvents.cpp @@ -1,14 +1,12 @@ #include "Tactility/kernel/SystemEvents.h" #include -#include - #include -#define TAG "system_event" - namespace tt::kernel { +constexpr auto* TAG = "SystemEvents"; + struct SubscriptionData { SystemEventSubscription id; SystemEvent event; diff --git a/TactilityCore/Include/Tactility/CoreDefines.h b/TactilityCore/Include/Tactility/CoreDefines.h index 4085cc5f..eb742716 100644 --- a/TactilityCore/Include/Tactility/CoreDefines.h +++ b/TactilityCore/Include/Tactility/CoreDefines.h @@ -1,9 +1,9 @@ #pragma once -#include "CoreExtraDefines.h" - #define TT_UNUSED __attribute__((unused)) +#define TT_STRINGIFY(x) #x + // region Variable arguments support // Adapted from https://stackoverflow.com/a/78848701/3848666 @@ -17,3 +17,12 @@ #define _TT_ARGCOUNT4(X,...) _TT_ARGCOUNT ## __VA_OPT__(5(__VA_ARGS__) TT_ARG_IGNORE) (4) #define _TT_ARGCOUNT5(X,...) 5 #define _TT_ARGCOUNT(X) X + +#if defined(__GNUC__) || defined(__clang__) +#define TT_DEPRECATED __attribute__((deprecated)) +#elif defined(_MSC_VER) +#define TT_DEPRECATED __declspec(deprecated) +#else +#pragma message("WARNING: TT_DEPRECATED is not implemented for this compiler") +#define TT_DEPRECATED +#endif diff --git a/TactilityCore/Include/Tactility/CoreExtraDefines.h b/TactilityCore/Include/Tactility/CoreExtraDefines.h deleted file mode 100644 index fa260b09..00000000 --- a/TactilityCore/Include/Tactility/CoreExtraDefines.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -#define TT_STRINGIFY(x) #x diff --git a/TactilityCore/Include/Tactility/Lock.h b/TactilityCore/Include/Tactility/Lock.h index c81411a0..983cbe28 100644 --- a/TactilityCore/Include/Tactility/Lock.h +++ b/TactilityCore/Include/Tactility/Lock.h @@ -4,7 +4,6 @@ #include "RtosCompat.h" #include #include -#include namespace tt { diff --git a/TactilityCore/Include/Tactility/TactilityCore.h b/TactilityCore/Include/Tactility/TactilityCore.h index 8dff9d89..0567df76 100644 --- a/TactilityCore/Include/Tactility/TactilityCore.h +++ b/TactilityCore/Include/Tactility/TactilityCore.h @@ -4,7 +4,6 @@ #include "Check.h" #include "CoreDefines.h" -#include "CoreExtraDefines.h" #include "EventFlag.h" #include "kernel/Kernel.h" #include "kernel/critical/Critical.h" diff --git a/sdkconfig.board.cyd-2432s024c b/sdkconfig.board.cyd-2432s024c index e1057d56..1ac24207 100644 --- a/sdkconfig.board.cyd-2432s024c +++ b/sdkconfig.board.cyd-2432s024c @@ -1,7 +1,7 @@ # Software defaults # Increase stack size for WiFi (fixes crash after scan) CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=3072 -CONFIG_ESP_MAIN_TASK_STACK_SIZE=5120 +CONFIG_ESP_MAIN_TASK_STACK_SIZE=6144 CONFIG_LV_FONT_MONTSERRAT_14=y CONFIG_LV_FONT_MONTSERRAT_18=y CONFIG_LV_USE_USER_DATA=y diff --git a/sdkconfig.board.cyd-2432s028r b/sdkconfig.board.cyd-2432s028r index d52e6608..ddc2ac3e 100644 --- a/sdkconfig.board.cyd-2432s028r +++ b/sdkconfig.board.cyd-2432s028r @@ -1,7 +1,7 @@ # Software defaults # Increase stack size for WiFi (fixes crash after scan) CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=3072 -CONFIG_ESP_MAIN_TASK_STACK_SIZE=5120 +CONFIG_ESP_MAIN_TASK_STACK_SIZE=6144 CONFIG_LV_FONT_MONTSERRAT_14=y CONFIG_LV_FONT_MONTSERRAT_18=y CONFIG_LV_USE_USER_DATA=y diff --git a/sdkconfig.board.cyd-2432s028rv3 b/sdkconfig.board.cyd-2432s028rv3 index 3e1cc993..0e56f192 100644 --- a/sdkconfig.board.cyd-2432s028rv3 +++ b/sdkconfig.board.cyd-2432s028rv3 @@ -1,7 +1,7 @@ # Software defaults # Increase stack size for WiFi (fixes crash after scan) CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=3072 -CONFIG_ESP_MAIN_TASK_STACK_SIZE=5120 +CONFIG_ESP_MAIN_TASK_STACK_SIZE=6144 CONFIG_LV_FONT_MONTSERRAT_14=y CONFIG_LV_FONT_MONTSERRAT_18=y CONFIG_LV_USE_USER_DATA=y diff --git a/sdkconfig.board.cyd-2432s032c b/sdkconfig.board.cyd-2432s032c index a8ef668d..c7603ca3 100644 --- a/sdkconfig.board.cyd-2432s032c +++ b/sdkconfig.board.cyd-2432s032c @@ -1,7 +1,7 @@ # Software defaults # Increase stack size for WiFi (fixes crash after scan) CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=3072 -CONFIG_ESP_MAIN_TASK_STACK_SIZE=5120 +CONFIG_ESP_MAIN_TASK_STACK_SIZE=6144 CONFIG_LV_FONT_MONTSERRAT_14=y CONFIG_LV_FONT_MONTSERRAT_18=y CONFIG_LV_USE_USER_DATA=y diff --git a/sdkconfig.board.cyd-4848s040c b/sdkconfig.board.cyd-4848s040c index 280bc2bc..f3db7743 100644 --- a/sdkconfig.board.cyd-4848s040c +++ b/sdkconfig.board.cyd-4848s040c @@ -1,7 +1,7 @@ # Software defaults # Increase stack size for WiFi (fixes crash after scan) CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=3072 -CONFIG_ESP_MAIN_TASK_STACK_SIZE=5120 +CONFIG_ESP_MAIN_TASK_STACK_SIZE=6144 CONFIG_LV_FONT_MONTSERRAT_14=y CONFIG_LV_FONT_MONTSERRAT_18=y CONFIG_LV_USE_USER_DATA=y diff --git a/sdkconfig.board.cyd-8048s043c b/sdkconfig.board.cyd-8048s043c index d33a8142..a0f6dbc9 100644 --- a/sdkconfig.board.cyd-8048s043c +++ b/sdkconfig.board.cyd-8048s043c @@ -1,7 +1,7 @@ # Software defaults # Increase stack size for WiFi (fixes crash after scan) CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=3072 -CONFIG_ESP_MAIN_TASK_STACK_SIZE=5120 +CONFIG_ESP_MAIN_TASK_STACK_SIZE=6144 CONFIG_LV_FONT_MONTSERRAT_14=y CONFIG_LV_FONT_MONTSERRAT_18=y CONFIG_LV_USE_USER_DATA=y diff --git a/sdkconfig.board.cyd-e32r28t b/sdkconfig.board.cyd-e32r28t index 91bf7b84..87fe9a98 100644 --- a/sdkconfig.board.cyd-e32r28t +++ b/sdkconfig.board.cyd-e32r28t @@ -1,6 +1,6 @@ # Software defaults CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=3072 -CONFIG_ESP_MAIN_TASK_STACK_SIZE=5120 +CONFIG_ESP_MAIN_TASK_STACK_SIZE=6144 CONFIG_LV_FONT_MONTSERRAT_14=y CONFIG_LV_FONT_MONTSERRAT_18=y CONFIG_LV_USE_USER_DATA=y diff --git a/sdkconfig.board.cyd-jc2432w328c b/sdkconfig.board.cyd-jc2432w328c index 607d35e9..f55fcc8e 100644 --- a/sdkconfig.board.cyd-jc2432w328c +++ b/sdkconfig.board.cyd-jc2432w328c @@ -1,7 +1,7 @@ # Software defaults # Increase stack size for WiFi (fixes crash after scan) CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=3072 -CONFIG_ESP_MAIN_TASK_STACK_SIZE=5120 +CONFIG_ESP_MAIN_TASK_STACK_SIZE=6144 CONFIG_LV_FONT_MONTSERRAT_14=y CONFIG_LV_FONT_MONTSERRAT_18=y CONFIG_LV_USE_USER_DATA=y diff --git a/sdkconfig.board.cyd-jc8048w550c b/sdkconfig.board.cyd-jc8048w550c index 21433033..69202827 100644 --- a/sdkconfig.board.cyd-jc8048w550c +++ b/sdkconfig.board.cyd-jc8048w550c @@ -1,7 +1,7 @@ # Software defaults # Increase stack size for WiFi (fixes crash after scan) CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=3072 -CONFIG_ESP_MAIN_TASK_STACK_SIZE=5120 +CONFIG_ESP_MAIN_TASK_STACK_SIZE=6144 CONFIG_LV_FONT_MONTSERRAT_14=y CONFIG_LV_FONT_MONTSERRAT_18=y CONFIG_LV_USE_USER_DATA=y diff --git a/sdkconfig.board.elecrow-crowpanel-advance-28 b/sdkconfig.board.elecrow-crowpanel-advance-28 index 7f5b8f9c..0fb01fec 100644 --- a/sdkconfig.board.elecrow-crowpanel-advance-28 +++ b/sdkconfig.board.elecrow-crowpanel-advance-28 @@ -1,7 +1,7 @@ # Software defaults # Increase stack size for WiFi (fixes crash after scan) CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=3072 -CONFIG_ESP_MAIN_TASK_STACK_SIZE=5120 +CONFIG_ESP_MAIN_TASK_STACK_SIZE=6144 CONFIG_LV_FONT_MONTSERRAT_14=y CONFIG_LV_FONT_MONTSERRAT_18=y CONFIG_LV_USE_USER_DATA=y diff --git a/sdkconfig.board.elecrow-crowpanel-advance-35 b/sdkconfig.board.elecrow-crowpanel-advance-35 index 38d5149e..5ad74af8 100644 --- a/sdkconfig.board.elecrow-crowpanel-advance-35 +++ b/sdkconfig.board.elecrow-crowpanel-advance-35 @@ -1,7 +1,7 @@ # Software defaults # Increase stack size for WiFi (fixes crash after scan) CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=3072 -CONFIG_ESP_MAIN_TASK_STACK_SIZE=5120 +CONFIG_ESP_MAIN_TASK_STACK_SIZE=6144 CONFIG_LV_FONT_MONTSERRAT_14=y CONFIG_LV_FONT_MONTSERRAT_18=y CONFIG_LV_USE_USER_DATA=y diff --git a/sdkconfig.board.elecrow-crowpanel-advance-50 b/sdkconfig.board.elecrow-crowpanel-advance-50 index d2d0fd68..a3bfc770 100644 --- a/sdkconfig.board.elecrow-crowpanel-advance-50 +++ b/sdkconfig.board.elecrow-crowpanel-advance-50 @@ -1,7 +1,7 @@ # Software defaults # Increase stack size for WiFi (fixes crash after scan) CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=3072 -CONFIG_ESP_MAIN_TASK_STACK_SIZE=5120 +CONFIG_ESP_MAIN_TASK_STACK_SIZE=6144 CONFIG_LV_FONT_MONTSERRAT_14=y CONFIG_LV_FONT_MONTSERRAT_18=y CONFIG_LV_USE_USER_DATA=y diff --git a/sdkconfig.board.elecrow-crowpanel-basic-28 b/sdkconfig.board.elecrow-crowpanel-basic-28 index 45a621e0..60a6af58 100644 --- a/sdkconfig.board.elecrow-crowpanel-basic-28 +++ b/sdkconfig.board.elecrow-crowpanel-basic-28 @@ -1,7 +1,7 @@ # Software defaults # Increase stack size for WiFi (fixes crash after scan) CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=3072 -CONFIG_ESP_MAIN_TASK_STACK_SIZE=5120 +CONFIG_ESP_MAIN_TASK_STACK_SIZE=6144 CONFIG_LV_FONT_MONTSERRAT_14=y CONFIG_LV_FONT_MONTSERRAT_18=y CONFIG_LV_USE_USER_DATA=y diff --git a/sdkconfig.board.elecrow-crowpanel-basic-35 b/sdkconfig.board.elecrow-crowpanel-basic-35 index d80f269e..3856f085 100644 --- a/sdkconfig.board.elecrow-crowpanel-basic-35 +++ b/sdkconfig.board.elecrow-crowpanel-basic-35 @@ -1,7 +1,7 @@ # Software defaults # Increase stack size for WiFi (fixes crash after scan) CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=3072 -CONFIG_ESP_MAIN_TASK_STACK_SIZE=5120 +CONFIG_ESP_MAIN_TASK_STACK_SIZE=6144 CONFIG_LV_FONT_MONTSERRAT_14=y CONFIG_LV_FONT_MONTSERRAT_18=y CONFIG_LV_USE_USER_DATA=y diff --git a/sdkconfig.board.elecrow-crowpanel-basic-50 b/sdkconfig.board.elecrow-crowpanel-basic-50 index c8778c92..7b1b83c1 100644 --- a/sdkconfig.board.elecrow-crowpanel-basic-50 +++ b/sdkconfig.board.elecrow-crowpanel-basic-50 @@ -1,7 +1,7 @@ # Software defaults # Increase stack size for WiFi (fixes crash after scan) CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=3072 -CONFIG_ESP_MAIN_TASK_STACK_SIZE=5120 +CONFIG_ESP_MAIN_TASK_STACK_SIZE=6144 CONFIG_LV_FONT_MONTSERRAT_14=y CONFIG_LV_FONT_MONTSERRAT_18=y CONFIG_LV_USE_USER_DATA=y diff --git a/sdkconfig.board.lilygo-tdeck b/sdkconfig.board.lilygo-tdeck index 7ba20445..a4f4ef1a 100644 --- a/sdkconfig.board.lilygo-tdeck +++ b/sdkconfig.board.lilygo-tdeck @@ -1,7 +1,7 @@ # Software defaults # Increase stack size for WiFi (fixes crash after scan) CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=3072 -CONFIG_ESP_MAIN_TASK_STACK_SIZE=5120 +CONFIG_ESP_MAIN_TASK_STACK_SIZE=6144 CONFIG_LV_FONT_MONTSERRAT_14=y CONFIG_LV_FONT_MONTSERRAT_18=y CONFIG_LV_USE_USER_DATA=y diff --git a/sdkconfig.board.lilygo-tdeck.dev b/sdkconfig.board.lilygo-tdeck.dev index dd0af3c2..7905d5a3 100644 --- a/sdkconfig.board.lilygo-tdeck.dev +++ b/sdkconfig.board.lilygo-tdeck.dev @@ -1,7 +1,7 @@ # Software defaults # Increase stack size for WiFi (fixes crash after scan) CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=3072 -CONFIG_ESP_MAIN_TASK_STACK_SIZE=5120 +CONFIG_ESP_MAIN_TASK_STACK_SIZE=6144 CONFIG_LV_FONT_MONTSERRAT_14=y CONFIG_LV_FONT_MONTSERRAT_18=y CONFIG_LV_USE_USER_DATA=y diff --git a/sdkconfig.board.lilygo-tdongle-s3 b/sdkconfig.board.lilygo-tdongle-s3 index db110d98..a8576b22 100644 --- a/sdkconfig.board.lilygo-tdongle-s3 +++ b/sdkconfig.board.lilygo-tdongle-s3 @@ -1,7 +1,7 @@ # Software defaults # Increase stack size for WiFi (fixes crash after scan) CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=3072 -CONFIG_ESP_MAIN_TASK_STACK_SIZE=5120 +CONFIG_ESP_MAIN_TASK_STACK_SIZE=6144 CONFIG_LV_FONT_MONTSERRAT_14=y CONFIG_LV_FONT_MONTSERRAT_18=y CONFIG_LV_USE_USER_DATA=y diff --git a/sdkconfig.board.lilygo-tlora-pager b/sdkconfig.board.lilygo-tlora-pager index fa8ed338..e2d5fc76 100644 --- a/sdkconfig.board.lilygo-tlora-pager +++ b/sdkconfig.board.lilygo-tlora-pager @@ -1,7 +1,7 @@ # Software defaults # Increase stack size for WiFi (fixes crash after scan) CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=3072 -CONFIG_ESP_MAIN_TASK_STACK_SIZE=5120 +CONFIG_ESP_MAIN_TASK_STACK_SIZE=6144 CONFIG_LV_FONT_MONTSERRAT_14=y CONFIG_LV_FONT_MONTSERRAT_18=y CONFIG_LV_USE_USER_DATA=y diff --git a/sdkconfig.board.m5stack-cardputer b/sdkconfig.board.m5stack-cardputer index 979335f1..d895aab9 100644 --- a/sdkconfig.board.m5stack-cardputer +++ b/sdkconfig.board.m5stack-cardputer @@ -1,7 +1,7 @@ # Software defaults # Increase stack size for WiFi (fixes crash after scan) CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=3072 -CONFIG_ESP_MAIN_TASK_STACK_SIZE=5120 +CONFIG_ESP_MAIN_TASK_STACK_SIZE=6144 CONFIG_LV_FONT_MONTSERRAT_14=y CONFIG_LV_FONT_MONTSERRAT_18=y CONFIG_LV_USE_USER_DATA=y diff --git a/sdkconfig.board.m5stack-core2 b/sdkconfig.board.m5stack-core2 index 9cb8e0de..8b51f17f 100644 --- a/sdkconfig.board.m5stack-core2 +++ b/sdkconfig.board.m5stack-core2 @@ -1,7 +1,7 @@ # Software defaults # Increase stack size for WiFi (fixes crash after scan) CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=3072 -CONFIG_ESP_MAIN_TASK_STACK_SIZE=5120 +CONFIG_ESP_MAIN_TASK_STACK_SIZE=6144 CONFIG_LV_FONT_MONTSERRAT_14=y CONFIG_LV_FONT_MONTSERRAT_18=y CONFIG_LV_USE_USER_DATA=y diff --git a/sdkconfig.board.m5stack-cores3 b/sdkconfig.board.m5stack-cores3 index 7ebdaf9c..50e4df3b 100644 --- a/sdkconfig.board.m5stack-cores3 +++ b/sdkconfig.board.m5stack-cores3 @@ -1,7 +1,7 @@ # Software defaults # Increase stack size for WiFi (fixes crash after scan) CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=3072 -CONFIG_ESP_MAIN_TASK_STACK_SIZE=5120 +CONFIG_ESP_MAIN_TASK_STACK_SIZE=6144 CONFIG_LV_FONT_MONTSERRAT_14=y CONFIG_LV_FONT_MONTSERRAT_18=y CONFIG_LV_USE_USER_DATA=y diff --git a/sdkconfig.board.m5stack-stickc-plus b/sdkconfig.board.m5stack-stickc-plus index c549db85..3fd09177 100644 --- a/sdkconfig.board.m5stack-stickc-plus +++ b/sdkconfig.board.m5stack-stickc-plus @@ -1,7 +1,7 @@ # Software defaults # Increase stack size for WiFi (fixes crash after scan) CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=3072 -CONFIG_ESP_MAIN_TASK_STACK_SIZE=5120 +CONFIG_ESP_MAIN_TASK_STACK_SIZE=6144 CONFIG_LV_FONT_MONTSERRAT_14=y CONFIG_LV_FONT_MONTSERRAT_18=y CONFIG_LV_USE_USER_DATA=y diff --git a/sdkconfig.board.m5stack-stickc-plus2 b/sdkconfig.board.m5stack-stickc-plus2 index b8eb2782..03154ba7 100644 --- a/sdkconfig.board.m5stack-stickc-plus2 +++ b/sdkconfig.board.m5stack-stickc-plus2 @@ -1,7 +1,7 @@ # Software defaults # Increase stack size for WiFi (fixes crash after scan) CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=3072 -CONFIG_ESP_MAIN_TASK_STACK_SIZE=5120 +CONFIG_ESP_MAIN_TASK_STACK_SIZE=6144 CONFIG_LV_FONT_MONTSERRAT_14=y CONFIG_LV_FONT_MONTSERRAT_18=y CONFIG_LV_USE_USER_DATA=y diff --git a/sdkconfig.board.unphone b/sdkconfig.board.unphone index 43b62561..1bc31461 100644 --- a/sdkconfig.board.unphone +++ b/sdkconfig.board.unphone @@ -1,7 +1,7 @@ # Software defaults # Increase stack size for WiFi (fixes crash after scan) CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=3072 -CONFIG_ESP_MAIN_TASK_STACK_SIZE=5120 +CONFIG_ESP_MAIN_TASK_STACK_SIZE=6144 CONFIG_LV_FONT_MONTSERRAT_14=y CONFIG_LV_FONT_MONTSERRAT_18=y CONFIG_LV_USE_USER_DATA=y diff --git a/sdkconfig.board.waveshare-s3-lcd-13 b/sdkconfig.board.waveshare-s3-lcd-13 index 86b0fa6e..a9f999a4 100644 --- a/sdkconfig.board.waveshare-s3-lcd-13 +++ b/sdkconfig.board.waveshare-s3-lcd-13 @@ -1,7 +1,7 @@ # Software defaults # Increase stack size for WiFi (fixes crash after scan) CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=3072 -CONFIG_ESP_MAIN_TASK_STACK_SIZE=5120 +CONFIG_ESP_MAIN_TASK_STACK_SIZE=6144 CONFIG_LV_FONT_MONTSERRAT_14=y CONFIG_LV_FONT_MONTSERRAT_18=y CONFIG_LV_USE_USER_DATA=y diff --git a/sdkconfig.board.waveshare-s3-touch-43 b/sdkconfig.board.waveshare-s3-touch-43 index 8bb518f6..6f1ce1ab 100644 --- a/sdkconfig.board.waveshare-s3-touch-43 +++ b/sdkconfig.board.waveshare-s3-touch-43 @@ -1,7 +1,7 @@ # Software defaults # Increase stack size for WiFi (fixes crash after scan) CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=3072 -CONFIG_ESP_MAIN_TASK_STACK_SIZE=5120 +CONFIG_ESP_MAIN_TASK_STACK_SIZE=6144 CONFIG_LV_FONT_MONTSERRAT_14=y CONFIG_LV_FONT_MONTSERRAT_18=y CONFIG_LV_USE_USER_DATA=y diff --git a/sdkconfig.board.waveshare-s3-touch-lcd-128 b/sdkconfig.board.waveshare-s3-touch-lcd-128 index de9535bd..97bccd47 100644 --- a/sdkconfig.board.waveshare-s3-touch-lcd-128 +++ b/sdkconfig.board.waveshare-s3-touch-lcd-128 @@ -1,7 +1,7 @@ # Software defaults # Increase stack size for WiFi (fixes crash after scan) CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=3072 -CONFIG_ESP_MAIN_TASK_STACK_SIZE=5120 +CONFIG_ESP_MAIN_TASK_STACK_SIZE=6144 CONFIG_LV_FONT_MONTSERRAT_14=y CONFIG_LV_FONT_MONTSERRAT_18=y CONFIG_LV_USE_USER_DATA=y diff --git a/sdkconfig.board.waveshare-s3-touch-lcd-147 b/sdkconfig.board.waveshare-s3-touch-lcd-147 index 90a6873e..f3e881ec 100644 --- a/sdkconfig.board.waveshare-s3-touch-lcd-147 +++ b/sdkconfig.board.waveshare-s3-touch-lcd-147 @@ -1,7 +1,7 @@ # Software defaults # Increase stack size for WiFi (fixes crash after scan) CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=3072 -CONFIG_ESP_MAIN_TASK_STACK_SIZE=5120 +CONFIG_ESP_MAIN_TASK_STACK_SIZE=6144 CONFIG_LV_FONT_MONTSERRAT_14=y CONFIG_LV_FONT_MONTSERRAT_18=y CONFIG_LV_USE_USER_DATA=y diff --git a/sdkconfig.defaults b/sdkconfig.defaults index 63eb6841..127a1bfe 100644 --- a/sdkconfig.defaults +++ b/sdkconfig.defaults @@ -1,7 +1,7 @@ # Software defaults # Increase stack size for WiFi (fixes crash after scan) CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=3072 -CONFIG_ESP_MAIN_TASK_STACK_SIZE=5120 +CONFIG_ESP_MAIN_TASK_STACK_SIZE=6144 CONFIG_LV_FONT_MONTSERRAT_14=y CONFIG_LV_FONT_MONTSERRAT_18=y CONFIG_LV_USE_USER_DATA=y