触摸屏驱动一关键函数
来源:互联网 发布:浙大gpa算法 编辑:程序博客网 时间:2024/05/01 00:27
- PUBLIC VOID
- DdsiTouchPanelGetPoint(TOUCH_PANEL_SAMPLE_FLAGS * pTipStateFlags,
- INT * pUncalX,
- INT * pUncalY)
- {
- static INT x, y;
- //DEBUGMSG(1, (TEXT("::: DdsiTouchPanelGetPoint()/r/n")));
- if (v_pINTregs->SUBSRCPND & (1<<IRQ_SUB_TC)) /* SYSINTR_TOUCH Interrupt Case */
- { //触点中断(INT_TC)
- *pTipStateFlags = TouchSampleValidFlag;
- //读取ADC Conversion DATA Register, 1-Stylus down state 0-Stylus up state
- if ( (v_pADCregs->ADCDAT0 & (1 << 15)) |
- (v_pADCregs->ADCDAT1 & (1 << 15)) )
- {
- //Stylus up state
- bTSP_DownFlag = FALSE;
- DEBUGMSG(ZONE_TIPSTATE, (TEXT("up/r/n")));
- //重新设置ADC TOUCH SCREEN CONTROL REGISTER
- v_pADCregs->ADCTSC &= 0xff;
- //读取上次的坐标值
- *pUncalX = x;
- *pUncalY = y;
- //停止取样(停止Timer3 PWM)
- TSP_SampleStop();
- //停止取样后忽略TIMER3中断
- /* At this point SYSINTR_TOUCH_CHANGED (timer3) interrupt could also be pending (and masked).
- Since we do not care about the timer3 interrupt after calling TSP_SampleStop, signal it Done.
- If we do not signal done and it was indeed pending and masked, IRQ_TIMER3 will not be unmasked
- and won't fire again unless unmasked */
- if (v_pINTregs->SRCPND & (1<<IRQ_TIMER3))
- InterruptDone(gIntrTouchChanged);
- }
- else
- {
- //Stylus down state
- bTSP_DownFlag = TRUE;
- //读触摸屏AD数据
- if (!TSP_GetXY(&x, &y))
- *pTipStateFlags = TouchSampleIgnore;
- //转换成LCD上的坐标
- TSP_TransXY(&x, &y);
- *pUncalX = x;
- *pUncalY = y;
- *pTipStateFlags |= TouchSampleDownFlag;
- DEBUGMSG(ZONE_TIPSTATE, (TEXT("down %x %x/r/n"), x, y));
- //启动Timer3 PWM
- TSP_SampleStart();
- }
- //屏蔽触摸屏中断,清除中断标志
- v_pINTregs->SUBSRCPND = (1<<IRQ_SUB_TC);
- v_pINTregs->INTSUBMSK &= ~(1<<IRQ_SUB_TC);
- //通知系统中断处理完成
- InterruptDone(gIntrTouch);
- }
- else /* SYSINTR_TOUCH_CHANGED Interrupt Case */
- {
- // TSP_SampleStart();
- //Timer3 PWM中断发生
- if (bTSP_DownFlag)
- {
- //触摸笔还处于down状态
- INT tx, ty;
- INT dx, dy;
- //读取触摸屏AD数据
- if (!TSP_GetXY(&tx, &ty))
- *pTipStateFlags = TouchSampleIgnore;
- else
- { //读到的是坏数据,进行相应处理,如不能修正则忽略该数据
- TSP_TransXY(&tx, &ty);
- // insert by mostek@dstcorp.com
- #define X_ERRV 0x3bf
- #define Y_ERRV 0x4ff
- // Subsequent info: If the ADC provides a bad reading, this catches it and
- // skips over it. Instead, it should be fixed at the source
- // so as not to provide a bad reading.
- if ((tx == X_ERRV) || (ty == Y_ERRV))
- {
- tx = x;
- ty = y;
- }
- // =================== mostek
- dx = (tx > x) ? (tx - x) : (x - tx);
- dy = (ty > y) ? (ty - y) : (y - ty);
- if (dx > TSP_CHANGE || dy > TSP_CHANGE)
- {
- *pUncalX = x = tx;
- *pUncalY = y = ty;
- DEBUGMSG(ZONE_TIPSTATE, (TEXT("down-c-v %x %x/r/n"), x, y));
- *pTipStateFlags = TouchSampleValidFlag | TouchSampleDownFlag;
- }
- else
- {
- *pUncalX = x;
- *pUncalY = y;
- DEBUGMSG(ZONE_TIPSTATE, (TEXT("down-c %x %x/r/n"), x, y));
- *pTipStateFlags = TouchSampleIgnore;
- }
- }
- }
- else
- {
- *pTipStateFlags = TouchSampleIgnore;
- TSP_SampleStop();
- }
- InterruptDone(gIntrTouchChanged);
- }
- }
- 触摸屏驱动一关键函数
- 触摸屏驱动学习笔记 一
- 触摸屏驱动之滤波函数
- 基于S3c6410触摸屏驱动分析(一)
- 触摸屏驱动 之 校正(一)
- 基于S3c6410触摸屏驱动分析(一)
- mini2440驱动(一):触摸屏原理
- msleep函数使用——触摸屏驱动
- 触摸屏驱动
- 触摸屏驱动
- 触摸屏驱动
- 触摸屏驱动
- 触摸屏驱动
- 触摸屏驱动
- 触摸屏驱动
- 触摸屏驱动
- 触摸屏驱动
- 触摸屏驱动
- (一)solr4.0 solr4.0,solr4.2,solr4.3, replica collection core shard slice 概念阐述
- DG3.1——逻辑备库说明
- Null component Catalina:type=JspMonitor,name=jsp,WebModule=//localhost/RixinWeb,J2EEApplication=non
- 第05章 数组 13 练习 11
- 可怜小女孩,模仿电视上吊死亡
- 触摸屏驱动一关键函数
- android中实现多个apk文件
- Unable to open log device '/dev/log/main': No such file or directory
- 51单片机和PC串口异步通信
- GNU/Linux(Fedora 17)ibus-pinyin自定义短语颜文字
- FCKeditor2.3控件使用指南
- rsyslog配置动态日志文件-outchannel补丁
- hdu 4059
- 触摸屏驱动之滤波函数