这里的示例以百问网的7寸(1024x600)、4寸方屏(480x480)、4寸圆屏RGB(480x480) LCD为例。 [color=var(--c-text-accent)]在新窗口打开[color=var(--c-text-accent)][size=0.85em]#选择方案这里建议用百问网提供的 [color=var(--c-text-accent)]r128-devkit-100ask-rgb在新窗口打开 方案,仓库地址:- Gitee: [color=var(--c-text-accent)]https://gitee.com/weidongshan/100ask_r128_demos/tree/master/other/RGB_LCD在新窗口打开
- GitHub:[color=var(--c-text-accent)]https://github.com/100askTeam/100ask_r128_demos/tree/master/other/RGB_LCD在新窗口打开
方案使用方法,请[color=var(--c-text-accent)]点击这里在新窗口打开查看。初始化环境变量,选择方案(r128s2_devkit_100ask_rgb_c906与r128s2_devkit_100ask_rgb_m33): [backcolor=var(--code-bg-color)]100ask@100ask:~/R128-FreeRTOS/SDK$ source envsetup.sh Setup env done!Run lunch_rtos to select project100ask@100ask:~/R128-FreeRTOS/SDK$ lunch_rtoslast=r128s2_devkit_c906You're building on LinuxLunch menu... pick a combo: 1. r128s2_devkit_100ask_rgb_c906 2. r128s2_devkit_100ask_rgb_m33 3. r128s2_devkit_c906 4. r128s2_devkit_m33 5. r128s2_devkit_rgb_c906 6. r128s2_devkit_rgb_m33 7. r128s2_evt_c906 8. r128s2_evt_m33Which would you like? [Default r128s2_devkit_c906]: 1select=1...r128s2/devkit_100ask_rgb_c906'/home/100ask/R128-FreeRTOS/SDK/lichee/rtos/projects/r128s2/devkit_100ask_rgb_c906/defconfig' -> '/home/100ask/R128-FreeRTOS/SDK/lichee/rtos/.config'============================================RTOS_BUILD_TOP=/home/100ask/R128-FreeRTOS/SDKRTOS_TARGET_ARCH=riscvRTOS_TARGET_CHIP=sun20iw2p1RTOS_TARGET_DEVICE=r128s2RTOS_PROJECT_NAME=r128s2_devkit_100ask_rgb_c906============================================Run mrtos_menuconfig to config rtosRun m or mrtos to build rtos[color=var(--code-ln-color)]
[color=var(--c-text-accent)][size=0.85em]#配置menuconfigmenuconfig具体配置: [backcolor=var(--code-bg-color)]# 1.打开下面的 DriversDrivers Options ---> soc related device drivers ---> PWM devices ---> [* enable pwm driver [ enable pwm hal APIs test command TWI Devices ---> -*- enable twi driver [ enable twi hal APIs test command Video support for sunxi ---> [* DISP Driver Support(sunxi-disp2) ......# 2. 打开LVGL相关配置System components ---> thirdparty components ---> [* Littlevgl-8 ---> --- Littlevgl-8 [* lvgl examples [ lvgl g2d test [* lvgl-8.1.0 use sunxifb double buffer [* lvgl-8.1.0 use sunxifb cache [ lvgl-8.1.0 use sunxifb g2d [ lvgl-8.1.0 use sunxifb g2d rotate [ lvgl-8.1.0 use freetype [ lvgl-8.1.0 use direct mode[color=var(--code-ln-color)]
[color=var(--c-text-accent)][size=0.85em]#显示[color=var(--c-text-accent)][size=0.85em]#sys_config.fex配置修改文件:R128-FreeRTOS/board/r128s2/devkit_rgb/configs/sys_config.fex [backcolor=var(--code-bg-color)][lcd0lcd_used = 1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 7寸屏(1024x600)lcd_driver_name = "default_lcd"lcd_backlight = 150lcd_if = 0lcd_x = 1024lcd_y = 600lcd_width = 150lcd_height = 94lcd_rb_swap = 0lcd_dclk_freq = 48lcd_pwm_used = 1lcd_pwm_ch = 7lcd_pwm_freq = 500000lcd_pwm_pol = 1lcd_hbp = 150lcd_ht = 1344lcd_hspw = 20lcd_vbp = 20lcd_vt = 635lcd_vspw = 3lcd_lvds_if = 0lcd_lvds_colordepth = 1lcd_lvds_mode = 0lcd_frm = 0lcd_io_phase = 0x0000lcd_gamma_en = 0lcd_bright_curve_en = 0lcd_cmap_en = 0;;;;;; 4寸方屏(480x480);lcd_driver_name = "default_lcd";lcd_backlight = 150;lcd_if = 0;lcd_x = 480;lcd_y = 480;lcd_width = 70;lcd_height = 70;lcd_rb_swap = 1;lcd_dclk_freq = 9;lcd_pwm_used = 1;lcd_pwm_ch = 7;lcd_pwm_freq = 500000;lcd_pwm_pol = 1;lcd_hbp = 20;lcd_ht = 526;lcd_hspw = 6;lcd_vbp = 10;lcd_vt = 510;lcd_vspw = 4;lcd_lvds_if = 0;lcd_lvds_colordepth = 1;lcd_lvds_mode = 0;lcd_frm = 1;lcd_io_phase = 0x0000;lcd_gamma_en = 0;lcd_bright_curve_en = 0;lcd_cmap_en = 0;;;;;; 4寸圆屏RGB(480*480);lcd_driver_name = "default_lcd";lcd_backlight = 200;lcd_if = 0;lcd_x = 480;lcd_y = 480;lcd_width = 70;lcd_height = 70;lcd_rb_swap = 1;lcd_dclk_freq = 9;lcd_pwm_used = 1;lcd_pwm_ch = 7;lcd_pwm_freq = 2000;lcd_pwm_pol = 1;lcd_hbp = 20;lcd_ht = 526;lcd_hspw = 6;lcd_vbp = 10;lcd_vt = 510;lcd_vspw = 4;lcd_lvds_if = 0;lcd_lvds_colordepth = 1;lcd_lvds_mode = 0;lcd_frm = 1;lcd_io_phase = 0x0000;lcd_gamma_en = 0;lcd_bright_curve_en = 0;lcd_cmap_en = 0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;deu_mode = 0lcdgamma4iep = 0smart_color = 0;LCD_D2-LCD_D7lcd_gpio_0 = port:PA00<8><0><3><0>lcd_gpio_1 = port:PA01<8><0><3><0>lcd_gpio_2 = port:PA02<8><0><3><0>lcd_gpio_3 = port:PA03<8><0><3><0>lcd_gpio_4 = port:PA04<8><0><3><0>lcd_gpio_5 = port:PA05<8><0><3><0>;LCD_D10-LCD_D15lcd_gpio_6 = port:PA11<8><0><3><0>lcd_gpio_7 = port:PA10<8><0><3><0>lcd_gpio_8 = port:PA08<8><0><3><0>lcd_gpio_9 = port:PA07<8><0><3><0>lcd_gpio_10 = port:PA06<8><0><3><0>lcd_gpio_11 = port:PA09<8><0><3><0>;LCD_D18-LCD_D23lcd_gpio_12 = port:PA12<8><0><3><0>lcd_gpio_13 = port:PA13<8><0><3><0>lcd_gpio_14 = port:PA14<8><0><3><0>lcd_gpio_15 = port:PA15<8><0><3><0>lcd_gpio_16 = port:PB03<8><0><3><0>lcd_gpio_17 = port:PB02<8><0><3><0>;LCD_VSYNC, LCD_HSYNC, LCD_DCLK, LCD_DElcd_gpio_18 = port:PA18<8><0><3><0>lcd_gpio_19 = port:PA19<8><0><3><0>lcd_gpio_20 = port:PA20<8><0><3><0>lcd_gpio_21 = port:PA21<8><0><3><0>[color=var(--code-ln-color)]
[color=var(--c-text-accent)][size=0.85em]#LVGL配置修改文件:SDK/lichee/rtos-components/thirdparty/littlevgl-8/lv_examples/src/lv_conf.h [backcolor=var(--code-bg-color)]/*Color depth: 1 (1 byte per pixel), 8 (RGB332), 16 (RGB565), 32 (ARGB8888)*/#define LV_COLOR_DEPTH 32 /*这里可以改为16,因为de会自动转换到32位,最终显示还是32位色深*//*Swap the 2 bytes of RGB565 color. Useful if the display has an 8-bit interface (e.g. SPI)*/#define LV_COLOR_16_SWAP 0[color=var(--code-ln-color)]
[color=var(--c-text-accent)][size=0.85em]#触摸[color=var(--c-text-accent)][size=0.85em]#配置menuconfigmenuconfig具体配置: [backcolor=var(--code-bg-color)]Drivers Options ---> other drivers ---> [* input driver ---> [* keyboard driver ---> [* touchscreen driver ---> [ enable tlsc6x touchscreen driver [* enable gt911 touchscreen driver [ enable cst226se touchscreen driver [ enable touchscreen drivers APIs test command soc related device drivers ---> EFUSE Devices ---> [* enable efuse driver [ enable efuse hal APIs test command[color=var(--code-ln-color)]
[color=var(--c-text-accent)][size=0.85em]#sys_config.fex配置修改文件:R128-FreeRTOS/board/r128s2/devkit_rgb/configs/sys_config.fex [backcolor=var(--code-bg-color)][touchscreentp_used = 1tp_int = port:PA24<1><0><default><default>tp_reset = port:PA25<1><0><default><default>tp_revert_mode = 0tp_exchange_flag = 0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 7寸屏(1024x600) GT911tp_max_x = 1024tp_max_y = 600tp_addr = 0x14;;;;;; 4寸方屏(480x480) GT911;tp_max_x = 480;tp_max_y = 480;tp_addr = 0x14;;;;;; 4寸圆屏RGB(480*480);待续...;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;tp_twi_id = 1[color=var(--code-ln-color)]
[color=var(--c-text-accent)][size=0.85em]#LVGL配置修改文件:SDK/lichee/rtos-components/thirdparty/littlevgl-8/lv_examples/src/lv_drv_conf.h [backcolor=var(--code-bg-color)]/*------------------------------------------------- * Mouse or touchpad as evdev interface (for Linux based systems) *------------------------------------------------*/#ifndef USE_EVDEV# define USE_EVDEV 1#endif[color=var(--code-ln-color)]
[color=var(--c-text-accent)][size=0.85em]#结果以上配置完成后,编译打包烧录,上电后屏幕背光亮起,屏幕为黑色。 并且可以在 LOG 中看到 [LCD_FB] lcd_fb_probe,line:103: 和 spi_clk_init()1609 [spi1] clk rate auto adjust to 48000000 SPI 初始化的 LOG。 [backcolor=var(--code-bg-color)]disp:[disp_device_attached_and_enable 230attached ok, mgr0<-->dev0disp:[disp_device_attached_and_enable 243type:1,mode:0,fmt:rgb,bits:8bits,eotf:4,cs:0 dvi_hdmi:2, range:2 scan:0 ratio:8[gt911[log PRODUCT_ID=39:31:31:00:60:10[gt911[log verison=00 range_x=0 range_y=0 point_num=0[gt911[log PRODUCT_ID=39:31:31:00:60:10[gt911[log verison=42 range_x=480 range_y=480 point_num=5[color=var(--code-ln-color)]
通过执行 lv_examples 命令运行LVGL测试demo。 lv_examples 代码位于: SDK/lichee/rtos-components/thirdparty/littlevgl-8/lv_examples/src/lv_main.c
|