static void BSP_Pointer_Update(void)
{
GUI_PID_STATE TS_State;
static TS_StateTypeDef prev_state;
TS_StateTypeDef ts;
uint16_t xDiff, yDiff;
BSP_TS_GetState(&ts);
TS_State.Pressed = ts.TouchDetected;
xDiff = (prev_state.X > ts.X) ? (prev_state.X - ts.X) : (ts.X - prev_state.X);
yDiff = (prev_state.Y > ts.Y) ? (prev_state.Y - ts.Y) : (ts.Y - prev_state.Y);
//if(ts.TouchDetected)
//{
if((prev_state.TouchDetected != ts.TouchDetected )|| (ts.TouchDetected &&
((xDiff > 3 )||
(yDiff > 3))))
{
prev_state = ts;
TS_State.Layer = 0;
TS_State.x = ts.X;
TS_State.y = ts.Y;
GUI_TOUCH_StoreStateEx(&TS_State);
if(ts.TouchDetected)
osDelay(50);
}
//}
}
{
GUI_PID_STATE TS_State;
static TS_StateTypeDef prev_state;
TS_StateTypeDef ts;
uint16_t xDiff, yDiff;
BSP_TS_GetState(&ts);
TS_State.Pressed = ts.TouchDetected;
xDiff = (prev_state.X > ts.X) ? (prev_state.X - ts.X) : (ts.X - prev_state.X);
yDiff = (prev_state.Y > ts.Y) ? (prev_state.Y - ts.Y) : (ts.Y - prev_state.Y);
//if(ts.TouchDetected)
//{
if((prev_state.TouchDetected != ts.TouchDetected )|| (ts.TouchDetected &&
((xDiff > 3 )||
(yDiff > 3))))
{
prev_state = ts;
TS_State.Layer = 0;
TS_State.x = ts.X;
TS_State.y = ts.Y;
GUI_TOUCH_StoreStateEx(&TS_State);
if(ts.TouchDetected)
osDelay(50);
}
//}
}