Library to control a Graphics TFT connected to 4-wire SPI - revised for the Raio RA8875 Display Controller.
Dependents: FRDM_RA8875_mPaint RA8875_Demo RA8875_KeyPadDemo SignalGenerator ... more
Fork of SPI_TFT by
See Components - RA8875 Based Display
Enhanced touch-screen support - where it previous supported both the Resistive Touch and Capacitive Touch based on the FT5206 Touch Controller, now it also has support for the GSL1680 Touch Controller.
Offline Help Manual (Windows chm)
/media/uploads/WiredHome/ra8875.zip.bin (download, rename to .zip and unzip)
Diff: RA8875.cpp
- Revision:
- 147:3494792458d9
- Parent:
- 146:373d59f08357
- Child:
- 148:33e99de1aca6
--- a/RA8875.cpp Thu Jun 01 11:00:40 2017 +0000 +++ b/RA8875.cpp Mon Jun 12 22:15:08 2017 +0000 @@ -525,20 +525,47 @@ bool RA8875::Intersect(rect_t rect1, rect_t rect2) { +#if 1 + // If one rectangle is on left side of other + if (max(rect1.p1.x,rect1.p2.x) < min(rect2.p1.x,rect2.p2.x) + || min(rect1.p1.x, rect1.p2.x) > max(rect2.p1.x, rect2.p2.x)) + return false; + // If one rectangle is above other + if (max(rect1.p1.y, rect1.p2.y) < min(rect2.p1.y, rect2.p2.y) + || min(rect1.p1.y, rect1.p2.y) > max(rect2.p1.y, rect2.p2.y)) + return false; + return true; // all that's left is they overlap +#else point_t bl, tr; - bl.x = rect2.p1.x; bl.y = rect2.p2.y; tr.x = rect2.p2.x; tr.y = rect2.p1.y; if (Intersect(rect1, rect2.p1) || Intersect(rect1, rect2.p2) - || Intersect(rect1, bl) || Intersect(rect1, tr)) + || Intersect(rect1, bl) || Intersect(rect1, tr)) return true; else return false; +#endif } +bool RA8875::Intersect(rect_t * pRect1, const rect_t * pRect2) +{ + if (Intersect(*pRect1, *pRect2)) { + rect_t iSect; + + iSect.p1.x = max(pRect1->p1.x, pRect2->p1.x); + iSect.p1.y = max(pRect1->p1.y, pRect2->p1.y); + iSect.p2.x = min(pRect1->p2.x, pRect2->p2.x); + iSect.p2.y = min(pRect1->p2.y, pRect2->p2.y); + *pRect1 = iSect; + return true; + } else { + return false; + } +} + RetCode_t RA8875::WriteCommandW(uint8_t command, uint16_t data) {