feat(lcd): support parlio lcd interface
This commit is contained in:
committed by
Chen Ji Chang
parent
b6b0758e42
commit
e890b4bd7e
@@ -135,6 +135,7 @@ USB_DOCS = ['api-reference/peripherals/usb_device.rst',
|
||||
I80_LCD_DOCS = ['api-reference/peripherals/lcd/i80_lcd.rst']
|
||||
RGB_LCD_DOCS = ['api-reference/peripherals/lcd/rgb_lcd.rst']
|
||||
DSI_LCD_DOCS = ['api-reference/peripherals/lcd/dsi_lcd.rst']
|
||||
PARLIO_LCD_DOCS = ['api-reference/peripherals/lcd/parl_lcd.rst']
|
||||
|
||||
# TODO: Merge this back with `USB_DOCS` IDF-9919 IDF-9920 IDF-9133
|
||||
USB_OTG_DFU_DOCS = ['api-guides/dfu.rst']
|
||||
@@ -269,6 +270,7 @@ conditional_include_dict = {'SOC_BT_SUPPORTED':BT_DOCS,
|
||||
'SOC_DEDICATED_GPIO_SUPPORTED':DEDIC_GPIO_DOCS,
|
||||
'SOC_LCD_I80_SUPPORTED':I80_LCD_DOCS,
|
||||
'SOC_LCD_RGB_SUPPORTED':RGB_LCD_DOCS,
|
||||
'SOC_PARLIO_SUPPORT_SPI_LCD':PARLIO_LCD_DOCS,
|
||||
'SOC_MIPI_DSI_SUPPORTED':DSI_LCD_DOCS,
|
||||
'SOC_SPIRAM_SUPPORTED':SPIRAM_DOCS,
|
||||
'SOC_PARLIO_SUPPORTED':PARLIO_DOCS,
|
||||
|
||||
@@ -179,6 +179,7 @@ INPUT = \
|
||||
$(PROJECT_PATH)/components/esp_lcd/include/esp_lcd_io_i2c.h \
|
||||
$(PROJECT_PATH)/components/esp_lcd/include/esp_lcd_io_i80.h \
|
||||
$(PROJECT_PATH)/components/esp_lcd/include/esp_lcd_io_spi.h \
|
||||
$(PROJECT_PATH)/components/esp_lcd/include/esp_lcd_io_parl.h \
|
||||
$(PROJECT_PATH)/components/esp_lcd/include/esp_lcd_panel_io.h \
|
||||
$(PROJECT_PATH)/components/esp_lcd/include/esp_lcd_panel_ops.h \
|
||||
$(PROJECT_PATH)/components/esp_lcd/include/esp_lcd_panel_vendor.h \
|
||||
|
||||
@@ -32,6 +32,7 @@ This document will discuss how to create the control plane and data plane, as me
|
||||
:SOC_LCD_I80_SUPPORTED: i80_lcd
|
||||
:SOC_LCD_RGB_SUPPORTED: rgb_lcd
|
||||
:SOC_MIPI_DSI_SUPPORTED: dsi_lcd
|
||||
:SOC_PARLIO_SUPPORT_SPI_LCD: parl_lcd
|
||||
|
||||
.. note::
|
||||
|
||||
@@ -84,6 +85,7 @@ Application Example
|
||||
:SOC_LCD_RGB_SUPPORTED: * :example:`peripherals/lcd/rgb_panel` demonstrates how to install an RGB panel driver, display a scatter chart on the screen based on the LVGL library.
|
||||
:SOC_I2C_SUPPORTED: * :example:`peripherals/lcd/i2c_oled` demonstrates how to use the SSD1306 panel driver from the `esp_lcd` component to facilitate the porting of LVGL library and display a scrolling text on the OLED screen.
|
||||
:SOC_MIPI_DSI_SUPPORTED: * :example:`peripherals/lcd/mipi_dsi` demonstrates the general process of installing a MIPI DSI LCD driver, and displays a LVGL widget on the screen.
|
||||
:SOC_PARLIO_SUPPORT_SPI_LCD: * :example:`peripherals/lcd/parlio_simulate` demonstrates how to use Parallel IO peripheral to drive an SPI or I80 Interfaced LCD.
|
||||
|
||||
|
||||
API Reference
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
Parallel IO simulation of SPI or I80 Interfaced LCD
|
||||
---------------------------------------------------
|
||||
|
||||
:link_to_translation:`zh_CN:[中文]`
|
||||
|
||||
Parallel IO is not a bus-type peripheral. The driver directly creates a Parallel IO device for the LCD. Currently the driver supports SPI (1 bit data width) and I80 (8 bit data width) modes.
|
||||
|
||||
#. Create Parallel IO device by :cpp:func:`esp_lcd_new_panel_io_parl`. You need to set up the following parameters for a Parallel IO device:
|
||||
|
||||
- :cpp:member:`esp_lcd_panel_io_parl_config_t::clk_src` sets the clock source of the Parallel IO device. Note, the default clock source may be different between ESP targets.
|
||||
- :cpp:member:`esp_lcd_panel_io_parl_config_t::clk_gpio_num` sets the GPIO number of the pixel clock (also referred as ``WR`` or ``SCLK`` in some LCD spec)
|
||||
- :cpp:member:`esp_lcd_panel_io_parl_config_t::dc_gpio_num` sets the GPIO number of the data or command select pin (also referred as ``RS`` in some LCD spec)
|
||||
- :cpp:member:`esp_lcd_panel_io_parl_config_t::cs_gpio_num` sets the GPIO number of the chip select pin. (Note that the Parallel IO LCD driver only supports a single LCD device).
|
||||
- :cpp:member:`esp_lcd_panel_io_parl_config_t::data_width` sets the bit width of the data bus (only support ``1`` or ``8``)
|
||||
- :cpp:member:`esp_lcd_panel_io_parl_config_t::data_gpio_nums` is the array of the GPIO number of the data bus. The number of GPIOs should be equal to the :cpp:member:`esp_lcd_panel_io_parl_config_t::data_width` value.
|
||||
- :cpp:member:`esp_lcd_panel_io_parl_config_t::max_transfer_bytes` sets the maximum number of bytes that can be transferred in one transaction.
|
||||
- :cpp:member:`esp_lcd_panel_io_parl_config_t::dma_burst_size` sets the number of bytes transferred by dma burst.
|
||||
- :cpp:member:`esp_lcd_panel_io_parl_config_t::pclk_hz` sets the pixel clock frequency in Hz. Higher pixel clock frequency results in higher refresh rate, but may cause display abnormalities if the DMA bandwidth is not sufficient or the LCD controller chip does not support high pixel clock frequency.
|
||||
- :cpp:member:`esp_lcd_panel_io_parl_config_t::dc_levels` sets the effective level for DC data selection and command selection.
|
||||
- :cpp:member:`esp_lcd_panel_io_parl_config_t::lcd_cmd_bits` and :cpp:member:`esp_lcd_panel_io_parl_config_t::lcd_param_bits` set the bit width of the command and parameter that recognized by the LCD controller chip. This is chip specific, you should refer to your LCD spec in advance.
|
||||
- :cpp:member:`esp_lcd_panel_io_parl_config_t::trans_queue_depth` sets the maximum number of transactions that can be queued in the Parallel IO device. A bigger value means more transactions can be queued up, but it also consumes more memory.
|
||||
|
||||
.. code-block:: c
|
||||
|
||||
esp_lcd_panel_io_handle_t io_handle = NULL;
|
||||
esp_lcd_panel_io_parl_config_t io_config = {
|
||||
.clk_src = PARLIO_CLK_SRC_DEFAULT,
|
||||
.dc_gpio_num = EXAMPLE_PIN_NUM_DC,
|
||||
.clk_gpio_num = EXAMPLE_PIN_NUM_PCLK,
|
||||
.data_gpio_nums = {
|
||||
EXAMPLE_PIN_NUM_DATA0, // set DATA0 to drive SPI interfaced LCD or set DATA0~7 to drive I80 interfaced LCD
|
||||
},
|
||||
.data_width = 1, // set 1 to drive SPI interfaced LCD or set 8 to drive I80 interfaced LCD
|
||||
.max_transfer_bytes = EXAMPLE_LCD_H_RES * 100 * sizeof(uint16_t), // transfer 100 lines of pixels (assume pixel is RGB565) at most in one transaction
|
||||
.dma_burst_size = EXAMPLE_DMA_BURST_SIZE,
|
||||
.cs_gpio_num = EXAMPLE_PIN_NUM_CS,
|
||||
.pclk_hz = EXAMPLE_LCD_PIXEL_CLOCK_HZ,
|
||||
.trans_queue_depth = 10,
|
||||
.dc_levels = {
|
||||
.dc_cmd_level = 0,
|
||||
.dc_data_level = 1,
|
||||
},
|
||||
.lcd_cmd_bits = EXAMPLE_LCD_CMD_BITS,
|
||||
.lcd_param_bits = EXAMPLE_LCD_PARAM_BITS,
|
||||
};
|
||||
|
||||
ESP_ERROR_CHECK(esp_lcd_new_panel_io_parl(&io_config, io_handle));
|
||||
|
||||
.. only:: not SOC_PARLIO_SUPPORT_I80_LCD
|
||||
|
||||
.. note::
|
||||
|
||||
Due to hardware limitations, {IDF_TARGET_NAME} can not drive I80 interfaced LCD by Parallel IO.
|
||||
|
||||
#. Install the LCD controller driver. The LCD controller driver is responsible for sending the commands and parameters to the LCD controller chip. In this step, you need to specify the Parallel IO device handle that allocated in the last step, and some panel specific configurations:
|
||||
|
||||
- :cpp:member:`esp_lcd_panel_dev_config_t::reset_gpio_num` sets the LCD's hardware reset GPIO number. If the LCD does not have a hardware reset pin, set this to ``-1``.
|
||||
- :cpp:member:`esp_lcd_panel_dev_config_t::rgb_ele_order` sets the RGB element order of each color data.
|
||||
- :cpp:member:`esp_lcd_panel_dev_config_t::bits_per_pixel` sets the bit width of the pixel color data. The LCD driver uses this value to calculate the number of bytes to send to the LCD controller chip.
|
||||
- :cpp:member:`esp_lcd_panel_dev_config_t::data_endian` specifies the data endian to be transmitted to the screen. No need to specify for color data within one byte, like RGB232. For drivers that do not support specifying data endian, this field would be ignored.
|
||||
|
||||
.. code-block:: c
|
||||
|
||||
esp_lcd_panel_handle_t panel_handle = NULL;
|
||||
esp_lcd_panel_dev_config_t panel_config = {
|
||||
.reset_gpio_num = EXAMPLE_PIN_NUM_RST,
|
||||
.rgb_ele_order = LCD_RGB_ELEMENT_ORDER_BGR,
|
||||
.bits_per_pixel = 16,
|
||||
};
|
||||
// Create LCD panel handle for ST7789, with the Parallel IO device handle
|
||||
ESP_ERROR_CHECK(esp_lcd_new_panel_st7789(io_handle, &panel_config, &panel_handle));
|
||||
|
||||
API Reference
|
||||
-------------
|
||||
|
||||
.. include-build-file:: inc/esp_lcd_io_parl.inc
|
||||
@@ -32,6 +32,7 @@ LCD 通常由两个主要平面组成:
|
||||
:SOC_LCD_I80_SUPPORTED: i80_lcd
|
||||
:SOC_LCD_RGB_SUPPORTED: rgb_lcd
|
||||
:SOC_MIPI_DSI_SUPPORTED: dsi_lcd
|
||||
:SOC_PARLIO_SUPPORT_SPI_LCD: parl_lcd
|
||||
|
||||
.. note::
|
||||
|
||||
@@ -84,6 +85,7 @@ LCD 数据面板操作
|
||||
:SOC_LCD_RGB_SUPPORTED: * :example:`peripherals/lcd/rgb_panel` 展示了如何安装 RGB 面板驱动程序,并基于 LVGL 库在屏幕上显示散点图。
|
||||
:SOC_I2C_SUPPORTED: * :example:`peripherals/lcd/i2c_oled` 演示了如何使用 `esp_lcd` 组件中的 SSD1306 面板驱动来简化移植 LVGL 库,并在 OLED 屏幕上显示滚动文本。
|
||||
:SOC_MIPI_DSI_SUPPORTED: * :example:`peripherals/lcd/mipi_dsi` 演示了如何安装 MIPI DSI LCD 驱动程序,并在屏幕上显示一个 LVGL 小部件。
|
||||
:SOC_PARLIO_SUPPORT_SPI_LCD: * :example:`peripherals/lcd/parlio_simulate` 演示了如何使用 Parallel IO 外设驱动 SPI 或 I80 接口的屏幕。
|
||||
|
||||
|
||||
API 参考
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
Parallel IO 模拟 SPI 或 I80 接口的 LCD
|
||||
--------------------------------------------------------------
|
||||
|
||||
:link_to_translation:`en:[English]`
|
||||
|
||||
Parallel IO 并不是总线型的外设,驱动直接为 LCD 创建 Parallel IO 设备。目前驱动支持 SPI (1 bit 数据位宽) 和 I80 (8 bit 数据位宽 )模式。
|
||||
|
||||
#. 调用 :cpp:func:`esp_lcd_new_panel_io_parl` 创建 Parallel IO 设备。请设置以下参数:
|
||||
|
||||
- :cpp:member:`esp_lcd_panel_io_parl_config_t::clk_src` 设置 Parallel IO 设备的时钟源。请注意,不同的 ESP 芯片可能有不同的默认时钟源。
|
||||
- :cpp:member:`esp_lcd_panel_io_parl_config_t::clk_gpio_num` 设置像素时钟的 GPIO 编号(在某些 LCD 规格书中也被称为 ``WR`` 或者 ``SCLK``)
|
||||
- :cpp:member:`esp_lcd_panel_io_parl_config_t::dc_gpio_num` 设置数据或命令选择管脚的 GPIO 编号(在某些 LCD 规格书中也被称为 ``RS``)
|
||||
- :cpp:member:`esp_lcd_panel_io_parl_config_t::cs_gpio_num` 设置 CS 信号线的 GPIO 编号。(注意,Parallel IO LCD 驱动仅支持单个 LCD 设备)。
|
||||
- :cpp:member:`esp_lcd_panel_io_parl_config_t::data_width` 设置数据的位宽(仅支持 ``1`` 位或 ``8`` 位)
|
||||
- :cpp:member:`esp_lcd_panel_io_parl_config_t::data_gpio_nums` 是数据总线的 GPIO 编号数组。GPIO 的数量应与 :cpp:member:`esp_lcd_panel_io_parl_config_t::data_width` 的值等同。
|
||||
- :cpp:member:`esp_lcd_panel_io_parl_config_t::max_transfer_bytes` 设置单次传输的最大字节数。
|
||||
- :cpp:member:`esp_lcd_panel_io_parl_config_t::dma_burst_size` 设置 dma burst 传输的字节数。
|
||||
- :cpp:member:`esp_lcd_panel_io_parl_config_t::pclk_hz` 设置像素时钟的频率 (Hz)。较高的像素时钟频率会带来较高的刷新率,但如果 DMA 带宽不足或 LCD 控制器芯片不支持高像素时钟频率,则可能会导致显示异常。
|
||||
- :cpp:member:`esp_lcd_panel_io_parl_config_t::dc_levels` 设置 DC 数据选择和命令选择的有效电平。
|
||||
- :cpp:member:`esp_lcd_panel_io_parl_config_t::lcd_cmd_bits` 和 :cpp:member:`esp_lcd_panel_io_spi_config_t::lcd_param_bits` 分别设置 LCD 控制器芯片可识别的命令及参数的位宽。不同芯片对位宽要求不同,请提前参阅 LCD 规格书。
|
||||
- :cpp:member:`esp_lcd_panel_io_parl_config_t::trans_queue_depth` 设置 Parallel IO 传输队列的深度。该值越大,可以排队的传输越多,但消耗的内存也越多。
|
||||
|
||||
.. code-block:: c
|
||||
|
||||
esp_lcd_panel_io_handle_t io_handle = NULL;
|
||||
esp_lcd_panel_io_parl_config_t io_config = {
|
||||
.clk_src = PARLIO_CLK_SRC_DEFAULT,
|
||||
.dc_gpio_num = EXAMPLE_PIN_NUM_DC,
|
||||
.clk_gpio_num = EXAMPLE_PIN_NUM_PCLK,
|
||||
.data_gpio_nums = {
|
||||
EXAMPLE_PIN_NUM_DATA0, // 驱动 SPI 接口的 LCD 时需要设置 DATA0,驱动 I80 接口的 LCD 时需要设置 DATA0~7
|
||||
},
|
||||
.data_width = 1, // 驱动 SPI 接口的 LCD 时数据宽度为 1,驱动 I80 接口的 LCD 时数据宽度为 8
|
||||
.max_transfer_bytes = EXAMPLE_LCD_H_RES * 100 * sizeof(uint16_t), // 单次最多可传输 100 行像素(假设像素格式为 RGB565)
|
||||
.dma_burst_size = EXAMPLE_DMA_BURST_SIZE,
|
||||
.cs_gpio_num = EXAMPLE_PIN_NUM_CS,
|
||||
.pclk_hz = EXAMPLE_LCD_PIXEL_CLOCK_HZ,
|
||||
.trans_queue_depth = 10,
|
||||
.dc_levels = {
|
||||
.dc_cmd_level = 0,
|
||||
.dc_data_level = 1,
|
||||
},
|
||||
.lcd_cmd_bits = EXAMPLE_LCD_CMD_BITS,
|
||||
.lcd_param_bits = EXAMPLE_LCD_PARAM_BITS,
|
||||
};
|
||||
|
||||
ESP_ERROR_CHECK(esp_lcd_new_panel_io_parl(&io_config, io_handle));
|
||||
|
||||
.. only:: not SOC_PARLIO_SUPPORT_I80_LCD
|
||||
|
||||
.. note::
|
||||
|
||||
注意,由于硬件限制,{IDF_TARGET_NAME} 不能通过 Parallel IO 模拟驱动 I80 接口 LCD。
|
||||
|
||||
#. 安装 LCD 控制器驱动程序。LCD 控制器驱动程序负责向 LCD 控制器芯片发送命令和参数。在此步骤中,需要指定上一步骤中分配到的 Parallel IO 设备句柄以及一些面板特定配置:
|
||||
|
||||
- :cpp:member:`esp_lcd_panel_dev_config_t::reset_gpio_num` 设置 LCD 的硬件复位 GPIO 编号。如果 LCD 没有硬件复位管脚,则将此设置为 ``-1``。
|
||||
- :cpp:member:`esp_lcd_panel_dev_config_t::rgb_ele_order` 设置每个颜色数据的 RGB 元素顺序。
|
||||
- :cpp:member:`esp_lcd_panel_dev_config_t::bits_per_pixel` 设置像素颜色数据的位宽。LCD 驱动程序使用此值计算要发送到 LCD 控制器芯片的字节数。
|
||||
- :cpp:member:`esp_lcd_panel_dev_config_t::data_endian` 指定传输到屏幕的数据的字节序。不超过一字节的颜色格式(如 RGB232)不需要指定数据字节序。若驱动程序不支持指定数据字节序,则将忽略此字段。
|
||||
|
||||
.. code-block:: c
|
||||
|
||||
esp_lcd_panel_handle_t panel_handle = NULL;
|
||||
esp_lcd_panel_dev_config_t panel_config = {
|
||||
.reset_gpio_num = EXAMPLE_PIN_NUM_RST,
|
||||
.rgb_ele_order = LCD_RGB_ELEMENT_ORDER_BGR,
|
||||
.bits_per_pixel = 16,
|
||||
};
|
||||
// 为 ST7789 创建 LCD 面板句柄,并指定 Parallel IO 设备句柄
|
||||
ESP_ERROR_CHECK(esp_lcd_new_panel_st7789(io_handle, &panel_config, &panel_handle));
|
||||
|
||||
API 参考
|
||||
--------
|
||||
|
||||
.. include-build-file:: inc/esp_lcd_io_parl.inc
|
||||
Reference in New Issue
Block a user