Merge develop into main (#392)

- Refactor `Ili934xDisplay` to use `EspLcdSpiDisplay` as base class
- Update `St7789Display` for changes to `EspLcdDisplayV2` related to ILI934x driver
- Updated all board driver implementations for ILI934x driver changes
- Simplified board configurations:
  - All boards now have a `Configuration.cpp`
  - All board config's headers are removed
  - Removed `Boards.h`
- Fix for untar-ing large files
- Increase main task stack size to avoid stackoverflow when downloading apps in App Hub
- Reduce SPI frequency for ST7789 displays (according to spec)
This commit is contained in:
Ken Van Hoeylandt 2025-10-26 23:26:28 +01:00 committed by GitHub
parent db6d3b4acb
commit 8115ca4fd9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
126 changed files with 562 additions and 905 deletions

View File

@ -1,6 +0,0 @@
#pragma once
#include <Tactility/hal/Configuration.h>
// Capacitive touch version of the 2.4" yellow board
extern const tt::hal::Configuration cyd_2432s024c_config;

View File

@ -1,14 +1,22 @@
#include "CYD2432S024C.h"
#include "devices/Display.h" #include "devices/Display.h"
#include "devices/SdCard.h" #include "devices/SdCard.h"
#include <Tactility/hal/Configuration.h>
#include <Tactility/lvgl/LvglSync.h> #include <Tactility/lvgl/LvglSync.h>
#include <PwmBacklight.h> #include <PwmBacklight.h>
#define CYD_SPI_TRANSFER_SIZE_LIMIT (TWODOTFOUR_LCD_DRAW_BUFFER_SIZE * LV_COLOR_DEPTH / 8)
static bool initBoot() { 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() { 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, .initBoot = initBoot,
.createDevices = createDevices, .createDevices = createDevices,
.i2c = { .i2c = {
@ -72,7 +80,7 @@ const tt::hal::Configuration cyd_2432s024c_config = {
.data6_io_num = GPIO_NUM_NC, .data6_io_num = GPIO_NUM_NC,
.data7_io_num = GPIO_NUM_NC, .data7_io_num = GPIO_NUM_NC,
.data_io_default_level = false, .data_io_default_level = false,
.max_transfer_sz = CYD_SPI_TRANSFER_SIZE_LIMIT, .max_transfer_sz = LCD_SPI_TRANSFER_SIZE_LIMIT,
.flags = 0, .flags = 0,
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO, .isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
.intr_flags = 0 .intr_flags = 0

View File

@ -16,21 +16,30 @@ static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
} }
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() { std::shared_ptr<tt::hal::display::DisplayDevice> 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>(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<Ili934xDisplay::Configuration>( return std::make_shared<Ili934xDisplay>(panel_configuration, spi_configuration, true);
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<Ili934xDisplay>(std::move(configuration));
return std::reinterpret_pointer_cast<tt::hal::display::DisplayDevice>(display);
} }

View File

@ -1,17 +1,19 @@
#pragma once #pragma once
#include "Tactility/hal/display/DisplayDevice.h" #include <Tactility/hal/display/DisplayDevice.h>
#include <driver/gpio.h>
#include <driver/spi_common.h>
#include <memory> #include <memory>
#define TWODOTFOUR_LCD_PIN_BACKLIGHT GPIO_NUM_27
// Display // Display
#define TWODOTFOUR_LCD_SPI_HOST SPI2_HOST constexpr auto LCD_PIN_BACKLIGHT = GPIO_NUM_27;
#define TWODOTFOUR_LCD_HORIZONTAL_RESOLUTION 240 constexpr auto LCD_SPI_HOST = SPI2_HOST;
#define TWODOTFOUR_LCD_VERTICAL_RESOLUTION 320 constexpr auto LCD_PIN_CS = GPIO_NUM_15;
#define TWODOTFOUR_LCD_DRAW_BUFFER_HEIGHT (TWODOTFOUR_LCD_VERTICAL_RESOLUTION / 10) constexpr auto LCD_PIN_DC = GPIO_NUM_2;
#define TWODOTFOUR_LCD_DRAW_BUFFER_SIZE (TWODOTFOUR_LCD_HORIZONTAL_RESOLUTION * TWODOTFOUR_LCD_DRAW_BUFFER_HEIGHT) constexpr auto LCD_HORIZONTAL_RESOLUTION = 240;
#define TWODOTFOUR_LCD_PIN_CS GPIO_NUM_15 constexpr auto LCD_VERTICAL_RESOLUTION = 320;
#define TWODOTFOUR_LCD_PIN_DC GPIO_NUM_2 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<tt::hal::display::DisplayDevice> createDisplay(); std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();

View File

@ -1,6 +0,0 @@
#pragma once
#include <Tactility/hal/Configuration.h>
// Resistive touch version of the 2.8" yellow board
extern const tt::hal::Configuration cyd_2432s028r_config;

View File

@ -1,22 +1,22 @@
#include "CYD2432S028RV3.h"
#include "devices/Display.h" #include "devices/Display.h"
#include "devices/SdCard.h" #include "devices/SdCard.h"
#include <Tactility/hal/Configuration.h>
#include <Tactility/lvgl/LvglSync.h> #include <Tactility/lvgl/LvglSync.h>
#include <PwmBacklight.h> #include <PwmBacklight.h>
#include <Tactility/hal/Configuration.h>
using namespace tt::hal; using namespace tt::hal;
static bool initBoot() { static bool initBoot() {
// Set the RGB LED Pins to output and turn them off // 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_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_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_17, GPIO_MODE_OUTPUT)); // Blue
// 0 on, 1 off... yep it's backwards. // 0 on, 1 off
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_4, 1)); //Red 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_16, 1)); // Green
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_17, 1)); //Blue ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_17, 1)); // Blue
return driver::pwmbacklight::init(LCD_PIN_BACKLIGHT); 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, .initBoot = initBoot,
.createDevices = createDevices, .createDevices = createDevices,
.i2c = { .i2c = {

View File

@ -3,52 +3,47 @@
#include <Ili934xDisplay.h> #include <Ili934xDisplay.h>
#include <PwmBacklight.h> #include <PwmBacklight.h>
constexpr auto* TAG = "CYD";
static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() { static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
auto configuration = std::make_unique<Xpt2046SoftSpi::Configuration>( auto configuration = std::make_unique<Xpt2046SoftSpi::Configuration>(
CYD_TOUCH_MOSI_PIN, TOUCH_MOSI_PIN,
CYD_TOUCH_MISO_PIN, TOUCH_MISO_PIN,
CYD_TOUCH_SCK_PIN, TOUCH_SCK_PIN,
CYD_TOUCH_CS_PIN, TOUCH_CS_PIN,
CYD2432S028R_LCD_HORIZONTAL_RESOLUTION, // 240 LCD_HORIZONTAL_RESOLUTION,
CYD2432S028R_LCD_VERTICAL_RESOLUTION, // 320 LCD_VERTICAL_RESOLUTION,
false, // swapXY false, // swapXY
true, // mirrorX true, // mirrorX
false // mirrorY false // mirrorY
); );
// Allocate the driver return std::make_shared<Xpt2046SoftSpi>(std::move(configuration));
auto touch = std::make_shared<Xpt2046SoftSpi>(std::move(configuration));
// Start the driver
if (!touch->start()) {
ESP_LOGE(TAG, "Touch driver start failed");
return nullptr;
}
return touch;
} }
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() { std::shared_ptr<tt::hal::display::DisplayDevice> 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<Ili934xDisplay::Configuration>( auto spi_configuration = std::make_shared<Ili934xDisplay::SpiConfiguration>(Ili934xDisplay::SpiConfiguration {
CYD2432S028R_LCD_SPI_HOST, .spiHostDevice = LCD_SPI_HOST,
CYD2432S028R_LCD_PIN_CS, .csPin = LCD_PIN_CS,
CYD2432S028R_LCD_PIN_DC, .dcPin = LCD_PIN_DC,
CYD2432S028R_LCD_HORIZONTAL_RESOLUTION, .pixelClockFrequency = 40'000'000,
CYD2432S028R_LCD_VERTICAL_RESOLUTION, .transactionQueueDepth = 10
touch, });
false, // swapXY
true, // mirrorX
false, // mirrorY
false,
CYD2432S028R_LCD_DRAW_BUFFER_SIZE
);
configuration->backlightDutyFunction = driver::pwmbacklight::setBacklightDuty; return std::make_shared<Ili934xDisplay>(panel_configuration, spi_configuration, true);
auto display = std::make_shared<Ili934xDisplay>(std::move(configuration));
return std::reinterpret_pointer_cast<tt::hal::display::DisplayDevice>(display);
} }

View File

@ -1,22 +1,28 @@
#pragma once #pragma once
#include "Tactility/hal/display/DisplayDevice.h" #include <Tactility/hal/display/DisplayDevice.h>
#include <driver/gpio.h>
#include <driver/spi_common.h>
#include <memory> #include <memory>
// Display // Display
#define CYD2432S028R_LCD_SPI_HOST SPI2_HOST constexpr auto LCD_SPI_HOST = SPI2_HOST;
#define CYD2432S028R_LCD_HORIZONTAL_RESOLUTION 240 constexpr auto LCD_PIN_CS = GPIO_NUM_15;
#define CYD2432S028R_LCD_VERTICAL_RESOLUTION 320 constexpr auto LCD_PIN_DC = GPIO_NUM_2;
#define CYD2432S028R_LCD_DRAW_BUFFER_HEIGHT (CYD2432S028R_LCD_VERTICAL_RESOLUTION / 10) constexpr auto LCD_HORIZONTAL_RESOLUTION = 240;
#define CYD2432S028R_LCD_DRAW_BUFFER_SIZE (CYD2432S028R_LCD_HORIZONTAL_RESOLUTION * CYD2432S028R_LCD_DRAW_BUFFER_HEIGHT) constexpr auto LCD_VERTICAL_RESOLUTION = 320;
#define CYD2432S028R_LCD_PIN_CS GPIO_NUM_15 constexpr auto LCD_BUFFER_HEIGHT = LCD_VERTICAL_RESOLUTION / 10;
#define CYD2432S028R_LCD_PIN_DC GPIO_NUM_2 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) // Touch (Software SPI)
#define CYD_TOUCH_MISO_PIN GPIO_NUM_39 constexpr auto TOUCH_MISO_PIN = GPIO_NUM_39;
#define CYD_TOUCH_MOSI_PIN GPIO_NUM_32 constexpr auto TOUCH_MOSI_PIN = GPIO_NUM_32;
#define CYD_TOUCH_SCK_PIN GPIO_NUM_25 constexpr auto TOUCH_SCK_PIN = GPIO_NUM_25;
#define CYD_TOUCH_CS_PIN GPIO_NUM_33 constexpr auto TOUCH_CS_PIN = GPIO_NUM_33;
#define CYD_TOUCH_IRQ_PIN GPIO_NUM_36 constexpr auto TOUCH_IRQ_PIN = GPIO_NUM_36;
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay(); std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();

View File

@ -1,6 +0,0 @@
#pragma once
#include <Tactility/hal/Configuration.h>
// Resistive touch version of the 2.8" yellow board version 3
extern const tt::hal::Configuration cyd_2432s028rv3_config;

View File

@ -1,29 +1,24 @@
#include "CYD2432S028R.h"
#include "devices/Display.h" #include "devices/Display.h"
#include "devices/SdCard.h" #include "devices/SdCard.h"
#include <Tactility/hal/Configuration.h>
#include <Tactility/lvgl/LvglSync.h> #include <Tactility/lvgl/LvglSync.h>
#include <PwmBacklight.h> #include <PwmBacklight.h>
#include <Tactility/hal/Configuration.h>
// 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; using namespace tt::hal;
static bool initBoot() { static bool initBoot() {
//Set the RGB Led Pins to output and turn them off // 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_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_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_17, GPIO_MODE_OUTPUT)); // Blue
//0 on, 1 off... yep it's backwards. // 0 on, 1 off
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_4, 1)); //Red 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_16, 1)); // Green
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_17, 1)); //Blue 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() { static DeviceVector createDevices() {
@ -33,7 +28,7 @@ static DeviceVector createDevices() {
}; };
} }
const Configuration cyd_2432s028r_config = { extern const Configuration hardwareConfiguration = {
.initBoot = initBoot, .initBoot = initBoot,
.createDevices = createDevices, .createDevices = createDevices,
.i2c = { .i2c = {
@ -71,7 +66,7 @@ const Configuration cyd_2432s028r_config = {
.data6_io_num = GPIO_NUM_NC, .data6_io_num = GPIO_NUM_NC,
.data7_io_num = GPIO_NUM_NC, .data7_io_num = GPIO_NUM_NC,
.data_io_default_level = false, .data_io_default_level = false,
.max_transfer_sz = CYD_SPI_TRANSFER_SIZE_LIMIT, .max_transfer_sz = LCD_SPI_TRANSFER_SIZE_LIMIT,
.flags = 0, .flags = 0,
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO, .isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
.intr_flags = 0 .intr_flags = 0

View File

@ -11,23 +11,14 @@ static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
TOUCH_MISO_PIN, TOUCH_MISO_PIN,
TOUCH_SCK_PIN, TOUCH_SCK_PIN,
TOUCH_CS_PIN, TOUCH_CS_PIN,
LCD_HORIZONTAL_RESOLUTION, // 240 LCD_HORIZONTAL_RESOLUTION,
LCD_VERTICAL_RESOLUTION, // 320 LCD_VERTICAL_RESOLUTION,
false, // swapXY false, // swapXY
true, // mirrorX true, // mirrorX
false // mirrorY false // mirrorY
); );
// Allocate the driver return std::make_shared<Xpt2046SoftSpi>(std::move(configuration));
auto touch = std::make_shared<Xpt2046SoftSpi>(std::move(configuration));
// Start the driver
if (!touch->start()) {
ESP_LOGE(TAG, "Touch driver start failed");
return nullptr;
}
return touch;
} }
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() { std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
@ -50,7 +41,7 @@ std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
.spiHostDevice = LCD_SPI_HOST, .spiHostDevice = LCD_SPI_HOST,
.csPin = LCD_PIN_CS, .csPin = LCD_PIN_CS,
.dcPin = LCD_PIN_DC, .dcPin = LCD_PIN_DC,
.pixelClockFrequency = 80'000'000, .pixelClockFrequency = 62'500'000,
.transactionQueueDepth = 10 .transactionQueueDepth = 10
}); });

View File

@ -1,6 +0,0 @@
#pragma once
#include <Tactility/hal/Configuration.h>
// Capacitive touch version of the 2.4" yellow board
extern const tt::hal::Configuration cyd_2432S032c_config;

View File

@ -1,17 +1,27 @@
#include "CYD2432S032C.h"
#include "Tactility/lvgl/LvglSync.h"
#include "devices/Display.h" #include "devices/Display.h"
#include "devices/SdCard.h" #include "devices/SdCard.h"
#include <Tactility/hal/Configuration.h>
#include <Tactility/kernel/SystemEvents.h> #include <Tactility/kernel/SystemEvents.h>
#include <Tactility/lvgl/LvglSync.h>
#include <PwmBacklight.h> #include <PwmBacklight.h>
bool initBoot() { bool initBoot() {
if (!driver::pwmbacklight::init(GPIO_NUM_27)) { if (!driver::pwmbacklight::init(LCD_PIN_BACKLIGHT)) {
return false; 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. // 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: // 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) { 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, .initBoot = initBoot,
.createDevices = createDevices, .createDevices = createDevices,
.i2c = { .i2c = {
@ -55,6 +65,7 @@ const tt::hal::Configuration cyd_2432S032c_config = {
} }
}, },
.spi { .spi {
// Display
tt::hal::spi::Configuration { tt::hal::spi::Configuration {
.device = SPI2_HOST, .device = SPI2_HOST,
.dma = SPI_DMA_CH_AUTO, .dma = SPI_DMA_CH_AUTO,
@ -69,7 +80,7 @@ const tt::hal::Configuration cyd_2432S032c_config = {
.data6_io_num = GPIO_NUM_NC, .data6_io_num = GPIO_NUM_NC,
.data7_io_num = GPIO_NUM_NC, .data7_io_num = GPIO_NUM_NC,
.data_io_default_level = false, .data_io_default_level = false,
.max_transfer_sz = 0, .max_transfer_sz = LCD_SPI_TRANSFER_SIZE_LIMIT,
.flags = 0, .flags = 0,
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO, .isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
.intr_flags = 0 .intr_flags = 0
@ -78,6 +89,7 @@ const tt::hal::Configuration cyd_2432S032c_config = {
.isMutable = false, .isMutable = false,
.lock = tt::lvgl::getSyncLock() // esp_lvgl_port owns the lock for the display .lock = tt::lvgl::getSyncLock() // esp_lvgl_port owns the lock for the display
}, },
// SD card
tt::hal::spi::Configuration { tt::hal::spi::Configuration {
.device = SPI3_HOST, .device = SPI3_HOST,
.dma = SPI_DMA_CH_AUTO, .dma = SPI_DMA_CH_AUTO,

View File

@ -7,34 +7,38 @@
static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() { static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
auto configuration = std::make_unique<Gt911Touch::Configuration>( auto configuration = std::make_unique<Gt911Touch::Configuration>(
I2C_NUM_0, I2C_NUM_0,
240, LCD_HORIZONTAL_RESOLUTION,
320 LCD_VERTICAL_RESOLUTION
); );
return std::make_shared<Gt911Touch>(std::move(configuration)); return std::make_shared<Gt911Touch>(std::move(configuration));
} }
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() { std::shared_ptr<tt::hal::display::DisplayDevice> 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>(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<Ili934xDisplay::Configuration>( return std::make_shared<Ili934xDisplay>(panel_configuration, spi_configuration, true);
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<Ili934xDisplay>(std::move(configuration));
return std::reinterpret_pointer_cast<tt::hal::display::DisplayDevice>(display);
} }

View File

@ -1,6 +1,19 @@
#pragma once #pragma once
#include <Tactility/hal/display/DisplayDevice.h> #include <Tactility/hal/display/DisplayDevice.h>
#include <driver/gpio.h>
#include <driver/spi_common.h>
#include <memory> #include <memory>
// 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<tt::hal::display::DisplayDevice> createDisplay(); std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();

View File

@ -1,6 +0,0 @@
#pragma once
#include <Tactility/hal/Configuration.h>
// Capacitive touch version of the 4" square yellow board
extern const tt::hal::Configuration cyd_4848s040c_config;

View File

@ -1,10 +1,9 @@
#include "CYD4848S040C.h"
#include "Tactility/kernel/SystemEvents.h"
#include "Tactility/lvgl/LvglSync.h"
#include "devices/St7701Display.h" #include "devices/St7701Display.h"
#include "devices/SdCard.h" #include "devices/SdCard.h"
#include <Tactility/hal/Configuration.h>
#include <Tactility/kernel/SystemEvents.h>
#include <Tactility/lvgl/LvglSync.h>
#include <PwmBacklight.h> #include <PwmBacklight.h>
using namespace tt::hal; using namespace tt::hal;
@ -20,7 +19,7 @@ static DeviceVector createDevices() {
}; };
} }
const Configuration cyd_4848s040c_config = { extern const Configuration hardwareConfiguration = {
.initBoot = initBoot, .initBoot = initBoot,
.createDevices = createDevices, .createDevices = createDevices,
.i2c = { .i2c = {

View File

@ -1,6 +0,0 @@
#pragma once
#include <Tactility/hal/Configuration.h>
// Capacitive touch version of the 4.3" yellow board
extern const tt::hal::Configuration cyd_8048s043c_config;

View File

@ -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 "PwmBacklight.h"
#include "devices/Display.h" #include "devices/Display.h"
#include "devices/SdCard.h" #include "devices/SdCard.h"
#include <Tactility/hal/Configuration.h>
using namespace tt::hal; using namespace tt::hal;
static bool initBoot() { static bool initBoot() {
@ -17,7 +18,7 @@ static DeviceVector createDevices() {
}; };
} }
const Configuration cyd_8048s043c_config = { extern const Configuration hardwareConfiguration = {
.initBoot = initBoot, .initBoot = initBoot,
.createDevices = createDevices, .createDevices = createDevices,
.i2c = { .i2c = {

View File

@ -1,13 +1,12 @@
#include "E32R28T.h"
#include "devices/SdCard.h" #include "devices/SdCard.h"
#include "devices/Display.h" #include "devices/Display.h"
#include <Tactility/hal/Configuration.h>
#include <Tactility/lvgl/LvglSync.h> #include <Tactility/lvgl/LvglSync.h>
#include <PwmBacklight.h> #include <PwmBacklight.h>
#define CYD_SPI_TRANSFER_SIZE_LIMIT (240 * 320 / 4 * 2)
static bool initBoot() { static bool initBoot() {
return driver::pwmbacklight::init(CYD_BACKLIGHT_PIN); return driver::pwmbacklight::init(LCD_BACKLIGHT_PIN);
} }
static tt::hal::DeviceVector createDevices() { 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, .initBoot = initBoot,
.createDevices = createDevices, .createDevices = createDevices,
.i2c = {}, .i2c = {},
@ -36,7 +35,7 @@ const tt::hal::Configuration cyd_e32r28t_config = {
.data6_io_num = GPIO_NUM_NC, .data6_io_num = GPIO_NUM_NC,
.data7_io_num = GPIO_NUM_NC, .data7_io_num = GPIO_NUM_NC,
.data_io_default_level = false, .data_io_default_level = false,
.max_transfer_sz = CYD_SPI_TRANSFER_SIZE_LIMIT, .max_transfer_sz = LCD_SPI_TRANSFER_SIZE_LIMIT,
.flags = 0, .flags = 0,
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO, .isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
.intr_flags = 0 .intr_flags = 0
@ -59,7 +58,7 @@ const tt::hal::Configuration cyd_e32r28t_config = {
.data6_io_num = GPIO_NUM_NC, .data6_io_num = GPIO_NUM_NC,
.data7_io_num = GPIO_NUM_NC, .data7_io_num = GPIO_NUM_NC,
.data_io_default_level = false, .data_io_default_level = false,
.max_transfer_sz = CYD_SPI_TRANSFER_SIZE_LIMIT, .max_transfer_sz = 0,
.flags = 0, .flags = 0,
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO, .isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
.intr_flags = 0 .intr_flags = 0

View File

@ -1,6 +0,0 @@
#pragma once
#include <Tactility/hal/Configuration.h>
// Resistive touch version of the waveshare 2.8" yellow board
extern const tt::hal::Configuration cyd_e32r28t_config;

View File

@ -7,12 +7,12 @@
static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() { static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
auto config = std::make_unique<Xpt2046SoftSpi::Configuration>( auto config = std::make_unique<Xpt2046SoftSpi::Configuration>(
CYD_TOUCH_MOSI_PIN, TOUCH_MOSI_PIN,
CYD_TOUCH_MISO_PIN, TOUCH_MISO_PIN,
CYD_TOUCH_SCK_PIN, TOUCH_SCK_PIN,
CYD_TOUCH_CS_PIN, TOUCH_CS_PIN,
CYD_DISPLAY_HORIZONTAL_RESOLUTION, LCD_HORIZONTAL_RESOLUTION,
CYD_DISPLAY_VERTICAL_RESOLUTION, LCD_VERTICAL_RESOLUTION,
false, false,
true, true,
false false
@ -22,20 +22,30 @@ static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
} }
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() { std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
auto configuration = std::make_unique<Ili934xDisplay::Configuration>( Ili934xDisplay::Configuration panel_configuration = {
CYD_DISPLAY_SPI_HOST, .horizontalResolution = LCD_HORIZONTAL_RESOLUTION,
CYD_DISPLAY_PIN_CS, .verticalResolution = LCD_VERTICAL_RESOLUTION,
CYD_DISPLAY_PIN_DC, .gapX = 0,
CYD_DISPLAY_HORIZONTAL_RESOLUTION, .gapY = 0,
CYD_DISPLAY_VERTICAL_RESOLUTION, .swapXY = false,
createTouch(), .mirrorX = true,
false, .mirrorY = false,
true, .invertColor = false,
false, .swapBytes = true,
false, .bufferSize = LCD_BUFFER_SIZE,
0, .touch = createTouch(),
LCD_RGB_ELEMENT_ORDER_BGR .backlightDutyFunction = driver::pwmbacklight::setBacklightDuty,
); .resetPin = GPIO_NUM_NC,
configuration->backlightDutyFunction = driver::pwmbacklight::setBacklightDuty; .rgbElementOrder = LCD_RGB_ELEMENT_ORDER_BGR
return std::make_shared<Ili934xDisplay>(std::move(configuration)); };
auto spi_configuration = std::make_shared<Ili934xDisplay::SpiConfiguration>(Ili934xDisplay::SpiConfiguration {
.spiHostDevice = LCD_SPI_HOST,
.csPin = LCD_PIN_CS,
.dcPin = LCD_PIN_DC,
.pixelClockFrequency = 40'000'000,
.transactionQueueDepth = 10
});
return std::make_shared<Ili934xDisplay>(panel_configuration, spi_configuration, true);
} }

View File

@ -1,25 +1,28 @@
#pragma once #pragma once
#include <Tactility/hal/display/DisplayDevice.h> #include <Tactility/hal/display/DisplayDevice.h>
#include <driver/gpio.h>
#include <driver/spi_common.h>
#include <memory> #include <memory>
// Display // Display
#define CYD_DISPLAY_SPI_HOST SPI2_HOST constexpr auto LCD_SPI_HOST = SPI2_HOST;
#define CYD_DISPLAY_PIN_CS GPIO_NUM_15 constexpr auto LCD_PIN_CS = GPIO_NUM_15;
#define CYD_DISPLAY_PIN_DC GPIO_NUM_2 constexpr auto LCD_PIN_DC = GPIO_NUM_2;
#define CYD_DISPLAY_HORIZONTAL_RESOLUTION 240 constexpr auto LCD_HORIZONTAL_RESOLUTION = 240;
#define CYD_DISPLAY_VERTICAL_RESOLUTION 320 constexpr auto LCD_VERTICAL_RESOLUTION = 320;
#define CYD_DISPLAY_DRAW_BUFFER_HEIGHT (CYD_DISPLAY_VERTICAL_RESOLUTION / 10) constexpr auto LCD_BUFFER_HEIGHT = (LCD_VERTICAL_RESOLUTION / 10);
#define CYD_DISPLAY_DRAW_BUFFER_SIZE (CYD_DISPLAY_HORIZONTAL_RESOLUTION * CYD_DISPLAY_DRAW_BUFFER_HEIGHT) 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) // Touch (Software SPI)
#define CYD_TOUCH_MISO_PIN GPIO_NUM_39 constexpr auto TOUCH_MISO_PIN = GPIO_NUM_39;
#define CYD_TOUCH_MOSI_PIN GPIO_NUM_32 constexpr auto TOUCH_MOSI_PIN = GPIO_NUM_32;
#define CYD_TOUCH_SCK_PIN GPIO_NUM_25 constexpr auto TOUCH_SCK_PIN = GPIO_NUM_25;
#define CYD_TOUCH_CS_PIN GPIO_NUM_33 constexpr auto TOUCH_CS_PIN = GPIO_NUM_33;
#define CYD_TOUCH_IRQ_PIN GPIO_NUM_36 constexpr auto TOUCH_IRQ_PIN = GPIO_NUM_36;
// Backlight // Backlight
#define CYD_BACKLIGHT_PIN GPIO_NUM_21 constexpr auto LCD_BACKLIGHT_PIN = GPIO_NUM_21;
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay(); std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();

View File

@ -1,4 +1,3 @@
#include "JC2432W328C.h"
#include "devices/Display.h" #include "devices/Display.h"
#include "devices/SdCard.h" #include "devices/SdCard.h"
@ -29,7 +28,7 @@ static DeviceVector createDevices() {
}; };
} }
const Configuration cyd_jc2432w328c_config = { extern const Configuration hardwareConfiguration = {
.initBoot = initBoot, .initBoot = initBoot,
.createDevices = createDevices, .createDevices = createDevices,
.i2c = { .i2c = {

View File

@ -1,6 +0,0 @@
#pragma once
#include <Tactility/hal/Configuration.h>
// Capacitive touch version of the 2.8" yellow board
extern const tt::hal::Configuration cyd_jc2432w328c_config;

View File

@ -34,7 +34,7 @@ std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
.spiHostDevice = LCD_SPI_HOST, .spiHostDevice = LCD_SPI_HOST,
.csPin = LCD_PIN_CS, .csPin = LCD_PIN_CS,
.dcPin = LCD_PIN_DC, .dcPin = LCD_PIN_DC,
.pixelClockFrequency = 80'000'000, .pixelClockFrequency = 62'500'000,
.transactionQueueDepth = 10 .transactionQueueDepth = 10
}); });

View File

@ -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 "PwmBacklight.h"
#include "devices/Display.h" #include "devices/Display.h"
#include "devices/SdCard.h" #include "devices/SdCard.h"
#include <Tactility/hal/Configuration.h>
using namespace tt::hal; using namespace tt::hal;
static bool initBoot() { static bool initBoot() {
@ -16,7 +17,7 @@ static DeviceVector createDevices() {
}; };
} }
const Configuration cyd_jc8048w550c_config = { extern const Configuration hardwareConfiguration = {
.initBoot = initBoot, .initBoot = initBoot,
.createDevices = createDevices, .createDevices = createDevices,
.i2c = { .i2c = {

View File

@ -1,6 +0,0 @@
#pragma once
#include <Tactility/hal/Configuration.h>
// Capacitive touch version of the 5" black board
extern const tt::hal::Configuration cyd_jc8048w550c_config;

View File

@ -2,8 +2,8 @@
#include "devices/Display.h" #include "devices/Display.h"
#include "devices/SdCard.h" #include "devices/SdCard.h"
#include <Tactility/lvgl/LvglSync.h>
#include <Tactility/hal/Configuration.h> #include <Tactility/hal/Configuration.h>
#include <Tactility/lvgl/LvglSync.h>
using namespace tt::hal; using namespace tt::hal;
@ -18,7 +18,7 @@ static DeviceVector createDevices() {
}; };
} }
extern const Configuration crowpanel_advance_28 = { extern const Configuration hardwareConfiguration = {
.initBoot = initBoot, .initBoot = initBoot,
.createDevices = createDevices, .createDevices = createDevices,
.i2c = { .i2c = {

View File

@ -1,5 +0,0 @@
#pragma once
#include <Tactility/hal/Configuration.h>
extern const tt::hal::Configuration crowpanel_advance_28;

View File

@ -38,7 +38,7 @@ std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
.spiHostDevice = LCD_SPI_HOST, .spiHostDevice = LCD_SPI_HOST,
.csPin = LCD_PIN_CS, .csPin = LCD_PIN_CS,
.dcPin = LCD_PIN_DC, .dcPin = LCD_PIN_DC,
.pixelClockFrequency = 80'000'000, .pixelClockFrequency = 62'500'000,
.transactionQueueDepth = 10 .transactionQueueDepth = 10
}); });

View File

@ -1,9 +1,9 @@
#include "PwmBacklight.h"
#include "Tactility/lvgl/LvglSync.h"
#include "devices/Display.h" #include "devices/Display.h"
#include "devices/SdCard.h" #include "devices/SdCard.h"
#include <Tactility/hal/Configuration.h> #include <Tactility/hal/Configuration.h>
#include <Tactility/lvgl/LvglSync.h>
#include <PwmBacklight.h>
#define CROWPANEL_SPI_TRANSFER_SIZE_LIMIT (CROWPANEL_LCD_HORIZONTAL_RESOLUTION * CROWPANEL_LCD_SPI_TRANSFER_HEIGHT * (LV_COLOR_DEPTH / 8)) #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, .initBoot = initBoot,
.createDevices = createDevices, .createDevices = createDevices,
.i2c = { .i2c = {

View File

@ -1,5 +0,0 @@
#pragma once
#include <Tactility/hal/Configuration.h>
extern const tt::hal::Configuration crowpanel_advance_35;

View File

@ -28,7 +28,7 @@ static DeviceVector createDevices() {
}; };
} }
extern const Configuration crowpanel_advance_50 = { extern const Configuration hardwareConfiguration = {
.initBoot = initBoot, .initBoot = initBoot,
.createDevices = createDevices, .createDevices = createDevices,
.i2c = { .i2c = {

View File

@ -1,5 +0,0 @@
#pragma once
#include <Tactility/hal/Configuration.h>
extern const tt::hal::Configuration crowpanel_advance_50;

View File

@ -2,11 +2,9 @@
#include "devices/Display.h" #include "devices/Display.h"
#include "devices/SdCard.h" #include "devices/SdCard.h"
#include <Xpt2046Power.h>
#include <Tactility/hal/Configuration.h> #include <Tactility/hal/Configuration.h>
#include <Tactility/lvgl/LvglSync.h> #include <Tactility/lvgl/LvglSync.h>
#include <Xpt2046Power.h>
#define CROWPANEL_SPI_TRANSFER_SIZE_LIMIT (CROWPANEL_LCD_HORIZONTAL_RESOLUTION * CROWPANEL_LCD_SPI_TRANSFER_HEIGHT * (LV_COLOR_DEPTH / 8))
using namespace tt::hal; using namespace tt::hal;
@ -22,7 +20,7 @@ static DeviceVector createDevices() {
}; };
} }
extern const Configuration crowpanel_basic_28 = { extern const Configuration hardwareConfiguration = {
.initBoot = initBoot, .initBoot = initBoot,
.createDevices = createDevices, .createDevices = createDevices,
.i2c = { .i2c = {
@ -62,7 +60,7 @@ extern const Configuration crowpanel_basic_28 = {
.data6_io_num = GPIO_NUM_NC, .data6_io_num = GPIO_NUM_NC,
.data7_io_num = GPIO_NUM_NC, .data7_io_num = GPIO_NUM_NC,
.data_io_default_level = false, .data_io_default_level = false,
.max_transfer_sz = CROWPANEL_SPI_TRANSFER_SIZE_LIMIT, .max_transfer_sz = LCD_SPI_TRANSFER_SIZE_LIMIT,
.flags = 0, .flags = 0,
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO, .isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
.intr_flags = 0 .intr_flags = 0

View File

@ -1,5 +0,0 @@
#pragma once
#include <Tactility/hal/Configuration.h>
extern const tt::hal::Configuration crowpanel_basic_28;

View File

@ -7,10 +7,10 @@
std::shared_ptr<Xpt2046Touch> createTouch() { std::shared_ptr<Xpt2046Touch> createTouch() {
auto configuration = std::make_unique<Xpt2046Touch::Configuration>( auto configuration = std::make_unique<Xpt2046Touch::Configuration>(
CROWPANEL_LCD_SPI_HOST, LCD_SPI_HOST,
CROWPANEL_TOUCH_PIN_CS, TOUCH_PIN_CS,
240, LCD_HORIZONTAL_RESOLUTION,
320, LCD_VERTICAL_RESOLUTION,
false, false,
true, true,
false false
@ -20,20 +20,30 @@ std::shared_ptr<Xpt2046Touch> createTouch() {
} }
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() { std::shared_ptr<tt::hal::display::DisplayDevice> 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<Ili934xDisplay::Configuration>( auto spi_configuration = std::make_shared<Ili934xDisplay::SpiConfiguration>(Ili934xDisplay::SpiConfiguration {
CROWPANEL_LCD_SPI_HOST, .spiHostDevice = LCD_SPI_HOST,
CROWPANEL_LCD_PIN_CS, .csPin = LCD_PIN_CS,
CROWPANEL_LCD_PIN_DC, .dcPin = LCD_PIN_DC,
240, .pixelClockFrequency = 40'000'000,
320, .transactionQueueDepth = 10
touch });
);
configuration->mirrorX = true; return std::make_shared<Ili934xDisplay>(panel_configuration, spi_configuration, true);
configuration->backlightDutyFunction = driver::pwmbacklight::setBacklightDuty;
auto display = std::make_shared<Ili934xDisplay>(std::move(configuration));
return std::reinterpret_pointer_cast<tt::hal::display::DisplayDevice>(display);
} }

View File

@ -1,13 +1,17 @@
#pragma once #pragma once
#include <Tactility/hal/display/DisplayDevice.h> #include <Tactility/hal/display/DisplayDevice.h>
#include <driver/gpio.h>
#include <driver/spi_common.h>
#define CROWPANEL_LCD_SPI_HOST SPI2_HOST constexpr auto LCD_SPI_HOST = SPI2_HOST;
#define CROWPANEL_LCD_PIN_CS GPIO_NUM_15 constexpr auto LCD_PIN_CS = GPIO_NUM_15;
#define CROWPANEL_TOUCH_PIN_CS GPIO_NUM_33 constexpr auto TOUCH_PIN_CS = GPIO_NUM_33;
#define CROWPANEL_LCD_PIN_DC GPIO_NUM_2 // RS constexpr auto LCD_PIN_DC = GPIO_NUM_2; // RS
#define CROWPANEL_LCD_HORIZONTAL_RESOLUTION 320 constexpr auto LCD_HORIZONTAL_RESOLUTION = 240;
#define CROWPANEL_LCD_VERTICAL_RESOLUTION 240 constexpr auto LCD_VERTICAL_RESOLUTION = 320;
#define CROWPANEL_LCD_SPI_TRANSFER_HEIGHT (CROWPANEL_LCD_VERTICAL_RESOLUTION / 10) 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<tt::hal::display::DisplayDevice> createDisplay(); std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();

View File

@ -3,8 +3,8 @@
#include "devices/Display.h" #include "devices/Display.h"
#include "devices/SdCard.h" #include "devices/SdCard.h"
#include <Xpt2046Power.h>
#include <Tactility/hal/Configuration.h> #include <Tactility/hal/Configuration.h>
#include <Xpt2046Power.h>
constexpr auto CROWPANEL_SPI_TRANSFER_SIZE_LIMIT = (CROWPANEL_LCD_HORIZONTAL_RESOLUTION * CROWPANEL_LCD_SPI_TRANSFER_HEIGHT * (LV_COLOR_DEPTH / 8)); 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, .initBoot = initBoot,
.createDevices = createDevices, .createDevices = createDevices,
.i2c = { .i2c = {

View File

@ -1,5 +0,0 @@
#pragma once
#include <Tactility/hal/Configuration.h>
extern const tt::hal::Configuration crowpanel_basic_35;

View File

@ -1,8 +1,8 @@
#include "devices/Display.h" #include "devices/Display.h"
#include "devices/SdCard.h" #include "devices/SdCard.h"
#include <PwmBacklight.h>
#include <Tactility/hal/Configuration.h> #include <Tactility/hal/Configuration.h>
#include <PwmBacklight.h>
using namespace tt::hal; using namespace tt::hal;
@ -18,7 +18,7 @@ static DeviceVector createDevices() {
}; };
} }
extern const Configuration crowpanel_basic_50 = { extern const Configuration hardwareConfiguration = {
.initBoot = initBoot, .initBoot = initBoot,
.createDevices = createDevices, .createDevices = createDevices,
.i2c = { .i2c = {

View File

@ -1,5 +0,0 @@
#pragma once
#include <Tactility/hal/Configuration.h>
extern const tt::hal::Configuration crowpanel_basic_50;

View File

@ -1,13 +1,13 @@
#include "Tactility/lvgl/LvglSync.h"
#include "devices/Display.h" #include "devices/Display.h"
#include "devices/SdCard.h" #include "devices/SdCard.h"
#include "devices/TpagerEncoder.h" #include "devices/TpagerEncoder.h"
#include "devices/TpagerKeyboard.h" #include "devices/TpagerKeyboard.h"
#include "devices/TpagerPower.h" #include "devices/TpagerPower.h"
#include <Tactility/hal/Configuration.h>
#include <Tactility/lvgl/LvglSync.h>
#include <Bq25896.h> #include <Bq25896.h>
#include <Drv2605.h> #include <Drv2605.h>
#include <Tactility/hal/Configuration.h>
#define TPAGER_SPI_TRANSFER_SIZE_LIMIT (480 * 222 * (LV_COLOR_DEPTH / 8)) #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, .initBoot = tpagerInit,
.createDevices = createDevices, .createDevices = createDevices,
.i2c = { .i2c = {

View File

@ -1,5 +0,0 @@
#pragma once
#include <Tactility/hal/Configuration.h>
extern const tt::hal::Configuration lilygo_tlora_pager;

View File

@ -1,11 +1,11 @@
#include <Tactility/hal/Configuration.h>
#include <Tactility/lvgl/LvglSync.h>
#include "devices/Display.h" #include "devices/Display.h"
#include "devices/Power.h" #include "devices/Power.h"
#include "devices/Sdcard.h" #include "devices/Sdcard.h"
#include "devices/TdeckKeyboard.h" #include "devices/TdeckKeyboard.h"
#include <Tactility/hal/Configuration.h>
#include <Tactility/lvgl/LvglSync.h>
bool initBoot(); bool initBoot();
using namespace tt::hal; using namespace tt::hal;
@ -19,7 +19,7 @@ static std::vector<std::shared_ptr<Device>> createDevices() {
}; };
} }
extern const Configuration lilygo_tdeck = { extern const Configuration hardwareConfiguration = {
.initBoot = initBoot, .initBoot = initBoot,
.createDevices = createDevices, .createDevices = createDevices,
.i2c = { .i2c = {

View File

@ -1,5 +0,0 @@
#pragma once
#include <Tactility/hal/Configuration.h>
extern const tt::hal::Configuration lilygo_tdeck;

View File

@ -38,7 +38,7 @@ std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
.spiHostDevice = LCD_SPI_HOST, .spiHostDevice = LCD_SPI_HOST,
.csPin = LCD_PIN_CS, .csPin = LCD_PIN_CS,
.dcPin = LCD_PIN_DC, .dcPin = LCD_PIN_DC,
.pixelClockFrequency = 80'000'000, .pixelClockFrequency = 62'500'000,
.transactionQueueDepth = 10 .transactionQueueDepth = 10
}); });

View File

@ -1,9 +1,9 @@
#include <Tactility/hal/Configuration.h>
#include <Tactility/lvgl/LvglSync.h>
#include "devices/Display.h" #include "devices/Display.h"
#include "devices/Sdcard.h" #include "devices/Sdcard.h"
#include <Tactility/hal/Configuration.h>
#include <Tactility/lvgl/LvglSync.h>
#define TDECK_SPI_TRANSFER_SIZE_LIMIT (80 * 160 * (LV_COLOR_DEPTH / 8)) #define TDECK_SPI_TRANSFER_SIZE_LIMIT (80 * 160 * (LV_COLOR_DEPTH / 8))
bool initBoot(); bool initBoot();
@ -17,7 +17,7 @@ static std::vector<std::shared_ptr<Device>> createDevices() {
}; };
} }
extern const Configuration lilygo_tdongle_s3 = { extern const Configuration hardwareConfiguration = {
.initBoot = initBoot, .initBoot = initBoot,
.uiScale = UiScale::Smallest, .uiScale = UiScale::Smallest,
.createDevices = createDevices, .createDevices = createDevices,

View File

@ -1,5 +0,0 @@
#pragma once
#include <Tactility/hal/Configuration.h>
extern const tt::hal::Configuration lilygo_tdongle_s3;

View File

@ -1,4 +1,3 @@
#include "M5stackCardputer.h"
#include "InitBoot.h" #include "InitBoot.h"
#include "devices/Display.h" #include "devices/Display.h"
#include "devices/SdCard.h" #include "devices/SdCard.h"
@ -6,8 +5,9 @@
#include "devices/CardputerKeyboard.h" #include "devices/CardputerKeyboard.h"
#include "devices/CardputerPower.h" #include "devices/CardputerPower.h"
#include <lvgl.h> #include <Tactility/hal/Configuration.h>
#include <Tactility/lvgl/LvglSync.h> #include <Tactility/lvgl/LvglSync.h>
#include <lvgl.h>
using namespace tt::hal; using namespace tt::hal;
@ -21,7 +21,7 @@ static DeviceVector createDevices() {
}; };
} }
extern const Configuration m5stack_cardputer = { extern const Configuration hardwareConfiguration = {
.initBoot = initBoot, .initBoot = initBoot,
.uiScale = UiScale::Smallest, .uiScale = UiScale::Smallest,
.createDevices = createDevices, .createDevices = createDevices,

View File

@ -1,5 +0,0 @@
#pragma once
#include <Tactility/hal/Configuration.h>
extern const tt::hal::Configuration m5stack_cardputer;

View File

@ -23,7 +23,7 @@ std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
.spiHostDevice = LCD_SPI_HOST, .spiHostDevice = LCD_SPI_HOST,
.csPin = LCD_PIN_CS, .csPin = LCD_PIN_CS,
.dcPin = LCD_PIN_DC, .dcPin = LCD_PIN_DC,
.pixelClockFrequency = 80'000'000, .pixelClockFrequency = 62'500'000,
.transactionQueueDepth = 10 .transactionQueueDepth = 10
}); });

View File

@ -1,19 +1,13 @@
#include "M5stackCore2.h"
#include "devices/Display.h" #include "devices/Display.h"
#include "devices/SdCard.h" #include "devices/SdCard.h"
#include "devices/Power.h" #include "devices/Power.h"
#include <lvgl.h> #include <Tactility/hal/Configuration.h>
#include <Tactility/lvgl/LvglSync.h> #include <Tactility/lvgl/LvglSync.h>
#define CORE2_SPI_TRANSFER_SIZE_LIMIT (CORE2_LCD_DRAW_BUFFER_SIZE * LV_COLOR_DEPTH / 8)
using namespace tt::hal; using namespace tt::hal;
constexpr auto* TAG = "Core2";
bool initBoot() { bool initBoot() {
TT_LOG_I(TAG, "initBoot");
return initAxp(); return initAxp();
} }
@ -25,7 +19,7 @@ static DeviceVector createDevices() {
}; };
} }
extern const Configuration m5stack_core2 = { extern const Configuration hardwareConfiguration = {
.initBoot = initBoot, .initBoot = initBoot,
.createDevices = createDevices, .createDevices = createDevices,
.i2c = { .i2c = {
@ -79,7 +73,7 @@ extern const Configuration m5stack_core2 = {
.data6_io_num = GPIO_NUM_NC, .data6_io_num = GPIO_NUM_NC,
.data7_io_num = GPIO_NUM_NC, .data7_io_num = GPIO_NUM_NC,
.data_io_default_level = false, .data_io_default_level = false,
.max_transfer_sz = CORE2_SPI_TRANSFER_SIZE_LIMIT, .max_transfer_sz = LCD_SPI_TRANSFER_SIZE_LIMIT,
.flags = 0, .flags = 0,
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO, .isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
.intr_flags = 0 .intr_flags = 0

View File

@ -1,5 +0,0 @@
#pragma once
#include <Tactility/hal/Configuration.h>
extern const tt::hal::Configuration m5stack_core2;

View File

@ -7,8 +7,8 @@ std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
auto configuration = std::make_unique<Ft6x36Touch::Configuration>( auto configuration = std::make_unique<Ft6x36Touch::Configuration>(
I2C_NUM_0, I2C_NUM_0,
GPIO_NUM_39, GPIO_NUM_39,
CORE2_LCD_HORIZONTAL_RESOLUTION, LCD_HORIZONTAL_RESOLUTION,
CORE2_LCD_VERTICAL_RESOLUTION LCD_VERTICAL_RESOLUTION
); );
auto touch = std::make_shared<Ft6x36Touch>(std::move(configuration)); auto touch = std::make_shared<Ft6x36Touch>(std::move(configuration));
@ -16,21 +16,30 @@ std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
} }
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() { std::shared_ptr<tt::hal::display::DisplayDevice> 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<Ili934xDisplay::Configuration>( auto spi_configuration = std::make_shared<Ili934xDisplay::SpiConfiguration>(Ili934xDisplay::SpiConfiguration {
CORE2_LCD_SPI_HOST, .spiHostDevice = LCD_SPI_HOST,
CORE2_LCD_PIN_CS, .csPin = LCD_PIN_CS,
CORE2_LCD_PIN_DC, .dcPin = LCD_PIN_DC,
CORE2_LCD_HORIZONTAL_RESOLUTION, .pixelClockFrequency = 40'000'000,
CORE2_LCD_VERTICAL_RESOLUTION, .transactionQueueDepth = 10
touch, });
false,
false,
false,
true
);
auto display = std::make_shared<Ili934xDisplay>(std::move(configuration)); return std::make_shared<Ili934xDisplay>(panel_configuration, spi_configuration, true);
return std::reinterpret_pointer_cast<tt::hal::display::DisplayDevice>(display);
} }

View File

@ -1,14 +1,17 @@
#pragma once #pragma once
#include "Tactility/hal/display/DisplayDevice.h" #include <Tactility/hal/display/DisplayDevice.h>
#include <driver/gpio.h>
#include <driver/spi_common.h>
#include <memory> #include <memory>
#define CORE2_LCD_SPI_HOST SPI2_HOST constexpr auto LCD_SPI_HOST = SPI2_HOST;
#define CORE2_LCD_PIN_CS GPIO_NUM_5 constexpr auto LCD_PIN_CS = GPIO_NUM_5;
#define CORE2_LCD_PIN_DC GPIO_NUM_15 constexpr auto LCD_PIN_DC = GPIO_NUM_15;
#define CORE2_LCD_HORIZONTAL_RESOLUTION 320 constexpr auto LCD_HORIZONTAL_RESOLUTION = 320;
#define CORE2_LCD_VERTICAL_RESOLUTION 240 constexpr auto LCD_VERTICAL_RESOLUTION = 240;
#define CORE2_LCD_DRAW_BUFFER_HEIGHT (CORE2_LCD_VERTICAL_RESOLUTION / 10) constexpr auto LCD_BUFFER_HEIGHT = LCD_VERTICAL_RESOLUTION / 10;
#define CORE2_LCD_DRAW_BUFFER_SIZE (CORE2_LCD_HORIZONTAL_RESOLUTION * CORE2_LCD_DRAW_BUFFER_HEIGHT) 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<tt::hal::display::DisplayDevice> createDisplay(); std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#include "Tactility/hal/sdcard/SdCardDevice.h" #include <Tactility/hal/sdcard/SdCardDevice.h>
using tt::hal::sdcard::SdCardDevice; using tt::hal::sdcard::SdCardDevice;

View File

@ -1,13 +1,11 @@
#include "M5stackCoreS3.h"
#include "InitBoot.h" #include "InitBoot.h"
#include "devices/Display.h" #include "devices/Display.h"
#include "devices/SdCard.h" #include "devices/SdCard.h"
#include <Axp2101Power.h> #include <Tactility/hal/Configuration.h>
#include <Tactility/lvgl/LvglSync.h>
#include <Tactility/hal/uart/Uart.h> #include <Tactility/hal/uart/Uart.h>
#include <Tactility/lvgl/LvglSync.h>
#define CORES3_TRANSACTION_SIZE (CORES3_LCD_DRAW_BUFFER_SIZE * LV_COLOR_DEPTH / 8) #include <Axp2101Power.h>
using namespace tt::hal; using namespace tt::hal;
@ -21,7 +19,7 @@ static DeviceVector createDevices() {
}; };
} }
const Configuration m5stack_cores3 = { extern const Configuration hardwareConfiguration = {
.initBoot = initBoot, .initBoot = initBoot,
.createDevices = createDevices, .createDevices = createDevices,
.i2c = { .i2c = {
@ -109,7 +107,7 @@ const Configuration m5stack_cores3 = {
.data6_io_num = GPIO_NUM_NC, .data6_io_num = GPIO_NUM_NC,
.data7_io_num = GPIO_NUM_NC, .data7_io_num = GPIO_NUM_NC,
.data_io_default_level = false, .data_io_default_level = false,
.max_transfer_sz = CORES3_TRANSACTION_SIZE, .max_transfer_sz = LCD_SPI_TRANSFER_SIZE_LIMIT,
.flags = 0, .flags = 0,
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO, .isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
.intr_flags = 0 .intr_flags = 0

View File

@ -1,5 +0,0 @@
#pragma once
#include <Tactility/hal/Configuration.h>
extern const tt::hal::Configuration m5stack_cores3;

View File

@ -20,8 +20,8 @@ static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
// Note for future changes: Reset pin is 48 and interrupt pin is 47 // Note for future changes: Reset pin is 48 and interrupt pin is 47
auto configuration = std::make_unique<Ft5x06Touch::Configuration>( auto configuration = std::make_unique<Ft5x06Touch::Configuration>(
I2C_NUM_0, I2C_NUM_0,
320, LCD_HORIZONTAL_RESOLUTION,
240 LCD_VERTICAL_RESOLUTION
); );
auto touch = std::make_shared<Ft5x06Touch>(std::move(configuration)); auto touch = std::make_shared<Ft5x06Touch>(std::move(configuration));
@ -29,23 +29,30 @@ static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
} }
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() { std::shared_ptr<tt::hal::display::DisplayDevice> 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<Ili934xDisplay::Configuration>( auto spi_configuration = std::make_shared<Ili934xDisplay::SpiConfiguration>(Ili934xDisplay::SpiConfiguration {
SPI3_HOST, .spiHostDevice = LCD_SPI_HOST,
GPIO_NUM_3, .csPin = LCD_PIN_CS,
GPIO_NUM_35, .dcPin = LCD_PIN_DC,
320, .pixelClockFrequency = 40'000'000,
240, .transactionQueueDepth = 10
touch, });
false,
false,
false,
true
);
configuration->backlightDutyFunction = ::setBacklightDuty; return std::make_shared<Ili934xDisplay>(panel_configuration, spi_configuration, true);
auto display = std::make_shared<Ili934xDisplay>(std::move(configuration));
return std::reinterpret_pointer_cast<tt::hal::display::DisplayDevice>(display);
} }

View File

@ -1,14 +1,17 @@
#pragma once #pragma once
#include <Tactility/hal/display/DisplayDevice.h> #include <Tactility/hal/display/DisplayDevice.h>
#include <driver/gpio.h>
#include <driver/spi_common.h>
// Display // Display
#define CORES3_LCD_SPI_HOST SPI3_HOST constexpr auto LCD_SPI_HOST = SPI3_HOST;
#define CORES3_LCD_PIN_CS GPIO_NUM_3 constexpr auto LCD_PIN_CS = GPIO_NUM_3;
#define CORES3_LCD_PIN_DC GPIO_NUM_35 constexpr auto LCD_PIN_DC = GPIO_NUM_35;
#define CORES3_LCD_HORIZONTAL_RESOLUTION 320 constexpr auto LCD_HORIZONTAL_RESOLUTION = 320;
#define CORES3_LCD_VERTICAL_RESOLUTION 240 constexpr auto LCD_VERTICAL_RESOLUTION = 240;
#define CORES3_LCD_DRAW_BUFFER_HEIGHT (CORES3_LCD_VERTICAL_RESOLUTION / 10) constexpr auto LCD_BUFFER_HEIGHT = LCD_VERTICAL_RESOLUTION / 10;
#define CORES3_LCD_DRAW_BUFFER_SIZE (CORES3_LCD_HORIZONTAL_RESOLUTION * CORES3_LCD_DRAW_BUFFER_HEIGHT) 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<tt::hal::display::DisplayDevice> createDisplay(); std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();

View File

@ -1,9 +1,9 @@
#include "M5StackStickCPlus.h"
#include "devices/Display.h" #include "devices/Display.h"
#include "devices/Power.h" #include "devices/Power.h"
#include <ButtonControl.h>
#include <Tactility/hal/Configuration.h>
#include <Tactility/lvgl/LvglSync.h> #include <Tactility/lvgl/LvglSync.h>
#include <ButtonControl.h>
using namespace tt::hal; using namespace tt::hal;
@ -24,7 +24,7 @@ static DeviceVector createDevices() {
}; };
} }
extern const Configuration m5stack_stickc_plus = { extern const Configuration hardwareConfiguration = {
.initBoot = initBoot, .initBoot = initBoot,
.uiScale = UiScale::Smallest, .uiScale = UiScale::Smallest,
.createDevices = createDevices, .createDevices = createDevices,

View File

@ -1,5 +0,0 @@
#pragma once
#include <Tactility/hal/Configuration.h>
extern const tt::hal::Configuration m5stack_stickc_plus;

View File

@ -1,9 +1,9 @@
#include "M5StackStickCPlus2.h"
#include "devices/Display.h" #include "devices/Display.h"
#include <Tactility/hal/Configuration.h>
#include <Tactility/lvgl/LvglSync.h>
#include <ButtonControl.h> #include <ButtonControl.h>
#include <PwmBacklight.h> #include <PwmBacklight.h>
#include <Tactility/lvgl/LvglSync.h>
using namespace tt::hal; using namespace tt::hal;
@ -26,7 +26,7 @@ static DeviceVector createDevices() {
}; };
} }
extern const Configuration m5stack_stickc_plus2 = { extern const Configuration hardwareConfiguration = {
.initBoot = initBoot, .initBoot = initBoot,
.uiScale = UiScale::Smallest, .uiScale = UiScale::Smallest,
.createDevices = createDevices, .createDevices = createDevices,

View File

@ -1,5 +0,0 @@
#pragma once
#include <Tactility/hal/Configuration.h>
extern const tt::hal::Configuration m5stack_stickc_plus2;

View File

@ -37,7 +37,7 @@ static std::vector<std::shared_ptr<Device>> createDevices() {
}; };
} }
extern const Configuration hardware = { extern const Configuration hardwareConfiguration = {
.initBoot = initBoot, .initBoot = initBoot,
.createDevices = createDevices, .createDevices = createDevices,
.i2c = { .i2c = {

View File

@ -1,9 +1,10 @@
#include "Tactility/lvgl/LvglSync.h"
#include "UnPhoneFeatures.h" #include "UnPhoneFeatures.h"
#include "Xpt2046Power.h"
#include "devices/Hx8357Display.h" #include "devices/Hx8357Display.h"
#include "devices/SdCard.h" #include "devices/SdCard.h"
#include <Tactility/hal/Configuration.h> #include <Tactility/hal/Configuration.h>
#include <Tactility/lvgl/LvglSync.h>
#include <Xpt2046Power.h>
#define UNPHONE_SPI_TRANSFER_SIZE_LIMIT (UNPHONE_LCD_HORIZONTAL_RESOLUTION * UNPHONE_LCD_SPI_TRANSFER_HEIGHT * LV_COLOR_DEPTH / 8) #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, .initBoot = initBoot,
.createDevices = createDevices, .createDevices = createDevices,
.i2c = { .i2c = {

View File

@ -1,5 +0,0 @@
#pragma once
#include <Tactility/hal/Configuration.h>
extern const tt::hal::Configuration unPhone;

View File

@ -1,9 +1,9 @@
#include "devices/Display.h" #include "devices/Display.h"
#include "devices/SdCard.h" #include "devices/SdCard.h"
#include <PwmBacklight.h>
#include <Tactility/hal/Configuration.h> #include <Tactility/hal/Configuration.h>
#include <Tactility/lvgl/LvglSync.h> #include <Tactility/lvgl/LvglSync.h>
#include <PwmBacklight.h>
using namespace tt::hal; using namespace tt::hal;
@ -18,7 +18,7 @@ static bool initBoot() {
return driver::pwmbacklight::init(GPIO_NUM_20, 256); return driver::pwmbacklight::init(GPIO_NUM_20, 256);
} }
extern const Configuration waveshare_s3_lcd_13 = { extern const Configuration hardwareConfiguration = {
.initBoot = initBoot, .initBoot = initBoot,
.uiScale = UiScale::Smallest, .uiScale = UiScale::Smallest,
.createDevices = createDevices, .createDevices = createDevices,

View File

@ -1,5 +0,0 @@
#pragma once
#include <Tactility/hal/Configuration.h>
extern const tt::hal::Configuration waveshare_s3_lcd_13;

View File

@ -23,7 +23,7 @@ std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
.spiHostDevice = SPI2_HOST, .spiHostDevice = SPI2_HOST,
.csPin = GPIO_NUM_39, .csPin = GPIO_NUM_39,
.dcPin = GPIO_NUM_38, .dcPin = GPIO_NUM_38,
.pixelClockFrequency = 80'000'000, .pixelClockFrequency = 62'500'000,
.transactionQueueDepth = 10 .transactionQueueDepth = 10
}); });

View File

@ -12,7 +12,7 @@ static DeviceVector createDevices() {
}; };
} }
extern const Configuration waveshare_s3_touch_43 = { extern const Configuration hardwareConfiguration = {
.uiScale = UiScale::Smallest, .uiScale = UiScale::Smallest,
.createDevices = createDevices, .createDevices = createDevices,
.i2c = { .i2c = {

View File

@ -1,5 +0,0 @@
#pragma once
#include <Tactility/hal/Configuration.h>
extern const tt::hal::Configuration waveshare_s3_touch_43;

View File

@ -1,9 +1,9 @@
#include "devices/Display.h" #include "devices/Display.h"
#include "devices/SdCard.h" #include "devices/SdCard.h"
#include <PwmBacklight.h>
#include <Tactility/hal/Configuration.h> #include <Tactility/hal/Configuration.h>
#include <Tactility/lvgl/LvglSync.h> #include <Tactility/lvgl/LvglSync.h>
#include <PwmBacklight.h>
using namespace tt::hal; using namespace tt::hal;
@ -20,7 +20,7 @@ static bool initBoot() {
return driver::pwmbacklight::init(GPIO_NUM_2, 256); return driver::pwmbacklight::init(GPIO_NUM_2, 256);
} }
extern const Configuration waveshare_s3_touch_lcd_128 = { extern const Configuration hardwareConfiguration = {
.initBoot = initBoot, .initBoot = initBoot,
.uiScale = UiScale::Smallest, .uiScale = UiScale::Smallest,
.createDevices = createDevices, .createDevices = createDevices,

View File

@ -1,5 +0,0 @@
#pragma once
#include <Tactility/hal/Configuration.h>
extern const tt::hal::Configuration waveshare_s3_touch_lcd_128;

View File

@ -1,9 +1,9 @@
#include <Tactility/hal/Configuration.h>
#include <Tactility/lvgl/LvglSync.h>
#include "devices/Display.h" #include "devices/Display.h"
#include "devices/Sdcard.h" #include "devices/Sdcard.h"
#include <Tactility/hal/Configuration.h>
#include <Tactility/lvgl/LvglSync.h>
#define SPI_TRANSFER_SIZE_LIMIT (172 * 320 * (LV_COLOR_DEPTH / 8)) #define SPI_TRANSFER_SIZE_LIMIT (172 * 320 * (LV_COLOR_DEPTH / 8))
bool initBoot(); bool initBoot();
@ -17,7 +17,7 @@ static std::vector<std::shared_ptr<Device>> createDevices() {
}; };
} }
extern const Configuration waveshare_s3_touch_lcd_147 = { extern const Configuration hardwareConfiguration = {
.initBoot = initBoot, .initBoot = initBoot,
.uiScale = UiScale::Smallest, .uiScale = UiScale::Smallest,
.createDevices = createDevices, .createDevices = createDevices,

View File

@ -1,5 +0,0 @@
#pragma once
#include <Tactility/hal/Configuration.h>
extern const tt::hal::Configuration waveshare_s3_touch_lcd_147;

View File

@ -2,11 +2,11 @@
## Before release ## Before release
- Make better esp_lcd driver (and test all devices) - Convert Ili934x driver to EspLcdSpiDisplay
- AppInstall.cpp fails to untar large files on Cardputer (EFF large word list doesn't fit in memory). Make a buffered reader & writer.
## Higher Priority ## Higher Priority
- Logging with a function that uses std::format
- Calculator bugs (see GitHub issue) - Calculator bugs (see GitHub issue)
- Expose http::download() and main dispatcher to TactiltyC. - 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 - 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. The latter is used for auto-selecting it as data partition.
- Support direct installation of an `.app` file with `tactility.py install helloworld.app <ip>` - Support direct installation of an `.app` file with `tactility.py install helloworld.app <ip>`
- Support `tactility.py target <ip>` to remember the device IP address. - Support `tactility.py target <ip>` to remember the device IP address.
- minitar/untarFile(): "entry->metadata.path" can escape its confined path (e.g. "../something")
## Medium Priority ## Medium Priority

View File

@ -1,14 +1,13 @@
#pragma once #pragma once
#include "Tactility/Lock.h" #include <Tactility/Lock.h>
#include <Tactility/Check.h>
#include <Tactility/hal/display/DisplayDevice.h> #include <Tactility/hal/display/DisplayDevice.h>
#include <esp_lcd_types.h> #include <esp_lcd_types.h>
#include <esp_lvgl_port_disp.h> #include <esp_lvgl_port_disp.h>
#include <Tactility/Check.h>
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_io_handle_t _Nullable ioHandle = nullptr;
esp_lcd_panel_handle_t _Nullable panelHandle = nullptr; esp_lcd_panel_handle_t _Nullable panelHandle = nullptr;

View File

@ -26,6 +26,8 @@ struct EspLcdConfiguration {
gpio_num_t resetPin; gpio_num_t resetPin;
lv_color_format_t lvglColorFormat; lv_color_format_t lvglColorFormat;
bool lvglSwapBytes; bool lvglSwapBytes;
lcd_rgb_element_order_t rgbElementOrder;
uint32_t bitsPerPixel;
}; };
class EspLcdDisplayV2 : public tt::hal::display::DisplayDevice { class EspLcdDisplayV2 : public tt::hal::display::DisplayDevice {

View File

@ -1,152 +1,43 @@
#include "Ili934xDisplay.h" #include "Ili934xDisplay.h"
#include <Tactility/Log.h>
#include <esp_lcd_ili9341.h> #include <esp_lcd_ili9341.h>
#include <esp_lcd_panel_commands.h>
#include <esp_lvgl_port.h> #include <esp_lvgl_port.h>
constexpr const char* TAG = "ILI934x"; std::shared_ptr<EspLcdConfiguration> Ili934xDisplay::createEspLcdConfiguration(const Configuration& configuration) {
return std::make_shared<EspLcdConfiguration>(EspLcdConfiguration {
bool Ili934xDisplay::createIoHandle(esp_lcd_panel_io_handle_t& outHandle) { .horizontalResolution = configuration.horizontalResolution,
const esp_lcd_panel_io_spi_config_t panel_io_config = { .verticalResolution = configuration.verticalResolution,
.cs_gpio_num = configuration->csPin, .gapX = configuration.gapX,
.dc_gpio_num = configuration->dcPin, .gapY = configuration.gapY,
.spi_mode = 0, .monochrome = false,
.pclk_hz = configuration->pixelClockFrequency, .swapXY = configuration.swapXY,
.trans_queue_depth = configuration->transactionQueueDepth, .mirrorX = configuration.mirrorX,
.on_color_trans_done = nullptr, .mirrorY = configuration.mirrorY,
.user_ctx = nullptr, .invertColor = configuration.invertColor,
.lcd_cmd_bits = 8, .bufferSize = configuration.bufferSize,
.lcd_param_bits = 8, .touch = configuration.touch,
.cs_ena_pretrans = 0, .backlightDutyFunction = configuration.backlightDutyFunction,
.cs_ena_posttrans = 0, .resetPin = configuration.resetPin,
.flags = { .lvglColorFormat = LV_COLOR_FORMAT_RGB565,
.dc_high_on_cmd = 0, .lvglSwapBytes = configuration.swapBytes,
.dc_low_on_data = 0, .rgbElementOrder = configuration.rgbElementOrder,
.dc_low_on_param = 0, .bitsPerPixel = 16
.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;
} }
bool Ili934xDisplay::createPanelHandle(esp_lcd_panel_io_handle_t ioHandle, esp_lcd_panel_handle_t& panelHandle) { esp_lcd_panel_dev_config_t Ili934xDisplay::createPanelConfig(std::shared_ptr<EspLcdConfiguration> espLcdConfiguration, gpio_num_t resetPin) {
const esp_lcd_panel_dev_config_t panel_config = { return {
.reset_gpio_num = configuration->resetPin, .reset_gpio_num = resetPin,
.rgb_ele_order = configuration->rgbElementOrder, .rgb_ele_order = espLcdConfiguration->rgbElementOrder,
.data_endian = LCD_RGB_DATA_ENDIAN_LITTLE, .data_endian = LCD_RGB_DATA_ENDIAN_LITTLE,
.bits_per_pixel = 16, .bits_per_pixel = espLcdConfiguration->bitsPerPixel,
.flags = { .flags = {
.reset_active_high = false .reset_active_high = 0
}, },
.vendor_config = nullptr .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) { 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 { return esp_lcd_new_panel_ili9341(ioHandle, &panelConfig, &panelHandle) == ESP_OK;
.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");
}
} }

View File

@ -1,107 +1,55 @@
#pragma once #pragma once
#include <Tactility/hal/display/DisplayDevice.h> #include <EspLcdSpiDisplay.h>
#include <Tactility/hal/spi/Spi.h>
#include <EspLcdDisplay.h>
#include <driver/gpio.h> #include <driver/gpio.h>
#include <esp_lcd_panel_io.h>
#include <esp_lcd_types.h>
#include <functional> #include <functional>
#include <lvgl.h> #include <lvgl.h>
class Ili934xDisplay final : public EspLcdDisplay { class Ili934xDisplay final : public EspLcdSpiDisplay {
std::shared_ptr<tt::Lock> lock;
public: public:
class Configuration { /** Minimal set of overrides for EspLcdConfiguration */
struct 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<tt::hal::touch::TouchDevice> 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;
unsigned int horizontalResolution; unsigned int horizontalResolution;
unsigned int verticalResolution; unsigned int verticalResolution;
bool swapXY = false; int gapX;
bool mirrorX = false; int gapY;
bool mirrorY = false; bool swapXY;
bool invertColor = false; bool mirrorX;
uint32_t bufferSize = 0; // Size in pixel count. 0 means default, which is 1/10 of the screen size bool mirrorY;
lcd_rgb_element_order_t rgbElementOrder = LCD_RGB_ELEMENT_ORDER_BGR; 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<tt::hal::touch::TouchDevice> touch; std::shared_ptr<tt::hal::touch::TouchDevice> touch;
std::function<void(uint8_t)> _Nullable backlightDutyFunction = nullptr; std::function<void(uint8_t)> _Nullable backlightDutyFunction;
gpio_num_t resetPin;
lcd_rgb_element_order_t rgbElementOrder;
}; };
private: private:
std::unique_ptr<Configuration> configuration; static std::shared_ptr<EspLcdConfiguration> 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> espLcdConfiguration, gpio_num_t resetPin) override;
bool createPanelHandle(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;
lvgl_port_display_cfg_t getLvglPortDisplayConfig(esp_lcd_panel_io_handle_t ioHandle, esp_lcd_panel_handle_t panelHandle) override;
public: public:
explicit Ili934xDisplay(std::unique_ptr<Configuration> inConfiguration) : explicit Ili934xDisplay(const Configuration& configuration, const std::shared_ptr<SpiConfiguration>& spiConfiguration, bool hasGammaCurves) :
EspLcdDisplay(tt::hal::spi::getLock(inConfiguration->spiHostDevice)), EspLcdSpiDisplay(
configuration(std::move(inConfiguration) createEspLcdConfiguration(configuration),
) { spiConfiguration,
assert(configuration != nullptr); (hasGammaCurves ? 4 : 0)
)
{
} }
std::string getName() const override { return "ILI934x"; } std::string getName() const override { return "ILI934x"; }
std::string getDescription() const override { return "ILI934x display"; } std::string getDescription() const override { return "ILI934x display"; }
std::shared_ptr<tt::hal::touch::TouchDevice> _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; };
}; };

View File

@ -18,16 +18,18 @@ std::shared_ptr<EspLcdConfiguration> St7789Display::createEspLcdConfiguration(co
.backlightDutyFunction = configuration.backlightDutyFunction, .backlightDutyFunction = configuration.backlightDutyFunction,
.resetPin = configuration.resetPin, .resetPin = configuration.resetPin,
.lvglColorFormat = LV_COLOR_FORMAT_RGB565, .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> espLcdConfiguration, gpio_num_t resetPin) { esp_lcd_panel_dev_config_t St7789Display::createPanelConfig(std::shared_ptr<EspLcdConfiguration> espLcdConfiguration, gpio_num_t resetPin) {
return { return {
.reset_gpio_num = resetPin, .reset_gpio_num = resetPin,
.rgb_ele_order = LCD_RGB_ELEMENT_ORDER_RGB, .rgb_ele_order = espLcdConfiguration->rgbElementOrder,
.data_endian = LCD_RGB_DATA_ENDIAN_LITTLE, .data_endian = LCD_RGB_DATA_ENDIAN_LITTLE,
.bits_per_pixel = 16, .bits_per_pixel = espLcdConfiguration->bitsPerPixel,
.flags = { .flags = {
.reset_active_high = false .reset_active_high = false
}, },

View File

@ -1,9 +1,6 @@
#pragma once #pragma once
#include "Tactility/hal/spi/Spi.h"
#include <EspLcdSpiDisplay.h> #include <EspLcdSpiDisplay.h>
#include <Tactility/hal/display/DisplayDevice.h>
#include <driver/gpio.h> #include <driver/gpio.h>
#include <functional> #include <functional>

View File

@ -1,104 +0,0 @@
#pragma once
#include <Tactility/hal/Configuration.h>
#ifdef ESP_PLATFORM
#include <sdkconfig.h>
// 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

View File

@ -1,11 +1,11 @@
#include "Boards.h"
#include <Tactility/Tactility.h> #include <Tactility/Tactility.h>
#ifdef ESP_PLATFORM #ifdef ESP_PLATFORM
#include "tt_init.h" #include <tt_init.h>
#endif #endif
extern const tt::app::AppManifest hello_world_app; // Each board project declares this variable
extern const tt::hal::Configuration hardwareConfiguration;
extern "C" { extern "C" {
@ -15,7 +15,7 @@ void app_main() {
* Auto-select a board based on the ./sdkconfig.board.* file * Auto-select a board based on the ./sdkconfig.board.* file
* that you copied to ./sdkconfig before you opened this project. * that you copied to ./sdkconfig before you opened this project.
*/ */
.hardware = TT_BOARD_HARDWARE .hardware = &hardwareConfiguration
}; };
#ifdef ESP_PLATFORM #ifdef ESP_PLATFORM

@ -1 +1 @@
Subproject commit 78c254ba114f6b66d888149d4ad0eff178dceb88 Subproject commit 23329dbf4c8237375343472952beb76f62693dda

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#include "Tactility/hal/spi/Spi.h" #include <Tactility/hal/spi/Spi.h>
#include <vector> #include <vector>
#include <memory> #include <memory>
@ -12,6 +12,6 @@ namespace tt::hal::spi {
* @param[in] configurations HAL configuration for a board * @param[in] configurations HAL configuration for a board
* @return true on success * @return true on success
*/ */
bool init(const std::vector<spi::Configuration>& configurations); bool init(const std::vector<Configuration>& configurations);
} }

View File

@ -1,8 +1,5 @@
#include "Tactility/Paths.h"
#include <Tactility/app/App.h> #include <Tactility/app/App.h>
#include <Tactility/app/AppManifestParsing.h> #include <Tactility/app/AppManifestParsing.h>
#include <Tactility/app/AppManifest.h> #include <Tactility/app/AppManifest.h>
#include <Tactility/app/AppRegistration.h> #include <Tactility/app/AppRegistration.h>
#include <Tactility/file/File.h> #include <Tactility/file/File.h>
@ -10,15 +7,15 @@
#include <Tactility/file/PropertiesFile.h> #include <Tactility/file/PropertiesFile.h>
#include <Tactility/hal/Device.h> #include <Tactility/hal/Device.h>
#include <Tactility/hal/sdcard/SdCardDevice.h> #include <Tactility/hal/sdcard/SdCardDevice.h>
#include <Tactility/Paths.h>
#include <errno.h> #include <cerrno>
#include <cstdio>
#include <cstring>
#include <fcntl.h> #include <fcntl.h>
#include <format> #include <format>
#include <libgen.h> #include <libgen.h>
#include <map> #include <map>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h> #include <unistd.h>
@ -28,22 +25,28 @@ constexpr auto* TAG = "App";
namespace tt::app { namespace tt::app {
static int untarFile(const minitar_entry* entry, const void* buf, const std::string& destinationPath) { static bool untarFile(minitar mp, const minitar_entry* entry, const std::string& destinationPath) {
auto absolute_path = destinationPath + "/" + entry->metadata.path; const auto absolute_path = destinationPath + "/" + entry->metadata.path;
if (!file::findOrCreateDirectory(destinationPath, 0777)) return 1; 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); // minitar_read_contents(&mp, &entry, file_buffer, entry.metadata.size);
if (fd < 0) return 1; 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());
if (write(fd, buf, entry->metadata.size) < 0) return 1; return false;
}
// Note: fchmod() doesn't exist on ESP-IDF and chmod() does nothing on that platform // 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; auto absolute_path = destinationPath + "/" + entry->metadata.path;
if (!file::findOrCreateDirectory(absolute_path, 0777)) return false; if (!file::findOrCreateDirectory(absolute_path, 0777)) return false;
return true; 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); TT_LOG_I(TAG, "Extracting %s", entry.metadata.path);
if (entry.metadata.type == MTAR_DIRECTORY) { if (entry.metadata.type == MTAR_DIRECTORY) {
if (!strcmp(entry.metadata.name, ".") || !strcmp(entry.metadata.name, "..") || !strcmp(entry.metadata.name, "/")) continue; 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)); TT_LOG_E(TAG, "Failed to create directory %s/%s: %s", destinationPath.c_str(), entry.metadata.name, strerror(errno));
success = false; success = false;
break; break;
} }
} else if (entry.metadata.type == MTAR_REGULAR) { } else if (entry.metadata.type == MTAR_REGULAR) {
auto file_buffer = static_cast<char*>(malloc(entry.metadata.size)); if (!untarFile(mp, &entry, destinationPath)) {
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) {
TT_LOG_E(TAG, "Failed to extract file %s: %s", entry.metadata.path, strerror(errno)); TT_LOG_E(TAG, "Failed to extract file %s: %s", entry.metadata.path, strerror(errno));
success = false; success = false;
break; break;

View File

@ -11,6 +11,7 @@
#include <Tactility/service/wifi/Wifi.h> #include <Tactility/service/wifi/Wifi.h>
#include <lvgl.h> #include <lvgl.h>
#include <algorithm>
#include <format> #include <format>
namespace tt::app::apphub { namespace tt::app::apphub {

View File

@ -1,14 +1,12 @@
#include "Tactility/kernel/SystemEvents.h" #include "Tactility/kernel/SystemEvents.h"
#include <Tactility/Mutex.h> #include <Tactility/Mutex.h>
#include <Tactility/CoreExtraDefines.h>
#include <list> #include <list>
#define TAG "system_event"
namespace tt::kernel { namespace tt::kernel {
constexpr auto* TAG = "SystemEvents";
struct SubscriptionData { struct SubscriptionData {
SystemEventSubscription id; SystemEventSubscription id;
SystemEvent event; SystemEvent event;

View File

@ -1,9 +1,9 @@
#pragma once #pragma once
#include "CoreExtraDefines.h"
#define TT_UNUSED __attribute__((unused)) #define TT_UNUSED __attribute__((unused))
#define TT_STRINGIFY(x) #x
// region Variable arguments support // region Variable arguments support
// Adapted from https://stackoverflow.com/a/78848701/3848666 // 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_ARGCOUNT4(X,...) _TT_ARGCOUNT ## __VA_OPT__(5(__VA_ARGS__) TT_ARG_IGNORE) (4)
#define _TT_ARGCOUNT5(X,...) 5 #define _TT_ARGCOUNT5(X,...) 5
#define _TT_ARGCOUNT(X) X #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

View File

@ -1,3 +0,0 @@
#pragma once
#define TT_STRINGIFY(x) #x

View File

@ -4,7 +4,6 @@
#include "RtosCompat.h" #include "RtosCompat.h"
#include <memory> #include <memory>
#include <functional> #include <functional>
#include <algorithm>
namespace tt { namespace tt {

View File

@ -4,7 +4,6 @@
#include "Check.h" #include "Check.h"
#include "CoreDefines.h" #include "CoreDefines.h"
#include "CoreExtraDefines.h"
#include "EventFlag.h" #include "EventFlag.h"
#include "kernel/Kernel.h" #include "kernel/Kernel.h"
#include "kernel/critical/Critical.h" #include "kernel/critical/Critical.h"

View File

@ -1,7 +1,7 @@
# Software defaults # Software defaults
# Increase stack size for WiFi (fixes crash after scan) # Increase stack size for WiFi (fixes crash after scan)
CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=3072 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_14=y
CONFIG_LV_FONT_MONTSERRAT_18=y CONFIG_LV_FONT_MONTSERRAT_18=y
CONFIG_LV_USE_USER_DATA=y CONFIG_LV_USE_USER_DATA=y

View File

@ -1,7 +1,7 @@
# Software defaults # Software defaults
# Increase stack size for WiFi (fixes crash after scan) # Increase stack size for WiFi (fixes crash after scan)
CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=3072 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_14=y
CONFIG_LV_FONT_MONTSERRAT_18=y CONFIG_LV_FONT_MONTSERRAT_18=y
CONFIG_LV_USE_USER_DATA=y CONFIG_LV_USE_USER_DATA=y

View File

@ -1,7 +1,7 @@
# Software defaults # Software defaults
# Increase stack size for WiFi (fixes crash after scan) # Increase stack size for WiFi (fixes crash after scan)
CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=3072 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_14=y
CONFIG_LV_FONT_MONTSERRAT_18=y CONFIG_LV_FONT_MONTSERRAT_18=y
CONFIG_LV_USE_USER_DATA=y CONFIG_LV_USE_USER_DATA=y

View File

@ -1,7 +1,7 @@
# Software defaults # Software defaults
# Increase stack size for WiFi (fixes crash after scan) # Increase stack size for WiFi (fixes crash after scan)
CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=3072 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_14=y
CONFIG_LV_FONT_MONTSERRAT_18=y CONFIG_LV_FONT_MONTSERRAT_18=y
CONFIG_LV_USE_USER_DATA=y CONFIG_LV_USE_USER_DATA=y

Some files were not shown because too many files have changed in this diff Show More