📄 main.c
字号:
//======================================================================
//Project Name: TestBoard
//Description: SPCE3200 test board self-test program
//IDE: SUNPLUS S+core IDE 2.2.0 (or later)
//lib: None
//Update: 2007.3.17 V1.0
//======================================================================
#include "SystemHeader.h"
#include "string.h"
char *MenuText[]={"Basic test\0★", "LCD display test\0★", "Key test\0★", "Sound test\0★", "SD card test\0★", "RS232 IF test\0★", "Joystick test\0★"};
//=============================================================
//Prototype: int main(void)
//Description: Main function
//Arguments: None
//Return Value: None
//=============================================================
int main()
{
MENU MainMenu={
80, 10, // x, y
150, 25, // width, height
7, // ItemCount
-1, // ItemSelected
0, // Chinese Font
0, // ASCII Font
8, // Spacing
COLOR_RED, COLOR_BLACK, // Forecolor, Corecolor_Sel
COLOR_GREEN, COLOR_WHITE, // Back
COLOR_YELLOW, COLOR_RED, // Border
MenuText,
};
short x, y;
short MenuItem;
int i;
TFT_Init();
Touch_Init();
TFT_SetBGColor(0x0001);
TFT_SetWindow(0, 0, TFT_WIDTH-1, TFT_HEIGHT-1);
Menu_Display(&MainMenu);
while(1)
{
Touch_Get(&x, &y);
MenuItem = Menu_CursorItem(x, y);
MainMenu.ItemSelected = MenuItem;
Menu_ServiceLoop();
if(MenuItem != -1)
{
for(i=0; i<1000000; i++);
switch(MenuItem)
{
case 0:
if(Test_Basic())
{
if(Test_GPIO())
strcpy(MenuText[0], "★ Basic test");
}
else
Test_GPIO();
break;
case 1:
Test_LCD();
strcpy(MenuText[1], "★ LCD display test");
break;
case 2:
if(Test_Key())
strcpy(MenuText[2], "★ Key test");
break;
case 3:
if(Test_Sound())
strcpy(MenuText[3], "★ Sound test");
break;
case 4:
if(Test_SDCard())
strcpy(MenuText[4], "★ SD card test");
break;
case 5:
if(Test_RS232())
strcpy(MenuText[5], "★ RS232 interface test");
break;
case 6:
if(Test_JoyStick())
strcpy(MenuText[6], "★ Joystick test");
break;
default:
break;
}
MainMenu.ItemSelected = -1;
Menu_Display(&MainMenu);
}
}
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -