Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions main/boards/lichuang-dev/lichuang_dev_board.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
#include <driver/i2c_master.h>
#include <driver/spi_common.h>
#include <wifi_station.h>
#include <esp_lcd_touch_ft5x06.h>
#include <esp_lvgl_port.h>
#include <lvgl.h>


#define TAG "LichuangDevBoard"

Expand Down Expand Up @@ -125,6 +129,41 @@ class LichuangDevBoard : public WifiBoard {
});
}

void InitializeTouch()
{
esp_lcd_touch_handle_t tp;
esp_lcd_touch_config_t tp_cfg = {
.x_max = DISPLAY_WIDTH,
.y_max = DISPLAY_HEIGHT,
.rst_gpio_num = GPIO_NUM_NC, // Shared with LCD reset
.int_gpio_num = GPIO_NUM_NC,
.levels = {
.reset = 0,
.interrupt = 0,
},
.flags = {
.swap_xy = 1,
.mirror_x = 1,
.mirror_y = 0,
},
};
esp_lcd_panel_io_handle_t tp_io_handle = NULL;
esp_lcd_panel_io_i2c_config_t tp_io_config = ESP_LCD_TOUCH_IO_I2C_FT5x06_CONFIG();
tp_io_config.scl_speed_hz = 400000;

esp_lcd_new_panel_io_i2c(i2c_bus_, &tp_io_config, &tp_io_handle);
esp_lcd_touch_new_i2c_ft5x06(tp_io_handle, &tp_cfg, &tp);
assert(tp);

/* Add touch input (for selected screen) */
const lvgl_port_touch_cfg_t touch_cfg = {
.disp = lv_display_get_default(),
.handle = tp,
};

lvgl_port_add_touch(&touch_cfg);
}

// 物联网初始化,添加对 AI 可见设备
void InitializeIot() {
auto& thing_manager = iot::ThingManager::GetInstance();
Expand All @@ -137,6 +176,7 @@ class LichuangDevBoard : public WifiBoard {
InitializeI2c();
InitializeSpi();
InitializeSt7789Display();
InitializeTouch();
InitializeButtons();
InitializeIot();
GetBacklight()->RestoreBrightness();
Expand Down
1 change: 1 addition & 0 deletions main/idf_component.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ dependencies:
espressif/esp-sr: "^2.0.5"
espressif/button: "^3.3.1"
espressif/knob: "^1.0.0"
espressif/esp_lcd_touch_ft5x06: "~1.0.6"
lvgl/lvgl: "~9.2.2"
esp_lvgl_port: "~2.4.4"
espressif/esp_io_expander_tca95xx_16bit: "^2.0.0"
Expand Down