/*
* tslib/src/ts_test.c
*
* Copyright (C) 2001 Russell King.
*
* This file is placed under the GPL. Please see the file
* COPYING for more details.
*
* $Id: ts_test.c,v 1.6 2004/10/19 22:01:27 dlowder Exp $
*
* Basic test program for touchscreen library.
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <sys/fcntl.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/time.h>
#include "tslib.h"
#include "fbutils.h"
int nowvalue,prevalue,op;
static int palette [] =
{
0x000000, 0xffe080, 0xffffff, 0xe0c0a0, 0x304050, 0x80b8c0
};
#define NR_COLORS (sizeof (palette) / sizeof (palette [0]))
struct ts_button {
int x, y, w, h;
char *text;
int flags;
#define BUTTON_ACTIVE 0x00000001
};
/* [inactive] border fill text [active] border fill text */
static int button_palette [6] =
{
1, 4, 2,
1, 5, 0
};
#define NR_BUTTONS 17
static struct ts_button buttons [NR_BUTTONS];
static void sig(int sig)
{
close_framebuffer();
fflush(stderr);
printf("signal %d caught\n", sig);
fflush(stdout);
exit(1);
}