New board: Elecrow CrowPanel Advance 3.5" (#231)

- Implement CrowPanel Advance 3.5"
- New driver subproject: ILI9488
- New driver subproject: GT911
- Refactor T-Deck to use new driver subproject
- Fix for `flash.ps1`: don't set flash speed
This commit is contained in:
Ken Van Hoeylandt
2025-02-22 19:09:15 +01:00
committed by GitHub
parent 44b366b557
commit b14887d5fb
28 changed files with 728 additions and 53 deletions
+16 -2
View File
@@ -1,7 +1,7 @@
#include "TdeckDisplay.h"
#include "TdeckDisplayConstants.h"
#include "TdeckTouch.h"
#include <Gt911Touch.h>
#include <PwmBacklight.h>
#include <St7789Display.h>
@@ -9,8 +9,22 @@
#define TAG "tdeck_display"
static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
// Note for future changes: Reset pin is 48 and interrupt pin is 47
auto configuration = std::make_unique<Gt911Touch::Configuration>(
I2C_NUM_0,
240,
320,
true,
true,
false
);
return std::make_shared<Gt911Touch>(std::move(configuration));
}
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
auto touch = std::make_shared<TdeckTouch>();
auto touch = createTouch();
auto configuration = std::make_unique<St7789Display::Configuration>(
TDECK_LCD_SPI_HOST,
@@ -1,85 +0,0 @@
#include "TdeckTouch.h"
#include <esp_err.h>
#include <esp_lcd_touch_gt911.h>
#include <Tactility/Log.h>
#include <esp_lvgl_port.h>
#define TAG "tdeck_touch"
// Touch (GT911)
#define TDECK_TOUCH_I2C_BUS_HANDLE I2C_NUM_0
#define TDECK_TOUCH_X_MAX 240
#define TDECK_TOUCH_Y_MAX 320
bool TdeckTouch::start(lv_display_t* display) {
const esp_lcd_panel_io_i2c_config_t io_config = ESP_LCD_TOUCH_IO_I2C_GT911_CONFIG();
if (esp_lcd_new_panel_io_i2c(TDECK_TOUCH_I2C_BUS_HANDLE, &io_config, &ioHandle) != ESP_OK) {
TT_LOG_E(TAG, "touch io i2c creation failed");
return false;
}
esp_lcd_touch_config_t config = {
.x_max = TDECK_TOUCH_X_MAX,
.y_max = TDECK_TOUCH_Y_MAX,
.rst_gpio_num = GPIO_NUM_NC,
.int_gpio_num = GPIO_NUM_NC, // There is no reset pin for touch on the T-Deck, leading to a bug in esp_lvgl_port firing multiple click events when tapping the screen
.levels = {
.reset = 0,
.interrupt = 0,
},
.flags = {
.swap_xy = 1,
.mirror_x = 1,
.mirror_y = 0,
},
.process_coordinates = nullptr,
.interrupt_callback = nullptr,
.user_data = nullptr,
.driver_data = nullptr
};
if (esp_lcd_touch_new_i2c_gt911(ioHandle, &config, &touchHandle) != ESP_OK) {
TT_LOG_E(TAG, "GT911 driver init failed");
cleanup();
return false;
}
const lvgl_port_touch_cfg_t touch_cfg = {
.disp = display,
.handle = touchHandle,
};
TT_LOG_I(TAG, "Adding touch to LVGL");
deviceHandle = lvgl_port_add_touch(&touch_cfg);
if (deviceHandle == nullptr) {
TT_LOG_E(TAG, "Adding touch failed");
cleanup();
return false;
}
return true;
}
bool TdeckTouch::stop() {
cleanup();
return true;
}
void TdeckTouch::cleanup() {
if (deviceHandle != nullptr) {
lv_indev_delete(deviceHandle);
deviceHandle = nullptr;
}
if (touchHandle != nullptr) {
esp_lcd_touch_del(touchHandle);
touchHandle = nullptr;
}
if (ioHandle != nullptr) {
esp_lcd_panel_io_del(ioHandle);
ioHandle = nullptr;
}
}
@@ -1,25 +0,0 @@
#pragma once
#include "Tactility/hal/touch/TouchDevice.h"
#include <Tactility/TactilityCore.h>
#include <esp_lcd_panel_io_interface.h>
#include <esp_lcd_touch.h>
class TdeckTouch : public tt::hal::touch::TouchDevice {
private:
std::string getName() const final { return "GT911"; }
std::string getDescription() const final { return "I2C Touch Driver"; }
esp_lcd_panel_io_handle_t _Nullable ioHandle = nullptr;
esp_lcd_touch_handle_t _Nullable touchHandle = nullptr;
lv_indev_t* _Nullable deviceHandle = nullptr;
void cleanup();
public:
bool start(lv_display_t* display) override;
bool stop() override;
lv_indev_t* _Nullable getLvglIndev() override { return deviceHandle; }
};