tstest.c
来自「该源码是创维特ARM7 JX44B0X板的例子程序」· C语言 代码 · 共 55 行
C
55 行
#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 + =
减小字号Ctrl + -
显示快捷键?