Specifications

Sample Driver Code 63
/* these variables now contain the raw coordinates the controller would
output for the extremes of the video image */
/* detect touchscreen orientation corrections */
*xyswap = abs(sx x1) < abs(sy y1);
if (*xyswap) {
xch(xhigh, yhigh);
xch(xlow, ylow);
}
xinv = *xhigh < *xlow;
yinv = *yhigh < *ylow;
/* display results of calibration useful for troubleshooting */
clearscreen(); cursoron();
printf("Calibration points are: %d,%d, %d,%d\n",*xlow,*ylow,*xhigh,*yhigh);
if (xinv)
printf("X axis inverted.\n");
if (yinv)
printf("Y axis inverted.\n"); /* normal */
if (*xyswap)
printf("X and Y axes swapped.\n");
if (xinv || yinv || *xyswap)
printf("Orientation adjusted.\n");
/* Axis inversion is automatically accomplished by the signed arithmetic
in the controller. The controller must be told to swap axes however. */
}
void getpoint(int x, int y, int *tx, int *ty)
/* display target at x,y, return touch coordinate */
{
int z,flags;
outstr(x, y, "*"); /* display target */
while (!gettouch(tx, ty, &z, &flags)) ;
outstr(x, y, " \a"); /* remove target, beep */
}
void outstr(int x, int y, char *s)
/* display string at x,y */
{
cursorxy(x, y);
printf("%s",s);
}
void xch(int *i1, int *i2)
/* swap integers */
{
int t;
t = *i1; *i1 = *i2; *i2 = t;
}
#include "bus.c" /* for E271-2201 and E271-2202 */
/* #include "serial.c" */ /* for E271-2200 and E271-2210 */