Forked para SNOCC
Fork of RA8875 by
Diff: RA8875_Touch.cpp
- Revision:
- 103:7e0464ca6c5c
- Parent:
- 88:bfddef6ec836
- Child:
- 108:7415c405ee08
diff -r fc60bfa0199f -r 7e0464ca6c5c RA8875_Touch.cpp --- a/RA8875_Touch.cpp Sat Jan 23 16:58:54 2016 +0000 +++ b/RA8875_Touch.cpp Sun Feb 07 23:18:01 2016 +0000 @@ -178,20 +178,22 @@ TouchCode_t ts = TouchPanelA2DFiltered(&a2dX, &a2dY); if (ts != no_touch) { - if (tpMatrix.Divider != 0 && TouchPoint) { - /* Operation order is important since we are doing integer */ - /* math. Make sure you add all terms together before */ - /* dividing, so that the remainder is not rounded off */ - /* prematurely. */ - TouchPoint->x = ( (tpMatrix.An * a2dX) + - (tpMatrix.Bn * a2dY) + - tpMatrix.Cn - ) / tpMatrix.Divider ; + if (tpMatrix.Divider != 0) { + if (TouchPoint) { + /* Operation order is important since we are doing integer */ + /* math. Make sure you add all terms together before */ + /* dividing, so that the remainder is not rounded off */ + /* prematurely. */ + TouchPoint->x = ( (tpMatrix.An * a2dX) + + (tpMatrix.Bn * a2dY) + + tpMatrix.Cn + ) / tpMatrix.Divider ; - TouchPoint->y = ( (tpMatrix.Dn * a2dX) + - (tpMatrix.En * a2dY) + - tpMatrix.Fn - ) / tpMatrix.Divider ; + TouchPoint->y = ( (tpMatrix.Dn * a2dX) + + (tpMatrix.En * a2dY) + + tpMatrix.Fn + ) / tpMatrix.Divider ; + } } else { ts = no_cal; }