当前位置: 代码迷 >> 驱动开发 >> 一个LCD裸板代码的,小疑点
  详细解决方案

一个LCD裸板代码的,小疑点

热度:88   发布时间:2016-04-28 10:13:52.0
一个LCD裸板代码的,小问题
void Lcd_ClearScr( U16 c) //清屏 ,即清帧内存(向帧内存写入同一颜色数据)
{
unsigned int x, y;

for( y = 0 ; y < SCR_YSIZE_TFT ; y++ )
{
for( x = 0 ; x < SCR_XSIZE_TFT ; x++ )
{
LCD_BUFER[y][x] = c ;
}
}
}


int Main(void)

lcd_port_init(); //初始化LCD引脚
tft_lcd_init();//设置时序、地址参数


//Lcd_ClearScr( (0x1f)); //屏幕显示蓝色
//Lcd_ClearScr( (0x1f<<5)); //屏幕显示绿色
//Lcd_ClearScr( (0x1f<<11)); //屏幕显示红色
Paint_Bmp(gImage_1); //显示图片


while(1)
{
;
}





我的疑问:
Lcd_ClearScr( (0x1f)); //屏幕显示蓝色
为什么0x1f蓝色
Lcd_ClearScr( (0x1f<<5)); //屏幕显示绿色
为什么0x1f<<5 为 绿色


设置是RGB 565的~~~
------解决方案--------------------
既然是RGB565,百度下:
The RGB565 color format is the same as the RGB555 color format, except that 6 bits are used for the green value instead of 5. Therefore, all 16 bits are in use. The organization of the pixels in the image buffer is from left to right and bottom up.
RGB565彩色模式, 一个像素占两个字节, 其中:
低字节的前5位用来表示B(BLUE)
低字节的后三位+高字节的前三位用来表示G(Green)
高字节的后5位用来表示R(RED)
明白了吧!
  相关解决方案