📄 lcd.c
字号:
rTPAL = 0; // Disable Temporary Palette
Uart_Printf("TFT 256 color mode test 2. Press any key!\n");
Uart_Getch();
Glib_ClearScr(0, MODE_TFT_8BIT_240320); // Fill the LCD panel with Black Color
k=0;
for(i=0;i<320;i+=10)
for(j=0;j<240;j+=10)
{
Glib_FilledRectangle(j,i,j+9,i+9,(k%256));
k+=30;
}
Uart_Printf("TFT 256 color mode test 3. Press any key!\n");
Uart_Getch();
Glib_ClearScr(0, MODE_TFT_8BIT_240320);
k=0;
for(i=80;i<240;i+=10)
{
for(j=60;j<180;j+=10)
{
Glib_FilledRectangle(j,i,j+9,i+9,k);
k++;
}
}
Glib_Rectangle(0,0,239,319,255);
Glib_Line(0,0,239,319,255);
Glib_Line(0,319,239,0,255);
Glib_Rectangle(0+240,0,239+240,319,255);
Glib_Line(0+240,0,239+240,319,255);
Glib_Line(0+240,319,239+240,0,255);
Glib_Rectangle(0,0+320,239,319+320,255);
Glib_Line(0,0+320,239,319+320,255);
Glib_Line(0,319+320,239,0+320,255);
Glib_Rectangle(0+240,0+320,239+240,319+320,255);
Glib_Line(0+240,0+320,239+240,319+320,255);
Glib_Line(0+240,319+320,239+240,0+320,255);
Glib_Rectangle(10+240,10+320,480-11,640-11,255);
Uart_Printf("Virtual Screen Test(TFT 256 color). Press any key[ijkm\\r]!\n");
MoveViewPort(MODE_TFT_8BIT_240320);
Lcd_MoveViewPort(0,0,MODE_TFT_8BIT_240320);
Lcd_EnvidOnOff(0);
Lcd_Port_Return();
}
void Test_Lcd_Tft_16Bit_240320(void)
{
int i,j,k;
Lcd_Port_Init();
Lcd_Init(MODE_TFT_16BIT_240320);
Glib_Init(MODE_TFT_16BIT_240320);
Lcd_Lpc3600Enable(); // Enable LPC3600
Lcd_PowerEnable(0, 1);
Lcd_EnvidOnOff(1);
Uart_Printf("[TFT 64K COLOR(16bit/1pixel) LCD TEST]\n");
Glib_ClearScr(0, MODE_TFT_16BIT_240320);
Glib_FilledRectangle(0,0,239,159,0xf800);
Glib_FilledRectangle(0,160,239,320,0xf800);
Uart_Printf("TFT 64K color mode test 1. Press any key!\n");
Uart_Getch();
Glib_ClearScr(0, MODE_TFT_16BIT_240320);
Glib_Rectangle(0,0,239,319,0x07e0);
Glib_FilledRectangle(0,0,20,20,65535);
Glib_Rectangle(220,300,239,319,65535);
Glib_Line(0,0,239,319,0x1f);
Glib_Line(239,0,0,319,0xf800);
Uart_Printf("TFT 64K color mode test 2. Press any key!\n");
Uart_Getch();
Glib_ClearScr(0, MODE_TFT_16BIT_240320);
k=0;
for(i=80;i<240;i+=10)
{
for(j=60;j<180;j+=10)
{
Glib_FilledRectangle(j,i,j+9,i+9,k);
k++;
}
}
Glib_Rectangle(0,0,239,319,65535);
Glib_Line(0,0,239,319,65535);
Glib_Line(0,319,239,0,65535);
Glib_Rectangle(0+240,0,239+240,319,255);
Glib_Line(0+240,0,239+240,319,255);
Glib_Line(0+240,319,239+240,0,255);
Glib_Rectangle(0,0+320,239,319+320,255);
Glib_Line(0,0+320,239,319+320,255);
Glib_Line(0,319+320,239,0+320,255);
Glib_Rectangle(0+240,0+320,239+240,319+320,255);
Glib_Line(0+240,0+320,239+240,319+320,255);
Glib_Line(0+240,319+320,239+240,0+320,255);
Glib_Rectangle(40+240,40+320,480-41,640-41,0x1f);
Uart_Printf("Virtual Screen Test(TFT 64K color). Press any key[ijkm\\r]!\n");
MoveViewPort(MODE_TFT_16BIT_240320);
Lcd_MoveViewPort(0,0,MODE_TFT_16BIT_240320);
Lcd_EnvidOnOff(0);
Lcd_Port_Return();
}
void Test_OURS_Lcd_Tft_16Bit_240320(void)
{
int i,j;
unsigned int k;
unsigned int m;
Lcd_Port_Init();
//init the LCD
Uart_Printf("LCD Port Init.\n");
Lcd_Init(MODE_OURS_TFT_16BIT_240320);
Uart_Printf("LCD Init.\n");
Glib_Init(MODE_TFT_16BIT_240320);
// Lcd_Lpc3600Enable(); // Disable LPC3600 ,for not use samsung lcd ,by OURSELEC LZF
// Lcd_PowerEnable(0, 1); // we didn't use the power on contral
Lcd_EnvidOnOff(1); //enable the lcd video output
Uart_Printf("Enable the video output and the LCD control signal.\n");
//begin the Lcd test
Uart_Printf("[TFT 64K COLOR(16bit/1pixel) LCD TEST]\n");
Glib_ClearScr(LCD_TFT_16Bit_BLACK, MODE_TFT_16BIT_240320);
Uart_Printf("Glib Clear Scr.\n");
Uart_Getch();
//test 1
Glib_FilledRectangle(0,0,239,39,LCD_TFT_16Bit_BLACK);
Glib_FilledRectangle(0,40,239,79,LCD_TFT_16Bit_BLUE);
Glib_FilledRectangle(0,80,239,119,LCD_TFT_16Bit_GREEN);
Glib_FilledRectangle(0,120,239,159,LCD_TFT_16Bit_CYAN);
Glib_FilledRectangle(0,160,239,199,LCD_TFT_16Bit_RED);
Glib_FilledRectangle(0,200,239,239,LCD_TFT_16Bit_MAGENTA);
Glib_FilledRectangle(0,240,239,279,LCD_TFT_16Bit_YELLOW);
Glib_FilledRectangle(0,280,239,319,LCD_TFT_16Bit_WHITE);
Uart_Printf("Glib Filled Rectangle.\n");
Uart_Printf("TFT 64K color mode test 1. Press any key!\n");
Uart_Getch();
//test 2
Glib_ClearScr(LCD_TFT_16Bit_BLACK, MODE_TFT_16BIT_240320);
k=0;
for(i=0;i<320;i++)
{
for(j=0;j<240;j++)
{
_PutTft16Bit_240320(j,i,k);
k++;
}
// Uart_Printf("k=%x\n",k);
}
Uart_Printf("Glib Put Pixel.\n");
Uart_Printf("TFT 64K color mode test 2. Press any key!\n");
Uart_Getch();
//test 3
Glib_ClearScr(LCD_TFT_16Bit_BLACK, MODE_TFT_16BIT_240320);
Glib_Line(100,0,100,319,LCD_TFT_16Bit_BLUE);
Glib_Line(0,100,239,100,LCD_TFT_16Bit_BLUE);
for (i=0;i<240;i++)
_PutTft16Bit_240320(i,200,i);
for (i=0;i<240;i++)
_PutTft16Bit_240320(i,203,i);
Glib_Line(0,0,239,319,LCD_TFT_16Bit_BLUE);
Glib_Line(239,0,0,319,LCD_TFT_16Bit_GREEN);
Glib_Line(0,120,239,200,LCD_TFT_16Bit_RED);
Glib_Line(0,240,239,120,LCD_TFT_16Bit_YELLOW);
Uart_Printf("Glib Line.\n");
Uart_Printf("TFT 64K color mode test 3. Press any key!\n");
Uart_Getch();
//test4
Glib_ClearScr(0, MODE_TFT_16BIT_240320);
Lcd_MoveViewPort(0,0,MODE_TFT_16BIT_240320);
k=0;
for(j=0;j<320;j++)
for(i=0;i<240;i++)
PutPixel(i,j,((int)DEMO240320[k++]));
/*
PutPixel(0,0,LCD_TFT_16Bit_BLUE);
PutPixel(239,0,LCD_TFT_16Bit_RED);
PutPixel(0,319,LCD_TFT_16Bit_YELLOW);
PutPixel(239,319,LCD_TFT_16Bit_RED);
*/
//add by lzf
// _DebugPutTft16Bit_240320(1,1,0xffffffff);
// _DebugPutTft16Bit_240320(0,1,0xffffffff)
Uart_Printf("BMP DISP.\n");
Uart_Printf("TFT 64K color mode test 4. Press any key!\n");
Uart_Getch();
//test 5
/*
Glib_ClearScr(0, MODE_TFT_16BIT_240320);
k=0;
for(i=80;i<240;i+=10)
{
for(j=60;j<180;j+=10)
{
Glib_FilledRectangle(j,i,j+9,i+9,k);
k++;
}
}
Glib_Rectangle(0,0,239,319,65535);
Glib_Line(0,0,239,319,65535);
Glib_Line(0,319,239,0,65535);
Glib_Rectangle(0+240,0,239+240,319,255);
Glib_Line(0+240,0,239+240,319,255);
Glib_Line(0+240,319,239+240,0,255);
Glib_Rectangle(0,0+320,239,319+320,255);
Glib_Line(0,0+320,239,319+320,255);
Glib_Line(0,319+320,239,0+320,255);
Glib_Rectangle(0+240,0+320,239+240,319+320,255);
Glib_Line(0+240,0+320,239+240,319+320,255);
Glib_Line(0+240,319+320,239+240,0+320,255);
Glib_Rectangle(40+240,40+320,480-41,640-41,0x1f);
*/
Uart_Printf("Virtual Screen Test(TFT 64K color). Press any key[ijkm\\r]!\n");
MoveViewPort(MODE_TFT_16BIT_240320);
Lcd_MoveViewPort(0,0,MODE_TFT_16BIT_240320);
Uart_Printf("Press any key to LCD Clear Scr&EXIT.\n");
Uart_Getch();
Glib_ClearScr(0, MODE_TFT_16BIT_240320);
// Lcd_EnvidOnOff(0);
// Lcd_Port_Return();
}
void Test_Lcd_Tft_8Bit_240320_On(void)
{
int i,j,k=0;
Lcd_Port_Init();
Lcd_Palette8Bit_Init();
Lcd_Init(MODE_TFT_8BIT_240320);
Glib_Init(MODE_TFT_8BIT_240320);
Lcd_Lpc3600Enable(); // Enable LPC3600
Lcd_PowerEnable(0, 1);
Uart_Printf("[TFT LCD(240x320 ,8bpp) WILL BE TURNED ON EVEN DURING OTHER TEST]\n");
Uart_Printf("If you'd like to off the TFT LCD, then excute other LCD test program,\n");
for(j=0;j<320;j++)
for(i=0;i<240;i++)
PutPixel(i,j,((int)DEMO256[k++]));
Lcd_EnvidOnOff(1);
}
void Test_Lcd_Tft_8Bit_240320_Bmp(void)
{
int i,j,k=0;
Lcd_Port_Init();
Lcd_Palette8Bit_Init();
Lcd_Init(MODE_TFT_8BIT_240320);
Glib_Init(MODE_TFT_8BIT_240320);
Lcd_Lpc3600Enable(); // Enable LPC3600
Lcd_PowerEnable(0, 1);
//Lcd_PowerEnable(0, 1); // Enable LCD_PWREN
for(j=0;j<320;j++)
for(i=0;i<240;i++)
PutPixel(i,j,((int)DEMO256[k++]));
Lcd_EnvidOnOff(1); // Enable ENVID
/*
Uart_Printf("Do you want to change palette(5:5:1->5:6:5)..........\n");
Uart_Printf("then press any key\n");
Uart_Getch();
Lcd_EnvidOnOff(0);
Uart_Printf("One more ,please...\n");
Uart_Getch();
Lcd_EnvidOnOff(1);
rLCDCON5|=(1<<11); // 5:6:5 Palette Setting
*/
Uart_Printf("Press any key to quit!\n");
Uart_Getch();
Glib_ClearScr(0, MODE_TFT_8BIT_240320);
Delay(5000);
Lcd_EnvidOnOff(0);
Lcd_Port_Return();
}
void Test_Lcd_Tft_8Bit_240320_IntFr(void)
{
int i,j,k=0;
Lcd_Port_Init();
Lcd_Palette8Bit_Init();
Lcd_Init(MODE_TFT_8BIT_240320);
Glib_Init(MODE_TFT_8BIT_240320);
Lcd_Lpc3600Enable(); // Enable LPC3600
Lcd_PowerEnable(0, 1);
rLCDCON5|=(1<<11); // 5:6:5 Palette Setting
for(j=0;j<320;j++)
for(i=0;i<240;i++)
PutPixel(i,j,((int)DEMO256[k++]));
//--------LCD frame interrupt test---------------------------------------------------START
//The content of GPG4 is changed to OUTPUT('01').
//We will check the frame interrupt with using Logic Analyzer.
rGPGUP=rGPGUP&(~(1<<4))|(1<<4); // Pull-up disable
rGPGDAT=rGPGDAT&(~(1<<4))|(1<<4); // GPG4=High
rGPGCON=rGPGCON&(~(3<<8))|(1<<8); // GPG4=Output
pISR_LCD=(unsigned)Lcd_Int_Frame;
rINTMSK=~(BIT_LCD);
rLCDINTMSK=(1<<2)|(0<<1)|(1); // 8Words Trigger Level,Unmask Frame int,mask Fifo int
//--------LCD frame interrupt test-----------------------------------------------------END
Lcd_EnvidOnOff(1); // Enable ENVID
Uart_Printf("Press any key to quit!\n");
Uart_Getch();
rLCDINTMSK|=3; // Mask LCD SUB Interrupt
rINTMSK|=(BIT_LCD); // Mask LCD INT
Lcd_EnvidOnOff(0);
Lcd_Port_Return();
}
void Test_Lcd_Tft_8Bit_240320_IntFi(void)
{
int i,j,k=0;
Lcd_Port_Init();
Lcd_Palette8Bit_Init();
Lcd_Init(MODE_TFT_8BIT_240320);
Glib_Init(MODE_TFT_8BIT_240320);
Lcd_Lpc3600Enable(); // Enable LPC3600
Lcd_PowerEnable(0, 1);
rLCDCON5|=(1<<11); // 5:6:5 Palette Setting
for(j=0;j<320;j++)
for(i=0;i<240;i++)
PutPixel(i,j,((int)DEMO256[k++]));
Lcd_EnvidOnOff(1); // Enable ENVID
//--------LCD FIFO interrupt test---------------------------------------------------START
pISR_LCD=(unsigned)Lcd_Int_Fifo;
rINTMSK=~(BIT_LCD);
rLCDINTMSK=(0<<2)|(1<<1)|(0); // 4Words Trigger Level,Mask Frame int,Unmask Fifo int
//--------LCD FIFO interrupt test-----------------------------------------------------END
Uart_Printf("Press any key to quit!\n");
Uart_Getch();
rLCDINTMSK|=3; // Mask LCD SUB Interrupt
rINTMSK|=(BIT_LCD); // Mask LCD INT
Lcd_EnvidOnOff(0);
Lcd_Port_Return();
}
//640480
void __irq Lcd_Int_Fifo_640480(void)
{
int i;
rLCDINTMSK|=3; // Mask LCD SUB Interrupt
// GPG4 is ....
rGPGDAT&=(~(1<<4)); // GPG4=Low
for(i=0;i<1;i++); // GPG4=Low
rGPGDAT|=(1<<4); //GPG4=High
rLCDSRCPND=1; // Clear LCD SUB Interrupt source pending
rLCDINTPND=1; // Clear LCD SUB Interrupt pending
rLCDINTMSK&=(~(1)); // Unmask LCD FRAME Interrupt
ClearPending(BIT_LCD);
}
void Test_Lcd_Tft_1Bit_640480(void)
{
int i,j;
Lcd_Palette1Bit_Init();
Lcd_Port_Init();
Lcd_Init(MODE_TFT_1BIT_640480);
Glib_Init(MODE_TFT_1BIT_640480);
Lcd_PowerEnable(0, 1);
Lcd_EnvidOnOff(1);
Uart_Printf("[TFT Mono(1bit/1pixel) LCD TEST]\n");
Glib_ClearScr(0,MODE_TFT_1BIT_640480);
rTPAL = (1<<24)|((0xff)<<8); // Enable Temporary Palette : Green
Uart_Printf("TFT Mono mode test 1. Press any key!\n");
Uart_Getch();
rTPAL = 0;
Glib_FilledRectangle(0,0,639,239,1);
Glib_FilledRectangle(0,239,639,479,0);
Uart_Printf("TFT Mono mode test 2. Press any key!\n");
Uart_Getch();
Glib_FilledRectangle(0,0,319,479,1);
Glib_FilledRectangle(320,0,639,479,0);
Uart_Printf("TFT Mono mode test 3. Press any key!\n");
Uart_Getch();
for(j=0;j<LCD_YSIZE_TFT_640480;j+=20)
for(i=320;i<640;i+=20)
Glib_FilledRectangle(i,j,i+19,j+19,((j+i)/20)%2);
Uart_Printf("TFT Mono mode test 4. Press any key!\n");
Uart_Getch();
Glib_ClearScr(0, MODE_TFT_1BIT_640480);
Glib_FilledRectangle(0+320,0+240,1279-320,959-240,1);
// #0
// 00
Glib_Rectangle(0,0,639,479,1);
Glib_Line(0,0,639,479,1);
Glib_Line(0,479,639,0,1);
// 0#
// 00
Glib_Rectangle(0+640,0,639+640,479,1);
Glib_Line(0+640,0,639+640,479,1);
Glib_Line(0+640,479,639+640,0,1);
// 00
// #0
Glib_Rectangle(0,0+480,639,479+480,1);
Glib_Line(0,0+480,639,479+480,1);
Glib_Line(0,479+480,639,0+480,1);
// 00
// 0#
Glib_Rectangle(0+640,0+480,639+640,479+480,1);
Glib_Line(0+640,0+480,639+640,479+480,1);
Glib_Line(0+640,479+480,639+640,0+480,1);
Glib_Rectangle(50+640,50+480,639+640-50,479+480-50,1);
Uart_Printf("Virtual Screen Test(TFT 256 color). Press any key[ijkm\\r]!\n");
MoveViewPort(MODE_TFT_1BIT_640480);
Lcd_MoveViewPort(0,0,MODE_TFT_1BIT_640480);
Lcd_EnvidOnOff(0);
Lcd_Port_Return();
}
void Test_Lcd_Tft_8Bit_640480(void)
{
int i,j,k;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -