?? 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 + -