From f929ad6e7a464268b7ef4a5ff35ad6d62736d8ac Mon Sep 17 00:00:00 2001 From: Vasil Date: Fri, 7 Jan 2022 14:37:48 +0300 Subject: [PATCH] Add BGR color configuration --- src/internal/NeoColorFeatures.h | 39 +++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/internal/NeoColorFeatures.h b/src/internal/NeoColorFeatures.h index bc4f2a3..623f442 100644 --- a/src/internal/NeoColorFeatures.h +++ b/src/internal/NeoColorFeatures.h @@ -593,6 +593,45 @@ public: }; +class NeoBgrFeature : public Neo3ByteElementsNoSettings +{ +public: + static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color) + { + uint8_t* p = getPixelAddress(pPixels, indexPixel); + + *p++ = color.B; + *p++ = color.G; + *p = color.R; + } + + static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel) + { + ColorObject color; + const uint8_t* p = getPixelAddress(pPixels, indexPixel); + + color.B = *p++; + color.G = *p++; + color.R = *p; + + return color; + } + + + static ColorObject retrievePixelColor_P(PGM_VOID_P pPixels, uint16_t indexPixel) + { + ColorObject color; + const uint8_t* p = getPixelAddress(reinterpret_cast(pPixels), indexPixel); + + color.B = pgm_read_byte(p++); + color.G = pgm_read_byte(p++); + color.R = pgm_read_byte(p); + + return color; + } + +}; + class NeoRgbw64Feature : public Neo8ByteElementsNoSettings { public: