# ESP LCD Touch JD9366
[English](README.md)
基于 ESP-IDF `esp_lcd_touch` 组件实现的 JD9366 In-cell 触摸控制器驱动。
## 支持的硬件
本驱动针对 **鱼鹰光电 10.1 寸 MIPI In-cell 触摸屏** 开发并测试:
| 项目 | 参数 |
| :--- | :--- |
| 厂商 | 鱼鹰光电 |
| 尺寸 | 10.1 寸 |
| 分辨率 | 800 × 1280 |
| 触摸控制器 | JD9366(I2C,地址 0x68) |
| 触摸类型 | In-cell |
| 购买链接 | [淘宝](https://item.taobao.com/item.htm?id=1057448450181) |
| 触摸控制器 | 通信接口 | 组件名称 | I2C 地址 |
| :--------: | :------: | :------: | :------: |
| JD9366 | I2C | esp_lcd_touch_jd9366 | 0x68 |
## 添加到工程
```bash
idf.py add-dependency "kevincoooool/esp_lcd_touch_jd9366^1.0.1"
```
## 使用示例
```c
i2c_master_bus_handle_t i2c_bus = NULL;
// ... 初始化 I2C 主机总线 ...
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_JD9366_CONFIG();
tp_io_config.scl_speed_hz = 400000;
ESP_ERROR_CHECK(esp_lcd_new_panel_io_i2c_v2(i2c_bus, &tp_io_config, &tp_io_handle));
esp_lcd_touch_handle_t tp = NULL;
esp_lcd_touch_config_t tp_cfg = {
.x_max = 800,
.y_max = 1280,
.rst_gpio_num = GPIO_NUM_NC,
.int_gpio_num = GPIO_NUM_NC,
.flags = {
.swap_xy = 0,
.mirror_x = 0,
.mirror_y = 0,
},
};
ESP_ERROR_CHECK(esp_lcd_touch_new_i2c_jd9366(tp_io_handle, &tp_cfg, &tp));
```
## 注意事项
- JD9366 In-cell 触摸通过 I2C 寄存器访问实现厂商特有的 BackDoor 协议。
- 本组件依赖 [esp_lcd_touch](https://components.espressif.com/components/espressif/esp_lcd_touch)。
idf.py add-dependency "kevincoooool/esp_lcd_touch_jd9366^1.0.1"