summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Purchase <shotofadds@rockbox.org>2009-03-24 23:06:36 +0000
committerRob Purchase <shotofadds@rockbox.org>2009-03-24 23:06:36 +0000
commita6913fd7c8a9d60727ea7fa62b792f09432d9c11 (patch)
treeec653ce0f41c80f548137363eb5d7d4b08599bff
parentdcf7b31ab6b2c93f027a023c4e57a4de7425c6e6 (diff)
downloadrockbox-a6913fd7c8a9d60727ea7fa62b792f09432d9c11.tar.gz
rockbox-a6913fd7c8a9d60727ea7fa62b792f09432d9c11.zip
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
-rw-r--r--firmware/target/arm/tcc780x/cowond2/button-cowond2.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/firmware/target/arm/tcc780x/cowond2/button-cowond2.c b/firmware/target/arm/tcc780x/cowond2/button-cowond2.c
index 12eb88907a..290058b78a 100644
--- a/firmware/target/arm/tcc780x/cowond2/button-cowond2.c
+++ b/firmware/target/arm/tcc780x/cowond2/button-cowond2.c
@@ -139,8 +139,16 @@ int button_read_device(int *data)
139 if (pcf50606_read(PCF5060X_ADCC1) & 0x80) /* Pen down */ 139 if (pcf50606_read(PCF5060X_ADCC1) & 0x80) /* Pen down */
140 { 140 {
141 unsigned char buf[3]; 141 unsigned char buf[3];
142
142 pcf50606_write(PCF5060X_ADCC2, (0xE<<1) | 1); /* ADC start X+Y */ 143 pcf50606_write(PCF5060X_ADCC2, (0xE<<1) | 1); /* ADC start X+Y */
143 pcf50606_read_multiple(PCF5060X_ADCS1, buf, 3); 144
145 do {
146 buf[1] = pcf50606_read(PCF5060X_ADCS2);
147 } while (!(buf[1] & 0x80)); /* Busy wait on ADCRDY flag */
148
149 buf[0] = pcf50606_read(PCF5060X_ADCS1);
150 buf[2] = pcf50606_read(PCF5060X_ADCS3);
151
144 pcf50606_write(PCF5060X_ADCC2, 0); /* ADC stop */ 152 pcf50606_write(PCF5060X_ADCC2, 0); /* ADC stop */
145 153
146 x = (buf[0] << 2) | (buf[1] & 3); 154 x = (buf[0] << 2) | (buf[1] & 3);
@@ -172,6 +180,7 @@ int button_read_device(int *data)
172 (*data&0x0000ffff), 180 (*data&0x0000ffff),
173 data); 181 data);
174 } 182 }
183
175 last_touch = current_tick; 184 last_touch = current_tick;
176 touch_available = false; 185 touch_available = false;
177 } 186 }