Color depth to 12bit

Hello Louis

How can I set the color depth to 12 bits?
I have checked the source code and I see routines for 48, 36, 24 and 12 bits.

I found two values in the Smarmatrix configuration:
#define COLOR_DEPTH 24
const uint8_t kRefreshDepth = 24;

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

Do I put both to 12, to work with 12 bits?
For my application, working with 12 bits of color will be enough, but I’m not sure which of the two values I should modify or if I modify both.

Another question:
How does performance vary by modifying this value?
const uint8_t kDmaBufferRows = 4;


12 bit color isn’t supported.

How does performance vary by modifying this value?
const uint8_t kDmaBufferRows = 4;

On the Teensy, SmartMatrix Library has a buffer of multiple rows of pixels ready to shift out to the panel. A higher value gives the library a better chance to keep up with the overall refresh rate even if interrupts are disabled for a longer period of time. Minimum value is 2 (so there’s one row ready to shift out while the other row is being calculated)

Ok, thanks.

So, if I enable loadMatrixBuffers12, forcing latchesPerRow to 4, will it fail ?. Are these functions related to color depth, 48bit, 36bit, 24bit and 12bit?

I try to improve the performance, regardless of what is not necessary, for example a color depth of 24bit is excessive for my application. I have also improved the performance, by harware, applying overclocking up to 240Mhz.

if (latchesPerRow == 16)
    loadMatrixBuffers48(currentRow, freeRowBuffer);
else if (latchesPerRow == 12)
    loadMatrixBuffers36(currentRow, freeRowBuffer);
else if (latchesPerRow == 8)
    loadMatrixBuffers24(currentRow, freeRowBuffer);
else if (latchesPerRow == 4)
    loadMatrixBuffers12(currentRow, freeRowBuffer);

Sorry for the delay. Yes it’s likely to fail, I didn’t add 12 bit color support.

IIRC, the adafruit lib is indeed RGB444 and they upconvert to RGB565 for the Adafruit::GFX lib.
It sure would be nice to have that support for using less RAM and having a higher refresh rate.
Relatedly, I met this guy at Above and Beyond Weekender in WA, and had made a 128x64 totem on ESP32 with your lib and my GFX lib and animatedgifs fork:

He mentioned that he hit a lot of memory limits and he has to downsample his animated gifs to 16 colors to save RAM on ESP32.