Data type of "maxtrix_name" in SMARTMATRIX_ALLOCATE_BUFFERS()

Sorry Im not very proficient at programming and I am having a hard time reading through the SmartMatrix code to determine what data type matrix_name is so I can declare pointer to it.

Sorry again I am probably not even asking the questions correctly.

Is it “RGB”?

It’s not something easy to do. I just had to work out the details. This code added to the Bitmaps example compiles but I didn’t actually test if it works.

void accessMatrixThroughPointer(SmartMatrixHub75Calc<kRefreshDepth, kMatrixWidth, kMatrixHeight, kPanelType, kMatrixOptions>* ptr) {
  ptr->setBrightness(128);
}

void setup() {
  matrix.addLayer(&backgroundLayer); 
  matrix.begin();

  matrix.setBrightness(128);

  accessMatrixThroughPointer(&matrix);
  SmartMatrixHub75Calc<kRefreshDepth, kMatrixWidth, kMatrixHeight, kPanelType, kMatrixOptions>* matrixptr = &matrix;
  accessMatrixThroughPointer(matrixptr);

  if(led >= 0)  pinMode(led, OUTPUT);
}

Hope that helps

would it be easier if I were using SMARTMATRIX_ALLOCATE_BACKGROUND_LAYER()? or does it still use the same template type definition?

No, it wouldn’t help

Do you know what it would be for a layer instead of a matrix?

Which layer type(s)?

There’s only one example I know of that uses a Layer through a pointer, it’s different for the background GFX Layer, and also different for the old Layers.

I havnt messed around with the different layers I am using SMARTMATRIX_ALLOCATE_BACKGROUND_LAYER.

There’s nothing special about the normal layers, no templates, so you can access them by pointer like any normal object

Excellent, So what would be the “data type *” so my function will know what to expect?

The class name is SMLayerBackground

It inherits from class SM_Layer so if you want to use a more generic pointer that can be used for different layer types you can use SM_Layer and recast if needed instead.