adafruit / RGB-matrix-Panel

Arduino library and example code for the 16x32 RGB matrix panels in the shop
http://www.adafruit.com/products/420
303 stars 145 forks source link

Add Support for unit32_t rgb values #14

Open Aerospacesmith opened 10 years ago

Aerospacesmith commented 10 years ago

For example : uint16_t RGBmatrixPanel::Color333(uint32_t c) { // RRRrrGGGgggBBBbb

uint8_t
  r = (uint8_t)(c >> 16),
  g = (uint8_t)(c >>  8),
  b = (uint8_t)c;

return ((r & 0x7) << 13) | ((r & 0x6) << 10) | ((g & 0x7) << 8) | ((g & 0x7) << 5) | ((b & 0x7) << 2) | ((b & 0x6) >> 1); }

eadmaster commented 6 years ago

Does this allow to have full-RGB colors in the 0-255 range per channel?

I've found the current 0-7 range quite restrictive as i lower the brightness values to save current.

marcmerlin commented 5 years ago

@eadmaster This is not going to be fixed in the current library, it can't do more than 4bpp on the older chips it runs out. If you can switch to teensy 3.x or ESP32, I recommend you switch to SmartMatrix which supports 24bpp: https://github.com/pixelmatix/SmartMatrix You can then install my GFX compat library on top https://github.com/marcmerlin/SmartMatrix_GFX/

If you do so, you'll also get FastLED and LEDMatrix compatibility and be able to run lots of demos like those here: https://github.com/marcmerlin/FastLED_NeoMatrix_SmartMatrix_LEDMatrix_GFX_Demos

@Aerospacesmith adding a function can be done, you can submit a pull request which may get accepted if the maintainers have time. Or you can switch to my compat layer library I mentioned above which supports 24bpp natively See https://github.com/marcmerlin/SmartMatrix_GFX/blob/master/SmartMatrix_GFX.cpp#L223