📄 main.c
字号:
/*
* $Revision: 1.1 $
*/
// Example code for Aiji Systems MBA-44B0.
// A red filled rectangle is drawn at each point pressed on
// the touch screen.
// At start up the user must press twice on the touch screen at the
// points marked by a yellow rectangle to calibrate the touch screen.
//
// The procedure can be restarted by pressing the EINT0 button at the
// same time as touching the touch screen.
//
// Code and data is located in the 512kb SRAM.
// The LCD fram buffer is located in the 32Mb SDRAM.
//
#include "s3c44b0x.h"
#include "main.h"
#include "touch.h"
#include "lcdlib.h"
#include "graphics.h"
#define MCLK (60000000)
void main(void)
{
rNCACHBE0 = 0xC0004000; // SRAM and SDRAM is cachable.
// Calibrate delay function. This must be done after cache setup.
Delay(0);
SetContrast(128);
Lcd_Init();
while(1)
{
Glib_ClearScr(0x0);
TouchLCDExample();
}
}
static int delayLoopCount=400;
void Delay(int time)
// time=0: adjust the Delay function by WatchDog timer.
// time>0: the number of loop time
// 100us resolution.
{
int i,adjust=0;
if(time==0)
{
time=200;
adjust=1;
delayLoopCount=400;
rWTCON=((MCLK/1000000-1)<<8)|(2<<3); // 1M/64,Watch-dog,nRESET,interrupt disable
rWTDAT=0xffff;
rWTCNT=0xffff;
rWTCON=((MCLK/1000000-1)<<8)|(2<<3)|(1<<5); // 1M/64,Watch-dog enable,nRESET,interrupt disable
}
for(;time>0;time--)
for(i=0;i<delayLoopCount;i++);
if(adjust==1)
{
rWTCON=((MCLK/1000000-1)<<8)|(2<<3);
i=0xffff-rWTCNT; // 1count/16us?????????
delayLoopCount=8000000/(i*64); //400*100/(i*64/200)
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -