aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTectu <joel@unormal.org>2012-09-09 00:58:52 -0700
committerTectu <joel@unormal.org>2012-09-09 00:58:52 -0700
commitb7791cc490d59bb029ca84e0b677923d9ec95aa7 (patch)
tree9913dce1b5577b8965ecb6cee68512c75d550691
parent2297c4b418b3d601c7c8f30e05de50299c2e0fa3 (diff)
parent11d299114fcabb721cb995228797ae069bcf8155 (diff)
downloaduGFX-b7791cc490d59bb029ca84e0b677923d9ec95aa7.tar.gz
uGFX-b7791cc490d59bb029ca84e0b677923d9ec95aa7.tar.bz2
uGFX-b7791cc490d59bb029ca84e0b677923d9ec95aa7.zip
Merge pull request #48 from mobyfab/master
Touchpad fixes
-rw-r--r--include/touchpad.h1
-rw-r--r--src/touchpad.c5
2 files changed, 4 insertions, 2 deletions
diff --git a/include/touchpad.h b/include/touchpad.h
index 55a83a9d..34c00e5d 100644
--- a/include/touchpad.h
+++ b/include/touchpad.h
@@ -73,6 +73,7 @@ extern "C" {
void tpInit(const TOUCHPADDriver *tp);
uint16_t tpReadX(void);
uint16_t tpReadY(void);
+void tpCalibrate(void);
#if TOUCHPAD_HAS_IRQ
uint8_t tpIRQ(void);
diff --git a/src/touchpad.c b/src/touchpad.c
index 44d5f426..5e81738b 100644
--- a/src/touchpad.c
+++ b/src/touchpad.c
@@ -196,11 +196,12 @@ uint16_t tpReadY(void) {
}
void tpCalibrate(void) {
- uint16_t cross[2][2] = {{40,50}, {200, 280}};
+ const uint16_t h = gdispGetHeight();
+ const uint16_t w = gdispGetWidth();
+ const uint16_t cross[2][2] = {{(w/8), (h/8)}, {(w-(w/8)) , (h-(h/8))}};
uint16_t points[2][2];
uint8_t i;
- //gdispSetOrientation(portrait);
gdispClear(Red);
gdispFillStringBox(0, 10, gdispGetWidth(), 30, "Calibration", &fontUI2Double, White, Red, justifyCenter);