# ESP LCD Touch JD9366
[中文文档](README_CN.md)
Implementation of the JD9366 incell touch controller with the ESP-IDF `esp_lcd_touch` component.
## Supported Hardware
This driver is developed and tested for the **Yuying Optoelectronics 10.1-inch MIPI incell touch panel**:
| Item | Value |
| :--- | :--- |
| Manufacturer | Yuying Optoelectronics |
| Size | 10.1 inch |
| Resolution | 800 × 1280 |
| Touch Controller | JD9366 (I2C, address 0x68) |
| Touch Type | In-cell |
| Product Link | [Taobao](https://item.taobao.com/item.htm?id=1057448450181) |
| Touch controller | Communication interface | Component name | I2C address |
| :--------------: | :---------------------: | :------------: | :---------: |
| JD9366 | I2C | esp_lcd_touch_jd9366 | 0x68 |
## Add to project
```bash
idf.py add-dependency "kevincoooool/esp_lcd_touch_jd9366^1.0.1"
```
## Example use
```c
i2c_master_bus_handle_t i2c_bus = NULL;
// ... initialize I2C master bus ...
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));
```
## Notes
- The JD9366 incell touch uses a vendor-specific BackDoor protocol over I2C register access.
- This component depends on [esp_lcd_touch](https://components.espressif.com/components/espressif/esp_lcd_touch).
idf.py add-dependency "kevincoooool/esp_lcd_touch_jd9366^1.0.1"