; #define LCD_XSIZE (800) /* X-resolution of LCD, Logical coor. */
#define LCD_YSIZE (480) /* Y-resolution of LCD, Logical coor. */
#define LCD_BITSPERPIXEL (16)
#define LCD_CONTROLLER 1
#define LCD_SWAP_RB_0 1
2.觸摸屏驅(qū)動(dòng):
觸摸屏驅(qū)動(dòng)計(jì)算出觸摸屏的坐標(biāo)(x,y),對(duì)dm2410實(shí)驗(yàn)板上的觸摸屏,左下為原點(diǎn),但不一定是(0,0)。兩個(gè)函數(shù):
1) 設(shè)置中斷向量,開中斷:
void SetTSInterrupt(void)
{
rADCDLY = (50000);
rADCCON = (1<<14)|(ADCPRS<<6)|(7<<3)|(0<<2)|(0<<1)|(0);
rADCTSC = (0<<8)|(1<<7)|(1<<6)|(0<<5)|(1<<4)|(0<<3)|(0<<2)|(3);
pISR_ADC = (U32)TSIrqISR; //
rINTMSK &= ~(BIT_ADC);
rINTSUBMSK &= ~(BIT_SUB_TC);
}
2) 中斷處理函數(shù):
static void TSIrqISR(void)
{
int i;
U32 Pt[6];
rINTSUBMSK |= (BIT_SUB_ADC|BIT_SUB_TC);
if(rADCDAT0 & 0x8000)
{//抬起
isDown = 0;
rADCTSC &= 0xff; // Set stylus down interrupt
TX = -1;
TY = -1; //抬起觸筆時(shí),TX,TY要值成不大于0的數(shù)
}
else //按下
{ isDown = 1;
rADCTSC=(0<<8)|(0<<7)|(0<<6)|(1<<5)|(1<<4)|(1<<3)|(0<<2)|(1);
for(i=0;i<LOOP;i++); //delay to set up the next channel
for(i=0;i<5;i++) //5 times
{
rADCCON|=0x1; // Start X-position conversion
while(rADCCON & 0x1); // Check if Enable_start is low
while(!(0x8000&rADCCON)); // Check ECFLG
&nbs





