本帖最后由 海滨消消 于 2022-9-8 10:37 编辑
用法和好处 请看测试程序: - void dev_lcd_test(void)
- {
- DevLcd *LcdCog;
- DevLcd *LcdOled;
- DevLcd *LcdTft;
- /* 打开三个设备 */
- LcdCog = dev_lcd_open("coglcd");
- if(LcdCog==NULL)
- uart_printf("open cog lcd err\r\n");
- LcdOled = dev_lcd_open("oledlcd");
- if(LcdOled==NULL)
- uart_printf("open oled lcd err\r\n");
- LcdTft = dev_lcd_open("tftlcd");
- if(LcdTft==NULL)
- uart_printf("open tft lcd err\r\n");
- /*打开背光*/
- dev_lcd_backlight(LcdCog, 1);
- dev_lcd_backlight(LcdOled, 1);
- dev_lcd_backlight(LcdTft, 1);
- dev_lcd_put_string(LcdOled, FONT_SONGTI_1212, 10,1, "ABC-abc,", BLACK);
- dev_lcd_put_string(LcdOled, FONT_SIYUAN_1616, 1, 13, "这是oled lcd", BLACK);
- dev_lcd_put_string(LcdOled, FONT_SONGTI_1212, 10,30, "www.wujique.com", BLACK);
- dev_lcd_put_string(LcdOled, FONT_SIYUAN_1616, 1, 47, "屋脊雀工作室", BLACK);
- dev_lcd_put_string(LcdCog, FONT_SONGTI_1212, 10,1, "ABC-abc,", BLACK);
- dev_lcd_put_string(LcdCog, FONT_SIYUAN_1616, 1, 13, "这是cog lcd", BLACK);
- dev_lcd_put_string(LcdCog, FONT_SONGTI_1212, 10,30, "www.wujique.com", BLACK);
- dev_lcd_put_string(LcdCog, FONT_SIYUAN_1616, 1, 47, "屋脊雀工作室", BLACK);
- dev_lcd_put_string(LcdTft, FONT_SONGTI_1212, 20,30, "ABC-abc,", RED);
- dev_lcd_put_string(LcdTft, FONT_SIYUAN_1616, 20,60, "这是tft lcd", RED);
- dev_lcd_put_string(LcdTft, FONT_SONGTI_1212, 20,100, "www.wujique.com", RED);
- dev_lcd_put_string(LcdTft, FONT_SIYUAN_1616, 20,150, "屋脊雀工作室", RED);
- while(1);
- }
复制代码
使用一个函数dev_lcd_open,可以打开3个LCD,获取LCD设备。然后调用dev_lcd_put_string就可以在不同的LCD上显示。其他所有的gui操作接口都只有一个。这样的设计对于APP层来说,就很友好。显示效果:
微信图片
|