CYD-E28R32T Implementation (#317)

- Add implementation for CYD-E28R28T. This implementation has the SD card working, using the same driver as the CYD-2432S028R.
- Edit .gitignore for some missing things.
- run chmod +x on some build scripts
- Make EspLcdDisplay's reference public for access from drivers (needed for driver St7789i8080)
> ```class EspLcdDisplay : public tt::hal::display::DisplayDevice {```
This commit is contained in:
NellowTCS
2025-09-06 05:52:46 -06:00
committed by GitHub
parent 1627b9fa85
commit a9b69010d8
21 changed files with 281 additions and 6 deletions
+1 -1
View File
@@ -2,5 +2,5 @@
#include <Tactility/hal/Configuration.h>
// Resitive touch version of the 2.8" yellow board
// Resistive touch version of the 2.8" yellow board
extern const tt::hal::Configuration cyd_2432s028r_config;
+7
View File
@@ -0,0 +1,7 @@
file(GLOB_RECURSE SOURCE_FILES Source/*.c*)
idf_component_register(
SRCS ${SOURCE_FILES}
INCLUDE_DIRS "Source"
REQUIRES Tactility esp_lvgl_port ILI934x XPT2046SoftSPI PwmBacklight driver vfs fatfs
)
+70
View File
@@ -0,0 +1,70 @@
#include "E32R28T.h"
#include "hal/YellowSdCard.h"
#include "hal/YellowDisplay.h"
#include "hal/YellowDisplayConstants.h"
#include <Tactility/lvgl/LvglSync.h>
#include <Tactility/app/App.h>
#include <PwmBacklight.h>
#define CYD_SPI_TRANSFER_SIZE_LIMIT (240 * 320 / 4 * 2)
bool initBoot() {
return driver::pwmbacklight::init(CYD_BACKLIGHT_PIN);
}
const tt::hal::Configuration cyd_e32r28t_config = {
.initBoot = initBoot,
.createDisplay = createDisplay,
.sdcard = createYellowSdCard(),
.power = nullptr,
.i2c = {},
.spi = {
tt::hal::spi::Configuration {
.device = SPI2_HOST,
.dma = SPI_DMA_CH_AUTO,
.config = {
.mosi_io_num = GPIO_NUM_13,
.miso_io_num = GPIO_NUM_12,
.sclk_io_num = GPIO_NUM_14,
.quadwp_io_num = GPIO_NUM_NC,
.quadhd_io_num = GPIO_NUM_NC,
.data4_io_num = GPIO_NUM_NC,
.data5_io_num = GPIO_NUM_NC,
.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,
.flags = 0,
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
.intr_flags = 0
},
.initMode = tt::hal::spi::InitMode::ByTactility,
.isMutable = false,
.lock = tt::lvgl::getSyncLock()
},
tt::hal::spi::Configuration {
.device = SPI3_HOST,
.dma = SPI_DMA_CH_AUTO,
.config = {
.mosi_io_num = GPIO_NUM_23,
.miso_io_num = GPIO_NUM_19,
.sclk_io_num = GPIO_NUM_18,
.quadwp_io_num = GPIO_NUM_NC,
.quadhd_io_num = GPIO_NUM_NC,
.data4_io_num = GPIO_NUM_NC,
.data5_io_num = GPIO_NUM_NC,
.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,
.flags = 0,
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
.intr_flags = 0
},
.initMode = tt::hal::spi::InitMode::ByTactility,
.isMutable = false,
.lock = tt::lvgl::getSyncLock()
},
}
};
+6
View File
@@ -0,0 +1,6 @@
#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;
@@ -0,0 +1,58 @@
#include "YellowDisplay.h"
#include "YellowDisplayConstants.h"
#include "Xpt2046SoftSpi.h"
#include <Ili934xDisplay.h>
#include <PwmBacklight.h>
#include <Tactility/hal/touch/TouchDevice.h>
#include <esp_log.h>
#include <string>
static const char* TAG = "YellowDisplay";
// Global to hold reference (only needed if calling stop() later)
static std::unique_ptr<Xpt2046SoftSpi> touch;
static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
ESP_LOGI(TAG, "Creating bitbang SPI touch");
// Create bitbang config object
auto config = std::make_unique<Xpt2046SoftSpi::Configuration>(
CYD_TOUCH_MOSI_PIN,
CYD_TOUCH_MISO_PIN,
CYD_TOUCH_SCK_PIN,
CYD_TOUCH_CS_PIN,
CYD_DISPLAY_HORIZONTAL_RESOLUTION, // 240
CYD_DISPLAY_VERTICAL_RESOLUTION, // 320
false, // swapXY
true, // mirrorX
false // mirrorY
);
// Allocate the driver
touch = std::make_unique<Xpt2046SoftSpi>(std::move(config));
// Start the driver
if (!touch->start()) {
ESP_LOGE(TAG, "Touch driver start failed");
}
return std::shared_ptr<tt::hal::touch::TouchDevice>(touch.get(), [](tt::hal::touch::TouchDevice*) {
// No delete needed; `touch` is managed above
});
}
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
auto touch_device = createTouch();
auto configuration = std::make_unique<Ili934xDisplay::Configuration>(
CYD_DISPLAY_SPI_HOST,
CYD_DISPLAY_PIN_CS,
CYD_DISPLAY_PIN_DC,
CYD_DISPLAY_HORIZONTAL_RESOLUTION,
CYD_DISPLAY_VERTICAL_RESOLUTION,
touch_device
);
configuration->mirrorX = true;
configuration->backlightDutyFunction = driver::pwmbacklight::setBacklightDuty;
configuration->rgbElementOrder = LCD_RGB_ELEMENT_ORDER_BGR;
return std::make_shared<Ili934xDisplay>(std::move(configuration));
}
@@ -0,0 +1,6 @@
#pragma once
#include "Tactility/hal/display/DisplayDevice.h"
#include <memory>
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
@@ -0,0 +1,25 @@
#pragma once
// 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)
// 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
// SD Card
#define CYD_SDCARD_SPI_HOST SPI3_HOST
#define CYD_SDCARD_PIN_CS GPIO_NUM_5
// Backlight
#define CYD_BACKLIGHT_PIN GPIO_NUM_21
@@ -0,0 +1,22 @@
#include "YellowSdCard.h"
#include "YellowDisplayConstants.h"
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
using tt::hal::sdcard::SpiSdCardDevice;
std::shared_ptr<SdCardDevice> createYellowSdCard() {
auto* configuration = new SpiSdCardDevice::Config(
CYD_SDCARD_PIN_CS,
GPIO_NUM_NC, // No card detect pin specified
GPIO_NUM_NC,
GPIO_NUM_NC,
SdCardDevice::MountBehaviour::AtBoot,
std::make_shared<tt::Mutex>(),
std::vector<gpio_num_t>(),
CYD_SDCARD_SPI_HOST
);
return std::shared_ptr<SdCardDevice>(
new SpiSdCardDevice(std::unique_ptr<SpiSdCardDevice::Config>(configuration))
);
}
@@ -0,0 +1,7 @@
#pragma once
#include "Tactility/hal/sdcard/SdCardDevice.h"
using tt::hal::sdcard::SdCardDevice;
std::shared_ptr<SdCardDevice> createYellowSdCard();