SmartMatrix_GFX installation

I’m trying to install this library to use with some previous project I had using the ADAFRUIT GFX library, but I’m running into a pile of errors that it does not recognize any of the Adafruit style code.

I’m using the Smartmatrix TeensyLC branch, and I’ve created a pattern for my P10 LEd Module. It’s working.

Next I installed the Smartmatrix_GFX requirements which are the following:
Framebuffer_GFX - github zip downloaded and installed
Smartmatrix - Already installed with the TeensyLC branch
Adafruit_GFX - Already installed from my previous project
FastLED - github zip downloaded and installed

Next I have these includes in my new project

#include <Adafruit_GFX.h>
#include <SmartMatrix_GFX.h>
#include <SmartLEDShieldV4.h>
#include <SmartMatrix3.h>

When I verify the code it spits out errors not recognizing any adafruit style gfx code, example filltriangle etc…
It also tells me Fastled and Adafruit GFX are already installed in the Teensy library folder inside of programfiles > Hardware > teensy> AVR> Library (conflict)

The libraries I installed are in the usual arduino library folder in My Documents

I’ve removed the libraries from the Hardware folder (Fastled and Adafruit GFX) and no change to the problem.

I’m missing something here, anyone have an idea?

Please paste the errors you see here (use the “preformatted text” button </> above) which may help.

I’m not really using Adafruit GFX, we may need @marcmerlin’s help with this

Did you install both


and

?

Both SmartMatrix_GFX and Framebuffer_GFX are installed.
In my Arduino Library I have both “Framebuffer_GFX-master” and “SmartMatrix_GFX-master”

I’m using the following, Teensy 3.5, SmartLedShield V4 and a P10 RGB 16x32 matrix panel 1/4scan with HUB 75.

my code starts like this. I’ve removed some snippets to make it more readable

#include <Adafruit_GFX.h>
#include <SmartMatrix_GFX.h>
#include <SmartLEDShieldV4.h>
#include <SmartMatrix3.h>

#define COLOR_DEPTH 24
const uint8_t kMatrixWidth = 32;
const uint8_t kMatrixHeight = 16;
const uint8_t kPanelType = SMARTMATRIX_HUB75_8ROW_32COL_MOD4SCAN_V3;
const uint8_t kRefreshDepth = 36;
const uint8_t kDmaBufferRows = 4;
const uint8_t kMatrixOptions = (SMARTMATRIX_OPTIONS_NONE); /
const uint8_t kBackgroundLayerOptions = (SM_BACKGROUND_OPTIONS_NONE);

SMARTMATRIX_ALLOCATE_BUFFERS(matrix, kMatrixWidth, kMatrixHeight, kRefreshDepth, kDmaBufferRows, kPanelType, kMatrixOptions);
SMARTMATRIX_ALLOCATE_BACKGROUND_LAYER(backgroundLayer, kMatrixWidth, kMatrixHeight, COLOR_DEPTH, kBackgroundLayerOptions);

my void setup() looks like this

matrix.addLayer(&backgroundLayer);
matrix.begin();
matrix.setBrightness(128);
backgroundLayer.swapBuffers();
Serial4.begin(9600);
pinMode(24,OUTPUT);

Some errors

In file included from C:\Users\printing\Documents\Arduino\libraries\Framebuffer_GFX-master/Framebuffer_GFX.h:33:0,

             from C:\Users\printing\Documents\Arduino\libraries\SmartMatrix_GFX-master/SmartMatrix_GFX.h:23,

             from C:\Users\printing\AppData\Local\Temp\arduino_modified_sketch_529434\Smartmatrixwork1.ino:11:

C:\Users\printing\Documents\Arduino\libraries\FastLED-master/FastLED.h:14:21: note: #pragma message: FastLED version 3.002.010

pragma message “FastLED version 3.002.010”

Smartmatrixwork1:327: error: ‘class SmartMatrix3<36, 32, 16, 10u, 0u>’ has no member named ‘fillScreen’
matrix.fillScreen(0);

      ^

Smartmatrixwork1:329: error: ‘class SmartMatrix3<36, 32, 16, 10u, 0u>’ has no member named ‘fillTriangle’
matrix.fillTriangle(0 + x, 7, 5 + x, 2, 5 + x, 13, matrix.Color333(4, 2, 0));

      ^

Smartmatrixwork1:329: error: ‘class SmartMatrix3<36, 32, 16, 10u, 0u>’ has no member named ‘Color333’
matrix.fillTriangle(0 + x, 7, 5 + x, 2, 5 + x, 13, matrix.Color333(4, 2, 0));

                                                         ^

Smartmatrixwork1:330: error: ‘class SmartMatrix3<36, 32, 16, 10u, 0u>’ has no member named ‘fillRect’
matrix.fillRect(6 + x, 4, 6, 8, matrix.Color333(4, 2, 0));

      ^

Smartmatrixwork1:330: error: ‘class SmartMatrix3<36, 32, 16, 10u, 0u>’ has no member named ‘Color333’
matrix.fillRect(6 + x, 4, 6, 8, matrix.Color333(4, 2, 0));


Does Smartmatrix_GFX need to be defined somewhere?

In the Smartmatrixd_GFX example I see this snippet of code

#define mw kMatrixWidth
#define mh kMatrixHeight
#define NUMMATRIX (kMatrixWidth*kMatrixHeight)

CRGB *matrixleds;

void show_callback();
SmartMatrix_GFX *matrix = new SmartMatrix_GFX(matrixleds, mw, mh, show_callback);
// Sadly this callback function must be copied around with this init code
void show_callback() {
backgroundLayer.swapBuffers(true);
matrixleds = (CRGB *)backgroundLayer.backBuffer();
matrix->newLedsPtr(matrixleds);
}

Also I’ve looked into SmartMatrix_GFX.cpp to find this

SmartMatrix_GFX::SmartMatrix_GFX(CRGB leds, uint8_t w, uint8_t h, void ( showptr)()):
Framebuffer_GFX(leds, w, h, showptr) {
}

I’m thinking I need to define it, but then do I have to refactor all the “matrix.” instructions to something else?
Like I said I’m missing something, and to me it’s not clear.

I managed to resolve all the issues

#1 I needed to define SmartMatrix_GFX and parameters. This is what I was missing.
#2 Implentations of Adafruit’s color controls had to be refactored in my code.
#3 swapbuffer handling doesn’t seem to work the same and had to be refactored.
#4 Issues of conflicting libraries between Teensy’s avr hardware library components and libraries loaded through the Arduino IDE doesn’t seem to make a difference. I completely removed Fastled and Smartmatrix from the hardware library. I assume they are part of the Teensy driver installation, and redundant.

I’d like to thank you both marcmerlin and Louis for providing these libraries, and for the help regardless.

Sorry for the late replies, somehow I didn’t get Email when you sent this and only noticed it later.

So, it’s not super clear what you changed/fixed.
Did you look at
https://github.com/marcmerlin/SmartMatrix_GFX/blob/master/examples/MatrixGFXDemo/MatrixGFXDemo.ino ?

Note that you have
SmartMatrix_GFX *matrix = new SmartMatrix_GFX(matrixleds, mw, mh, show_callback);
that is the GFX object. You were trying to make GFX method calls against Louis’ backgroundLayer object.
If you use my library, backgroundLayer is only used a single time and that’s in void show_callback() which repoints the SmartMatrix_GFX CRGB buffer to Louis’ SmartMatrix object.
That way, the whole thing is 0 copy.

I’m not quite sure how you made things work, but hopefully the difference between the 2 objects makes sense.
I’m not sure how you refactored swapBuffers, but the example I gave above works fine :slight_smile:

It’s working great right now, thanks again!

Later I’ll pester Louis with a question on one of my other SMD panels, it uses the A B C and D lines plus the inputs seem to be inverted. :grimacing: