summaryrefslogtreecommitdiffstats
path: root/board/goldelico/gta04/tsc2007.c
diff options
context:
space:
mode:
authorH. Nikolaus Schaller <hns@goldelico.com>2011-12-08 07:56:31 +0100
committerH. Nikolaus Schaller <hns@goldelico.com>2011-12-08 07:56:31 +0100
commit05815bfdc77807192eb5246953202742c4f42385 (patch)
tree2c99606e7d4de050ac670876aeda9f7ae5955113 /board/goldelico/gta04/tsc2007.c
parente17fde7c50b8c54967450c7aea465e7e6bcb29dd (diff)
downloadbootable_bootloader_goldelico_gta04-05815bfdc77807192eb5246953202742c4f42385.zip
bootable_bootloader_goldelico_gta04-05815bfdc77807192eb5246953202742c4f42385.tar.gz
bootable_bootloader_goldelico_gta04-05815bfdc77807192eb5246953202742c4f42385.tar.bz2
big collective commit - see diff what has been changed
Diffstat (limited to 'board/goldelico/gta04/tsc2007.c')
-rw-r--r--board/goldelico/gta04/tsc2007.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/board/goldelico/gta04/tsc2007.c b/board/goldelico/gta04/tsc2007.c
index 430ecbc..b2a0cfa 100644
--- a/board/goldelico/gta04/tsc2007.c
+++ b/board/goldelico/gta04/tsc2007.c
@@ -155,3 +155,27 @@ void print_adc(void)
read_adc(7));
}
+int pendown(int *x, int *y)
+{
+#if 1
+ int z;
+ int xx;
+ int yy;
+ xx=read_adc(0);
+ yy=read_adc(1);
+ z=read_adc(2); // read Z
+ if(z < 0)
+ return 0; // read error
+#if 0
+ printf("z=%04d x:%04d y:%04d\n", z, xx, yy);
+#endif
+ if(x) *x=xx;
+ if(y) *y=yy;
+ udelay(10000); // reduce I2C traffic and debounce...
+ return z > 200; // was pressed
+#else
+ // must be in PENIRQ mode...
+ return (status_get_buttons() & (1 << 4)) == 0;
+#endif
+}
+