📄 tstest.c
字号:
#include <unistd.h>#include <stdio.h>#include <fcntl.h> /* for data reading from /dev/ts */typedef struct ts_event_1{ int x,y; int dx,dy; int event; int state; int ev_no; unsigned long ev_time;}ts_pen_info;/* * tstest application code, the start code of Linux touch screen application * compile : * $arm-elf-gcc -Wl,-elf2flt -o tstest tstest.c * $cp tstest /tftpboot/examples * run in target: * #cd /var * #ftp 192.168.1.180 * ftp>bin * ftp>cd /tftpboot/examples * ftp>get tstest * ftp>by * #./tstest */int main(int argc, char **argv){ static int ts = -1; static int mousex = 0; static int mousey = 0; static ts_pen_info ts_event; // touch screen printf("touch screen test program\n"); printf("please touch the screen\n"); ts = open ("/dev/ts", O_RDONLY); if (ts < 0) { fprintf (stderr, "Can not open touch screen!\n"); exit(1); } while(1) { read (ts, &ts_event, sizeof (ts_pen_info)); if (ts_event.event > 0) { printf ("mouse down: ts_event.x = %d, ts_event.y = %d\n", ts_event.x, ts_event.y); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -