RA8876LiteTeensy For Teensy T36 and T40

Y'all are the most awesomest. Straight up. I'm building an RV controller I am going to sell. All plug n play and open source. Hope to make it fully community involved. Going to start with the buydisplay 7" widescreen, and it's really all possible because of the wealth of knowledge you guys have taken the time to put here for us.

MAJOR KUDOS.

Sure, I could have used a regular ol craptastic china display, but thanks to you guys I get to use a fantastic china display!

The boot screen is going to have all of your names up there in bold so everyone knows.

I will post what I've done with the code as soon as I get it up and running.
 
Y'all are the most awesomest. Straight up. I'm building an RV controller I am going to sell. All plug n play and open source. Hope to make it fully community involved. Going to start with the buydisplay 7" widescreen, and it's really all possible because of the wealth of knowledge you guys have taken the time to put here for us.

MAJOR KUDOS.

Sure, I could have used a regular ol craptastic china display, but thanks to you guys I get to use a fantastic china display!

The boot screen is going to have all of your names up there in bold so everyone knows.

I will post what I've done with the code as soon as I get it up and running.

Sounds interesting. Been a long time since I played with that library...

Good luck and have fun:)
 
@KurtE - Ra8876LiteTeensy seems to be broken . I decided to go through the examples to check and I am getting compiler errors.
graphics.ino fails with:
Code:
Compiling sketch...
/home/wwatson/arduino-1.8.19-1.58B3/hardware/teensy/../tools/precompile_helper /home/wwatson/arduino-1.8.19-1.58B3/hardware/teensy/avr/cores/teensy4 /tmp/arduino_build_255149 /home/wwatson/arduino-1.8.19-1.58B3/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -x c++-header -O2 -g -Wall -ffunction-sections -fdata-sections -nostdlib -MMD -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=158 -DARDUINO=10819 -DARDUINO_TEENSY41 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/wwatson/arduino-1.8.19-1.58B3/hardware/teensy/avr/cores/teensy4 /tmp/arduino_build_255149/pch/Arduino.h -o /tmp/arduino_build_255149/pch/Arduino.h.gch
/home/wwatson/arduino-1.8.19-1.58B3/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -c -O2 -g -Wall -ffunction-sections -fdata-sections -nostdlib -MMD -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=158 -DARDUINO=10819 -DARDUINO_TEENSY41 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/tmp/arduino_build_255149/pch -I/home/wwatson/arduino-1.8.19-1.58B3/hardware/teensy/avr/cores/teensy4 -I/home/wwatson/Arduino/libraries/Ra8876LiteTeensy/src -I/home/wwatson/arduino-1.8.19-1.58B3/hardware/teensy/avr/libraries/SPI -I/home/wwatson/arduino-1.8.19-1.58B3/hardware/teensy/avr/libraries/Wire -I/home/wwatson/arduino-1.8.19-1.58B3/hardware/teensy/avr/libraries/ILI9341_t3 /tmp/arduino_build_255149/sketch/graphics.ino.cpp -o /tmp/arduino_build_255149/sketch/graphics.ino.cpp.o
In file included from /home/wwatson/arduino-1.8.19-1.58B3/hardware/teensy/avr/libraries/ILI9341_t3/font_Arial.h:4,
                 from /home/wwatson/Arduino/libraries/Ra8876LiteTeensy/examples/graphics/graphics.ino:8:
/home/wwatson/arduino-1.8.19-1.58B3/hardware/teensy/avr/libraries/ILI9341_t3/ILI9341_t3.h:170:3: error: conflicting declaration 'typedef struct ILI9341_t3_font_t ILI9341_t3_font_t'
  170 | } ILI9341_t3_font_t;
      |   ^~~~~~~~~~~~~~~~~
In file included from /home/wwatson/Arduino/libraries/Ra8876LiteTeensy/src/RA8876_t3.h:81,
                 from /home/wwatson/Arduino/libraries/Ra8876LiteTeensy/examples/graphics/graphics.ino:7:
/home/wwatson/Arduino/libraries/Ra8876LiteTeensy/src/_fonts.h:27:3: note: previous declaration as 'typedef struct ILI9341_t3_font_t ILI9341_t3_font_t'
   27 | } ILI9341_t3_font_t;
      |   ^~~~~~~~~~~~~~~~~
Using library Ra8876LiteTeensy at version 1.0.0 in folder: /home/wwatson/Arduino/libraries/Ra8876LiteTeensy 
Using library SPI at version 1.0 in folder: /home/wwatson/arduino-1.8.19-1.58B3/hardware/teensy/avr/libraries/SPI 
Using library Wire at version 1.0 in folder: /home/wwatson/arduino-1.8.19-1.58B3/hardware/teensy/avr/libraries/Wire 
Using library ILI9341_t3 at version 1.0 in folder: /home/wwatson/arduino-1.8.19-1.58B3/hardware/teensy/avr/libraries/ILI9341_t3 
Error compiling for board Teensy 4.1.

And "ILI_Ada_FontTest4.ino" fails with:
Code:
/home/wwatson/arduino-1.8.19-1.58B3/arduino-builder -dump-prefs -logger=machine -hardware /home/wwatson/arduino-1.8.19-1.58B3/hardware -tools /home/wwatson/arduino-1.8.19-1.58B3/tools-builder -tools /home/wwatson/arduino-1.8.19-1.58B3/hardware/tools/avr -built-in-libraries /home/wwatson/arduino-1.8.19-1.58B3/libraries -libraries /home/wwatson/Arduino/libraries -fqbn=teensy:avr:teensy41:usb=serial,speed=600,opt=o2std,keys=en-us -ide-version=10819 -build-path /tmp/arduino_build_662901 -warnings=none -build-cache /tmp/arduino_cache_124179 -verbose /home/wwatson/Arduino/libraries/Ra8876LiteTeensy/examples/ILI_Ada_FontTest4/ILI_Ada_FontTest4.ino
/home/wwatson/arduino-1.8.19-1.58B3/arduino-builder -compile -logger=machine -hardware /home/wwatson/arduino-1.8.19-1.58B3/hardware -tools /home/wwatson/arduino-1.8.19-1.58B3/tools-builder -tools /home/wwatson/arduino-1.8.19-1.58B3/hardware/tools/avr -built-in-libraries /home/wwatson/arduino-1.8.19-1.58B3/libraries -libraries /home/wwatson/Arduino/libraries -fqbn=teensy:avr:teensy41:usb=serial,speed=600,opt=o2std,keys=en-us -ide-version=10819 -build-path /tmp/arduino_build_662901 -warnings=none -build-cache /tmp/arduino_cache_124179 -verbose /home/wwatson/Arduino/libraries/Ra8876LiteTeensy/examples/ILI_Ada_FontTest4/ILI_Ada_FontTest4.ino
Using board 'teensy41' from platform in folder: /home/wwatson/arduino-1.8.19-1.58B3/hardware/teensy/avr
Using core 'teensy4' from platform in folder: /home/wwatson/arduino-1.8.19-1.58B3/hardware/teensy/avr
Detecting libraries used...
/home/wwatson/arduino-1.8.19-1.58B3/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=158 -DARDUINO=10819 -DARDUINO_TEENSY41 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/wwatson/arduino-1.8.19-1.58B3/hardware/teensy/avr/cores/teensy4 /tmp/arduino_build_662901/sketch/ILI_Ada_FontTest4.ino.cpp -o /dev/null
Alternatives for Adafruit_GFX.h: []
ResolveLibrary(Adafruit_GFX.h)
  -> candidates: []
/home/wwatson/Arduino/libraries/Ra8876LiteTeensy/examples/ILI_Ada_FontTest4/ILI_Ada_FontTest4.ino:1:10: fatal error: Adafruit_GFX.h: No such file or directory
    1 | #include <Adafruit_GFX.h>
      |          ^~~~~~~~~~~~~~~~
compilation terminated.
Error compiling for board Teensy 4.1.

I fixed most of the examples by renaming "glcdfont.c" to "glcdfont.c.org" and changing "_fonts.h" this way:
Code:
// https://github.com/kurte/ILI9341_t3n
// http://forum.pjrc.com/threads/26305-Highly-optimized-ILI9341-(320x240-TFT-color-display)-library
//
// ILI Font file definition.
#ifndef _ILI9341_FONTS_H_
#define _ILI9341_FONTS_H_
#include "ILI9341_t3.h"
/*
typedef struct {
	const unsigned char *index;
	const unsigned char *unicode;
	const unsigned char *data;
	unsigned char version;
	unsigned char reserved;
	unsigned char index1_first;
	unsigned char index1_last;
	unsigned char index2_first;
	unsigned char index2_last;
	unsigned char bits_index;
	unsigned char bits_width;
	unsigned char bits_height;
	unsigned char bits_xoffset;
	unsigned char bits_yoffset;
	unsigned char bits_delta;
	unsigned char line_space;
	unsigned char cap_height;
} ILI9341_t3_font_t;
*/
#endif

Not sure what to do with "Adafruit_GFX.h". Wasn't that Adafruit library removed from Teensyduino?
 
I have been fighting the glcdfont.c problem since at least Feb 2022. My SDR program uses a define to switch between the RA8875 and RA8876 display and therefor their libraries, and the glcdfonts.c is present in multiple libraries folders including the ILI9341. Each time I end up renaming one or more instances of glcdfonts.c in one of them experimentally until I can get an error free compile.

On Nov 26 2022 I put some time into this and wrote the following solution on our SDR forum at https://groups.io/g/keithsdr/message/1930

_______________________________

I wasted hours tracking down the dupe glcdfonts problem. Looks like I fixed it. The ILI9488 and RA8876 and RA8875 libraries all are calling

extern "C" const unsigned char glcdfont[];

The #include for the file was commented out in all files.

#include "glcdfont.c"

I changed all files to use the #include only. First one called should load and the rest should skip loading it again. Seems to be working. Both RA8876 and RA8875 now build and load with the IDE, no more games. Each time the TeensyDuino is updated it will likely overwrite the changes to the ILI9488_t3 and RA8875 libs. RA8876_t3 is outside the TeensyDuino package.

______________________________________________________

EDIT: I had updated to Arduino 2.0.3 and TeensyDuino 1.57.2 when I again ran into the problem so indeed still an issue.


Mike K7MDL
https://github.com/K7MDL2/KEITHSDR
 
Last edited:
I have been fighting the glcdfont.c problem since at least Feb 2022. My SDR program uses a define to switch between the RA8875 and RA8876 display and therefor their libraries, and the glcdfonts.c is present in multiple libraries folders including the ILI9341. Each time I end up renaming one or more instances of glcdfonts.c in one of them experimentally until I can get an error free compile.

I saw similar problems with uncanny eyes between the ST7789_t3 and GC9A01A_t3n libraries (GC9A01A_t3n is not distributed with Teensy). I was trying to build a library that could have both drivers in it. I gave up, and just built only one display per build. I suspect a lot of display drivers just cloned the previous driver, and most people only have one type of display on their system. Note, at present I used Ardunio 1.8.19 and currently teensy 1.58-beta2.
 
Sorry I have not kept up with testing all of the examples:( I basically am using it as a one trick pony but decided to go through all of the examples. I'll make changes and create another branch on the GIT repo so I don't break anything else:) @KurtE and @mjs513 did a major update to the library along with and a few other contributors. Maybe I can get some input from them about this issue...
 
wwatson said:
Not sure what to do with "Adafruit_GFX.h". Wasn't that Adafruit library removed from Teensyduino?

Not sure how to answer this without sounding cranky :). The fontTest examples were designed to demonstrate how to use the GFX and the ILI9341_fonts hence the name ILI_Ada_FontTest4. However even with the include adafruit_gfx commented out the only error I am seeing is:
Code:
C:\Users\Merli\AppData\Local\Temp\arduino_modified_sketch_860976\ILI_Ada_FontTest4.ino:19:10: fatal error: Fonts/FreeMonoBoldOblique12pt7b.h: No such file or directory
   19 | #include <Fonts/FreeMonoBoldOblique12pt7b.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

The really issue I think is that some of the examples use the font library and/or the GFX library. Probably should go through and put some instructions in that for this example you need to install adafruit GFX and or the font library. Probably should add to the readme as well.
 
I saw similar problems with uncanny eyes between the ST7789_t3 and GC9A01A_t3n libraries (GC9A01A_t3n is not distributed with Teensy). I was trying to build a library that could have both drivers in it. I gave up, and just built only one display per build. I suspect a lot of display drivers just cloned the previous driver, and most people only have one type of display on their system. Note, at present I used Ardunio 1.8.19 and currently teensy 1.58-beta2.

Forgot to say happy new year all.

This issue is next up on the list I think unless I get distracted again today
 
Not sure how to answer this without sounding cranky :). The fontTest examples were designed to demonstrate how to use the GFX and the ILI9341_fonts hence the name ILI_Ada_FontTest4. However even with the include adafruit_gfx commented out the only error I am seeing is:
Code:
C:\Users\Merli\AppData\Local\Temp\arduino_modified_sketch_860976\ILI_Ada_FontTest4.ino:19:10: fatal error: Fonts/FreeMonoBoldOblique12pt7b.h: No such file or directory
   19 | #include <Fonts/FreeMonoBoldOblique12pt7b.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

The really issue I think is that some of the examples use the font library and/or the GFX library. Probably should go through and put some instructions in that for this example you need to install adafruit GFX and or the font library. Probably should add to the readme as well.

No worries:) As I stated above I need to do a better job of maintaining the library...
 
@KurtE - @MichaelMeissner etc

Just put together a quick test using the GC and St7789 boards:
Code:
#include "SPI.h"
#include "GC9A01A_t3n.h"

// *************** Change to your Pin numbers ***************
#define TFT_DC  9
#define TFT_CS 10
#define TFT_RST 8
#define TFT_SCK 13
//#define TFT_MISO 12
#define TFT_MOSI 11

GC9A01A_t3n tft_9A01A = GC9A01A_t3n(TFT_CS, TFT_DC, TFT_RST);

#include <ST7735_t3.h> // Hardware-specific library
#include <ST7789_t3.h> // Hardware-specific library
ST7789_t3 tft_7789 = ST7789_t3(3, 4, 26, 27, 5);


#include <ST7735_t3.h> // Hardware-specific library
#include <ST7789_t3.h> // Hardware-specific library

float p = 3.1415926;

void setup() {
  while (!Serial && millis() < 5000) ; // wait for Arduino Serial Monitor
  Serial.begin(9600);
  delay(500);

  tft_9A01A.begin();
  tft_7789.init(240, 320);           // Init ST7789 320x240
    tft_7789.fillScreen(ST7735_BLACK);
  // large block of text
  tft_7789.fillScreen(ST7735_BLACK);
  testdrawtext("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur adipiscing ante sed nibh tincidunt feugiat. Maecenas enim massa, fringilla sed malesuada et, malesuada sit amet turpis. Sed porttitor neque ut ante pretium vitae malesuada nunc bibendum. Nullam aliquet ultrices massa eu hendrerit. Ut sed nisi lorem. In vestibulum purus a tortor imperdiet posuere. ", ST7735_WHITE);
  delay(1000);

  // tft print function!
  tftPrintTest();
  delay(4000);

  // a single pixel
  tft_7789.drawPixel(tft_7789.width()/2, tft_7789.height()/2, ST7735_GREEN);
  delay(500);

  // line draw test
  testlines(ST7735_YELLOW);
  delay(1000);

  // optimized lines
  testfastlines(ST7735_RED, ST7735_BLUE);
  delay(1000);

  testdrawrects(ST7735_GREEN);
  delay(1000);

  testfillrects(ST7735_YELLOW, ST7735_MAGENTA);
  delay(1000);

  tft_7789.fillScreen(ST7735_BLACK);
  testfillcircles(10, ST7735_BLUE);
  testdrawcircles(10, ST7735_WHITE);
  delay(500);

  testroundrects();
  delay(1000);

  testtriangles();
  delay(1000);

  mediabuttons();
  delay(500);

  Serial.println("done");
  delay(1000);
}

void loop() {
  // put your main code here, to run repeatedly:

}

void testlines(uint16_t color) {
  tft_7789.fillScreen(ST7735_BLACK);
  for (int16_t x=0; x < tft_7789.width(); x+=6) {
    tft_7789.drawLine(0, 0, x, tft_7789.height()-1, color);
    delay(200);
  }
  for (int16_t y=0; y < tft_7789.height(); y+=6) {
    tft_7789.drawLine(0, 0, tft_7789.width()-1, y, color);
  }

  tft_7789.fillScreen(ST7735_BLACK);
  for (int16_t x=0; x < tft_7789.width(); x+=6) {
    tft_7789.drawLine(tft_7789.width()-1, 0, x, tft_7789.height()-1, color);
  }
  for (int16_t y=0; y < tft_7789.height(); y+=6) {
    tft_7789.drawLine(tft_7789.width()-1, 0, 0, y, color);
  }

  tft_7789.fillScreen(ST7735_BLACK);
  for (int16_t x=0; x < tft_7789.width(); x+=6) {
    tft_7789.drawLine(0, tft_7789.height()-1, x, 0, color);
  }
  for (int16_t y=0; y < tft_7789.height(); y+=6) {
    tft_7789.drawLine(0, tft_7789.height()-1, tft_7789.width()-1, y, color);
  }

  tft_7789.fillScreen(ST7735_BLACK);
  for (int16_t x=0; x < tft_7789.width(); x+=6) {
    tft_7789.drawLine(tft_7789.width()-1, tft_7789.height()-1, x, 0, color);
  }
  for (int16_t y=0; y < tft_7789.height(); y+=6) {
    tft_7789.drawLine(tft_7789.width()-1, tft_7789.height()-1, 0, y, color);
  }
}

void testdrawtext(const char *text, uint16_t color) {
  tft_7789.setCursor(0, 0);
  tft_7789.setTextColor(color);
  tft_7789.setTextWrap(true);
  tft_7789.print(text);
}

void testfastlines(uint16_t color1, uint16_t color2) {
  tft_7789.fillScreen(ST7735_BLACK);
  for (int16_t y=0; y < tft_7789.height(); y+=5) {
    tft_7789.drawFastHLine(0, y, tft_7789.width(), color1);
  }
  for (int16_t x=0; x < tft_7789.width(); x+=5) {
    tft_7789.drawFastVLine(x, 0, tft_7789.height(), color2);
  }
}

void testdrawrects(uint16_t color) {
  tft_7789.fillScreen(ST7735_BLACK);
  for (int16_t x=0; x < tft_7789.width(); x+=6) {
    tft_7789.drawRect(tft_7789.width()/2 -x/2, tft_7789.height()/2 -x/2 , x, x, color);
  }
}

void testfillrects(uint16_t color1, uint16_t color2) {
  tft_7789.fillScreen(ST7735_BLACK);
  for (int16_t x=tft_7789.width()-1; x > 6; x-=6) {
    tft_7789.fillRect(tft_7789.width()/2 -x/2, tft_7789.height()/2 -x/2 , x, x, color1);
    tft_7789.drawRect(tft_7789.width()/2 -x/2, tft_7789.height()/2 -x/2 , x, x, color2);
  }
}

void testfillcircles(uint8_t radius, uint16_t color) {
  for (int16_t x=radius; x < tft_7789.width(); x+=radius*2) {
    for (int16_t y=radius; y < tft_7789.height(); y+=radius*2) {
      tft_7789.fillCircle(x, y, radius, color);
    }
  }
}

void testdrawcircles(uint8_t radius, uint16_t color) {
  for (int16_t x=0; x < tft_7789.width()+radius; x+=radius*2) {
    for (int16_t y=0; y < tft_7789.height()+radius; y+=radius*2) {
      tft_7789.drawCircle(x, y, radius, color);
    }
  }
}

void testtriangles() {
  tft_7789.fillScreen(ST7735_BLACK);
  int color = 0xF800;
  int t;
  int w = tft_7789.width()/2;
  int x = tft_7789.height()-1;
  int y = 0;
  int z = tft_7789.width();
  for(t = 0 ; t <= 15; t+=1) {
    tft_7789.drawTriangle(w, y, y, x, z, x, color);
    x-=4;
    y+=4;
    z-=4;
    color+=100;
  }
}

void testroundrects() {
  tft_7789.fillScreen(ST7735_BLACK);
  int color = 100;
  int i;
  int t;
  for(t = 0 ; t <= 4; t+=1) {
    int x = 0;
    int y = 0;
    int w = tft_7789.width()-2;
    int h = tft_7789.height()-2;
    for(i = 0 ; i <= 16; i+=1) {
      tft_7789.drawRoundRect(x, y, w, h, 5, color);
      x+=2;
      y+=3;
      w-=4;
      h-=6;
      color+=1100;
    }
    color+=100;
  }
}

void tftPrintTest() {
  tft_7789.setTextWrap(false);
  tft_7789.fillScreen(ST7735_BLACK);
  tft_7789.setCursor(0, 30);
  tft_7789.setTextColor(ST7735_RED);
  tft_7789.setTextSize(1);
  tft_7789.println("Hello World!");
  tft_7789.setTextColor(ST7735_YELLOW);
  tft_7789.setTextSize(2);
  tft_7789.println("Hello World!");
  tft_7789.setTextColor(ST7735_GREEN);
  tft_7789.setTextSize(3);
  tft_7789.println("Hello World!");
  tft_7789.setTextColor(ST7735_BLUE);
  tft_7789.setTextSize(4);
  tft_7789.print(1234.567);
  delay(1500);
  tft_7789.setCursor(0, 0);
  tft_7789.fillScreen(ST7735_BLACK);
  tft_7789.setTextColor(ST7735_WHITE);
  tft_7789.setTextSize(0);
  tft_7789.println("Hello World!");
  tft_7789.setTextSize(1);
  tft_7789.setTextColor(ST7735_GREEN);
  tft_7789.print(p, 6);
  tft_7789.println(" Want pi?");
  tft_7789.println(" ");
  tft_7789.print(8675309, HEX); // print 8,675,309 out in HEX!
  tft_7789.println(" Print HEX!");
  tft_7789.println(" ");
  tft_7789.setTextColor(ST7735_WHITE);
  tft_7789.println("Sketch has been");
  tft_7789.println("running for: ");
  tft_7789.setTextColor(ST7735_MAGENTA);
  tft_7789.print(millis() / 1000);
  tft_7789.setTextColor(ST7735_WHITE);
  tft_7789.print(" seconds.");
}

void mediabuttons() {
  // play
  tft_7789.fillScreen(ST7735_BLACK);
  tft_7789.fillRoundRect(25, 10, 78, 60, 8, ST7735_WHITE);
  tft_7789.fillTriangle(42, 20, 42, 60, 90, 40, ST7735_RED);
  delay(500);
  // pause
  tft_7789.fillRoundRect(25, 90, 78, 60, 8, ST7735_WHITE);
  tft_7789.fillRoundRect(39, 98, 20, 45, 5, ST7735_GREEN);
  tft_7789.fillRoundRect(69, 98, 20, 45, 5, ST7735_GREEN);
  delay(500);
  // play color
  tft_7789.fillTriangle(42, 20, 42, 60, 90, 40, ST7735_BLUE);
  delay(50);
  // pause color
  tft_7789.fillRoundRect(39, 98, 20, 45, 5, ST7735_RED);
  tft_7789.fillRoundRect(69, 98, 20, 45, 5, ST7735_RED);
  // play color
  tft_7789.fillTriangle(42, 20, 42, 60, 90, 40, ST7735_GREEN);
}
and just compiled it under 1.8.19 with 1.58beta3 and did get some conflcts
Code:
In file included from D:\Users\Merli\Documents\Arduino\Dual_different_displays_test\Dual_different_displays_test.ino:14:
F:\arduino-1.8.19-1131\hardware\teensy\avr\libraries\ST7735_t3/ST7735_t3.h:188: warning: "CL" redefined
  188 | #define CL(_r,_g,_b) ((((_r)&0xF8)<<8)|(((_g)&0xFC)<<3)|((_b)>>3))
      | 
In file included from D:\Users\Merli\Documents\Arduino\Dual_different_displays_test\Dual_different_displays_test.ino:2:
D:\Users\Merli\Documents\Arduino\libraries\GC9A01A_t3n\src/GC9A01A_t3n.h:225: note: this is the location of the previous definition
  225 | #define CL(_r, _g, _b) ((((_r)&0xF8) << 8) | (((_g)&0xFC) << 3) | ((_b) >> 3))
      | 
In file included from D:\Users\Merli\Documents\Arduino\Dual_different_displays_test\Dual_different_displays_test.ino:14:
F:\arduino-1.8.19-1131\hardware\teensy\avr\libraries\ST7735_t3/ST7735_t3.h:580: warning: "TCR_MASK" redefined
  580 |   #define TCR_MASK  (LPSPI_TCR_PCS(3) | LPSPI_TCR_FRAMESZ(31) | LPSPI_TCR_CONT | LPSPI_TCR_RXMSK )
      | 
In file included from D:\Users\Merli\Documents\Arduino\Dual_different_displays_test\Dual_different_displays_test.ino:2:
D:\Users\Merli\Documents\Arduino\libraries\GC9A01A_t3n\src/GC9A01A_t3n.h:852: note: this is the location of the previous definition
  852 | #define TCR_MASK                                                               \
      | 
In file included from D:\Users\Merli\Documents\Arduino\Dual_different_displays_test\Dual_different_displays_test.ino:14:
F:\arduino-1.8.19-1131\hardware\teensy\avr\libraries\ST7735_t3/ST7735_t3.h:853: warning: "Adafruit_GFX_Button" redefined
  853 | #define Adafruit_GFX_Button ST7735_Button
      | 
In file included from D:\Users\Merli\Documents\Arduino\Dual_different_displays_test\Dual_different_displays_test.ino:2:
D:\Users\Merli\Documents\Arduino\libraries\GC9A01A_t3n\src/GC9A01A_t3n.h:1212: note: this is the location of the previous definition
 1212 | #define Adafruit_GFX_Button GC9A01A_Button
      | 
f:/arduino-1.8.19-1131/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld.exe: C:\Users\Merli\AppData\Local\Temp\arduino_build_636116\libraries\ST7735_t3\glcdfont.c.o:F:\arduino-1.8.19-1131\hardware\teensy\avr\libraries\ST7735_t3/glcdfont.c:6: multiple definition of `glcdfont'; C:\Users\Merli\AppData\Local\Temp\arduino_build_636116\libraries\GC9A01A_t3n\GC9A01A_t3n.a(glcdfont.c.o):D:\Users\Merli\Documents\Arduino\libraries\GC9A01A_t3n\src/glcdfont.c:6: first defined here
collect2.exe: error: ld returned 1 exit status
Error compiling for board Teensy 4.1.
that looks like we are going to have to sort out.
 
Looks like the #defines for CL and TCR_MASK will be a easy fix by doing something like this in the Libs:
Code:
#ifdef CL
#undef CL
#endif
#define CL(_r,_g,_b) ((((_r)&0xF8)<<8)|(((_g)&0xFC)<<3)|((_b)>>3))

not sure what to do with the media buttons
 
I guess a real question is how well should we fix this?

That is we can and should fix each of these piecemeal

Or one thing I been wondering if we should do, would be to do like Adafruit and create a base class.
They have something like SPITFT...

we could have something like tft_display_t3 or the like.
This would allow a lot of the common code to be all in that base class class that:
ili9341_t3n, st7735_t3, ILI9488, GC9..., could all inherit from.

Could do this in one major step, or could start off with a smaller subset of the common code.
One reason I have not tried to do this up till now, is how to coordinate this between the several different master forks for this.
I own some, mjs513, PaulStoffregen owns some. And it is easier for me to be lazy and just fix or extend stuff in my own (and Mike's)

And that new library would probably need to be included in Teensyduino.. And/Or we could maybe add all of these as Arduino libraries, and build in the dependencies, such that if we update some of the libraries, they will pull in the new ones they depend on.
 
Think the fix piecemeal might work for the short term but think in the long term probably should do something like have a base class.

Most of the Libs I put together are all based off the ILI9341_t3n library and then we did alot of the tweaking - except maybe for the RAIO displays. But then some of that is even common. It would save when a fix gets put in for one having to make that same fix for the other libraries (as appropriate). But probably need some input from @PaulStoffregen
 
@KurtE - @MichaelMeissner etc

Just put together a quick test using the GC and St7789 boards: that looks like we are going to have to sort out.
Well since those are macros and such, the simplest way is just to keep each in separate .cpp files, either in the directory the .ino file is in or moved to separate libraries.

However if you do move the stuff to separate functions, you get the following errors from linking:

Code:
/rock/shared/arduino/teensy-1.58-beta2-1.8.19/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld: /tmp/arduino_build_240222/libraries/ST7735_t3/glcdfont.c.o:/rock/shared/arduino/teensy-1.58-beta2-1.8.19/hardware/teensy/avr/libraries/ST7735_t3/glcdfont.c:6: multiple definition of `glcdfont'; /tmp/arduino_build_240222/libraries/GC9A01A_t3n/glcdfont.c.o:/home/meissner/Arduino/libraries/GC9A01A_t3n/glcdfont.c:6: first defined here
/rock/shared/arduino/teensy-1.58-beta2-1.8.19/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld: /tmp/arduino_build_240222/libraries/ST7735_t3/st7735_t3_font_Arial.c.o:/rock/shared/arduino/teensy-1.58-beta2-1.8.19/hardware/teensy/avr/libraries/ST7735_t3/st7735_t3_font_Arial.c:12972: multiple definition of `Arial_96'; /tmp/arduino_build_240222/libraries/GC9A01A_t3n/GC9A01A_t3n_font_Arial.c.o:/home/meissner/Arduino/libraries/GC9A01A_t3n/GC9A01A_t3n_font_Arial.c:12972: first defined here
/rock/shared/arduino/teensy-1.58-beta2-1.8.19/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld: /tmp/arduino_build_240222/libraries/ST7735_t3/st7735_t3_font_Arial.c.o:/rock/shared/arduino/teensy-1.58-beta2-1.8.19/hardware/teensy/avr/libraries/ST7735_t3/st7735_t3_font_Arial.c:8887: multiple definition of `Arial_72'; /tmp/arduino_build_240222/libraries/GC9A01A_t3n/GC9A01A_t3n_font_Arial.c.o:/home/meissner/Arduino/libraries/GC9A01A_t3n/GC9A01A_t3n_font_Arial.c:8887: first defined here
/rock/shared/arduino/teensy-1.58-beta2-1.8.19/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld: /tmp/arduino_build_240222/libraries/ST7735_t3/st7735_t3_font_Arial.c.o:/rock/shared/arduino/teensy-1.58-beta2-1.8.19/hardware/teensy/avr/libraries/ST7735_t3/st7735_t3_font_Arial.c:6539: multiple definition of `Arial_60'; /tmp/arduino_build_240222/libraries/GC9A01A_t3n/GC9A01A_t3n_font_Arial.c.o:/home/meissner/Arduino/libraries/GC9A01A_t3n/GC9A01A_t3n_font_Arial.c:6539: first defined here
/rock/shared/arduino/teensy-1.58-beta2-1.8.19/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld: /tmp/arduino_build_240222/libraries/ST7735_t3/st7735_t3_font_Arial.c.o:/rock/shared/arduino/teensy-1.58-beta2-1.8.19/hardware/teensy/avr/libraries/ST7735_t3/st7735_t3_font_Arial.c:4884: multiple definition of `Arial_48'; /tmp/arduino_build_240222/libraries/GC9A01A_t3n/GC9A01A_t3n_font_Arial.c.o:/home/meissner/Arduino/libraries/GC9A01A_t3n/GC9A01A_t3n_font_Arial.c:4884: first defined here
/rock/shared/arduino/teensy-1.58-beta2-1.8.19/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld: /tmp/arduino_build_240222/libraries/ST7735_t3/st7735_t3_font_Arial.c.o:/rock/shared/arduino/teensy-1.58-beta2-1.8.19/hardware/teensy/avr/libraries/ST7735_t3/st7735_t3_font_Arial.c:3768: multiple definition of `Arial_40'; /tmp/arduino_build_240222/libraries/GC9A01A_t3n/GC9A01A_t3n_font_Arial.c.o:/home/meissner/Arduino/libraries/GC9A01A_t3n/GC9A01A_t3n_font_Arial.c:3768: first defined here
/rock/shared/arduino/teensy-1.58-beta2-1.8.19/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld: /tmp/arduino_build_240222/libraries/ST7735_t3/st7735_t3_font_Arial.c.o:/rock/shared/arduino/teensy-1.58-beta2-1.8.19/hardware/teensy/avr/libraries/ST7735_t3/st7735_t3_font_Arial.c:2974: multiple definition of `Arial_32'; /tmp/arduino_build_240222/libraries/GC9A01A_t3n/GC9A01A_t3n_font_Arial.c.o:/home/meissner/Arduino/libraries/GC9A01A_t3n/GC9A01A_t3n_font_Arial.c:2974: first defined here
/rock/shared/arduino/teensy-1.58-beta2-1.8.19/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld: /tmp/arduino_build_240222/libraries/ST7735_t3/st7735_t3_font_Arial.c.o:/rock/shared/arduino/teensy-1.58-beta2-1.8.19/hardware/teensy/avr/libraries/ST7735_t3/st7735_t3_font_Arial.c:2431: multiple definition of `Arial_28'; /tmp/arduino_build_240222/libraries/GC9A01A_t3n/GC9A01A_t3n_font_Arial.c.o:/home/meissner/Arduino/libraries/GC9A01A_t3n/GC9A01A_t3n_font_Arial.c:2431: first defined here
/rock/shared/arduino/teensy-1.58-beta2-1.8.19/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld: /tmp/arduino_build_240222/libraries/ST7735_t3/st7735_t3_font_Arial.c.o:/rock/shared/arduino/teensy-1.58-beta2-1.8.19/hardware/teensy/avr/libraries/ST7735_t3/st7735_t3_font_Arial.c:1988: multiple definition of `Arial_24'; /tmp/arduino_build_240222/libraries/GC9A01A_t3n/GC9A01A_t3n_font_Arial.c.o:/home/meissner/Arduino/libraries/GC9A01A_t3n/GC9A01A_t3n_font_Arial.c:1988: first defined here
/rock/shared/arduino/teensy-1.58-beta2-1.8.19/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld: /tmp/arduino_build_240222/libraries/ST7735_t3/st7735_t3_font_Arial.c.o:/rock/shared/arduino/teensy-1.58-beta2-1.8.19/hardware/teensy/avr/libraries/ST7735_t3/st7735_t3_font_Arial.c:1647: multiple definition of `Arial_20'; /tmp/arduino_build_240222/libraries/GC9A01A_t3n/GC9A01A_t3n_font_Arial.c.o:/home/meissner/Arduino/libraries/GC9A01A_t3n/GC9A01A_t3n_font_Arial.c:1647: first defined here
/rock/shared/arduino/teensy-1.58-beta2-1.8.19/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld: /tmp/arduino_build_240222/libraries/ST7735_t3/st7735_t3_font_Arial.c.o:/rock/shared/arduino/teensy-1.58-beta2-1.8.19/hardware/teensy/avr/libraries/ST7735_t3/st7735_t3_font_Arial.c:1374: multiple definition of `Arial_18'; /tmp/arduino_build_240222/libraries/GC9A01A_t3n/GC9A01A_t3n_font_Arial.c.o:/home/meissner/Arduino/libraries/GC9A01A_t3n/GC9A01A_t3n_font_Arial.c:1374: first defined here
...
 
Well since those are macros and such, the simplest way is just to keep each in separate .cpp files, either in the directory the .ino file is in or moved to separate libraries.

However if you do move the stuff to separate functions, you get the following errors from linking:
...

Think in the long run probably better to use a common base.

What I am trying to remember is why we changed:
Code:
#include "glcdfont.c"
//extern "C" const unsigned char glcdfont[];
which work to use extern.... @KurtE might remember.
 
Because it was a .c file so it was compiled in and ended up with duplicate ...

A couple of possible fixes:

1) rename gldfont.c to something else like gldfont.h or .hxx or .cxx...
git mv gldfont.c gldfont.h

Edit the structure, to be marked static...

2) which may work... Just tried.
Turn all of these into proper libraries. Several are, but st7735_t3 is not.
Move all of the src files into src directory and then in library.properties add the line:
Code:
dot_a_linkage=true
This line appears to not do anything if old style library.

When both of these are libraries. the Linker will see one of these files and use it, and then see the second one and say it does not have any symbol in it I need and not include it...
 
Because it was a .c file so it was compiled in and ended up with duplicate ...

A couple of possible fixes:

1) rename gldfont.c to something else like gldfont.h or .hxx or .cxx...
git mv gldfont.c gldfont.h

Edit the structure, to be marked static...

2) which may work... Just tried.
Turn all of these into proper libraries. Several are, but st7735_t3 is not.
Move all of the src files into src directory and then in library.properties add the line:
Code:
dot_a_linkage=true
This line appears to not do anything if old style library.

When both of these are libraries. the Linker will see one of these files and use it, and then see the second one and say it does not have any symbol in it I need and not include it...

To be honest not sure which way is the best or the preferred way so take your choice and let me know.
 
Ran into a conflict between "Adafruit_GFX.h" and "ILI9341.h".

Code:
Linking everything together...

/home/wwatson/arduino-1.8.19-1.58B3/hardware/teensy/../tools/arm/bin/arm-none-eabi-gcc -O2 -Wl,--gc-sections,--relax -T/home/wwatson/arduino-1.8.19-1.58B3/hardware/teensy/avr/cores/teensy4/imxrt1062_t41.ld -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -o /tmp/arduino_build_609306/lilbConflict.ino.elf /tmp/arduino_build_609306/sketch/lilbConflict.ino.cpp.o /tmp/arduino_build_609306/libraries/Adafruit_GFX_Library/glcdfont.c.o /tmp/arduino_build_609306/libraries/Adafruit_GFX_Library/Adafruit_GFX.cpp.o /tmp/arduino_build_609306/libraries/Adafruit_GFX_Library/Adafruit_GrayOLED.cpp.o /tmp/arduino_build_609306/libraries/Adafruit_GFX_Library/Adafruit_SPITFT.cpp.o /tmp/arduino_build_609306/libraries/Adafruit_BusIO/Adafruit_BusIO_Register.cpp.o /tmp/arduino_build_609306/libraries/Adafruit_BusIO/Adafruit_I2CDevice.cpp.o /tmp/arduino_build_609306/libraries/Adafruit_BusIO/Adafruit_SPIDevice.cpp.o /tmp/arduino_build_609306/libraries/Wire/Wire.cpp.o /tmp/arduino_build_609306/libraries/Wire/WireIMXRT.cpp.o /tmp/arduino_build_609306/libraries/Wire/WireKinetis.cpp.o /tmp/arduino_build_609306/libraries/Wire/utility/twi.c.o /tmp/arduino_build_609306/libraries/SPI/SPI.cpp.o /tmp/arduino_build_609306/libraries/ILI9341_t3/font_Arial.c.o /tmp/arduino_build_609306/libraries/ILI9341_t3/font_ArialBold.c.o /tmp/arduino_build_609306/libraries/ILI9341_t3/glcdfont.c.o /tmp/arduino_build_609306/libraries/ILI9341_t3/ILI9341_t3.cpp.o /tmp/arduino_build_609306/core/core.a -L/tmp/arduino_build_609306 -larm_cortexM7lfsp_math -lm -lstdc++

