diff options
author | inmarket <andrewh@inmarket.com.au> | 2013-11-10 21:34:49 +1000 |
---|---|---|
committer | inmarket <andrewh@inmarket.com.au> | 2013-11-10 21:34:49 +1000 |
commit | 1646f9da1a5052bbc6d7fbb1db0c1b411bff46bd (patch) | |
tree | 022abf62e82493efa8d20dfa56dd03f9b61de175 /src/ginput | |
parent | 5cc1c5d67b339dc3cc623a6f3d10b9137d0929c8 (diff) | |
download | uGFX-1646f9da1a5052bbc6d7fbb1db0c1b411bff46bd.tar.gz uGFX-1646f9da1a5052bbc6d7fbb1db0c1b411bff46bd.tar.bz2 uGFX-1646f9da1a5052bbc6d7fbb1db0c1b411bff46bd.zip |
Allow full range of values to be returned from the mouse driver when it is in RAW mode
Diffstat (limited to 'src/ginput')
-rw-r--r-- | src/ginput/mouse.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/ginput/mouse.c b/src/ginput/mouse.c index 99ef04f6..80a4ed20 100644 --- a/src/ginput/mouse.c +++ b/src/ginput/mouse.c @@ -65,6 +65,7 @@ static struct MouseConfig_t { #define FLG_CAL_OK 0x0020 #define FLG_CAL_SAVED 0x0040 #define FLG_CAL_FREE 0x0080 + #define FLG_CAL_RAW 0x0100 #if GINPUT_MOUSE_NEED_CALIBRATION GMouseCalibrationSaveRoutine fnsavecal; GMouseCalibrationLoadRoutine fnloadcal; @@ -200,14 +201,18 @@ static void get_calibrated_reading(MouseReading *pt) { pt->x = t; } break; + default: + break; } #endif #if GINPUT_MOUSE_NEED_CALIBRATION + if (!(MouseConfig.flags & FLG_CAL_RAW)) { if (pt->x < 0) pt->x = 0; else if (pt->x >= w) pt->x = w-1; if (pt->y < 0) pt->y = 0; else if (pt->y >= h) pt->y = h-1; + } #endif } @@ -350,7 +355,7 @@ GSourceHandle ginputGetMouse(uint16_t instance) { MouseConfig.caldata.ay = 0; MouseConfig.caldata.by = 1; MouseConfig.caldata.cy = 0; - MouseConfig.flags |= (FLG_CAL_OK|FLG_CAL_SAVED); + MouseConfig.flags |= (FLG_CAL_OK|FLG_CAL_SAVED|FLG_CAL_RAW); } else ginputCalibrateMouse(instance); #endif @@ -437,7 +442,7 @@ bool_t ginputCalibrateMouse(uint16_t instance) { MouseConfig.flags |= FLG_IN_CAL; gtimerStop(&MouseTimer); - MouseConfig.flags &= ~(FLG_CAL_OK|FLG_CAL_SAVED); + MouseConfig.flags &= ~(FLG_CAL_OK|FLG_CAL_SAVED|FLG_CAL_RAW); #if GDISP_NEED_CONTROL gdispGSetOrientation(MouseConfig.display, GDISP_ROTATE_0); |