kevincoooool/esp_lcd_jd9366

1.0.1

Latest
uploaded 2 hours ago
ESP LCD JD9366 (MIPI-DSI) driver for Yuying 10.1-inch incell panel

Readme (zh)

# ESP LCD JD9366

[![Component Registry](https://components.espressif.com/components/espressif/esp_lcd_jd9366/badge.svg)](https://components.espressif.com/components/espressif/esp_lcd_jd9366)

[English](README.md)

基于 ESP-IDF `esp_lcd` 组件实现的 JD9366 LCD 控制器驱动。

## 支持的硬件

本驱动针对 **鱼鹰光电 10.1 寸 MIPI In-cell 触摸屏** 开发并测试:

| 项目 | 参数 |
| :--- | :--- |
| 厂商 | 鱼鹰光电 |
| 尺寸 | 10.1 寸 |
| 分辨率 | 800 × 1280 |
| 接口 | MIPI-DSI(2 Lane) |
| 触摸 | In-cell(JD9366 I2C 触摸,见 `esp_lcd_touch_jd9366`) |
| LCD 控制器 | JD9366 |
| 购买链接 | [淘宝](https://item.taobao.com/item.htm?id=1057448450181) |

| LCD 控制器 | 通信接口 | 组件名称 | 数据手册 |
| :--------: | :------: | :------: | :------: |
| JD9366 | MIPI-DSI | esp_lcd_jd9366 | 初始化序列见 `docs/` 目录 |

**注意**:MIPI-DSI 接口仅支持 ESP32-P4 平台上的 ESP-IDF v5.3 及以上版本。

更多 LCD 相关信息,请参阅 [LCD 文档](https://docs.espressif.com/projects/esp-iot-solution/zh_CN/latest/display/lcd/index.html)。

## 添加到工程

本组件可上传至 [乐鑫组件库](https://components.espressif.com/),通过以下命令添加依赖:

```bash
idf.py add-dependency "kevincoooool/esp_lcd_jd9366^1.0.1"
```

也可以在 `idf_component.yml` 中手动添加依赖,详见 [乐鑫组件管理文档](https://docs.espressif.com/projects/esp-idf/zh_CN/latest/esp32/api-guides/tools/idf-component-manager.html)。

## 使用示例

```c
    ESP_LOGI(TAG, "MIPI DSI PHY Powered on");
    esp_ldo_channel_handle_t ldo_mipi_phy = NULL;
    esp_ldo_channel_config_t ldo_mipi_phy_config = {
        .chan_id = 3,
        .voltage_mv = 2500,
    };
    ESP_ERROR_CHECK(esp_ldo_acquire_channel(&ldo_mipi_phy_config, &ldo_mipi_phy));

    ESP_LOGI(TAG, "Initialize MIPI DSI bus");
    esp_lcd_dsi_bus_handle_t mipi_dsi_bus = NULL;
    esp_lcd_dsi_bus_config_t bus_config = JD9366_PANEL_BUS_DSI_2CH_CONFIG();
    ESP_ERROR_CHECK(esp_lcd_new_dsi_bus(&bus_config, &mipi_dsi_bus));

    ESP_LOGI(TAG, "Install panel IO");
    esp_lcd_panel_io_handle_t mipi_dbi_io = NULL;
    esp_lcd_dbi_io_config_t dbi_config = JD9366_PANEL_IO_DBI_CONFIG();
    ESP_ERROR_CHECK(esp_lcd_new_panel_io_dbi(mipi_dsi_bus, &dbi_config, &mipi_dbi_io));

    ESP_LOGI(TAG, "Install JD9366 panel driver");
    esp_lcd_panel_handle_t panel_handle = NULL;
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(6, 0, 0)
    const esp_lcd_dpi_panel_config_t dpi_config = JD9366_800_1280_PANEL_60HZ_DPI_CONFIG(LCD_COLOR_FORMAT_RGB565);
#else
    const esp_lcd_dpi_panel_config_t dpi_config = JD9366_800_1280_PANEL_60HZ_DPI_CONFIG(LCD_COLOR_PIXEL_FORMAT_RGB565);
#endif
    jd9366_vendor_config_t vendor_config = {
        .mipi_config = {
            .dsi_bus = mipi_dsi_bus,
            .dpi_config = &dpi_config,
        },
    };
    const esp_lcd_panel_dev_config_t panel_config = {
        .reset_gpio_num = EXAMPLE_LCD_IO_RST,
        .rgb_ele_order = LCD_RGB_ELEMENT_ORDER_RGB,
        .bits_per_pixel = 16,
        .vendor_config = &vendor_config,
    };
    ESP_ERROR_CHECK(esp_lcd_new_panel_jd9366(mipi_dbi_io, &panel_config, &panel_handle));
    ESP_ERROR_CHECK(esp_lcd_panel_reset(panel_handle));
    ESP_ERROR_CHECK(esp_lcd_panel_init(panel_handle));
    ESP_ERROR_CHECK(esp_lcd_panel_disp_on_off(panel_handle, true));
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(6, 0, 0)
    ESP_ERROR_CHECK(esp_lcd_dpi_panel_enable_dma2d(panel_handle, true));
#endif
```

## ESP-IDF v6 兼容性

- ESP-IDF v6.x:使用 `lcd_color_format_t` 类型的 `JD9366_800_1280_PANEL_60HZ_DPI_CONFIG()`。
- ESP-IDF v5.x:使用 `lcd_color_rgb_pixel_format_t` 类型的 `JD9366_800_1280_PANEL_60HZ_DPI_CONFIG()`。
- ESP-IDF v6.x 如需 DMA2D,创建面板后需调用 `esp_lcd_dpi_panel_enable_dma2d()`。
- 总线配置中设置 `phy_clk_src = 0`,让 ESP-IDF 根据芯片版本自动选择正确的 PHY 时钟源。

Links

Target

To add this component to your project, run:

idf.py add-dependency "kevincoooool/esp_lcd_jd9366^1.0.1"

download archive

Stats

  • Archive size
    Archive size ~ 21.60 KB
  • Downloaded in total
    Downloaded in total 0 times
  • Downloaded this version
    This version: 0 times

Badge

kevincoooool/esp_lcd_jd9366 version: 1.0.1
|