📄 tstest.c
字号:
#include <unistd.h>#include <stdio.h>#include <fcntl.h> /* for data reading from /dev/ts */typedef struct { unsigned short pressure; unsigned short x; unsigned short y; unsigned short pad;} TS_EVENT;/* * tstest application code, the start code of Linux touch screen application * compile : * $/usr/local/arm/2.95.3/bin/arm-linux-gcc -o tstest tstest.c * $cp tstest /tftpboot/examples * run in target: * #mount 192.168.1.180:/tftpboot/ /mnt/nfs * #cd /mnt/nfs/examples * #./tstest */int main(int argc, char **argv){ static int ts = -1; static int mousex = 0; static int mousey = 0; static TS_EVENT 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_EVENT)); if (ts_event.pressure > 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 + -