📄 display.c
字号:
lprintf(50,100,0xffff,"Window 1");
*WINCONx_Reg_Addr[1] &= ~((1<<6)|(1<<1));
*WINCONx_Reg_Addr[1] |= (alpha_sel<<1);
*VIDOSDxC_Reg_Addr[1] = (0<<20)|(0<<16)|(0<<12)|(0xf<<8)|(0xf<<4)|(0xf<<0);
LcdWindowOnOff(LCD_WIN_ALL,LCD_ON);
LcdEnvidOnOff(LCD_ON);
printf("Press any key to start\n");
getchar();
for(i=0;i<8;i++)
{
//*VIDOSDxC_Reg_Addr[1] = (i<<20)|(i<<16)|(i<<12)|((i^0xf)<<8)|((i^0xf)<<4)|((i^0xf)<<0);
*VIDOSDxC_Reg_Addr[1] = (i<<20)|(i<<16)|(i<<12);
delayLoop(10000000);
}
/* Ending Test */
Display_End(LCD_WIN_ALL);
}
void PixelBlendingTest_Serial( void)
{
uint32 i;
LcdWindowOnOff(LCD_WIN_ALL,LCD_OFF);
LcdEnvidOnOff(LCD_OFF);
// Setting Window 0
Basic_Display_Setting_Serial(LCD_WIN_0,LCD_BUF_0,WINCONx_16BPP_565,lcd_horizon_value,lcd_line_value);
LCD_FilledRectangle(0, 0, screen_width-1, screen_height/4*1-1, 0xf800);
LCD_FilledRectangle(0, screen_height/4*1, screen_width-1, screen_height/4*2-1, 0x7e0);
LCD_FilledRectangle(0, screen_height/4*2, screen_width-1, screen_height/4*3-1, 0x1f);
LCD_FilledRectangle(0, screen_height/4*3, screen_width-1, screen_height-1, 0xffff);
lprintf(50,20,0xffff,"Window 0");
// Setting Window 1
Basic_Display_Setting_Serial(LCD_WIN_1,LCD_BUF_0,WINCONx_16BPP_A555,lcd_horizon_value,lcd_line_value);
LCD_FilledRectangle(0, 0, screen_width/8*1-1, screen_height-1, 0x7c00);
LCD_FilledRectangle(screen_width/8*1, 0, screen_width/8*2-1, screen_height-1, 0x3e0);
LCD_FilledRectangle(screen_width/8*2, 0, screen_width/8*3-1, screen_height-1, 0x1f);
LCD_FilledRectangle(screen_width/8*3, 0, screen_width/8*4-1, screen_height-1, 0x7fff);
LCD_FilledRectangle(screen_width/8*4, 0, screen_width/8*5-1, screen_height-1, 0xfc00);
LCD_FilledRectangle(screen_width/8*5, 0, screen_width/8*6-1, screen_height-1, 0x83e0);
LCD_FilledRectangle(screen_width/8*6, 0, screen_width/8*7-1, screen_height-1, 0x801f);
LCD_FilledRectangle(screen_width/8*7, 0, screen_width-1, screen_height-1, 0xffff);
lprintf(0,100,0x7fff,"Window 1");
lprintf(0,120,0x7fff,"non blending area");
lprintf(screen_width/2,100,0xffff,"Window 1");
lprintf(screen_width/2,120,0xffff,"blending area");
*WINCONx_Reg_Addr[1] &= ~((1<<6)|(1<<1));
*WINCONx_Reg_Addr[1] |= (1<<6);
*VIDOSDxC_Reg_Addr[1] = (0x0<<20)|(0x0<<16)|(0x0<<12)|(0xf<<8)|(0xf<<4)|(0xf<<0);
LcdWindowOnOff(LCD_WIN_ALL,LCD_ON);
LcdEnvidOnOff(LCD_ON);
printf("Press any key to start\n");
getchar();
for(i=0;i<16;i++)
{
*VIDOSDxC_Reg_Addr[1] = (i<<20)|(i<<16)|(i<<12)|((i^0xf)<<8)|((i^0xf)<<4)|((i^0xf)<<0);
//Delay(1);
delayLoop(10000000);
}
/* Ending Test */
Display_End(LCD_WIN_ALL);
}
void Test_EachWindow_EachBPP_Serial(void)
{
int32 window,buffer,bpp;
uint32 i=0;
while(1)
{
printf("\nSelect the window # which you want to test\n");
printf("(If you want to stop this test, press enter key)\n");
printf(" 0: Window 0 (Buffer0) 1: Window 1\n");
window = GetIntNum();
if ((window<0)||(window>1)) break;
while(1)
{
printf("\nSelect the bpp type which you want to test\n");
printf("(If you want to exit, press enter key)\n");
for(i=0;i<14;i++)
{
printf(" %2d:%s\n",i,lcd_bpp_mode[i]);
}
bpp = GetIntNum();
if( (bpp<0)||(bpp>14) ) break;
LcdWindowOnOff(LCD_WIN_ALL,LCD_OFF);
LcdEnvidOnOff(LCD_OFF);
Basic_Display_Setting_Serial(window,LCD_BUF_0,bpp,lcd_horizon_value,lcd_line_value);
LCD_ClearScr(0);
Prepare_Image(window,bpp);
Display_Start(window);
Display_End(window);
}
}
}
void Test_DisplayFramebufferSerial_Bufferchange(void)
{
U32 i,j,data;
U32 *framebuffer0_0, *framebuffer0_1;
printf("CPU I/F Display Controller Test!\n");
framebuffer0_0 = (U32 *)LCD_FRAME_BUFFER;//window 0
framebuffer0_1 = (U32 *)(LCD_FRAME_BUFFER+0x100000);//window 1
for(i=0; i<240*320*2/4; i++) {
//data=cpuiftestimg[i*2+1];
//data |= (cpuiftestimg[i*2] <<16);
data=0xf800;
data |= (0xf800 <<16);
*framebuffer0_0 ++ = data;
}
for(i=0; i<240*320*2/4; i++) {
//data=cpuiftestimg[i*2+1];
//data |= (cpuiftestimg[i*2] <<16);
data=0x001f;
data |= (0x001f <<16);
*framebuffer0_1 ++ = data;
}
LcdWindowOnOff(LCD_WIN_ALL,LCD_OFF);
LcdEnvidOnOff(LCD_OFF);
Basic_Display_Setting_Serial(0,1,WINCONx_16BPP_565,lcd_horizon_value,lcd_line_value);
rWINCON0 = rWINCON0 & ~(0x1<<22) | (1<<22);
rVIDW00ADD0B0 = LCD_FRAME_BUFFER;
rVIDW00ADD1B0 = LCD_FRAME_BUFFER + (320*240*2);
rVIDW00ADD0B1 = LCD_FRAME_BUFFER+0x100000;
rVIDW00ADD1B1 = LCD_FRAME_BUFFER+0x100000 + (320*240*2);
Display_Start_CPUIF(0);
//Display_End(LCD_WIN_ALL);
Uart_getc();
Display_Start_CPUIF(0);
//Display_End(LCD_WIN_ALL);
Uart_getc();
Display_Start_CPUIF(0);
//Display_End(LCD_WIN_ALL);
Uart_getc();
Display_Start_CPUIF(0);
//Display_End(LCD_WIN_ALL);
}
void Test_ColorMap_Serial(void)
{
int8 window=-1;
uint8 i=0;
uint32 color_map=0;
while(1)
{
printf("\nSelect the window # which you want to test\n");
printf("(If you want to stop this test, press enter key)\n");
printf(" 0: Window 0 1: Window 1 \n");
window = GetIntNum();
if( window==(-1) ) return;
else
{
switch(window)
{
case 0:
color_map = 0xffff00;
break;
case 1:
color_map = 0x00ffff;
break;
default:
color_map = 0;
break;
}
LcdWindowOnOff(LCD_WIN_ALL,LCD_OFF);
LcdEnvidOnOff(LCD_OFF);
Basic_Display_Setting_Serial(window,LCD_BUF_0,WINCONx_24BPP_888,lcd_horizon_value,lcd_line_value);
LCD_ClearScr(0);
*WINxMAP_Reg_Addr[window] = (1<<24)|(color_map); //color map enable
Display_Start(window);
Display_End(window);
}
}
return;
}
void Test_Virtual_Screen_Serial(void)
{
uint32 i;
uint32 byte_pixel;
LcdWindowOnOff(LCD_WIN_ALL,LCD_OFF);
LcdEnvidOnOff(LCD_OFF);
Basic_Display_Setting_Serial(LCD_WIN_0,LCD_BUF_0,WINCONx_18BPP_666,lcd_horizon_value*2,lcd_line_value*2);
LCD_ClearScr(0);
lprintf(0,0,0xffffff,"123456789012345678901234567890123456789012345678901234567890");
lprintf(0,50,0xffffff,"123456789012345678901234567890123456789012345678901234567890");
lprintf(0,100,0xffffff,"123456789012345678901234567890123456789012345678901234567890");
lprintf(0,150,0xffffff,"123456789012345678901234567890123456789012345678901234567890");
Display_Start(LCD_WIN_0);
printf("Press any key to start.\n");
getchar();
byte_pixel = lcd_bit_order[WINCONx_18BPP_666]/8;
for(i=0;i<100;i++) {
*VIDWxADD0_Reg_Addr[LCD_WIN_0][LCD_BUF_0] = (uint32)lcd_framebuffer + i*byte_pixel + i*lcd_horizon_value*2*byte_pixel;
*VIDWxADD1_Reg_Addr[LCD_WIN_0][LCD_BUF_0] = (uint32)lcd_framebuffer + i*byte_pixel + i*lcd_horizon_value*2*byte_pixel + lcd_horizon_value*2*byte_pixel*lcd_line_value;
*VIDWxADD2_Reg_Addr[LCD_WIN_0][LCD_BUF_0] = ((lcd_horizon_value*byte_pixel)<<13)|(lcd_horizon_value*byte_pixel);
delayLoop(1000000);
}
Display_End(LCD_WIN_0);
}
//------------------------------------------
// Basic Display Test sub function 1
//
void Test_DisplayFramebufferRgbIf_QVGA1(void)
{
int8 image,window,buffer;
uint32 i,j,k;
printf("\nSelect the window # which you want to test\n");
printf(" 0: Window 0 1: Window 1\n");
window = GetIntNum();
if( (window<0) || (window>1) ) return;
if (window==0)
{
printf("\nSelect the buffer # which you want to test\n");
printf(" 0: Buffer 0 1: Buffer 1\n");
buffer = GetIntNum();
if( (buffer<0) || (buffer>1) ) return;
} else {
buffer = 0;
}
printf("\nSelect the image which you want to display\n");
printf(" 1: RGBW (24bpp) 2: Snail (16bpp)\n");
image = GetIntNum();
if(image == 1) //RGBW
{
Basic_Display_Setting(window,buffer,WINCONx_24BPP_888,lcd_horizon_value,lcd_line_value);
LCD_FilledRectangle(0, 0, screen_width-1, screen_height/4*1-1, 0xff0000);
LCD_FilledRectangle(0, screen_height/4*1, screen_width-1, screen_height/4*2-1, 0x00ff00);
LCD_FilledRectangle(0, screen_height/4*2, screen_width-1, screen_height/4*3-1, 0x0000ff);
LCD_FilledRectangle(0, screen_height/4*3, screen_width-1, screen_height-1, 0xffffff);
lprintf(130,80,0xffffff,"Hello~");
}
else if(image == 2) //Snail
{
Basic_Display_Setting(window,buffer,WINCONx_16BPP_565,lcd_horizon_value,lcd_line_value);
for(j=0;j<screen_height;j++)
for(i=0;i<screen_width;i++)
PutPixel(i,j,snail16bpp[k++]);
}
else
{
printf("You entered wrong number..\n");
return;
}
Display_Start(window);
printf("\n >>> display through window %d[%s] is going on...\n",window,lcd_bpp_mode[WINCONx_16BPP_565]);
Display_End(window);
return;
}
//------------------------------------------
// Basic Display Test sub function 1
//
void Test_DisplayFramebufferRgbIf_QVGA1_Serial(void)
{
int8 image,window,buffer;
uint32 i,j,k;
printf("\nSelect the window # which you want to test\n");
printf(" 0: Window 0 1: Window 1\n");
window = GetIntNum();
if( (window<0) || (window>1) ) return;
if (window==0)
{
printf("\nSelect the buffer # which you want to test\n");
printf(" 0: Buffer 0 1: Buffer 1\n");
buffer = GetIntNum();
if( (buffer<0) || (buffer>1) ) return;
} else {
buffer = 0;
}
printf("\nSelect the image which you want to display\n");
printf(" 1: RGBW (24bpp) 2: prayer (16bpp)\n");
image = GetIntNum();
if(image == 1) //RGBW
{
Basic_Display_Setting_Serial(window,buffer,WINCONx_24BPP_888,lcd_horizon_value,lcd_line_value);
LCD_FilledRectangle(0, 0, screen_width-1, screen_height/4*1-1, 0xff0000);
LCD_FilledRectangle(0, screen_height/4*1, screen_width-1, screen_height/4*2-1, 0x00ff00);
LCD_FilledRectangle(0, screen_height/4*2, screen_width-1, screen_height/4*3-1, 0x0000ff);
LCD_FilledRectangle(0, screen_height/4*3, screen_width-1, screen_height-1, 0xffffff);
lprintf(130,80,0xffffff,"Hello~");
}
else if(image == 2) //RGBW
{
Basic_Display_Setting_Serial(window,buffer,WINCONx_16BPP_565,lcd_horizon_value,lcd_line_value);
for(j=0;j<screen_height;j++)
for(i=0;i<screen_width;i++)
PutPixel(i,j,prayer16bpp[k++]);
//PutPixel(i,j,snail16bpp[k++]);
}
Display_Start(window);
printf("\n >>> display through window %d[%s] is going on...\n",window,lcd_bpp_mode[WINCONx_16BPP_565]);
Display_End(window);
return;
}
//------------------------------------------
// Basic Display Test sub function 2
//
void Test_DisplayFramebufferRgbIf_QVGA2(void)
{
int32 image,window,buffer;
uint32 i,j,k;
printf("\nSelect the window # which you want to test\n");
printf(" 0: Window 0 1: Window 1\n");
window = GetIntNum();
if( (window<0) || (window>1) ) return;
if (window==0)
{
printf("\nSelect the buffer # which you want to test\n");
printf(" 0: Buffer 0 1: Buffer 1\n");
buffer = GetIntNum();
if( (buffer<0) || (buffer>1) ) return;
} else {
buffer = 0;
}
printf("\nSelect the image which you want to display\n");
printf(" 1: RGBW (24bpp) 2: praying girl (16bpp)\n");
image = GetIntNum();
if(image == 1) //RGBW
{
Basic_Display_Setting(window,buffer,WINCONx_24BPP_888,lcd_horizon_value,lcd_line_value);
LCD_FilledRectangle(0, 0, screen_width-1, screen_height/4*1-1, 0xff0000);
LCD_FilledRectangle(0, screen_height/4*1, screen_width-1, screen_height/4*2-1, 0x00ff00);
LCD_FilledRectangle(0, screen_height/4*2, screen_width-1, screen_height/4*3-1, 0x0000ff);
LCD_FilledRectangle(0, screen_height/4*3, screen_width-1, screen_height-1, 0xffffff);
lprintf(130,80,0xffffff,"Hello~");
}
else if(image == 2) //praying girl
{
Basic_Display_Setting(window,buffer,WINCONx_16BPP_565,lcd_horizon_value,lcd_line_value);
for(j=0;j<screen_height;j++)
for(i=0;i<screen_width;i++)
PutPixel(i,j,pPrayer320240[k++]);
}
Display_Start(window);
printf("\n >>> display through window %d[%s] is going on...\n",window,lcd_bpp_mode[WINCONx_24BPP_888]);
Display_End(window);
return;
}
//
//==========================================
//==========================================
// Each Window and Each BPP Test function
//
void Test_EachWindow_EachBPP(void)
{
int32 window,buffer,bpp;
uint32 i=0;
while(1)
{
printf("\nSelect the window # which you want to test\n");
printf("(If you want to stop this test, press enter key)\n");
printf(" 0: Window 0 (Buffer0) 1: Window 1\n");
window = GetIntNum();
if ((window<0)||(window>1)) break;
while(1)
{
printf("\nSelect the bpp type which you want to test\n");
printf("(If you want to exit, press enter key)\n");
for(i=0;i<14;i++)
{
printf(" %2d:%s\n",i,lcd_bpp_mode[i]);
}
bpp = GetIntNum();
if( (bpp<0)||(bpp>14) ) break;
LcdWindowOnOff(LCD_WIN_ALL,LCD_OFF);
LcdEnvidOnOff(LCD_OFF);
Basic_Display_Setting(window,LCD_BUF_0,bpp,lcd_horizon_value,lcd_line_value);
LCD_ClearScr(0);
Prepare_Image(window,bpp);
Display_Start(window);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -