diff --git a/config/mxgui_settings.h b/config/mxgui_settings.h index f72ef7000ce0b3bb2d3c733a722536b2cb7ce695..5c54fe6b49c5478d5655ca6e818af3f895fa16b5 100644 --- a/config/mxgui_settings.h +++ b/config/mxgui_settings.h @@ -84,6 +84,13 @@ static const unsigned int level2MaxNumApps=4; //#define MXGUI_ORIENTATION_VERTICAL_MIRRORED //#define MXGUI_ORIENTATION_HORIZONTAL_MIRRORED +/// +/// Invert touch screen Y coordinate. +/// Required on some boards as the touchscreen sensor is mounted with an +/// inverted vertical coordinate with respect to the display's one. +/// +//#define MXGUI_TOUCH_INVERT_Y + /// /// Select which fonts are required. Choose one or more /// diff --git a/drivers/event_stm32f4discovery.cpp b/drivers/event_stm32f4discovery.cpp index a4889d6617288ed556ac7761f7aabb1ca4590149..13242298628b67a07864dd53a5acf7d26e0d2bbf 100644 --- a/drivers/event_stm32f4discovery.cpp +++ b/drivers/event_stm32f4discovery.cpp @@ -188,6 +188,9 @@ static Point getTouchData() int x=static_cast<int>(tsData[0])<<4 | tsData[1]>>4; int y=((static_cast<int>(tsData[1]) & 0xf)<<8) | tsData[2]; x=4095-x; //X is swapped + #ifdef MXGUI_TOUCH_INVERT_Y + y=4095-y; //On some boards Y is swapped too + #endif //Calibration values. May vary from unit to unit const int xMin=300; const int xMax=3770;