?? test_ads7843.c
字號(hào):
#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;
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -