Two additional EVE displays (#18839)

This commit is contained in:
RudolphRiedel 2021-02-28 02:39:32 +01:00 committed by GitHub
parent 1236585693
commit 04b83d50a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 163 additions and 38 deletions

View File

@ -1565,6 +1565,8 @@
//#define LCD_HAOYU_FT810CB // Haoyu with 5" (800x480) //#define LCD_HAOYU_FT810CB // Haoyu with 5" (800x480)
//#define LCD_ALEPHOBJECTS_CLCD_UI // Aleph Objects Color LCD UI //#define LCD_ALEPHOBJECTS_CLCD_UI // Aleph Objects Color LCD UI
//#define LCD_FYSETC_TFT81050 // FYSETC with 5" (800x480) //#define LCD_FYSETC_TFT81050 // FYSETC with 5" (800x480)
//#define LCD_EVE3_50G // Matrix Orbital 5.0", 800x480, BT815
//#define LCD_EVE2_50G // Matrix Orbital 5.0", 800x480, FT813
// Correct the resolution if not using the stock TFT panel. // Correct the resolution if not using the stock TFT panel.
//#define TOUCH_UI_320x240 //#define TOUCH_UI_320x240

View File

@ -112,7 +112,7 @@
} }
/** /**
* Settings for the 4D Systems, 4.3" Embedded SPI Display 480x272, SPI, FT800 (4DLCD-FT843) * Settings for the 4D Systems, 4.3" Embedded SPI Display 480x272, SPI, FT800 (4DLCD-FT843)
* https://4dsystems.com.au/4dlcd-ft843 * https://4dsystems.com.au/4dlcd-ft843
* Datasheet: * Datasheet:
* https://4dsystems.com.au/mwdownloads/download/link/id/52/ * https://4dsystems.com.au/mwdownloads/download/link/id/52/
@ -177,8 +177,105 @@
constexpr uint8_t CSpread = 0; constexpr uint8_t CSpread = 0;
constexpr uint16_t touch_threshold = 2000; /* touch-sensitivity */ constexpr uint16_t touch_threshold = 2000; /* touch-sensitivity */
} }
/**
* Settings for EVE3-50G - Matrix Orbital 5.0" 800x480, BT815
* https://www.matrixorbital.com/ftdi-eve/eve-bt815-bt816/eve3-50g
* use for example with: https://github.com/RudolphRiedel/EVE_display-adapter
*/
#elif defined(LCD_EVE3_50G)
#if !HAS_RESOLUTION
#define TOUCH_UI_800x480
#define TOUCH_UI_800x480_GENERIC // use more common timing parameters as the original set
#endif
#ifndef FTDI_API_LEVEL
#define FTDI_API_LEVEL 810
#endif
namespace FTDI {
IS_FT810
constexpr bool Use_Crystal = true; // 0 = use internal oscillator, 1 = module has a crystal populated
constexpr bool GPIO_0_Audio_Enable = false;
constexpr bool GPIO_1_Audio_Shutdown = false;
#define USE_GT911 // this display uses an alternative touch-controller and we need to tell the init function to switch
constexpr uint8_t Swizzle = 0;
constexpr uint8_t CSpread = 1;
constexpr uint8_t Pclkpol = 1;
constexpr uint16_t touch_threshold = 1200; /* touch-sensitivity */
constexpr uint32_t default_transform_a = 0x000109E4;
constexpr uint32_t default_transform_b = 0x000007A6;
constexpr uint32_t default_transform_c = 0xFFEC1EBA;
constexpr uint32_t default_transform_d = 0x0000072C;
constexpr uint32_t default_transform_e = 0x0001096A;
constexpr uint32_t default_transform_f = 0xFFF469CF;
}
/**
* Settings for EVE2-50G - Matrix Orbital 5.0" 800x480, FT813
* https://www.matrixorbital.com/ftdi-eve/eve-bt815-bt816/eve3-50g
* use for example with: https://github.com/RudolphRiedel/EVE_display-adapter
*/
#elif defined(LCD_EVE2_50G)
#if !HAS_RESOLUTION
#define TOUCH_UI_800x480
#define TOUCH_UI_800x480_GENERIC // use more common timing parameters as the original set
#endif
#ifndef FTDI_API_LEVEL
#define FTDI_API_LEVEL 810
#endif
namespace FTDI {
IS_FT810
constexpr bool Use_Crystal = false; // 0 = use internal oscillator, 1 = module has a crystal populated
constexpr bool GPIO_0_Audio_Enable = false;
constexpr bool GPIO_1_Audio_Shutdown = false;
#define PATCH_GT911 // this display uses an alternative touch-controller and we need to tell the init function to patch the FT813 for it
constexpr uint8_t Pclkpol = 1;
constexpr uint8_t Swizzle = 0;
constexpr uint8_t CSpread = 1;
constexpr uint16_t touch_threshold = 1200; /* touch-sensitivity */
constexpr uint32_t default_transform_a = 0x000109E4;
constexpr uint32_t default_transform_b = 0x000007A6;
constexpr uint32_t default_transform_c = 0xFFEC1EBA;
constexpr uint32_t default_transform_d = 0x0000072C;
constexpr uint32_t default_transform_e = 0x0001096A;
constexpr uint32_t default_transform_f = 0xFFF469CF;
}
#else #else
#error "Unknown or no TOUCH_UI_FTDI_EVE board specified. To add a new board, modify this file." #error "Unknown or no TOUCH_UI_FTDI_EVE board specified. To add a new board, modify this file."
#endif #endif
/* this data is used to patch FT813 displays that use a GT911 as a touch-controller */
#ifdef PATCH_GT911
constexpr PROGMEM unsigned char GT911_data[] = {
26,255,255,255,32,32,48,0,4,0,0,0,2,0,0,0,
34,255,255,255,0,176,48,0,120,218,237,84,221,111,84,69,20,63,51,179,93,160,148,101,111,76,5,44,141,123,111,161,11,219,154,16,9,16,17,229,156,75,26,11,13,21,227,3,16,252,184,179,
45,219,143,45,41,125,144,72,67,100,150,71,189,113,18,36,17,165,100,165,198,16,32,17,149,196,240,128,161,16,164,38,54,240,0,209,72,130,15,38,125,48,66,82,30,76,19,31,172,103,46,
139,24,255,4,227,157,204,156,51,115,102,206,231,239,220,5,170,94,129,137,75,194,216,98,94,103,117,115,121,76,131,177,125,89,125,82,123,60,243,58,142,242,204,185,243,188,118,156,
227,155,203,238,238,195,251,205,229,71,92,28,169,190,184,84,143,113,137,53,244,103,181,237,87,253,113,137,233,48,12,198,165,181,104,139,25,84,253,155,114,74,191,0,54,138,163,
12,62,131,207,129,23,217,34,91,31,128,65,246,163,175,213,8,147,213,107,35,203,94,108,3,111,40,171,83,24,15,165,177,222,116,97,23,188,140,206,150,42,102,181,87,78,86,182,170,134,
215,241,121,26,243,252,2,76,115,217,139,222,206,173,136,132,81,61,35,185,39,113,23,46,199,76,178,54,151,183,224,0,40,189,28,149,182,58,131,79,152,30,76,34,98,234,162,216,133,141,
102,39,170,40,192,101,53,201,146,191,37,77,44,177,209,74,211,5,206,187,5,6,216,47,53,96,123,22,50,103,251,192,84,17,74,227,185,56,106,51,91,161,96,182,163,48,171,141,139,65,152,
66,66,11,102,43,158,75,36,80,147,184,147,139,112,17,235,216,103,111,239,245,92,10,175,194,40,44,58,125,5,59,112,50,103,245,4,78,192,5,156,194,51,60,191,134,75,110,173,237,46,192,
121,156,192,115,184,218,120,67,63,115,46,11,102,10,97,232,50,235,114,182,148,118,178,41,188,12,135,77,202,124,12,96,238,35,161,234,189,129,23,249,212,139,230,25,53,48,205,52,93,
163,117,53,154,170,81,85,163,178,70,69,66,167,241,14,46,241,1,226,136,152,179,197,59,184,148,254,49,132,48,15,176,137,192,76,131,196,105,104,162,86,81,160,165,255,26,173,162,137,
86,145,210,183,192,55,175,194,211,60,91,120,230,184,174,27,41,131,155,40,224,29,87,179,232,16,55,55,7,165,147,81,23,165,49,101,54,224,75,180,81,108,18,29,226,69,225,110,175,224,
42,212,25,47,130,193,110,234,192,215,252,56,74,162,24,46,251,174,54,106,68,245,14,9,155,160,22,120,207,104,240,29,90,178,140,28,24,220,47,166,112,61,251,208,192,111,56,239,238,
93,255,251,62,99,32,193,75,61,190,235,123,229,110,218,194,85,79,225,59,98,20,238,227,235,220,11,221,149,25,180,116,194,159,111,96,192,24,213,59,139,179,156,215,69,230,19,24,35,
135,117,206,171,206,162,67,129,234,61,235,11,104,103,84,64,223,167,254,40,163,101,92,84,43,150,46,249,219,205,7,116,11,91,104,61,57,75,223,8,48,25,28,119,252,222,113,49,86,249,
74,180,211,156,181,61,215,168,157,7,251,199,150,242,250,91,58,132,94,121,7,53,151,139,98,6,165,153,69,214,32,110,211,100,101,31,89,45,81,98,23,205,205,197,209,109,186,198,35,
141,191,249,25,60,132,223,153,251,98,20,239,146,139,20,217,250,41,250,137,58,177,90,57,79,51,108,233,20,253,194,187,49,222,205,114,141,96,48,175,219,107,54,111,138,22,154,103,
108,79,58,252,179,178,79,164,195,2,153,36,39,170,199,201,167,197,85,106,8,59,177,81,46,56,2,230,75,114,17,55,112,188,65,208,137,77,114,10,115,55,58,208,197,173,122,87,6,140,
110,42,208,124,163,70,108,241,104,18,245,98,214,187,134,53,42,221,22,182,133,211,116,148,177,194,209,192,85,90,199,58,55,203,2,229,19,137,187,161,228,154,112,203,145,125,244,
188,220,118,228,41,201,181,41,195,144,215,183,51,80,250,21,217,16,217,200,235,109,227,188,122,218,142,60,170,224,112,240,184,130,229,224,113,5,223,148,163,80,165,183,130,187,
132,116,64,238,161,85,220,115,139,205,98,227,244,29,102,125,7,37,243,123,223,11,26,92,63,243,116,61,191,138,123,244,160,84,186,74,31,5,174,247,119,135,199,248,253,135,242,97,
102,145,190,144,14,85,238,221,231,193,158,48,205,25,120,248,15,220,29,158,9,70,185,30,103,229,33,254,23,237,160,172,62,193,90,222,224,232,14,200,56,90,104,142,227,120,110,6,
21,211,203,65,150,99,151,220,247,87,164,50,159,49,239,234,58,142,0,109,108,123,18,79,227,36,100,248,222,205,96,127,120,26,171,228,69,63,36,17,252,200,17,116,242,187,227,88,143,
247,2,75,191,6,130,59,188,11,55,240,31,243,122,152,226,183,207,154,73,188,39,219,43,105,222,87,41,143,141,140,175,73,112,184,252,61,184,16,90,250,35,168,82,119,176,57,116,94,
200,150,22,190,179,44,104,12,235,84,149,102,252,89,154,193,99,228,106,242,125,248,64,194,255,223,127,242,83,11,255,2,70,214,226,128,0,0
};
#endif // PATCH_GT911

