aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ginput
diff options
context:
space:
mode:
authorinmarket <andrewh@inmarket.com.au>2015-02-23 18:15:22 +1000
committerinmarket <andrewh@inmarket.com.au>2015-02-23 18:15:22 +1000
commit78db2f1d49534998264077a6b2fc3eb7234be0df (patch)
tree1d0d78d95a04713dfe61415456dd3e795252615a /drivers/ginput
parent07707276f61fa9cfcc7a44859c07c816b4b9ae81 (diff)
downloaduGFX-78db2f1d49534998264077a6b2fc3eb7234be0df.tar.gz
uGFX-78db2f1d49534998264077a6b2fc3eb7234be0df.tar.bz2
uGFX-78db2f1d49534998264077a6b2fc3eb7234be0df.zip
Fix to STMPE811 touch driver to fix self-calibration in other orientations
Diffstat (limited to 'drivers/ginput')
-rw-r--r--drivers/ginput/touch/STMPE811/gmouse_lld_STMPE811.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/ginput/touch/STMPE811/gmouse_lld_STMPE811.c b/drivers/ginput/touch/STMPE811/gmouse_lld_STMPE811.c
index 353539f9..56e8c98f 100644
--- a/drivers/ginput/touch/STMPE811/gmouse_lld_STMPE811.c
+++ b/drivers/ginput/touch/STMPE811/gmouse_lld_STMPE811.c
@@ -208,8 +208,21 @@ static bool_t read_xyz(GMouse* m, GMouseReading* pdr)
// Rescale X,Y if we are using self-calibration
#if GMOUSE_STMPE811_SELF_CALIBRATE
- pdr->x = gdispGGetWidth(m->display) - pdr->x / (4096/gdispGGetWidth(m->display));
- pdr->y = pdr->y / (4096/gdispGGetHeight(m->display));
+ #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->y = pdr->y / (4096/gdispGGetHeight(m->display));
+ 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));
+ }
+ #else
+ pdr->x = gdispGGetWidth(m->display) - pdr->x / (4096/gdispGGetWidth(m->display));
+ pdr->y = pdr->y / (4096/gdispGGetHeight(m->display));
+ #endif
#endif
return TRUE;