⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test_lcd.c

📁 Taiwan sunplus develop spce3200, it is a test program ----- testboard source code
💻 C
字号:
//====================================================================================
//File Name:	Test_LCD.c
//Description:	LCD test
//Update:		V1.0 by wangtao <wangtao@sunnorth.com.cn>
//====================================================================================
#include "SystemHeader.h"

void Test_LCD(void)
{
	int i, j;
	short x, y;
	char *TempChar = "10";
	

	while(1)
	{
		TFT_SetBGColor(COLOR_RED);
		TFT_SetWindow(0, 0, TFT_WIDTH-1, TFT_HEIGHT-1);
		TFT_SetColor(COLOR_YELLOW);
		TFT_SetTextPos(150, 110);
		TFT_Print("Red");
		TFT_SetTextPos(0, 220);
		TFT_Print("Click any position on the screen to return");
		for(i=0; i<1500000; i++)
		{
			Touch_Get(&x, &y);
			if(x!=-1)
				goto TEST_LCD_EXIT;
		}
	
		TFT_SetBGColor(COLOR_GREEN);
		TFT_SetWindow(0, 0, TFT_WIDTH-1, TFT_HEIGHT-1);
		TFT_SetColor(COLOR_RED);
		TFT_SetTextPos(150, 110);
		TFT_Print("Green");
		TFT_SetTextPos(0, 220);
		TFT_Print("Click any position on the screen to return");
		for(i=0; i<1500000; i++)
		{
			Touch_Get(&x, &y);
			if(x!=-1)
				goto TEST_LCD_EXIT;
		}
		
		TFT_SetBGColor(COLOR_BLUE);
		TFT_SetWindow(0, 0, TFT_WIDTH-1, TFT_HEIGHT-1);
		TFT_SetColor(COLOR_YELLOW);
		TFT_SetTextPos(150, 110);
		TFT_Print("Blue");
		TFT_SetTextPos(0, 220);
		TFT_Print("Click any position on the screen to return");
		for(i=0; i<1500000; i++)
		{
			Touch_Get(&x, &y);
			if(x!=-1)
				goto TEST_LCD_EXIT;
		}
		
		TFT_SetBGColor(COLOR_WHITE);
		TFT_SetWindow(0, 0, TFT_WIDTH-1, TFT_HEIGHT-1);
		TFT_SetColor(COLOR_BLUE);
		TFT_SetTextPos(150, 110);
		TFT_Print("White");
		TFT_SetTextPos(0, 220);
		TFT_Print("Click any position on the screen to return");
		for(i=0; i<1500000; i++)
		{
			Touch_Get(&x, &y);
			if(x!=-1)
				goto TEST_LCD_EXIT;
		}
		
		TFT_SetBGColor(0x0001);
		TFT_SetWindow(0, 0, TFT_WIDTH-1, TFT_HEIGHT-1);
		TFT_SetColor(COLOR_WHITE);
		TFT_SetTextPos(150, 110);
		TFT_Print("Black");
		TFT_SetTextPos(0, 220);
		TFT_Print("Click any position on the screen to return");
		for(i=0; i<1500000; i++)
		{
			Touch_Get(&x, &y);
			if(x!=-1)
				goto TEST_LCD_EXIT;
		}
		
		TFT_SetBGColor(COLOR_BLACK);
		TFT_SetWindow(0, 0, TFT_WIDTH-1, TFT_HEIGHT-1);
		
		for(i=0; i<TFT_WIDTH/20; i++)
		{
			for(j=0; j<TFT_HEIGHT/20; j++)
			{
				TFT_SetColor((i+j)%2 ? COLOR_BLUE: COLOR_WHITE);
				TFT_Rectangle(i*20, j*20, i*20+19, j*20+19, PAINT_SOLID);
				if(i==0)
				{
					TFT_SetColor((i+j)%2 ? COLOR_WHITE: COLOR_BLUE);
					if(j<9)
					{
						TempChar[0] = '1' + j;
						TempChar[1] = '\0';
						TFT_SetTextPos(i*20+6, j*20+2);
					}
					else
					{
						TempChar[0] = '1';
						TempChar[1] = '1' + j - 10;
						TempChar[2] = '\0';
						TFT_SetTextPos(i*20+2, j*20+2);
					}
					TFT_Print(TempChar);
				}
				else if(j==0)
				{
					TFT_SetColor((i+j)%2 ? COLOR_WHITE: COLOR_BLUE);
					if(i<9)
					{
						TempChar[0] = '1' + i;
						TempChar[1] = '\0';
						TFT_SetTextPos(i*20+6, j*20+2);
					}
					else
					{
						TempChar[0] = '1';
						TempChar[1] = '1' + i - 10;
						TempChar[2] = '\0';
						TFT_SetTextPos(i*20+2, j*20+2);
					}
					TFT_Print(TempChar);
				}
			}
		}
		TFT_SetColor(COLOR_MAGENTA);
		TFT_SetTextPos(120, 110);
		TFT_Print("16×12 grid");
		TFT_SetTextPos(0, 220);
		TFT_Print("Click any position on the screen to return");
		for(i=0; i<3000000; i++)
		{
			Touch_Get(&x, &y);
			if(x!=-1)
				goto TEST_LCD_EXIT;
		}
	}
TEST_LCD_EXIT:
	TFT_SetBGColor(0x0001);
	TFT_SetWindow(0, 0, TFT_WIDTH-1, TFT_HEIGHT-1);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -