1
0
Fork 0
forked from len0rd/rockbox

D2: Slightly reduce the number of incorrect touchscreen presses by busy-waiting on the ADCRDY flag.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20527 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Rob Purchase 2009-03-24 23:06:36 +00:00
parent dcf7b31ab6
commit a6913fd7c8

View file

@ -139,8 +139,16 @@ int button_read_device(int *data)
if (pcf50606_read(PCF5060X_ADCC1) & 0x80) /* Pen down */
{
unsigned char buf[3];
pcf50606_write(PCF5060X_ADCC2, (0xE<<1) | 1); /* ADC start X+Y */
pcf50606_read_multiple(PCF5060X_ADCS1, buf, 3);
do {
buf[1] = pcf50606_read(PCF5060X_ADCS2);
} while (!(buf[1] & 0x80)); /* Busy wait on ADCRDY flag */
buf[0] = pcf50606_read(PCF5060X_ADCS1);
buf[2] = pcf50606_read(PCF5060X_ADCS3);
pcf50606_write(PCF5060X_ADCC2, 0); /* ADC stop */
x = (buf[0] << 2) | (buf[1] & 3);
@ -172,6 +180,7 @@ int button_read_device(int *data)
(*data&0x0000ffff),
data);
}
last_touch = current_tick;
touch_available = false;
}