Fix self calibration for touch devices FT5x06 and STMPE610
This commit is contained in:
parent
cd3a87f2d4
commit
fe980847d4
2 changed files with 23 additions and 7 deletions
|
@ -72,10 +72,25 @@ static bool_t MouseXYZ(GMouse* m, GMouseReading* pdr)
|
||||||
pdr->y = (coord_t)read_word(m, FT5x06_TOUCH1_YH);
|
pdr->y = (coord_t)read_word(m, FT5x06_TOUCH1_YH);
|
||||||
pdr->z = 1;
|
pdr->z = 1;
|
||||||
|
|
||||||
|
// Rescale X,Y if we are using self-calibration
|
||||||
#if GMOUSE_FT5x06_SELF_CALIBRATE
|
#if GMOUSE_FT5x06_SELF_CALIBRATE
|
||||||
// Rescale X,Y,Z - If we are using self-calibration
|
#if GDISP_NEED_CONTROL
|
||||||
|
switch(gdispGGetOrientation(m->display)) {
|
||||||
|
case GDISP_ROTATE_0:
|
||||||
|
case GDISP_ROTATE_180:
|
||||||
pdr->x = gdispGGetWidth(m->display) - pdr->x / (4096/gdispGGetWidth(m->display));
|
pdr->x = gdispGGetWidth(m->display) - pdr->x / (4096/gdispGGetWidth(m->display));
|
||||||
pdr->y = pdr->y / (4096/gdispGGetHeight(m->display));
|
pdr->y = pdr->y / (4096/gdispGGetHeight(m->display));
|
||||||
|
break;
|
||||||
|
case GDISP_ROTATE_90:
|
||||||
|
case GDISP_ROTATE_270:
|
||||||
|
pdr->x = gdispGGetHeight(m->display) - pdr->x / (4096/gdispGGetHeight(m->display));
|
||||||
|
pdr->y = pdr->y / (4096/gdispGGetWidth(m->display));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
pdr->x = gdispGGetWidth(m->display) - pdr->x / (4096/gdispGGetWidth(m->display));
|
||||||
|
pdr->y = pdr->y / (4096/gdispGGetHeight(m->display));
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -207,7 +207,6 @@ static bool_t read_xyz(GMouse* m, GMouseReading* pdr)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Rescale X,Y if we are using self-calibration
|
// Rescale X,Y if we are using self-calibration
|
||||||
// Not working currently.
|
|
||||||
#if GMOUSE_STMPE610_SELF_CALIBRATE
|
#if GMOUSE_STMPE610_SELF_CALIBRATE
|
||||||
#if GDISP_NEED_CONTROL
|
#if GDISP_NEED_CONTROL
|
||||||
switch(gdispGGetOrientation(m->display)) {
|
switch(gdispGGetOrientation(m->display)) {
|
||||||
|
@ -215,14 +214,16 @@ static bool_t read_xyz(GMouse* m, GMouseReading* pdr)
|
||||||
case GDISP_ROTATE_180:
|
case GDISP_ROTATE_180:
|
||||||
default:
|
default:
|
||||||
pdr->x = pdr->x / (4096/gdispGGetWidth(m->display));
|
pdr->x = pdr->x / (4096/gdispGGetWidth(m->display));
|
||||||
pdr->y = gdispGGetHeight(m->display) - pdr->y / (4096/gdispGGetHeight(m->display));
|
pdr->y = pdr->y / (4096/gdispGGetHeight(m->display));
|
||||||
|
break;
|
||||||
case GDISP_ROTATE_90:
|
case GDISP_ROTATE_90:
|
||||||
case GDISP_ROTATE_270:
|
case GDISP_ROTATE_270:
|
||||||
pdr->x = pdr->x / (4096/gdispGGetHeight(m->display));
|
pdr->x = pdr->x / (4096/gdispGGetHeight(m->display));
|
||||||
pdr->y = gdispGGetWidth(m->display) - pdr->y / (4096/gdispGGetWidth(m->display));
|
pdr->y = pdr->y / (4096/gdispGGetWidth(m->display));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
pdr->x = gdispGGetWidth(m->display) - pdr->x / (4096/gdispGGetWidth(m->display));
|
pdr->x = pdr->x / (4096/gdispGGetWidth(m->display));
|
||||||
pdr->y = pdr->y / (4096/gdispGGetHeight(m->display));
|
pdr->y = pdr->y / (4096/gdispGGetHeight(m->display));
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue