⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ucb1400_ts.h

📁 基于pxa270的touch screen的源码
💻 H
字号:
#ifndef UCB1400_TS_H
#define UCB1400_TS_H


typedef struct
{
void * PositiveIntEnable;
void * NegativeIntEnable;
void * IntClearStatus;
void * TouchScreenControl;
void * ADCControl;
void * ADCData;
void * FeatureCSR1;
void * FeatureCSR2;
void * VendorID1;
void * VendorID2;
} UCB1400TSREG;



//Touch Screen Control register (0x64)
#define MXP		(0x1<<0)
#define PXP		(0x1<<1)
#define MYP		(0x1<<2)
#define PYP		(0x1<<3)
#define MXG             (0x1<<4)
#define PXG             (0x1<<5)
#define MYG		(0x1<<6)
#define PYG		(0x1<<7)

#define BIAS            (0x1<<11)

#define TM_INTERRUPT    (0<<8)
#define TM_PRESSURE     (1<<8)
#define TM_POSITION     (2<<8)

#define PX              (0x1<<12)
#define MX              (0x1<<13)



//Positive INT Enable register (0x5e)
#define TMXP		(0x1<<13)
#define TPXP		(0x1<<12)
#define ADCP            (0x1<<11)

//Negative INT Enable register (0x60)
#define TMXN		(0x1<<13)
#define TPXN		(0x1<<12)
#define ADCN            (0x1<<11)


//INT Clear/Status register (0x62)
#define TMXS		(0x1<<13)
#define TPXS		(0x1<<12)
#define ADCS            (0x1<<11)

//ADC Control register
#define AE		(0x1<<15)
#define AS		(0x1<<7)
#define AI_TSPX         (0x000   )
#define AI_TSMX		(1<<2)
#define AI_TSPY		(2<<2)
#define AI_TSMY		(3<<2)


typedef struct {
     short pressure;
     short x;
     short y;
     short millisecs;
} TS_EVENT;


static int raw_max_x, raw_max_y, res_x, res_y, raw_min_x, raw_min_y, xyswap;

static int cal_ok, x_rev, y_rev;

static DECLARE_WAIT_QUEUE_HEAD(queue);

static struct timer_list timer;

#define TS_NAME "UCB1400 TouchScreen Controller"
#define TS_MAJOR   11
#define BUFSIZE    128
#define XLIMIT     160
#define YLIMIT     160
#define UCB1400_IRQ   IRQ_GPIO(13)

//The following codes are added for calibration

#define QUE_LENTH 30
typedef struct TCH_QUEUE {
   TS_EVENT tch_queue[QUE_LENTH+1];
   short head;
   short tail;
   short  num;
} TCH_QUEUE,*PTCH_QUEUE;

static int xConDif=0;
static int x2xScaDif=0;
static int y2xScaDif=0;
static int yConDif=0;
static int y2yScaDif=0;
static int x2yScaDif=0;
static int mulNum=1;

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -