在main.c中输入以下代码,编译、下载、在串口控制台输入lcd_fill,屏幕就开始刷新了。void lcd_fill(int argc, void **argv)
{
static rt_uint8_t lcd_init = 0;
rt_device_t lcd = RT_NULL;
rt_uint8_t x=0;
if(lcd_init == 0)
{
lcd_init = 1;
lcd = rt_device_find("lcd");//获取设备句柄
rt_device_init(lcd);//初始化lcd
}
while(1)
{
switch(x)
{
//填充颜色测试
case 0:LCD_Clear(WHITE);break;
case 1:LCD_Clear(BLACK);break;
case 2:LCD_Clear(BLUE);break;
case 3:LCD_Clear(RED);break;
case 4:LCD_Clear(MAGENTA);break;
case 5:LCD_Clear(GREEN);break;
case 6:LCD_Clear(CYAN);break;
case 7:LCD_Clear(YELLOW);break;
case 8:LCD_Clear(BRRED);break;
case 9:LCD_Clear(GRAY);break;
case 10:LCD_Clear(LGRAY);break;
case 11:LCD_Clear(BROWN);break;
};
x++;
if(x==12)x=0;
rt_thread_mdelay(1000);
}
}
MSH_CMD_EXPORT(lcd_fill, lcd fill test for mcu lcd);
|