From 20345ef765dbefff4ad776635419c999982457bc Mon Sep 17 00:00:00 2001 From: Tectu Date: Sun, 3 Jun 2012 17:52:02 +0200 Subject: [PATCH] added basic calibration routine --- touchpad.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++---- touchpad.h | 1 + 2 files changed, 64 insertions(+), 4 deletions(-) diff --git a/touchpad.c b/touchpad.c index 0c2fbf8c..0118952a 100644 --- a/touchpad.c +++ b/touchpad.c @@ -1,6 +1,8 @@ #include "touchpad.h" #include "glcd.h" +static int16_t x_cal, y_cal; + static void spicb(SPIDriver *spip); static const SPIConfig spicfg = { NULL, @@ -47,8 +49,12 @@ static __inline uint16_t readY(void) { return y; } +uint8_t __inline tpIRQ(void) { + return (!palReadPad(TP_PORT, TP_IRQ)); +} + uint16_t tpReadX(void) { - uint32_t results; + uint32_t results = 0; uint16_t i, x; for(i=0; i