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)
Revision 200:ae29b60d087c, committed 2020-03-29
- Comitter:
- WiredHome
- Date:
- Sun Mar 29 14:33:19 2020 +0000
- Parent:
- 199:fb06805f447f
- Child:
- 201:0b25d24d9bda
- Commit message:
- Correct issue with the reset pin control
Changed in this revision
RA8875.cpp | Show annotated file Show diff for this revision Revisions of this file |
RA8875.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/RA8875.cpp Sat Mar 28 15:08:43 2020 +0000 +++ b/RA8875.cpp Sun Mar 29 14:33:19 2020 +0000 @@ -190,9 +190,11 @@ : GraphicsDisplay(name) , spi(mosi, miso, sclk) , cs(csel) - , res(reset) + , res(NULL) { INFO("RA8875"); + if (reset != NC) + res = new DigitalOut(reset); InitAllMemberVars(); touchInfo = (touchInfo_T *)malloc(RESISTIVE_TOUCH_POINTS * sizeof(touchInfo_T)); if (touchInfo) @@ -206,9 +208,11 @@ : GraphicsDisplay(name) , spi(mosi, miso, sclk) , cs(csel) - , res(reset) + , res(NULL) { INFO("RA8875"); + if (reset != NC) + res = new DigitalOut(reset); InitAllMemberVars(); m_irq = new InterruptIn(irq); m_i2c = new I2C(sda, scl); @@ -244,9 +248,11 @@ : GraphicsDisplay(name) , spi(mosi, miso, sclk) , cs(csel) - , res(reset) + , res(NULL) { INFO("RA8875"); + if (reset != NC) + res = new DigitalOut(reset); InitAllMemberVars(); m_irq = new InterruptIn(irq); @@ -430,10 +436,10 @@ RetCode_t ret; #if 1 - if (res != (PinName)NC) { - res = 0; // Active low - assert reset - wait_us(2000); // must be > 1024 clock periods. (@25 MHz, this is 40.96 usec) - res = 1; // de-assert reset + if (res) { + res->write(0); // Active low - assert reset + wait_us(2000); // must be > 1024 clock periods. (@25 MHz, this is 40.96 usec) + res->write(1); // de-assert reset } #endif ret = WriteCommand(RA8875_PWRR, 0x01); // Apply Display Off, Reset @@ -1493,25 +1499,25 @@ } dim_t cWidth = GetTextWidth(p, true); INFO("txtPos: %d, cWidth: %d, p2.x: %d", txtPos, cWidth, windowrect.p2.x); - if (txtPos + cWidth < windowrect.p2.x) { + if (txtPos + cWidth <= windowrect.p2.x) { txtPos += cWidth; } else { newLineNeeded = true; break; } - INFO("+ %c width %d, ttl Width %d < %d", *p, cWidth, txtPos, windowrect.p2.x); + INFO("+ %c width %d, ttl Width %d <= %d", *p, cWidth, txtPos, windowrect.p2.x); p++; } while (*p); INFO("p: len(%d), (%s)", strlen(p), p); - if (*p != ' ' && pSpace) { + if (*p && *p != ' ' && pSpace) { p = pSpace; INFO("p: len(%d), (%s)", strlen(p), p); } char dbgBuf[256]; strncpy(dbgBuf, string, (p - string)); dbgBuf[p - string] = '\0'; - INFO("chunk: %d < w.p2.x: %d - '%s'", txtPos, windowrect.p2.x, dbgBuf); - if (txtPos < windowrect.p2.x) { + INFO("chunk: %d <= w.p2.x: %d - '%s'", txtPos, windowrect.p2.x, dbgBuf); + if (txtPos <= windowrect.p2.x) { while (*string && string <= p) { INFO("*string %02X", *string); if (*string == '\r') {
--- a/RA8875.h Sat Mar 28 15:08:43 2020 +0000 +++ b/RA8875.h Sun Mar 29 14:33:19 2020 +0000 @@ -3542,7 +3542,7 @@ unsigned long spiwritefreq; ///< saved write freq unsigned long spireadfreq; ///< saved read freq DigitalOut cs; ///< RA8875 chip select pin, assumed active low - DigitalOut res; ///< RA8875 reset pin, assumed active low + DigitalOut * res; ///< RA8875 reset pin, assumed active low DigitalOut * m_wake; ///< GSL1680 wake pin // display metrics to avoid lengthy spi read queries