aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTectu <joel@unormal.org>2012-06-01 13:50:42 +0200
committerTectu <joel@unormal.org>2012-06-01 13:50:42 +0200
commit764c2739755f584177a11cf3430ef3b4478cabd7 (patch)
treed610cfbf233afc21a6fba177e6b5579a243b235a
parent732c04081d75956173544bde05405e2fe4d4577e (diff)
downloaduGFX-764c2739755f584177a11cf3430ef3b4478cabd7.tar.gz
uGFX-764c2739755f584177a11cf3430ef3b4478cabd7.tar.bz2
uGFX-764c2739755f584177a11cf3430ef3b4478cabd7.zip
added dummy readout
-rw-r--r--touchpad.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/touchpad.c b/touchpad.c
index 51a9c07e..0c2fbf8c 100644
--- a/touchpad.c
+++ b/touchpad.c
@@ -13,7 +13,7 @@ void tpInit(void) {
spiStart(&SPID1, &spicfg);
}
-static uint16_t readX(void) {
+static __inline uint16_t readX(void) {
uint8_t txbuf[1];
uint8_t rxbuf[2];
uint16_t x;
@@ -30,7 +30,7 @@ static uint16_t readX(void) {
return x;
}
-static uint16_t readY(void) {
+static __inline uint16_t readY(void) {
uint8_t txbuf[1];
uint8_t rxbuf[2];
uint16_t y;
@@ -52,6 +52,7 @@ uint16_t tpReadX(void) {
uint16_t i, x;
for(i=0; i<CONVERSIONS; i++) {
+ readX();
results += readX();
}
@@ -64,8 +65,10 @@ uint16_t tpReadY(void) {
uint32_t results;
uint16_t i, y;
- for(i=0; i<CONVERSIONS; i++)
+ for(i=0; i<CONVERSIONS; i++) {
+ readY();
results += readY();
+ }
y = (((lcdGetWidth()-1) * (results/CONVERSIONS)) / 2048);