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:
- 181:0032d1b8f5d4
- Parent:
- 178:ae472eb22740
- Child:
- 182:8832d03a2a29
--- a/RA8875.cpp Thu Aug 01 22:35:29 2019 +0000 +++ b/RA8875.cpp Fri Aug 02 02:12:26 2019 +0000 @@ -247,7 +247,7 @@ #if MBED_VERSION >= MBED_ENCODE_VERSION(5,8,0) eventThread.start(callback(&queue, &EventQueue::dispatch_forever)); m_irq->fall(queue.event(callback(this, &RA8875::TouchPanelISR))); - #elif (MBED_MAJOR_VERSION >= 5) || (MBED_LIBRARY_VERSION > 128) // Is this the right version? + #elif (MBED_MAJOR_VERSION >= 5) || (MBED_LIBRARY_VERSION > 127) m_irq->fall(callback(this, &RA8875::TouchPanelISR)); #else m_irq->fall(this, &RA8875::TouchPanelISR); @@ -295,7 +295,7 @@ #if MBED_VERSION >= MBED_ENCODE_VERSION(5,8,0) eventThread.start(callback(&queue, &EventQueue::dispatch_forever)); m_irq->fall(queue.event(callback(this, &RA8875::TouchPanelISR))); - #elif (MBED_MAJOR_VERSION >= 5) || (MBED_LIBRARY_VERSION > 128) // Is this the right version? + #elif (MBED_MAJOR_VERSION >= 5) || (MBED_LIBRARY_VERSION > 127) m_irq->fall(callback(this, &RA8875::TouchPanelISR)); #else m_irq->fall(this, &RA8875::TouchPanelISR); @@ -1110,7 +1110,9 @@ { uint8_t fncr1Val = ReadCommand(0x22); uint8_t dpcrVal = ReadCommand(0x20); + RetCode_t r; + screen_orientation = angle; fncr1Val &= ~0x10; // remove the old direction bit dpcrVal &= ~0x0C; // remove the old scan direction bits switch (angle) { @@ -1138,8 +1140,9 @@ return bad_parameter; } INFO("Orientation: %d, %d", angle, portraitmode); - WriteCommand(RA8875_FNCR1, fncr1Val); - return WriteCommand(RA8875_DPCR, dpcrVal); + r = WriteCommand(RA8875_FNCR1, fncr1Val); + r = WriteCommand(RA8875_DPCR, dpcrVal); + return r; } @@ -1940,11 +1943,31 @@ RetCode_t RA8875::circle(loc_t x, loc_t y, dim_t radius, fill_t fillit) { RetCode_t ret = noerror; - + INFO("circle"); PERFORMANCE_RESET; - if (radius <= 0 || (x - radius) < 0 || (x + radius) > screenwidth - || (y - radius) < 0 || (y + radius) > screenheight) { + #if 0 + loc_t t; + SetTextCursor(0,10); + printf("Circle(%3d,%3d) => ", x,y); + switch (screen_orientation) { + default: + case rotate_0: + break; + case rotate_90: + t = x; + x = y; + y = t; + break; + case rotate_180: + break; + case rotate_270: + break; + } + printf(" => (%3d,%3d)\r\n", x,y); + #endif + if (radius <= 0 || (x - radius) < 0 || (x + radius) > width() + || (y - radius) < 0 || (y + radius) > height()) { ret = bad_parameter; } else if (radius == 1) { pixel(x,y);