Index: wzero3_tp.c =================================================================== RCS file: /cvsroot/src/sys/arch/hpcarm/dev/wzero3_tp.c,v retrieving revision 1.5 diff -u -r1.5 wzero3_tp.c --- wzero3_tp.c 30 May 2010 10:00:27 -0000 1.5 +++ wzero3_tp.c 18 Jul 2010 10:37:40 -0000 @@ -549,8 +549,8 @@ #define MAXCTRL_RW_SH 15 /* R/W bit (0:Write/1:Read) */ /* VREF=2.5V, sets interrupt initiated touch-screen scans - * 3.5us/sample, 4 data ave., settling time: 100us */ -#define MAX1233_ADCCTRL 0x8b43 + * 3.5us/sample, 16 data ave., 12 bit, settling time: 100us */ +#define MAX1233_ADCCTRL 0x8be3 void max1233_init(void) @@ -564,6 +564,10 @@ (void)wzero3ssp_ic_send(WZERO3_SSP_IC_MAX1233, (0<= 10); - if (!down) - goto out; - - pos->x = wzero3ssp_ic_send(WZERO3_SSP_IC_MAX1233, + x = wzero3ssp_ic_send(WZERO3_SSP_IC_MAX1233, (1<x)); - pos->y = wzero3ssp_ic_send(WZERO3_SSP_IC_MAX1233, + DPRINTF(("%s: x=%d\n", __func__, x)); + y = wzero3ssp_ic_send(WZERO3_SSP_IC_MAX1233, (1<y)); + DPRINTF(("%s: y=%d\n", __func__, y)); z1 = wzero3ssp_ic_send(WZERO3_SSP_IC_MAX1233, (1<= 10) { rt = 400 /* XXX: X plate ohms */; - rt *= pos->x; + rt *= x; rt *= (z2 / z1) - 1; rt >>= 12; - } else + } else { rt = 0; + } DPRINTF(("%s: rt=%d\n", __func__, rt)); - /* check that pen is still down */ - if (z1 == 0 || rt == 0) - down = 0; + down = (rt != 0); + if (down) { + pos->x = x; + pos->y = y; + } pos->z = down; -out: return down; }