bsp/stm32f10x/touch.c: normalize the calibrated touch position
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1783 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
e803640027
commit
f344f00278
|
@ -171,6 +171,17 @@ static void rtgui_touch_calculate()
|
|||
{
|
||||
touch->y = (touch->min_y - touch->y) * Y_WIDTH /(touch->min_y - touch->max_y);
|
||||
}
|
||||
|
||||
// normalize the data
|
||||
if (touch->x & 0x8000)
|
||||
touch->x = 0;
|
||||
else if (touch->x > X_WIDTH)
|
||||
touch->x = X_WIDTH - 1;
|
||||
|
||||
if (touch->y & 0x8000)
|
||||
touch->y = 0;
|
||||
else if (touch->y > Y_WIDTH)
|
||||
touch->y = Y_WIDTH - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue