From 021f71445e77e0fbef7ff4dc78e0f6cc86a78968 Mon Sep 17 00:00:00 2001 From: inmarket Date: Mon, 25 Nov 2013 23:11:56 +1000 Subject: Add support for edge to edge touch calibration. --- include/ginput/lld/mouse.h | 5 +++++ src/ginput/mouse.c | 18 +++++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/include/ginput/lld/mouse.h b/include/ginput/lld/mouse.h index a3056519..6b8246dc 100644 --- a/include/ginput/lld/mouse.h +++ b/include/ginput/lld/mouse.h @@ -31,6 +31,11 @@ #define GINPUT_MOUSE_NEED_CALIBRATION FALSE #endif +// TRUE/FALSE - Should the calibration happen at the extremes of the panel? +#ifndef GINPUT_MOUSE_CALIBRATE_EXTREMES + #define GINPUT_MOUSE_CALIBRATE_EXTREMES FALSE +#endif + // TRUE/FALSE - Can the mouse/touch driver itself save calibration data? #ifndef GINPUT_MOUSE_LLD_CALIBRATION_LOADSAVE #define GINPUT_MOUSE_LLD_CALIBRATION_LOADSAVE FALSE diff --git a/src/ginput/mouse.c b/src/ginput/mouse.c index 1d2a314a..8166608a 100644 --- a/src/ginput/mouse.c +++ b/src/ginput/mouse.c @@ -428,16 +428,16 @@ bool_t ginputCalibrateMouse(uint16_t instance) { const coord_t height = gdispGGetHeight(MouseConfig.display); const coord_t width = gdispGGetWidth(MouseConfig.display); - #if 1 - const MousePoint cross[] = {{(width / 4), (height / 4)}, - {(width - (width / 4)) , (height / 4)}, - {(width - (width / 4)) , (height - (height / 4))}, - {(width / 2), (height / 2)}}; /* Check point */ - #else + #if GINPUT_MOUSE_CALIBRATE_EXTREMES const MousePoint cross[] = {{0, 0}, - {(width - 1) , 0}, - {(width - 1) , (height - 1)}, - {(width / 2), (height / 2)}}; /* Check point */ + {(width - 1) , 0}, + {(width - 1) , (height - 1)}, + {(width / 2), (height / 2)}}; /* Check point */ + #else + const MousePoint cross[] = {{(width / 4), (height / 4)}, + {(width - (width / 4)) , (height / 4)}, + {(width - (width / 4)) , (height - (height / 4))}, + {(width / 2), (height / 2)}}; /* Check point */ #endif MousePoint points[GINPUT_MOUSE_CALIBRATION_POINTS]; const MousePoint *pc; -- cgit v1.2.3