mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-09 05:05:20 -05:00
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:
parent
dcf7b31ab6
commit
a6913fd7c8
1 changed files with 10 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue