外置

The menuconfig option for the screen module is a comprehensive menu option that combines the screen driver IC, backlight IC, and touch control IC,It specifies which screen IC this module uses, which touch control IC, what type of backlight is used, and also specifies the resolution, DPI, shape and other information of the liquid crystal glass of the module。添加后就可以在工程里面使用这个新的menuconfig菜单选项

Divided into the following steps in total:

  1. Create a new screen driver folder and Kconfig.proj

  2. Add screen module options

  3. Configure the resolution and DPI of the screen module LCD

  4. 使用新的屏幕(通过Menuconfig选择)

1 添加屏驱文件宏定义

1、Konfig.proj框架如下

  • 在创建的文件夹中添加如下内容,复制SDK\example\rt_driver并修改名称,以屏驱名称命名(如果已有外置的工程,可以直接在工程中进行修改添加)

  • project中创建新的Konfig.proj框架如下

#APP specific configuration.

config CUSTOM MEM MAP
    boo1
    select custom mem map
    default y
comment "------------Project configuration-----------"  

if !BSP_USING_BUILT_LCD
    

endif
  • Add # CONFIG_BSP_USING_BUILTIN_LCD is not set in project\proj.conf to use the external screen driver and disable the internal screen driver of the SDK.。
    如果想单独某个板子使用外置屏驱,或者使用内置屏驱,需要再project目录下新建文件例如sf32lb52-lcd_n16r8/proj.conf 其中添加# CONFIG_BSP_USING_BUILTIN_LCD is not setCONFIG_BSP_USING_BUILTIN_LCD=y

2、在Kconfig文件中增加屏驱驱动IC的宏定义

首先打开SDK\customer\peripherals\Kconfig文件里面有很多类似LCD_USING_XXX的config,复制一个,在project\Kconfig.proj中添加新的config:

if !BSP_USING_BUILT_LCD

config LCD_USING_NV3051F1
    bool
    default n

endif

3、在Kconfig文件中增加TP驱动IC的宏定义

首先打开SDK\customer\peripherals\Kconfig文件里面有很多类似TSC_USING_XXX的config,在project\Kconfig.proj中添加新的config:

if !BSP_USING_BUILT_LCD

config TSC_USING_GT911
    bool
    default n

endif

4、在Kconfig文件中增加背光驱动IC的宏定义

首先打开SDK\customer\peripherals\Kconfig文件里面找到其他背光的定义处,比如BL_USING_AW9364的config,在project\Kconfig.proj中添加新的config:(例如加入的IC名字为NW9527):

if !BSP_USING_BUILT_LCD

config BL_USING_NW9527
    def_bool n

endif


注意: 如果已经有同名的屏驱IC,一定要修改成不同的名称,严禁与SDK内部命名相同

2 Add screen module options

  • The general form of the macro for the new screen module is LCD_USING_AAA_BBB_CCC, AAA is the manufacturer of the module, BBB is the model of the module, CCC is the number and manufacture date of the module, etc.,这些信息在模组厂提供的屏幕模组信息里面有。

  • 屏幕模组的名称,尽量写上尺寸,接口类型,模组厂家,模组编号,分辨率,等信息

if !BSP_USING_BUILT_LCD
    choice
        prompt "Custom LCD driver"
        default LCD_USING_TFT_AH034A01ZJINV4C30

        config LCD_USING_TFT_AH034A01ZJINV4C30            <<<<<<新的屏幕模组的宏,不能跟其他的有重名
            bool "3.4 round DSI Video TFT LCD(800x800)"   <<<<<<屏幕模组的名称,在menuconfig中显示的名称
            select TSC_USING_GT911 if BSP_USING_TOUCHD    <<<<<<<模组使用的TP的IC宏
            select LCD_USING_NV3051F1                     <<<<<<模组使用的屏驱IC宏
            select BL_USING_AW9364                        <<<<<<可选项,选择背光驱动 见注3 
            select BSP_USING_ROUND_TYPE_LCD               <<<<<<可选项,建议圆形屏幕添加,方形屏幕可删除这行
            select BSP_LCDC_USING_DSI_VIDEO               <<<<<<见注1
            depends on BSP_SUPPORT_DSI_VIDEO              <<<<<<可选项,见注2

    endchoice
endif

注1: Specifies what interface type the screen uses, supports the following options:

宏定义

屏驱接口类型

BSP_LCDC_USING_SPI_NODCX_1DATA

3SPI 1DATA(代表3线SPI,使用1根数据线,下同)

BSP_LCDC_USING_SPI_NODCX_2DATA

3SPI 2DATA

BSP_LCDC_USING_SPI_DCX_1DATA

4SPI 1DATA

BSP_LCDC_USING_SPI_DCX_2DATA

4SPI 2DATA

BSP_LCDC_USING_QADSPI

4SPI 4DATA,目前比较常用的QSPI接口

BSP_LCDC_USING_DDR_QADSPI

4SPI 4DATA DDR(QSPI的接口基础上,使用双沿通信)

BSP_LCDC_USING_DBI

DBI

BSP_LCDC_USING_DSI

DSI Command

BSP_LCDC_USING_DSI_VIDEO

DSI Video

BSP_LCDC_USING_DPI

DPI(RGB)

BSP_LCDC_USING_JDI_PARALLEL

JDI 并口

BSP_LCDC_USING_EPD_8BIT

8BIT(墨水屏)

注2: Optional, depending on whether the current development board supports this type of interface, to decide whether to display the menuconfig option。 支持的选项如下(其他接口默认都支持,可以不设置):

宏定义

屏驱接口类型

BSP_SUPPORT_DSI

DSI Command

BSP_SUPPORT_DSI_VIDEO

DSI Video

BSP_SUPPORT_DPI

DPI(RGB)

注3: Optional, backlight drive only applies to screen modules with backlight. If AMOLED screens do not need backlight, it can be unset 支持的选项如下:

宏定义

屏驱接口类型

BL_USING_AW9364

使用AW9364背光芯片

LCD_USING_PWM_AS_BACKLIGHT

直接使用芯片的PWM驱动背光

3 Configure the resolution and DPI of the screen module LCD

  • The resolution is relatively easy to find in the module manual

  • DPI(Dot Per Inch, 有的叫PPI - Pixel Per Inch)的值可能需要自己根据屏幕的物理大小和分辨率计算一下。But this value will not affect the lighting of the screen, usually this value will be used at the UI layer。

if !BSP_USING_BUILT_LCD
    config LCD_HOR_RES_MAX
        int
	    default 800 if LCD_USING_TFT_AH034A01ZJINV4C30  <<<<<<新增项,前面的数字代表水平分辨率是800

    config LCD_VER_RES_MAX
        int
        default 800 if LCD_USING_TFT_AH034A01ZJINV4C30   <<<<<<新增项,前面的数字代表垂直分辨率是800

    config LCD_DPI
        int
        default 235 if LCD_USING_TFT_AH034A01ZJINV4C30  <<<<<<新增项,前面的数字代表DPI值是235
endif