小学生
最后登录1970-1-1
在线时间 小时
注册时间2024-4-6
|
static uint16_t ILI9806G_Read_PixelData ( void )
{
uint16_t usR=0, usG=0, usB=0 ;
ILI9806G_Write_Cmd ( 0x2E ); /* 读数据 */
usR = ILI9806G_Read_Data (); /*FIRST READ OUT DUMMY DATA*/
usR = ILI9806G_Read_Data (); /*READ OUT RED DATA */
usB = ILI9806G_Read_Data (); /*READ OUT BLUE DATA*/
usG = ILI9806G_Read_Data (); /*READ OUT GREEN DATA*/
return ( ( ( usR >> 11 ) << 11 ) | ( ( usG >> 10 ) << 5 ) | ( usB >> 11 ) );
}
uint16_t ILI9806G_GetPointPixel ( uint16_t usX, uint16_t usY )
{
uint16_t usPixelData;
ILI9806G_SetCursor ( usX, usY );
usPixelData = ILI9806G_Read_PixelData ();
return usPixelData;
}
static void ReadColor(unsigned int x,unsigned int y,COLOR_RGB *Rgb)
{
unsigned short C16;
//读某点颜色,返回的就是16位颜色数据
C16 = ILI9806G_GetPointPixel(x,y);
//将16位RGB转换为24位存储
Rgb->red = (unsigned char)((C16&0xf800)>>8);
Rgb->green = (unsigned char)((C16&0x07e0)>>3);
Rgb->blue = (unsigned char)((C16&0x001f)<<3);
}
|
-
储存的24位RGB值
|