📄 main.c
字号:
#include "2410addr.h"
#include "2410slib.h"
#include "lcd.h"
#include "port.h"
#include "uart0.h"
void Main(void)
{
int i;
unsigned char KeyCnt4=0;
static unsigned char KeyPressed4 = 0;
unsigned char KeyCnt3=0;
static unsigned char KeyPressed3 = 0;
unsigned int EllipseR=0;
MMU_EnableICache();
Port_Init();
Uart0_Init();
Uart0_SendString("\n\n\n");
Uart0_SendString("+---------------------------------------------+\n");
Uart0_SendString("| S3C2410X lcd test code, v1.1. |\n");
Uart0_SendString("+---------------------------------------------+\n");
Lcd_Init();
Lcd_Clear(0x07e0);
Uart0_SendString("Lcd init end!\n");
while (1)
{
if(!(rGPFDAT&(0x01<<7)))
{
for(i=0;i<100000;i++);
if((!(rGPFDAT&(0x01<<7))) && (!KeyPressed4))
{
KeyPressed4 = 1;
KeyCnt4 = ((KeyCnt4<2) ? (KeyCnt4+1) : 0);
}
switch(KeyCnt4)
{
case 0:
Lcd_Clear(0x07e0);
break;
case 1:
Lcd_DispColorBar();
break;
case 2:
Lcd_DispBlackLine();
break;
default:
break;
}
}
else
{
for(i=0;i<100000;i++);
if(rGPFDAT&(0x01<<7))
{
KeyPressed4 = 0;
}
}
if(!(rGPFDAT&(0x01<<3)))
{
for(i=0;i<100000;i++);
if((!(rGPFDAT&(0x01<<3))) && (!KeyPressed3))
{
KeyPressed3 = 1;
KeyCnt3 = ((KeyCnt3<1) ? (KeyCnt3+1) : 0);
EllipseR = 0;
switch(KeyCnt4)
{
case 0:
Lcd_Clear(0x07e0);
break;
case 1:
Lcd_DispColorBar();
break;
case 2:
Lcd_DispBlackLine();
break;
default:
break;
}
}
}
else
{
for(i=0;i<100000;i++);
if(rGPFDAT&(0x01<<3))
{
KeyPressed3 = 0;
}
}
if(KeyCnt3 == 1)
{
if(EllipseR<200)
{
EllipseR += 3;
}
else
{
EllipseR = 0;
switch(KeyCnt4)
{
case 0:
Lcd_Clear(0x07e0);
break;
case 1:
Lcd_DispColorBar();
break;
case 2:
Lcd_DispBlackLine();
break;
default:
break;
}
}
Lcd_DispEllipse(LCD_XSIZE/2, LCD_YSIZE/2, EllipseR, EllipseR, 0x001f);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -