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

📄 test_ads7843.c

📁 xscale pxa255 处理器
💻 C
字号:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types>
#include <sys/stat.h>
#include <fcntl.h>

int ts_fd;

static char *dev_name="/dev/ads7843";

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

int main(int argc, char **argv)
{
	TS_EVENT data;
	short x_pos, y_pos;
	
	
	ts_fd=open(dev_name ,O_RDONLY);
	
	if(!(ts_fd>=0))
		{
			printf("%s file open failed\n",dev_name);
			exit(-1);
		}
		printf("\n test_ads7843_touchscreen: press the touchscreen and see the position  - Exit Ctrl C \n",dev_name);

		 while (1)
		  {
			 
				read(ts_fd, &data,sizeof(data));
			  x_pos=data.x;
			  y_pos=data.y;

			
					printf("the x position is %d ,y position is %d\n", data[1],data[2]);
		  }
		
			close(fd);
			return 0;
}
			  
		    
			

⌨️ 快捷键说明

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