DdsiTouchPanelGetPoint(
TOUCH_PANEL_SAMPLE_FLAGS *pTipStateFlags,
INT *pUncalX,
INT *pUncalY
)
{
ULONG status;
// USHORT ioAdcCntr;
// USHORT intrMask;
static int SampleCount = 0;
static TOUCH_PANEL_SAMPLE_FLAGS PrevStateFlags = TouchSampleIgnore;
static INT PrevX = 0;
static INT PrevY = 0;
TOUCH_PANEL_SAMPLE_FLAGS TmpStateFlags;
INT TmpX = 0;
INT TmpY = 0;
int i;
//RETAILMSG(1, (TEXT(":::::::::::: DdsiTouchPanelGetPoint routine !!!\r\n")));
// Read the status passed back by the HAL
status = READ_REGISTER_ULONG( &(v_pDriverGlobals->tch.status) );
if(status == TOUCH_PEN_UP) {
v_pADCregs->rADCTSC = 0xD3; // Set stylus down interrupt
*pTipStateFlags = TouchSampleValidFlag;
*pUncalX = PrevX;
*pUncalY = PrevY;
InterruptDone( gIntrTouchChanged );
RETAILMSG(0, (TEXT("8 - (%d, %d) 0x%X\r\n"), *pUncalX, *pUncalY, *pTipStateFlags));
}
else if(status == TOUCH_PEN_DOWN){
*pTipStateFlags = TouchSampleIgnore;
*pUncalX = PrevX;
*pUncalY = PrevY;
Touch_Timer0_Setup();
InterruptDone( gIntrTouchChanged );
RETAILMSG(0, (TEXT("9 - (%d, %d) 0x%X\r\n"), *pUncalX, *pUncalY, *pTipStateFlags));
}
else {
if( (v_pADCregs->rADCDAT0 & 0x8000) || (v_pADCregs->rADCDAT1 & 0x8000) ){
v_pADCregs->rADCTSC = 0xD3; // Set stylus down interrupt
*pTipStateFlags = TouchSampleValidFlag;
*pUncalX = PrevX;
*pUncalY = PrevY;
InterruptDone( gIntrTouchChanged );
RETAILMSG(0, (TEXT("91 - (%d, %d) 0x%X\r\n"), *pUncalX, *pUncalY, *pTipStateFlags));
}
else{ // charlie
//
for (i =0; i < 3; i++) {
// v_pADCregs->rADCTSC=(0<<8)|(1<<7)|(1<<6)|(0<<5)|(1<<4)|(1<<3)|(1<<2)|(0);
v_pADCregs->rADCTSC=(1<<3)|(1<<2);
// Stylus Down,Don't care,Don't care,Don't care,Don't care,XP pullup Dis,Auto,No operation
v_pADCregs->rADCCON|=0x1; // Start Auto conversion
while(v_pADCregs->rADCCON & 0x1); //check if Enable_start is low
while(!(0x8000&v_pADCregs->rADCCON)); // Check ECFLG
//#ifdef YC_2440_SUPPORT
#ifndef YC_2440_SUPPORT
xbuf = 0x3ff & v_pADCregs->rADCDAT0;
ybuf = 0x3ff & v_pADCregs->rADCDAT1;
#else
ybuf = 0x3ff - (0x3ff & v_pADCregs->rADCDAT0);
//xbuf = 0x3ff & v_pADCregs->rADCDAT1;
xbuf = 0x3ff-(0x3ff & v_pADCregs->rADCDAT1); //fhg
#endif
}
PddpTouchPanelEvaluateSamples( &TmpStateFlags, &TmpX, &TmpY);
v_pADCregs->rADCTSC=(1<<8)|(1<<7)|(1<<6)|(0<<5)|(1<<4)|(0<<3)|(0<<2)|(3);
Touch_CoordinateConversion(&TmpX, &TmpY);
if (Touch_Pen_filtering(&TmpX, &TmpY)) // Valid touch pen
{
//RETAILMSG(1, (TEXT("valid touch pen\r\n")));
*pTipStateFlags = TouchSampleValidFlag | TouchSampleDownFlag;
*pTipStateFlags &= ~TouchSampleIgnore;
}
else // Invalid touch pen
{
//RETAILMSG(1, (TEXT("invalid touch pen\r\n")));
*pTipStateFlags = TouchSampleValidFlag;
*pTipStateFlags |= TouchSampleIgnore;
}
*pUncalX = PrevX = TmpX;
*pUncalY = PrevY = TmpY;
InterruptDone( gIntrTouch );
RETAILMSG(0, (TEXT("0 - (%d, %d) 0x%X\r\n"), *pUncalX, *pUncalY, *pTipStateFlags));
}
}
return;
}
这个里面只有采样三个点,,我想多采样几个点应该怎么做
for (i =0; i < 3; i++) {
// v_pADCregs->rADCTSC=(0<<8)|(1<<7)|(1<<6)|(0<<5)|(1<<4)|(1<<3)|(1<<2)|(0);
v_pADCregs->rADCTSC=(1<<3)|(1<<2);
// Stylus Down,Don't care,Don't care,Don't care,Don't care,XP pullup Dis,Auto,No operation
v_pADCregs->rADCCON|=0x1; // Start Auto conversion
while(v_pADCregs->rADCCON & 0x1); //check if Enable_start is low
while(!(0x8000&v_pADCregs->rADCCON)); // Check ECFLG
//#ifdef YC_2440_SUPPORT
#ifndef YC_2440_SUPPORT
xbuf = 0x3ff & v_pADCregs->rADCDAT0;
ybuf = 0x3ff & v_pADCregs->rADCDAT1;
我将这里的i改大,是否可以!!1