[English]

ILI9341 LCD Controller driver(ILI9341液晶控制器驱动程序)

Overview(概览)

显示原文

The ILI9341 is a 262,144-color single-chip SOC driver for a-TFT liquid crystal display with resolution of 240RGBx320 dots, comprising a 720-channel source driver, a 320-channel gate driver, 172,800 bytes GRAM for graphic display data of 240RGBx320 dots, and power supply circuit. ILI9341 supports parallel 8-/9-/16-/18-bit data bus MCU interface, 6-/16-/18-bit data bus RGB interface and 3-/4-line serial peripheral interface (SPI).

The ILI9341 LCD controller driver is a platform-agnostic driver, based on the generic MIPI driver. It implements display initialization, supports display rotation and implements the display flush callback. The user needs to implement only two platform-specific functions to send a command or pixel data to the controller via SPI or parallel bus. Typically these are implemented by calling the appropriate SDK library functions on the given platform.


ILI9341 是一款262,144色单芯片SOC驱动器,用于分辨率为240RGBx320点的a-TFT液晶显示器,包括720通道源驱动器、320通道栅极驱动器、240RGBx320点的图形显示数据的172,800字节GRAM和电源电路。 ILI9341支持并行的8-/9-/16-/18-bit数据总线MCU接口,6-/16-/18-bit数据总线RGB接口和3-/4线串行外设接口(SPI)。

ILI9341 LCD控制器 driver is a platform-agnostic driver, based on the generic MIPI driver 是一款平台无关的驱动器,基于通用MIPI驱动器。它实现了显示初始化,支持显示旋转并实现了显示刷新回调。用户只需实现两个特定于平台的功能,通过SPI或并行总线向控制器发送命令或像素数据。通常情况下,这些是通过调用给定平台上的适当SDK库函数来实现的。

Prerequisites(先决条件)

显示原文

There are no prerequisites.


没有先决条件。

Configuring the driver(配置驱动程序)

显示原文

Enable the ILI9341 driver support in lv_conf.h, by cmake compiler define or by KConfig

#define LV_USE_ILI9341  1

通过CMake编译器定义或KConfig,在lv_conf.h中启用ILI9341驱动程序支持。

#define LV_USE_ILI9341  1

Usage(用法)

显示原文

You need to implement two platform-dependent functions:

/* Send short command to the LCD. This function shall wait until the transaction finishes. */
int32_t my_lcd_send_cmd(lv_display_t *disp, const uint8_t *cmd, size_t cmd_size, const uint8_t *param, size_t param_size)
{
        ...
}

/* Send large array of pixel data to the LCD. If necessary, this function has to do the byte-swapping. This function can do the transfer in the background. */
int32_t my_lcd_send_color(lv_display_t *disp, const uint8_t *cmd, size_t cmd_size, uint8_t *param, size_t param_size)
{
        ...
}

To create an ILI9341-based display use the function

/**
 * Create an LCD display with ILI9341 driver
 * @param hor_res       horizontal resolution
 * @param ver_res       vertical resolution
 * @param flags         default configuration settings (mirror, RGB ordering, etc.)
 * @param send_cmd      platform-dependent function to send a command to the LCD controller (usually uses polling transfer)
 * @param send_color    platform-dependent function to send pixel data to the LCD controller (usually uses DMA transfer: must implement a 'ready' callback)
 * @return              pointer to the created display
 */
lv_display_t * lv_ili9341_create(uint32_t hor_res, uint32_t ver_res, lv_lcd_flag_t flags,
                                                                lv_ili9341_send_cmd_cb_t send_cmd_cb, lv_ili9341_send_color_cb_t send_color_cb);

For additional details and a working example see the generic MIPI driver documentation.

备注

You can find a step-by-step guide and the actual implementation of the callbacks on an STM32F746 using STM32CubeIDE and the ST HAL libraries here: Step-by-step Guide: How to use the LVGL v9 LCD drivers with STM32 devices(分步指南:如何将LVGL v9 LCD驱动程序与STM32设备一起使用)


您需要实现两个与平台相关的函数:

/* Send short command to the LCD. This function shall wait until the transaction finishes. */
int32_t my_lcd_send_cmd(lv_display_t *disp, const uint8_t *cmd, size_t cmd_size, const uint8_t *param, size_t param_size)
{
        ...
}

/* Send large array of pixel data to the LCD. If necessary, this function has to do the byte-swapping. This function can do the transfer in the background. */
int32_t my_lcd_send_color(lv_display_t *disp, const uint8_t *cmd, size_t cmd_size, uint8_t *param, size_t param_size)
{
        ...
}

要创建基于ILI9341驱动的显示器,请使用以下函数:

/**
 * Create an LCD display with ILI9341 driver
 * @param hor_res       horizontal resolution
 * @param ver_res       vertical resolution
 * @param flags         default configuration settings (mirror, RGB ordering, etc.)
 * @param send_cmd      platform-dependent function to send a command to the LCD controller (usually uses polling transfer)
 * @param send_color    platform-dependent function to send pixel data to the LCD controller (usually uses DMA transfer: must implement a 'ready' callback)
 * @return              pointer to the created display
 */
lv_display_t * lv_ili9341_create(uint32_t hor_res, uint32_t ver_res, lv_lcd_flag_t flags,
                                                                lv_ili9341_send_cmd_cb_t send_cmd_cb, lv_ili9341_send_color_cb_t send_color_cb);

有关更多详细信息和工作示例,请参阅`通用MIPI驱动程序文档 https://github.com/lvgl/lvgl/doc/integration/drivers/display/gen_mipi.rst.

您可以在以下位置找到使用STM32CubIDE和ST HAL库的STM32F746上回调的分步指南和实际实现这里:Step-by-step Guide: How to use the LVGL v9 LCD drivers with STM32 devices(分步指南:如何将LVGL v9 LCD驱动程序与STM32设备一起使用)