View File

@ -1073,37 +1073,48 @@ void CLCD::init() {
for (counter = 0; counter < 250; counter++) { for (counter = 0; counter < 250; counter++) {
uint8_t device_id = mem_read_8(REG::ID); // Read Device ID, Should Be 0x7C; uint8_t device_id = mem_read_8(REG::ID); // Read Device ID, Should Be 0x7C;
if (device_id == 0x7C) { if (device_id == 0x7C) {
#if ENABLED(TOUCH_UI_DEBUG) if (ENABLED(TOUCH_UI_DEBUG)) SERIAL_ECHO_MSG("FTDI chip initialized ");
SERIAL_ECHO_MSG("FTDI chip initialized");
#endif
break; break;
} }
else else
delay(1); delay(1);
if (counter == 249) { if (TERN0(TOUCH_UI_DEBUG, counter > 248))
#if ENABLED(TOUCH_UI_DEBUG) SERIAL_ECHO_MSG("Timeout waiting for device ID, should be 124, got ", device_id);
SERIAL_ECHO_MSG("Timeout waiting for device ID, should be 124, got ", device_id);
#endif
}
} }
/* make sure that all units are in working conditions, usually the touch-controller needs a little more time */ /* Ensure all units are in working condition, usually the touch-controller needs a little more time */
for (counter = 0; counter < 100; counter++) { for (counter = 0; counter < 100; counter++) {
uint8_t reset_status = mem_read_8(REG::CPURESET) & 0x03; uint8_t reset_status = mem_read_8(REG::CPURESET) & 0x03;
if (reset_status == 0x00) { if (reset_status == 0x00) {
#if ENABLED(TOUCH_UI_DEBUG) if (ENABLED(TOUCH_UI_DEBUG)) SERIAL_ECHO_MSG("FTDI chip all units running ");
SERIAL_ECHO_MSG("FTDI chip all units running ");
#endif
break; break;
} }
else else
delay(1); delay(1);
if (ENABLED(TOUCH_UI_DEBUG) && counter == 99) if (TERN0(TOUCH_UI_DEBUG, counter > 98))
SERIAL_ECHO_MSG("Timeout waiting for reset status. Should be 0x00, got ", reset_status); SERIAL_ECHO_MSG("Timeout waiting for reset status. Should be 0x00, got ", reset_status);
} }
#if ENABLED(USE_GT911) /* switch BT815 to use Goodix GT911 touch controller */
mem_write_32(REG::TOUCH_CONFIG, 0x000005D1);
#endif
#if ENABLED(PATCH_GT911) /* patch FT813 use Goodix GT911 touch controller */
mem_write_pgm(REG::CMDB_WRITE, GT911_data, sizeof(GT911_data)); /* write binary blob to command-fifo */
delay(10);
mem_write_8(REG::TOUCH_OVERSAMPLE, 0x0F); /* setup oversample to 0x0f as "hidden" in binary-blob for AN_336 */
mem_write_16(REG::TOUCH_CONFIG, 0x05d0); /* write magic cookie as requested by AN_336 */
/* specific to the EVE2 modules from Matrix-Orbital we have to use GPIO3 to reset GT911 */
mem_write_16(REG::GPIOX_DIR,0x8008); /* Reset-Value is 0x8000, adding 0x08 sets GPIO3 to output, default-value for REG_GPIOX is 0x8000 -> Low output on GPIO3 */
delay(1); /* wait more than 100µs */
mem_write_8(REG::CPURESET, 0x00); /* clear all resets */
delay(56); /* wait more than 55ms */
mem_write_16(REG::GPIOX_DIR,0x8000); /* setting GPIO3 back to input */
#endif
mem_write_8(REG::PWM_DUTY, 0); // turn off Backlight, Frequency already is set to 250Hz default mem_write_8(REG::PWM_DUTY, 0); // turn off Backlight, Frequency already is set to 250Hz default
/* Configure the FT8xx Registers */ /* Configure the FT8xx Registers */
@ -1140,13 +1151,13 @@ void CLCD::init() {
if (GPIO_1_Audio_Shutdown) { if (GPIO_1_Audio_Shutdown) {
mem_write_8(REG::GPIO_DIR, GPIO_DISP | GPIO_GP1); mem_write_8(REG::GPIO_DIR, GPIO_DISP | GPIO_GP1);
mem_write_8(REG::GPIO, GPIO_DISP | GPIO_GP1); mem_write_8(REG::GPIO, GPIO_DISP | GPIO_GP1);
} else if (GPIO_0_Audio_Enable) { }
else if (GPIO_0_Audio_Enable) {
mem_write_8(REG::GPIO_DIR, GPIO_DISP | GPIO_GP0); mem_write_8(REG::GPIO_DIR, GPIO_DISP | GPIO_GP0);
mem_write_8(REG::GPIO, GPIO_DISP | GPIO_GP0); mem_write_8(REG::GPIO, GPIO_DISP | GPIO_GP0);
} }
else { else
mem_write_8(REG::GPIO, GPIO_DISP); /* REG::GPIO_DIR is set to output for GPIO_DISP by default */ mem_write_8(REG::GPIO, GPIO_DISP); /* REG::GPIO_DIR is set to output for GPIO_DISP by default */
}
mem_write_8(REG::PCLK, Pclk); // Turns on Clock by setting PCLK Register to the value necessary for the module mem_write_8(REG::PCLK, Pclk); // Turns on Clock by setting PCLK Register to the value necessary for the module

View File

@ -43,7 +43,7 @@
constexpr uint16_t Vsync0 = tvfp - 1; \ constexpr uint16_t Vsync0 = tvfp - 1; \
constexpr uint16_t Vsync1 = tvfp + tvpw - 1; \ constexpr uint16_t Vsync1 = tvfp + tvpw - 1; \
static_assert(thfp + thb + Hsize == th, "Mismatch in display th"); \ static_assert(thfp + thb + Hsize == th, "Mismatch in display th"); \
static_assert(tvfp + tvb + Vsize == tv, "Mismatch in display tv"); static_assert(tvfp + tvb + Vsize == tv, "Mismatch in display tv")
#if ENABLED(TOUCH_UI_320x240) #if ENABLED(TOUCH_UI_320x240)
namespace FTDI { namespace FTDI {
@ -85,7 +85,7 @@
constexpr uint16_t tvb = 2; // VS Back porch (blanking) constexpr uint16_t tvb = 2; // VS Back porch (blanking)
constexpr uint16_t tvpw = 10; // VS pulse width constexpr uint16_t tvpw = 10; // VS pulse width
COMPUTE_REGS_FROM_DATASHEET COMPUTE_REGS_FROM_DATASHEET;
constexpr uint32_t default_transform_a = 0x00008100; constexpr uint32_t default_transform_a = 0x00008100;
constexpr uint32_t default_transform_b = 0x00000000; constexpr uint32_t default_transform_b = 0x00000000;
@ -97,29 +97,44 @@
#elif defined(TOUCH_UI_800x480) #elif defined(TOUCH_UI_800x480)
namespace FTDI { namespace FTDI {
constexpr uint8_t Pclk = 3; #if defined(TOUCH_UI_800x480_GENERIC)
constexpr uint8_t Pclkpol = 1; constexpr uint8_t Pclk = 2;
constexpr uint16_t Hsize = 800; constexpr uint16_t Hsize = 800;
constexpr uint16_t Vsize = 480; constexpr uint16_t Vsize = 480;
constexpr uint16_t th = 1056; // One horizontal line constexpr uint16_t Vsync0 = 0;
constexpr uint16_t thfp = 210; // HS Front porch constexpr uint16_t Vsync1 = 3;
constexpr uint16_t thb = 46; // HS Back porch (blanking) constexpr uint16_t Voffset = 32;
constexpr uint16_t thpw = 23; // HS pulse width constexpr uint16_t Vcycle = 525;
constexpr uint16_t Hsync0 = 0;
constexpr uint16_t Hsync1 = 48;
constexpr uint16_t Hoffset = 88;
constexpr uint16_t Hcycle = 928;
#else
constexpr uint8_t Pclk = 3;
constexpr uint8_t Pclkpol = 1;
constexpr uint16_t Hsize = 800;
constexpr uint16_t Vsize = 480;
constexpr uint16_t tv = 525; // Vertical period time constexpr uint16_t th = 1056; // One horizontal line
constexpr uint16_t tvfp = 22; // VS Front porch constexpr uint16_t thfp = 210; // HS Front porch
constexpr uint16_t tvb = 23; // VS Back porch (blanking) constexpr uint16_t thb = 46; // HS Back porch (blanking)
constexpr uint16_t tvpw = 10; // VS pulse width constexpr uint16_t thpw = 23; // HS pulse width
COMPUTE_REGS_FROM_DATASHEET constexpr uint16_t tv = 525; // Vertical period time
constexpr uint16_t tvfp = 22; // VS Front porch
constexpr uint16_t tvb = 23; // VS Back porch (blanking)
constexpr uint16_t tvpw = 10; // VS pulse width
constexpr uint32_t default_transform_a = 0x0000D8B9; COMPUTE_REGS_FROM_DATASHEET;
constexpr uint32_t default_transform_b = 0x00000124;
constexpr uint32_t default_transform_c = 0xFFE23926; constexpr uint32_t default_transform_a = 0x0000D8B9;
constexpr uint32_t default_transform_d = 0xFFFFFF51; constexpr uint32_t default_transform_b = 0x00000124;
constexpr uint32_t default_transform_e = 0xFFFF7E4F; constexpr uint32_t default_transform_c = 0xFFE23926;
constexpr uint32_t default_transform_f = 0x01F0AF70; constexpr uint32_t default_transform_d = 0xFFFFFF51;
constexpr uint32_t default_transform_e = 0xFFFF7E4F;
constexpr uint32_t default_transform_f = 0x01F0AF70;
#endif
} }
#else #else