Compare commits

..

5 Commits

Author SHA1 Message Date
Dang Quang Vinh
f93616e9e4
Merge c5a9305f0fb65f62853df8665284a0b052971a5d into 0461e2ff88369c3da0d4caced31e8488f53376cd 2025-02-27 03:26:34 +00:00
Quang Vinh Dang
c5a9305f0f feat(spi_lcd_touch): Add config for mirror_y esp_lcd_touch screen 2025-02-26 19:26:03 -08:00
Quang Vinh Dang
3b9c69213e fix: Installed pre-commit and run 2025-02-26 19:24:50 -08:00
Quang Vinh Dang
a1a0957c92 Update the version of idf_component.yml 2025-02-26 19:24:50 -08:00
Quang Vinh Dang
25cc970992 feat(esp32/lcd/spi_lcd_touch):Adding driver for XPT2046 2025-02-26 19:24:50 -08:00
2 changed files with 8 additions and 26 deletions

View File

@ -37,4 +37,11 @@ menu "Example Configuration"
Touch controller XPT2046 connected via SPI.
endchoice
config EXAMPLE_LCD_MIRROR_Y
int
default 1 if EXAMPLE_LCD_TOUCH_ENABLED && EXAMPLE_LCD_TOUCH_CONTROLLER_XPT2046
default 0
help
This value is 1 if XPT2046 touch controller is selected, 0 otherwise.
endmenu

View File

@ -129,7 +129,6 @@ static void example_lvgl_flush_cb(lv_display_t *disp, const lv_area_t *area, uin
esp_lcd_panel_draw_bitmap(panel_handle, offsetx1, offsety1, offsetx2 + 1, offsety2 + 1, px_map);
}
#ifdef CONFIG_EXAMPLE_LCD_TOUCH_CONTROLLER_STMPE610
static void example_lvgl_touch_cb(lv_indev_t *indev, lv_indev_data_t *data)
{
uint16_t touchpad_x[1] = {0};
@ -149,30 +148,6 @@ static void example_lvgl_touch_cb(lv_indev_t *indev, lv_indev_data_t *data)
data->state = LV_INDEV_STATE_RELEASED;
}
}
#elif CONFIG_EXAMPLE_LCD_TOUCH_CONTROLLER_XPT2046
static void example_lvgl_touch_cb(lv_indev_t *indev, lv_indev_data_t *data)
{
uint16_t touchpad_x[1] = {0};
uint16_t touchpad_y[1] = {0};
uint8_t touchpad_cnt = 0;
esp_lcd_touch_handle_t touch_pad = lv_indev_get_user_data(indev);
esp_lcd_touch_read_data(touch_pad);
bool touchpad_pressed = esp_lcd_touch_get_coordinates(touch_pad, touchpad_x, touchpad_y, NULL, &touchpad_cnt, 1);
if (touchpad_pressed && touchpad_cnt > 0) {
int32_t x = touchpad_x[0];
int32_t y = touchpad_y[0];
data->point.x = x;
data->point.y = y;
data->state = LV_INDEV_STATE_PRESSED;
} else {
data->state = LV_INDEV_STATE_RELEASED;
}
}
#endif
static void example_increase_lvgl_tick(void *arg)
{
@ -320,7 +295,7 @@ void app_main(void)
{
.swap_xy = 0,
.mirror_x = 0,
.mirror_y = 1,
.mirror_y = CONFIG_EXAMPLE_LCD_MIRROR_Y,
},
};
esp_lcd_touch_handle_t tp = NULL;