Forked para SNOCC
Fork of RA8875 by
Diff: RA8875_Touch.cpp
- Revision:
- 79:544eb4964795
- Parent:
- 78:faf49c381591
- Child:
- 81:01da2e34283d
--- a/RA8875_Touch.cpp Sun Dec 28 03:14:35 2014 +0000 +++ b/RA8875_Touch.cpp Sun Dec 28 19:55:16 2014 +0000 @@ -37,7 +37,7 @@ return noerror; } -unsigned char RA8875::TouchPanelRead(loc_t *x, loc_t *y) +bool RA8875::TouchPanelA2DFiltered(loc_t *x, loc_t *y) { unsigned char touchready; static int xbuf[TPBUFSIZE], ybuf[TPBUFSIZE], sample = 0; @@ -100,7 +100,7 @@ return touchready; } -unsigned char RA8875::TouchPanelReadRaw(loc_t *x, loc_t *y) +bool RA8875::TouchPanelA2DRaw(loc_t *x, loc_t *y) { unsigned char touchready; @@ -366,14 +366,14 @@ * operations to scale results by a factor of 2 or even 4. * */ -RetCode_t RA8875::TouchPanelPoint(point_t * TouchPoint) +bool RA8875::TouchPanelReadable(point_t * TouchPoint) { - RetCode_t retValue = no_touch; + bool touched = false; point_t screenpoint = {0, 0}; - if (TouchPanelRead(&screenpoint.x, &screenpoint.y)) { - retValue = touch; - if (tpMatrix.Divider != 0 ) { + if (TouchPanelA2DFiltered(&screenpoint.x, &screenpoint.y)) { + touched = true; + 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 */ @@ -388,10 +388,10 @@ tpMatrix.Fn ) / tpMatrix.Divider ; } else { - retValue = bad_parameter ; + touched = false; } } - return( retValue ); + return touched; }