现在在TFT_LCD上作描点函数。LCD 型号 auo3.0''TFT A030DL01 920X240;
遇到了问题:每行最多只能显示320个像素点(从最左端到最右端均匀显示),如果说LCD 型号不对,是320X240 ,可显存缓冲区为啥是按照960*240来配置的,难道是华邦提供的LCD的库函数有问题?具体代码如下,请万工和其他人指点。
VOID LCD_BuildInTest(VOID)
{
extern UINT8 image_960x240_16bpp[LCD_PATTERN_SIZE];
INT nLoop;
INT nLEDLoop = 0;
LCD_LOCATION_T location;
LCD_IMAGE_T image;
PUCHAR puLcdBuffer;
CHAR cUserSelect;
INT8 PixelSEQ = 1; //r1g2b3r4g5b6
unsigned int x=0,y=0 ,i=0;
Set_EBILED(0x00);
memset(&image, 0, sizeof(LCD_IMAGE_T));
memset(&location, 0, sizeof(LCD_LOCATION_T));
sysPrintf("\nStart LCD test:\n");
// window location
location.x = 0;
location.y = 0;
// window size
image.width = 960;
image.height = 240;
lcdInit(VIDEO_DEVICE);
lcdOpen(VIDEO_DEVICE);
puLcdBuffer = lcdMmap(VIDEO_DEVICE, image.width * image.height*2 );
// memcpy(puLcdBuffer, image_480x240_16bpp, image.width * image.height * 2);
memset(puLcdBuffer, 0x00, image.width * image.height*2 );
lcdIoctl(VIDEO_DEVICE, LCD_IOC_SET_IMAGE_SIZE, (UINT32)&image);
lcdIoctl(VIDEO_DEVICE, LCD_IOC_SET_WINDOW, (UINT32)&location);
lcdIoctl(VIDEO_DEVICE,LCD_IOC_PIXELSEQ,(UINT32) &PixelSEQ);
lcdIoctl(VIDEO_DEVICE, LCD_IOC_LCD_ENABLE, 0);
lcdIoctl(VIDEO_DEVICE, LCD_IOC_LCD_DISABLE, 0);
lcdIoctl(VIDEO_DEVICE, LCD_IOC_LCD_ENABLE, 0);
lcdIoctl(VIDEO_DEVICE, LCD_IOC_DISPLAY_ON, 0);
do
{
cUserSelect = sysGetChar();// Get user select
switch(cUserSelect)
{
case '1':
{ sysPrintf(" x= %d--",x); //自己编写的测试代码,发现只有当x=5,8,11,14,17,20,23,.......屏幕上才显示像素点
*(((unsigned short *)(puLcdBuffer)) + x)=0Xe0E0;
x=x+1;
break;
}
default: break;
}
}while(cUserSelect != 27);// Do until user press ESC
for(x=960*3,y=0;x<960*3+960;x++)
{ //在第三行描点,画直线,发现,只能有320个像素点显示出来,并且是从左到右手均匀分布的,
感觉是间隔3个 像素 才能显示
*(((unsigned short *)(puLcdBuffer)) +y*960 + x)=0Xe0E0;
}
for(nLoop = 0; nLoop < LCD_SHOW_DELAY*10; nLoop++)
{
if((nLoop%1000000) == 0)
{
sysPrintf(".");
Set_EBILED(1<<nLEDLoop++);
if(nLEDLoop == 8)
{
nLEDLoop = 0;
}
}
if(inpb(REG_UART0_LSR) & 0x01)
{
sysGetChar();
break;
}
}
memset(puLcdBuffer, 0x0, image.width * image.height*2 );
lcdIoctl(VIDEO_DEVICE, LCD_IOC_DISPLAY_OFF, 0);
lcdIoctl(VIDEO_DEVICE, LCD_IOC_LCD_DISABLE, 0);
// lcdClose();
Set_EBILED(0x00);
sysPrintf("\nLCD test finish!\n");
} |