Esempio n. 1
0
File: elo.c Progetto: ysei/uclinux-2
// Reset the touch-screen interface.
//
static int elo_reset_touch(int fd)
{
  fd_set set;
  struct timeval timeout={0, 100000};  /* 0.1 seconds */
  unsigned char packet[8];

  /* Send reset command */
  memset(packet, 0, 8);
  packet[0]='R';
  packet[1]=1;    /* 0=Hard reset, 1=Soft */
  elo_putbuf(fd, packet);

  /* Wait for response */
  FD_ZERO(&set);
  FD_SET(fd, &set);
  if(!select(fd+1, &set, NULL, NULL, &timeout))
    return -1;  /* no communications */

  if(!elo_check_ack(fd))
    return -1;  /* no valid packet received */

  /* Set the proper mode of operation:
      Initial Touch, Range Checking, Calibration, Scaling, and Trim. */

  elo_set_mode(fd,ELO_M_INITIAL|ELO_M_UNTOUCH|ELO_M_RANGECK,
                  ELO_M_CALIB|ELO_M_SCALE|ELO_M_TRIM);

  /* Set scaling to 80 x 25 */
  elo_set_scale(fd, 'X', elo_MINX, elo_SCREENWIDTH-1);
  elo_set_scale(fd, 'Y', elo_MINY, elo_SCREENHEIGHT-1);

  return 0;
}
Esempio n. 2
0
// Reset the touch-screen interface.
//
static int elo_reset_touch(int fd)
{
  unsigned char packet[8];

  /* Send reset command */
  memset(packet, 0, 8);
  packet[0]='R';
  packet[1]=1;    /* 0=Hard reset, 1=Soft */
  elo_putbuf(fd, packet);

  /* Wait for response */
  if(!elo_check_ack(fd))
    return -1;  /* no valid packet received */

  /* Set the proper mode of operation:
      Initial Touch, Range Checking, Calibration, Scaling, and Trim. */

  elo_set_mode(fd,ELO_M_INITIAL|ELO_M_UNTOUCH|ELO_M_RANGECK,
                  ELO_M_CALIB|ELO_M_SCALE|ELO_M_TRIM);

  /* Set scaling to 80 x 25 */
  elo_set_scale(fd, 'X', elo_MINX, elo_SCREENWIDTH-1);
  elo_set_scale(fd, 'Y', elo_MINY, elo_SCREENHEIGHT-1);

  return 0;
}