提交 f344f002 编写于 作者: C chaos.proton@gmail.com

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
上级 e8036400
......@@ -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;
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册