forked from xiaozhi/xiaozhi-esp32
add lcd touch for lichuang_dev (#531)
* add lcd touch for lichuang_dev * Update lichuang_dev_board.cc --------- Co-authored-by: zk <982145@qq.com> Co-authored-by: Xiaoxia <terrence@tenclass.com>
This commit is contained in:
@@ -12,6 +12,10 @@
|
|||||||
#include <driver/i2c_master.h>
|
#include <driver/i2c_master.h>
|
||||||
#include <driver/spi_common.h>
|
#include <driver/spi_common.h>
|
||||||
#include <wifi_station.h>
|
#include <wifi_station.h>
|
||||||
|
#include <esp_lcd_touch_ft5x06.h>
|
||||||
|
#include <esp_lvgl_port.h>
|
||||||
|
#include <lvgl.h>
|
||||||
|
|
||||||
|
|
||||||
#define TAG "LichuangDevBoard"
|
#define TAG "LichuangDevBoard"
|
||||||
|
|
||||||
@@ -125,6 +129,41 @@ private:
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 可见设备
|
// 物联网初始化,添加对 AI 可见设备
|
||||||
void InitializeIot() {
|
void InitializeIot() {
|
||||||
auto& thing_manager = iot::ThingManager::GetInstance();
|
auto& thing_manager = iot::ThingManager::GetInstance();
|
||||||
@@ -137,6 +176,7 @@ public:
|
|||||||
InitializeI2c();
|
InitializeI2c();
|
||||||
InitializeSpi();
|
InitializeSpi();
|
||||||
InitializeSt7789Display();
|
InitializeSt7789Display();
|
||||||
|
InitializeTouch();
|
||||||
InitializeButtons();
|
InitializeButtons();
|
||||||
InitializeIot();
|
InitializeIot();
|
||||||
GetBacklight()->RestoreBrightness();
|
GetBacklight()->RestoreBrightness();
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ dependencies:
|
|||||||
espressif/esp-sr: "^2.0.5"
|
espressif/esp-sr: "^2.0.5"
|
||||||
espressif/button: "^3.3.1"
|
espressif/button: "^3.3.1"
|
||||||
espressif/knob: "^1.0.0"
|
espressif/knob: "^1.0.0"
|
||||||
|
espressif/esp_lcd_touch_ft5x06: "~1.0.6"
|
||||||
lvgl/lvgl: "~9.2.2"
|
lvgl/lvgl: "~9.2.2"
|
||||||
esp_lvgl_port: "~2.4.4"
|
esp_lvgl_port: "~2.4.4"
|
||||||
espressif/esp_io_expander_tca95xx_16bit: "^2.0.0"
|
espressif/esp_io_expander_tca95xx_16bit: "^2.0.0"
|
||||||
|
|||||||
Reference in New Issue
Block a user