This is the David Smart RA8875 Library with mods for working with FRDM-K64F
Diff: RA8875_Touch.cpp
- Revision:
- 190:3132b7dfad82
- Parent:
- 184:464cc376265d
- Child:
- 193:74f80834d59d
--- a/RA8875_Touch.cpp Thu Sep 19 21:45:18 2019 +0000 +++ b/RA8875_Touch.cpp Sat Sep 21 17:30:00 2019 +0000 @@ -49,7 +49,7 @@ RetCode_t RA8875::TouchPanelInit(void) { RetCode_t r = noerror; - + panelTouched = false; if (useTouchPanel == TP_GSL1680) { INFO("TouchPanelInit: TP_GSL1680"); @@ -74,7 +74,7 @@ #else touchTicker.attach_us(this, &RA8875::_TouchTicker, TOUCH_TICKER_uS); #endif - + timeSinceTouch.start(); timeSinceTouch.reset(); r = _internal_ts_cal(); @@ -303,7 +303,7 @@ } else if (useTouchPanel == TP_RES) { int a2dX = 0; int a2dY = 0; - + touchInfo[0].touchID = 0; ts = TouchPanelA2DFiltered(&a2dX, &a2dY); if (ts != no_touch) { @@ -345,15 +345,15 @@ return ts; } -uint8_t RA8875::TouchID(uint8_t channel) +uint8_t RA8875::TouchID(uint8_t channel) { if (channel >= TouchChannels()) channel = 0; - return touchInfo[channel].touchID; + return touchInfo[channel].touchID; } -TouchCode_t RA8875::TouchCode(uint8_t channel) -{ +TouchCode_t RA8875::TouchCode(uint8_t channel) +{ if (channel >= TouchChannels()) channel = 0; INFO("TouchCode[%d] = %d", channel, touchInfo[channel].touchCode); @@ -364,7 +364,7 @@ { if (channel >= TouchChannels()) channel = 0; - return TranslateOrientation(touchInfo[channel].coordinates); + return TranslateOrientation(touchInfo[channel].coordinates); } TouchCode_t RA8875::TouchPanelGet(point_t * TouchPoint) @@ -387,7 +387,7 @@ point_t RA8875::TranslateOrientation(point_t rawPoint) { point_t newPoint = rawPoint; - + #if 1 switch (screen_orientation) { default: @@ -595,26 +595,25 @@ /// point given a corresponding set of touch screen points: /// /// <pre> -/// /- -\ -/// /- -\ /- -\ | | -/// | | | | | Xs | -/// | Xd | | A B C | | | -/// | | = | | * | Ys | -/// | Yd | | D E F | | | -/// | | | | | 1 | -/// \- -/ \- -/ | | -/// \- -/ +/// /- -\ // +/// /- -\ /- -\ | | // +/// | | | | | Xs | // +/// | Xd | | A B C | | | // +/// | | = | | * | Ys | // +/// | Yd | | D E F | | | // +/// | | | | | 1 | // +/// \- -/ \- -/ | | // +/// \- -/ // /// where: /// (Xd,Yd) represents the desired display point /// coordinates, /// (Xs,Ys) represents the available touch screen /// coordinates, and the matrix -/// /- -\ -/// |A,B,C| -/// |D,E,F| represents the factors used to translate -/// \- -/ the available touch screen point values -/// into the corresponding display -/// coordinates. +/// /- -\ represents the factors used to translate +/// |A,B,C| the available touch screen point values +/// |D,E,F| into the corresponding display +/// \- -/ coordinates. +/// /// Note that for practical considerations, the utilities /// within this file do not use the matrix coefficients as /// defined above, but instead use the following @@ -776,7 +775,7 @@ FILE * fh; tpMatrix_t matrix; RetCode_t r = noerror; - + if (tpFQFN) { fh = fopen(tpFQFN, "rb"); if (fh) { @@ -811,7 +810,7 @@ uint8_t RA8875::FT5206_ReadRegU8(uint8_t reg) { char val; - + m_i2c->write(m_addr, (const char *)®, 1); m_i2c->read(m_addr, &val, 1); //INFO("ReadReg %02X, Val %02X", reg, val);