/home/wwatson/arduino-1.8.19-1.58B3/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld: /tmp/arduino_build_609306/libraries/ILI9341_t3/ILI9341_t3.cpp.o: in function `Adafruit_GFX_Button::drawButton(bool)':

/home/wwatson/arduino-1.8.19-1.58B3/hardware/teensy/avr/libraries/ILI9341_t3/ILI9341_t3.cpp:1816: multiple definition of `Adafruit_GFX_Button::drawButton(bool)'; /tmp/arduino_build_609306/libraries/Adafruit_GFX_Library/Adafruit_GFX.cpp.o:/home/wwatson/Arduino/libraries/Adafruit_GFX_Library/Adafruit_GFX.cpp:1675: first defined here

/home/wwatson/arduino-1.8.19-1.58B3/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld: /tmp/arduino_build_609306/libraries/ILI9341_t3/ILI9341_t3.cpp.o: in function `Adafruit_GFX_Button::contains(short, short)':

/home/wwatson/arduino-1.8.19-1.58B3/hardware/teensy/avr/libraries/ILI9341_t3/ILI9341_t3.cpp:1838: multiple definition of `Adafruit_GFX_Button::contains(short, short)'; /tmp/arduino_build_609306/libraries/Adafruit_GFX_Library/Adafruit_GFX.cpp.o:/home/wwatson/Arduino/libraries/Adafruit_GFX_Library/Adafruit_GFX.cpp:1709: first defined here

collect2: error: ld returned 1 exit status
Using library Adafruit_GFX_Library at version 1.11.3 in folder: /home/wwatson/Arduino/libraries/Adafruit_GFX_Library 
Using library Adafruit_BusIO at version 1.14.1 in folder: /home/wwatson/Arduino/libraries/Adafruit_BusIO 
Using library Wire at version 1.0 in folder: /home/wwatson/arduino-1.8.19-1.58B3/hardware/teensy/avr/libraries/Wire 
Using library SPI at version 1.0 in folder: /home/wwatson/arduino-1.8.19-1.58B3/hardware/teensy/avr/libraries/SPI 
Using library ILI9341_t3 at version 1.0 in folder: /home/wwatson/arduino-1.8.19-1.58B3/hardware/teensy/avr/libraries/ILI9341_t3 
Error compiling for board Teensy 4.1.

A small sketch to reproduce the problem:
Code:
// Testing Adafruit_GFX/ILI9341 library conflict.

#include "Adafruit_GFX.h"
#include "ILI9341_t3.h"

void setup() {
  while(!Serial);
#ifdef _ADAFRUIT_GFX_H
  Serial.printf("_ADAFRUIT_GFX_H: is defined\n");
#endif
}

void loop() {

}

I found this in "ILI9341_t3.h" at line #556:
Code:
// To avoid conflict when also using Adafruit_GFX or any Adafruit library
// which depends on Adafruit_GFX, #include the Adafruit library *BEFORE*
// you #include ILI9341_t3.h.
#ifndef _ADAFRUIT_GFX_H

If you comment out the ILI9341_t3.h include and recompile the sketch you will see _ADAFRUIT_GFX_H is defined.

Arduino 1.8.19 TD1.58B3
 
Last edited:
Alcon
@KurtE and I have been working through all the display libraries to allow for multiple displays as well as fixing the glcdfont issue. So far the following libraries have been updated:
RA8895_t4: https://github.com/mjs513/RA8875/tree/RA8875_t4
Ra8876LiteTeensy: https://github.com/mjs513/Ra8876LiteTeensy
HX8357_t3n: https://github.com/mjs513/HX8357_t3n
ST7735_t3: https://github.com/mjs513/ST7735_t3
GC9A01A_t3n: https://github.com/mjs513/GC9A01A_t3n

Only lib that hasn't been updated is the ILI9341_t3n - thats next on the list

@KurtE - Did I forget any?

UPDATE:
Just issued a PR to @KurtE for an Update to the ILI9341_t3n lib

@MichaelMeissner hope this didn't break anything for you.
 
Last edited:
@KurtE @ mjs513 - You guys are awesome:) Everything seems to be working flawlessly. I just finished cleaning up and testing all of the examples in the RA8876_t3 library. I removed the vt100 example as well. I found that "graphicCursor.ino" was only working with a wired mouse. It failed to work with a wireless keyboard/mouse combo. Turns out I needed to ad another instance of HIDPaser.
Code:
//************************************************************
// Even though the keyboard is not used we still need
// to create a keyboardController and USBHIDParser instance
// just in case a wireless keyboard/mouse is used. Otherwise
// the mouse will not be claimed.
//************************************************************* 
MouseController mouse1(myusb);
KeyboardController keyboard1(myusb); // Not used.
USBHIDParser hid1(myusb); // Needed for USB mouse.
[COLOR="#FF0000"]USBHIDParser hid2(myusb); // Needed for USB wireless keyboard/mouse combo.[/COLOR]

Hopefully I have not screwed up any of the examples:)

Thanks for the assist...
 
@KurtE @ mjs513 - You guys are awesome:) Everything seems to be working flawlessly. I just finished cleaning up and testing all of the examples in the RA8876_t3 library. I removed the vt100 example as well. I found that "graphicCursor.ino" was only working with a wired mouse. It failed to work with a wireless keyboard/mouse combo. Turns out I needed to ad another instance of HIDPaser.
Code:
//************************************************************
// Even though the keyboard is not used we still need
// to create a keyboardController and USBHIDParser instance
// just in case a wireless keyboard/mouse is used. Otherwise
// the mouse will not be claimed.
//************************************************************* 
MouseController mouse1(myusb);
KeyboardController keyboard1(myusb); // Not used.
USBHIDParser hid1(myusb); // Needed for USB mouse.
[COLOR="#FF0000"]USBHIDParser hid2(myusb); // Needed for USB wireless keyboard/mouse combo.[/COLOR]

Hopefully I have not screwed up any of the examples:)

Thanks for the assist...

Glad we all got it working.
 
Back
Top