forked from Makuna/NeoPixelBus
Color feature refactor (#716)
* refactor color order design within a color feature using a template to reduce duplicate code making it easier to add similar features with different order * fix warnings
This commit is contained in:
@@ -30,22 +30,28 @@ License along with NeoPixel. If not, see
|
|||||||
//
|
//
|
||||||
#include "features/NeoElementsNoSettings.h"
|
#include "features/NeoElementsNoSettings.h"
|
||||||
#include "features/NeoByteElements.h"
|
#include "features/NeoByteElements.h"
|
||||||
#include "features/Neo2Byte555Elements.h"
|
|
||||||
|
// Core Feature base classes
|
||||||
|
#include "features/Neo2Byte555Feature.h"
|
||||||
|
#include "features/Neo3ByteFeature.h"
|
||||||
|
#include "features/Neo3Byte777Feature.h"
|
||||||
|
#include "features/Neo4ByteFeature.h"
|
||||||
|
#include "features/DotStarX4ByteFeature.h"
|
||||||
|
#include "features/DotStarL4ByteFeature.h"
|
||||||
|
#include "features/Neo6xByteFeature.h"
|
||||||
|
#include "features/Neo6xxByteFeature.h"
|
||||||
|
#include "features/Neo3WordFeature.h"
|
||||||
|
#include "features/Neo4WordFeature.h"
|
||||||
|
|
||||||
// NeoPixel Features
|
// NeoPixel Features
|
||||||
//
|
//
|
||||||
#include "features/NeoBgrFeature.h"
|
#include "features/NeoRgbFeatures.h"
|
||||||
#include "features/NeoBrgFeature.h"
|
#include "features/NeoRgbwFeatures.h"
|
||||||
#include "features/NeoGrb48Feature.h"
|
#include "features/NeoRgb48Features.h"
|
||||||
#include "features/NeoGrbFeature.h"
|
#include "features/NeoRgbw64Features.h"
|
||||||
#include "features/NeoGrbwFeature.h"
|
|
||||||
#include "features/NeoRbgFeature.h"
|
#include "features/NeoRgbwxxFeatures.h"
|
||||||
#include "features/NeoRgb48Feature.h"
|
#include "features/NeoRgbcwxFeatures.h"
|
||||||
#include "features/NeoRgbFeature.h"
|
|
||||||
#include "features/NeoRgbw64Feature.h"
|
|
||||||
#include "features/NeoRgbwFeature.h"
|
|
||||||
#include "features/NeoRgbwxxFeature.h"
|
|
||||||
#include "features/NeoGrbcwxFeature.h"
|
|
||||||
#include "features/NeoSm168xxFeatures.h"
|
#include "features/NeoSm168xxFeatures.h"
|
||||||
#include "features/NeoTm1814Features.h"
|
#include "features/NeoTm1814Features.h"
|
||||||
#include "features/NeoTm1914Features.h"
|
#include "features/NeoTm1914Features.h"
|
||||||
@@ -56,24 +62,11 @@ typedef NeoGrb48Feature NeoGrbWs2816Feature;
|
|||||||
|
|
||||||
// DotStart Features
|
// DotStart Features
|
||||||
//
|
//
|
||||||
#include "features/DotStarBgrFeature.h"
|
#include "features/DotStarRgbFeatures.h"
|
||||||
#include "features/DotStarBrgFeature.h"
|
#include "features/DotStarLrgbFeatures.h"
|
||||||
#include "features/DotStarGbrFeature.h"
|
#include "features/Lpd6803RgbFeatures.h"
|
||||||
#include "features/DotStarGrbFeature.h"
|
#include "features/Lpd8806RgbFeatures.h"
|
||||||
#include "features/DotStarLbgrFeature.h"
|
|
||||||
#include "features/DotStarLbrgFeature.h"
|
|
||||||
#include "features/DotStarLgbrFeature.h"
|
|
||||||
#include "features/DotStarLgrbFeature.h"
|
|
||||||
#include "features/DotStarLrbgFeature.h"
|
|
||||||
#include "features/DotStarLrgbFeature.h"
|
|
||||||
#include "features/DotStarRbgFeature.h"
|
|
||||||
#include "features/DotStarRgbFeature.h"
|
|
||||||
#include "features/Lpd8806BrgFeature.h"
|
|
||||||
#include "features/Lpd8806GrbFeature.h"
|
|
||||||
#include "features/Lpd6803BrgFeature.h"
|
|
||||||
#include "features/Lpd6803GrbFeature.h"
|
|
||||||
#include "features/Lpd6803GbrFeature.h"
|
|
||||||
#include "features/Lpd6803RgbFeature.h"
|
|
||||||
#include "features/P9813BgrFeature.h"
|
#include "features/P9813BgrFeature.h"
|
||||||
|
|
||||||
// 7 Segment Features
|
// 7 Segment Features
|
||||||
|
@@ -28,6 +28,7 @@ License along with NeoPixel. If not, see
|
|||||||
|
|
||||||
#include "colors/NeoHueBlend.h"
|
#include "colors/NeoHueBlend.h"
|
||||||
|
|
||||||
|
#include "colors/RgbColorIndexes.h"
|
||||||
#include "colors/RgbColorBase.h"
|
#include "colors/RgbColorBase.h"
|
||||||
|
|
||||||
#include "colors/RgbColor.h"
|
#include "colors/RgbColor.h"
|
||||||
|
@@ -39,6 +39,23 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
// operator [] - readonly
|
||||||
|
// access elements in order by index rather than member name
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
uint16_t operator[](size_t idx) const
|
||||||
|
{
|
||||||
|
switch (idx)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
return RedTenthMilliAmpere;
|
||||||
|
case 1:
|
||||||
|
return GreenTenthMilliAmpere;
|
||||||
|
default:
|
||||||
|
return BlueTenthMilliAmpere;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const uint16_t RedTenthMilliAmpere; // in 1/10th ma
|
const uint16_t RedTenthMilliAmpere; // in 1/10th ma
|
||||||
const uint16_t GreenTenthMilliAmpere; // in 1/10th ma
|
const uint16_t GreenTenthMilliAmpere; // in 1/10th ma
|
||||||
const uint16_t BlueTenthMilliAmpere; // in 1/10th ma
|
const uint16_t BlueTenthMilliAmpere; // in 1/10th ma
|
||||||
@@ -55,6 +72,25 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
// operator [] - readonly
|
||||||
|
// access elements in order by index rather than member name
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
uint16_t operator[](size_t idx) const
|
||||||
|
{
|
||||||
|
switch (idx)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
return RedTenthMilliAmpere;
|
||||||
|
case 1:
|
||||||
|
return GreenTenthMilliAmpere;
|
||||||
|
case 2:
|
||||||
|
return BlueTenthMilliAmpere;
|
||||||
|
default:
|
||||||
|
return WhiteTenthMilliAmpere;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const uint16_t RedTenthMilliAmpere; // in 1/10th ma
|
const uint16_t RedTenthMilliAmpere; // in 1/10th ma
|
||||||
const uint16_t GreenTenthMilliAmpere; // in 1/10th ma
|
const uint16_t GreenTenthMilliAmpere; // in 1/10th ma
|
||||||
const uint16_t BlueTenthMilliAmpere; // in 1/10th ma
|
const uint16_t BlueTenthMilliAmpere; // in 1/10th ma
|
||||||
@@ -73,6 +109,27 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
// operator [] - readonly
|
||||||
|
// access elements in order by index rather than member name
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
uint16_t operator[](size_t idx) const
|
||||||
|
{
|
||||||
|
switch (idx)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
return RedTenthMilliAmpere;
|
||||||
|
case 1:
|
||||||
|
return GreenTenthMilliAmpere;
|
||||||
|
case 2:
|
||||||
|
return BlueTenthMilliAmpere;
|
||||||
|
case 3:
|
||||||
|
return WarmWhiteTenthMilliAmpere;
|
||||||
|
default:
|
||||||
|
return CoolWhiteTenthMilliAmpere;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const uint16_t RedTenthMilliAmpere; // in 1/10th ma
|
const uint16_t RedTenthMilliAmpere; // in 1/10th ma
|
||||||
const uint16_t GreenTenthMilliAmpere; // in 1/10th ma
|
const uint16_t GreenTenthMilliAmpere; // in 1/10th ma
|
||||||
const uint16_t BlueTenthMilliAmpere; // in 1/10th ma
|
const uint16_t BlueTenthMilliAmpere; // in 1/10th ma
|
||||||
|
@@ -41,9 +41,9 @@ public:
|
|||||||
return NeoBufferContext<T_COLOR_FEATURE>(Pixels(), PixelsSize());
|
return NeoBufferContext<T_COLOR_FEATURE>(Pixels(), PixelsSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t* Pixels() const
|
const uint8_t* Pixels() const
|
||||||
{
|
{
|
||||||
return (uint8_t*)_pixels;
|
return reinterpret_cast<const uint8_t*>(_pixels);
|
||||||
};
|
};
|
||||||
|
|
||||||
size_t PixelsSize() const
|
size_t PixelsSize() const
|
||||||
|
35
src/internal/colors/RgbColorIndexes.h
Normal file
35
src/internal/colors/RgbColorIndexes.h
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
/*-------------------------------------------------------------------------
|
||||||
|
RgbColorIndexes provides constants for color element vector access on
|
||||||
|
RGB(w) Color Objects
|
||||||
|
|
||||||
|
Written by Michael C. Miller.
|
||||||
|
|
||||||
|
I invest time and resources providing this open source code,
|
||||||
|
please support me by dontating (see https://github.com/Makuna/NeoPixelBus)
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------
|
||||||
|
This file is part of the Makuna/NeoPixelBus library.
|
||||||
|
|
||||||
|
NeoPixelBus is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as
|
||||||
|
published by the Free Software Foundation, either version 3 of
|
||||||
|
the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
NeoPixelBus is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with NeoPixel. If not, see
|
||||||
|
<http://www.gnu.org/licenses/>.
|
||||||
|
-------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
const uint8_t ColorIndexR = 0;
|
||||||
|
const uint8_t ColorIndexG = 1;
|
||||||
|
const uint8_t ColorIndexB = 2;
|
||||||
|
const uint8_t ColorIndexW = 3;
|
||||||
|
const uint8_t ColorIndexWW = 3; // warmer white
|
||||||
|
const uint8_t ColorIndexCW = 4; // cooler white
|
@@ -1,70 +0,0 @@
|
|||||||
/*-------------------------------------------------------------------------
|
|
||||||
DotStarBrgFeature provides feature classes to describe color order and
|
|
||||||
color depth for NeoPixelBus template class when used with DotStars
|
|
||||||
|
|
||||||
Written by Michael C. Miller.
|
|
||||||
|
|
||||||
I invest time and resources providing this open source code,
|
|
||||||
please support me by dontating (see https://github.com/Makuna/NeoPixelBus)
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------
|
|
||||||
This file is part of the Makuna/NeoPixelBus library.
|
|
||||||
|
|
||||||
NeoPixelBus is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as
|
|
||||||
published by the Free Software Foundation, either version 3 of
|
|
||||||
the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
NeoPixelBus is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with NeoPixel. If not, see
|
|
||||||
<http://www.gnu.org/licenses/>.
|
|
||||||
-------------------------------------------------------------------------*/
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
class DotStarBrgFeature :
|
|
||||||
public NeoByteElements<4, RgbColor, uint32_t>,
|
|
||||||
public NeoElementsNoSettings
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
|
||||||
{
|
|
||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
|
|
||||||
*p++ = 0xff; // upper three bits are always 111 and brightness at max
|
|
||||||
*p++ = color.B;
|
|
||||||
*p++ = color.R;
|
|
||||||
*p = color.G;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
|
|
||||||
p++; // ignore the first byte
|
|
||||||
color.B = *p++;
|
|
||||||
color.R = *p++;
|
|
||||||
color.G = *p;
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor_P(PGM_VOID_P pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint8_t* p = getPixelAddress((const uint8_t*)pPixels, indexPixel);
|
|
||||||
|
|
||||||
pgm_read_byte(p++); // ignore the first byte
|
|
||||||
color.B = pgm_read_byte(p++);
|
|
||||||
color.R = pgm_read_byte(p++);
|
|
||||||
color.G = pgm_read_byte(p);
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
@@ -1,70 +0,0 @@
|
|||||||
/*-------------------------------------------------------------------------
|
|
||||||
DotStarGbrFeature provides feature classes to describe color order and
|
|
||||||
color depth for NeoPixelBus template class when used with DotStars
|
|
||||||
|
|
||||||
Written by Michael C. Miller.
|
|
||||||
|
|
||||||
I invest time and resources providing this open source code,
|
|
||||||
please support me by dontating (see https://github.com/Makuna/NeoPixelBus)
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------
|
|
||||||
This file is part of the Makuna/NeoPixelBus library.
|
|
||||||
|
|
||||||
NeoPixelBus is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as
|
|
||||||
published by the Free Software Foundation, either version 3 of
|
|
||||||
the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
NeoPixelBus is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with NeoPixel. If not, see
|
|
||||||
<http://www.gnu.org/licenses/>.
|
|
||||||
-------------------------------------------------------------------------*/
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
class DotStarGbrFeature :
|
|
||||||
public NeoByteElements<4, RgbColor, uint32_t>,
|
|
||||||
public NeoElementsNoSettings
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
|
||||||
{
|
|
||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
|
|
||||||
*p++ = 0xff; // upper three bits are always 111 and brightness at max
|
|
||||||
*p++ = color.G;
|
|
||||||
*p++ = color.B;
|
|
||||||
*p = color.R;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
|
|
||||||
p++; // ignore the first byte
|
|
||||||
color.G = *p++;
|
|
||||||
color.B = *p++;
|
|
||||||
color.R = *p;
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor_P(PGM_VOID_P pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint8_t* p = getPixelAddress((const uint8_t*)pPixels, indexPixel);
|
|
||||||
|
|
||||||
pgm_read_byte(p++); // ignore the first byte
|
|
||||||
color.G = pgm_read_byte(p++);
|
|
||||||
color.B = pgm_read_byte(p++);
|
|
||||||
color.R = pgm_read_byte(p);
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
@@ -1,71 +0,0 @@
|
|||||||
/*-------------------------------------------------------------------------
|
|
||||||
DotStarGrbFeature provides feature classes to describe color order and
|
|
||||||
color depth for NeoPixelBus template class when used with DotStars
|
|
||||||
|
|
||||||
Written by Michael C. Miller.
|
|
||||||
|
|
||||||
I invest time and resources providing this open source code,
|
|
||||||
please support me by dontating (see https://github.com/Makuna/NeoPixelBus)
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------
|
|
||||||
This file is part of the Makuna/NeoPixelBus library.
|
|
||||||
|
|
||||||
NeoPixelBus is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as
|
|
||||||
published by the Free Software Foundation, either version 3 of
|
|
||||||
the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
NeoPixelBus is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with NeoPixel. If not, see
|
|
||||||
<http://www.gnu.org/licenses/>.
|
|
||||||
-------------------------------------------------------------------------*/
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
|
|
||||||
class DotStarGrbFeature :
|
|
||||||
public NeoByteElements<4, RgbColor, uint32_t>,
|
|
||||||
public NeoElementsNoSettings
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
|
||||||
{
|
|
||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
|
|
||||||
*p++ = 0xff; // upper three bits are always 111 and brightness at max
|
|
||||||
*p++ = color.G;
|
|
||||||
*p++ = color.R;
|
|
||||||
*p = color.B;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
|
|
||||||
p++; // ignore the first byte
|
|
||||||
color.G = *p++;
|
|
||||||
color.R = *p++;
|
|
||||||
color.B = *p;
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor_P(PGM_VOID_P pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint8_t* p = getPixelAddress((const uint8_t*)pPixels, indexPixel);
|
|
||||||
|
|
||||||
pgm_read_byte(p++); // ignore the first byte
|
|
||||||
color.G = pgm_read_byte(p++);
|
|
||||||
color.R = pgm_read_byte(p++);
|
|
||||||
color.B = pgm_read_byte(p);
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
@@ -1,6 +1,6 @@
|
|||||||
/*-------------------------------------------------------------------------
|
/*-------------------------------------------------------------------------
|
||||||
DotStarLbgrFeature provides feature classes to describe color order and
|
DotStarL4Feature provides feature base class to describe color order for
|
||||||
color depth for NeoPixelBus template class when used with DotStars
|
3 color but 4 byte features when used with DotStars, exposing Luminance as W
|
||||||
|
|
||||||
Written by Michael C. Miller.
|
Written by Michael C. Miller.
|
||||||
|
|
||||||
@@ -26,10 +26,9 @@ License along with NeoPixel. If not, see
|
|||||||
-------------------------------------------------------------------------*/
|
-------------------------------------------------------------------------*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
template <uint8_t V_IC_1, uint8_t V_IC_2, uint8_t V_IC_3>
|
||||||
class DotStarLbgrFeature :
|
class DotStarL4Feature :
|
||||||
public NeoByteElements<4, RgbwColor, uint32_t>,
|
public NeoByteElements<4, RgbwColor, uint32_t>
|
||||||
public NeoElementsNoSettings
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
||||||
@@ -37,9 +36,9 @@ public:
|
|||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
||||||
|
|
||||||
*p++ = 0xE0 | (color.W < 31 ? color.W : 31); // upper three bits are always 111
|
*p++ = 0xE0 | (color.W < 31 ? color.W : 31); // upper three bits are always 111
|
||||||
*p++ = color.B;
|
*p++ = color[V_IC_1];
|
||||||
*p++ = color.G;
|
*p++ = color[V_IC_2];
|
||||||
*p = color.R;
|
*p = color[V_IC_3];
|
||||||
}
|
}
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
||||||
@@ -48,9 +47,9 @@ public:
|
|||||||
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
||||||
|
|
||||||
color.W = (*p++) & 0x1F; // mask out upper three bits
|
color.W = (*p++) & 0x1F; // mask out upper three bits
|
||||||
color.B = *p++;
|
color[V_IC_1] = *p++;
|
||||||
color.G = *p++;
|
color[V_IC_2] = *p++;
|
||||||
color.R = *p;
|
color[V_IC_3] = *p;
|
||||||
|
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
@@ -61,9 +60,9 @@ public:
|
|||||||
const uint8_t* p = getPixelAddress((const uint8_t*)pPixels, indexPixel);
|
const uint8_t* p = getPixelAddress((const uint8_t*)pPixels, indexPixel);
|
||||||
|
|
||||||
color.W = pgm_read_byte(p++) & 0x1F; // mask out upper three bits
|
color.W = pgm_read_byte(p++) & 0x1F; // mask out upper three bits
|
||||||
color.B = pgm_read_byte(p++);
|
color[V_IC_1] = pgm_read_byte(p++);
|
||||||
color.G = pgm_read_byte(p++);
|
color[V_IC_2] = pgm_read_byte(p++);
|
||||||
color.R = pgm_read_byte(p);
|
color[V_IC_3] = pgm_read_byte(p);
|
||||||
|
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
@@ -1,70 +0,0 @@
|
|||||||
/*-------------------------------------------------------------------------
|
|
||||||
DotStarLbrgFeature provides feature classes to describe color order and
|
|
||||||
color depth for NeoPixelBus template class when used with DotStars
|
|
||||||
|
|
||||||
Written by Michael C. Miller.
|
|
||||||
|
|
||||||
I invest time and resources providing this open source code,
|
|
||||||
please support me by dontating (see https://github.com/Makuna/NeoPixelBus)
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------
|
|
||||||
This file is part of the Makuna/NeoPixelBus library.
|
|
||||||
|
|
||||||
NeoPixelBus is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as
|
|
||||||
published by the Free Software Foundation, either version 3 of
|
|
||||||
the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
NeoPixelBus is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with NeoPixel. If not, see
|
|
||||||
<http://www.gnu.org/licenses/>.
|
|
||||||
-------------------------------------------------------------------------*/
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
class DotStarLbrgFeature :
|
|
||||||
public NeoByteElements<4, RgbwColor, uint32_t>,
|
|
||||||
public NeoElementsNoSettings
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
|
||||||
{
|
|
||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
|
|
||||||
*p++ = 0xE0 | (color.W < 31 ? color.W : 31); // upper three bits are always 111
|
|
||||||
*p++ = color.B;
|
|
||||||
*p++ = color.R;
|
|
||||||
*p = color.G;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
|
|
||||||
color.W = (*p++) & 0x1F; // mask out upper three bits
|
|
||||||
color.B = *p++;
|
|
||||||
color.R = *p++;
|
|
||||||
color.G = *p;
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor_P(PGM_VOID_P pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint8_t* p = getPixelAddress((const uint8_t*)pPixels, indexPixel);
|
|
||||||
|
|
||||||
color.W = pgm_read_byte(p++) & 0x1F; // mask out upper three bits
|
|
||||||
color.B = pgm_read_byte(p++);
|
|
||||||
color.R = pgm_read_byte(p++);
|
|
||||||
color.G = pgm_read_byte(p);
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
@@ -1,71 +0,0 @@
|
|||||||
/*-------------------------------------------------------------------------
|
|
||||||
DotStarLgbrFeature provides feature classes to describe color order and
|
|
||||||
color depth for NeoPixelBus template class when used with DotStars
|
|
||||||
|
|
||||||
Written by Michael C. Miller.
|
|
||||||
|
|
||||||
I invest time and resources providing this open source code,
|
|
||||||
please support me by dontating (see https://github.com/Makuna/NeoPixelBus)
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------
|
|
||||||
This file is part of the Makuna/NeoPixelBus library.
|
|
||||||
|
|
||||||
NeoPixelBus is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as
|
|
||||||
published by the Free Software Foundation, either version 3 of
|
|
||||||
the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
NeoPixelBus is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with NeoPixel. If not, see
|
|
||||||
<http://www.gnu.org/licenses/>.
|
|
||||||
-------------------------------------------------------------------------*/
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
|
|
||||||
class DotStarLgbrFeature :
|
|
||||||
public NeoByteElements<4, RgbwColor, uint32_t>,
|
|
||||||
public NeoElementsNoSettings
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
|
||||||
{
|
|
||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
|
|
||||||
*p++ = 0xE0 | (color.W < 31 ? color.W : 31); // upper three bits are always 111
|
|
||||||
*p++ = color.G;
|
|
||||||
*p++ = color.B;
|
|
||||||
*p = color.R;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
|
|
||||||
color.W = (*p++) & 0x1F; // mask out upper three bits
|
|
||||||
color.G = *p++;
|
|
||||||
color.B = *p++;
|
|
||||||
color.R = *p;
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor_P(PGM_VOID_P pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint8_t* p = getPixelAddress((const uint8_t*)pPixels, indexPixel);
|
|
||||||
|
|
||||||
color.W = pgm_read_byte(p++) & 0x1F; // mask out upper three bits
|
|
||||||
color.G = pgm_read_byte(p++);
|
|
||||||
color.B = pgm_read_byte(p++);
|
|
||||||
color.R = pgm_read_byte(p);
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
@@ -1,71 +0,0 @@
|
|||||||
/*-------------------------------------------------------------------------
|
|
||||||
DotStarLgrbFeature provides feature classes to describe color order and
|
|
||||||
color depth for NeoPixelBus template class when used with DotStars
|
|
||||||
|
|
||||||
Written by Michael C. Miller.
|
|
||||||
|
|
||||||
I invest time and resources providing this open source code,
|
|
||||||
please support me by dontating (see https://github.com/Makuna/NeoPixelBus)
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------
|
|
||||||
This file is part of the Makuna/NeoPixelBus library.
|
|
||||||
|
|
||||||
NeoPixelBus is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as
|
|
||||||
published by the Free Software Foundation, either version 3 of
|
|
||||||
the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
NeoPixelBus is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with NeoPixel. If not, see
|
|
||||||
<http://www.gnu.org/licenses/>.
|
|
||||||
-------------------------------------------------------------------------*/
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
|
|
||||||
class DotStarLgrbFeature :
|
|
||||||
public NeoByteElements<4, RgbwColor, uint32_t>,
|
|
||||||
public NeoElementsNoSettings
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
|
||||||
{
|
|
||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
|
|
||||||
*p++ = 0xE0 | (color.W < 31 ? color.W : 31); // upper three bits are always 111
|
|
||||||
*p++ = color.G;
|
|
||||||
*p++ = color.R;
|
|
||||||
*p = color.B;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
|
|
||||||
color.W = (*p++) & 0x1F; // mask out upper three bits
|
|
||||||
color.G = *p++;
|
|
||||||
color.R = *p++;
|
|
||||||
color.B = *p;
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor_P(PGM_VOID_P pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint8_t* p = getPixelAddress((const uint8_t*)pPixels, indexPixel);
|
|
||||||
|
|
||||||
color.W = pgm_read_byte(p++) & 0x1F; // mask out upper three bits
|
|
||||||
color.G = pgm_read_byte(p++);
|
|
||||||
color.R = pgm_read_byte(p++);
|
|
||||||
color.B = pgm_read_byte(p);
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
@@ -1,70 +0,0 @@
|
|||||||
/*-------------------------------------------------------------------------
|
|
||||||
DotStarLrbgFeature provides feature classes to describe color order and
|
|
||||||
color depth for NeoPixelBus template class when used with DotStars
|
|
||||||
|
|
||||||
Written by Michael C. Miller.
|
|
||||||
|
|
||||||
I invest time and resources providing this open source code,
|
|
||||||
please support me by dontating (see https://github.com/Makuna/NeoPixelBus)
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------
|
|
||||||
This file is part of the Makuna/NeoPixelBus library.
|
|
||||||
|
|
||||||
NeoPixelBus is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as
|
|
||||||
published by the Free Software Foundation, either version 3 of
|
|
||||||
the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
NeoPixelBus is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with NeoPixel. If not, see
|
|
||||||
<http://www.gnu.org/licenses/>.
|
|
||||||
-------------------------------------------------------------------------*/
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
class DotStarLrbgFeature :
|
|
||||||
public NeoByteElements<4, RgbwColor, uint32_t>,
|
|
||||||
public NeoElementsNoSettings
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
|
||||||
{
|
|
||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
|
|
||||||
*p++ = 0xE0 | (color.W < 31 ? color.W : 31); // upper three bits are always 111
|
|
||||||
*p++ = color.R;
|
|
||||||
*p++ = color.B;
|
|
||||||
*p = color.G;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
|
|
||||||
color.W = (*p++) & 0x1F; // mask out upper three bits
|
|
||||||
color.R = *p++;
|
|
||||||
color.B = *p++;
|
|
||||||
color.G = *p;
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor_P(PGM_VOID_P pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint8_t* p = getPixelAddress((const uint8_t*)pPixels, indexPixel);
|
|
||||||
|
|
||||||
color.W = pgm_read_byte(p++) & 0x1F; // mask out upper three bits
|
|
||||||
color.R = pgm_read_byte(p++);
|
|
||||||
color.B = pgm_read_byte(p++);
|
|
||||||
color.G = pgm_read_byte(p);
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
@@ -27,44 +27,39 @@ License along with NeoPixel. If not, see
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class DotStarLrgbFeature :
|
class DotStarLrgbFeature :
|
||||||
public NeoByteElements<4, RgbwColor, uint32_t>,
|
public DotStarL4Feature<ColorIndexR, ColorIndexG, ColorIndexB>,
|
||||||
public NeoElementsNoSettings
|
public NeoElementsNoSettings
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
|
||||||
{
|
|
||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
|
|
||||||
*p++ = 0xE0 | (color.W < 31 ? color.W : 31); // upper three bits are always 111
|
|
||||||
*p++ = color.R;
|
|
||||||
*p++ = color.G;
|
|
||||||
*p = color.B;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
|
|
||||||
color.W = (*p++) & 0x1F; // mask out upper three bits
|
|
||||||
color.R = *p++;
|
|
||||||
color.G = *p++;
|
|
||||||
color.B = *p;
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor_P(PGM_VOID_P pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint8_t* p = getPixelAddress((const uint8_t*)pPixels, indexPixel);
|
|
||||||
|
|
||||||
color.W = pgm_read_byte(p++) & 0x1F; // mask out upper three bits
|
|
||||||
color.R = pgm_read_byte(p++);
|
|
||||||
color.G = pgm_read_byte(p++);
|
|
||||||
color.B = pgm_read_byte(p);
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class DotStarLrbgFeature :
|
||||||
|
public DotStarL4Feature<ColorIndexR, ColorIndexB, ColorIndexG>,
|
||||||
|
public NeoElementsNoSettings
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class DotStarLgrbFeature :
|
||||||
|
public DotStarL4Feature<ColorIndexG, ColorIndexR, ColorIndexB>,
|
||||||
|
public NeoElementsNoSettings
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
class DotStarLgbrFeature :
|
||||||
|
public DotStarL4Feature<ColorIndexG, ColorIndexB, ColorIndexR>,
|
||||||
|
public NeoElementsNoSettings
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class DotStarLbrgFeature :
|
||||||
|
public DotStarL4Feature<ColorIndexB, ColorIndexR, ColorIndexG>,
|
||||||
|
public NeoElementsNoSettings
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
class DotStarLbgrFeature :
|
||||||
|
public DotStarL4Feature<ColorIndexB, ColorIndexG, ColorIndexR>,
|
||||||
|
public NeoElementsNoSettings
|
||||||
|
{
|
||||||
|
};
|
@@ -1,70 +0,0 @@
|
|||||||
/*-------------------------------------------------------------------------
|
|
||||||
DotStarRgbFeature provides feature classes to describe color order and
|
|
||||||
color depth for NeoPixelBus template class when used with DotStars
|
|
||||||
|
|
||||||
Written by Michael C. Miller.
|
|
||||||
|
|
||||||
I invest time and resources providing this open source code,
|
|
||||||
please support me by dontating (see https://github.com/Makuna/NeoPixelBus)
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------
|
|
||||||
This file is part of the Makuna/NeoPixelBus library.
|
|
||||||
|
|
||||||
NeoPixelBus is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as
|
|
||||||
published by the Free Software Foundation, either version 3 of
|
|
||||||
the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
NeoPixelBus is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with NeoPixel. If not, see
|
|
||||||
<http://www.gnu.org/licenses/>.
|
|
||||||
-------------------------------------------------------------------------*/
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
class DotStarRgbFeature :
|
|
||||||
public NeoByteElements<4, RgbColor, uint32_t>,
|
|
||||||
public NeoElementsNoSettings
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
|
||||||
{
|
|
||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
|
|
||||||
*p++ = 0xff; // upper three bits are always 111 and brightness at max
|
|
||||||
*p++ = color.R;
|
|
||||||
*p++ = color.G;
|
|
||||||
*p = color.B;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
|
|
||||||
p++; // ignore the first byte
|
|
||||||
color.R = *p++;
|
|
||||||
color.G = *p++;
|
|
||||||
color.B = *p;
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor_P(PGM_VOID_P pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint8_t* p = getPixelAddress((const uint8_t*)pPixels, indexPixel);
|
|
||||||
|
|
||||||
pgm_read_byte(p++); // ignore the first byte
|
|
||||||
color.R = pgm_read_byte(p++);
|
|
||||||
color.G = pgm_read_byte(p++);
|
|
||||||
color.B = pgm_read_byte(p);
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
@@ -26,45 +26,40 @@ License along with NeoPixel. If not, see
|
|||||||
-------------------------------------------------------------------------*/
|
-------------------------------------------------------------------------*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class DotStarRbgFeature :
|
class DotStarRgbFeature :
|
||||||
public NeoByteElements<4, RgbColor, uint32_t>,
|
public DotStarX4Feature<ColorIndexR, ColorIndexG, ColorIndexB>,
|
||||||
|
public NeoElementsNoSettings
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
class DotStarRbgFeature :
|
||||||
|
public DotStarX4Feature<ColorIndexR, ColorIndexB, ColorIndexG>,
|
||||||
|
public NeoElementsNoSettings
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class DotStarGbrFeature :
|
||||||
|
public DotStarX4Feature<ColorIndexG, ColorIndexB, ColorIndexR>,
|
||||||
|
public NeoElementsNoSettings
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
class DotStarGrbFeature :
|
||||||
|
public DotStarX4Feature<ColorIndexG, ColorIndexR, ColorIndexB>,
|
||||||
|
public NeoElementsNoSettings
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class DotStarBrgFeature :
|
||||||
|
public DotStarX4Feature<ColorIndexB, ColorIndexR, ColorIndexG>,
|
||||||
|
public NeoElementsNoSettings
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
class DotStarBgrFeature :
|
||||||
|
public DotStarX4Feature<ColorIndexB, ColorIndexG, ColorIndexR>,
|
||||||
public NeoElementsNoSettings
|
public NeoElementsNoSettings
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
|
||||||
{
|
|
||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
|
|
||||||
*p++ = 0xff; // upper three bits are always 111 and brightness at max
|
|
||||||
*p++ = color.R;
|
|
||||||
*p++ = color.B;
|
|
||||||
*p = color.G;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
|
|
||||||
p++; // ignore the first byte
|
|
||||||
color.R = *p++;
|
|
||||||
color.B = *p++;
|
|
||||||
color.G = *p;
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor_P(PGM_VOID_P pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint8_t* p = getPixelAddress((const uint8_t*)pPixels, indexPixel);
|
|
||||||
|
|
||||||
pgm_read_byte(p++); // ignore the first byte
|
|
||||||
color.R = pgm_read_byte(p++);
|
|
||||||
color.B = pgm_read_byte(p++);
|
|
||||||
color.G = pgm_read_byte(p);
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
@@ -1,6 +1,6 @@
|
|||||||
/*-------------------------------------------------------------------------
|
/*-------------------------------------------------------------------------
|
||||||
DotStarBgrFeature provides feature classes to describe color order and
|
DotStarX4Feature provides feature base class to describe color order for
|
||||||
color depth for NeoPixelBus template class when used with DotStars
|
3 color but 4 byte features when used with DotStars
|
||||||
|
|
||||||
Written by Michael C. Miller.
|
Written by Michael C. Miller.
|
||||||
|
|
||||||
@@ -26,10 +26,9 @@ License along with NeoPixel. If not, see
|
|||||||
-------------------------------------------------------------------------*/
|
-------------------------------------------------------------------------*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
template <uint8_t V_IC_1, uint8_t V_IC_2, uint8_t V_IC_3>
|
||||||
class DotStarBgrFeature :
|
class DotStarX4Feature :
|
||||||
public NeoByteElements<4, RgbColor, uint32_t>,
|
public NeoByteElements<4, RgbColor, uint32_t>
|
||||||
public NeoElementsNoSettings
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
||||||
@@ -37,9 +36,9 @@ public:
|
|||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
||||||
|
|
||||||
*p++ = 0xff; // upper three bits are always 111 and brightness at max
|
*p++ = 0xff; // upper three bits are always 111 and brightness at max
|
||||||
*p++ = color.B;
|
*p++ = color[V_IC_1];
|
||||||
*p++ = color.G;
|
*p++ = color[V_IC_2];
|
||||||
*p = color.R;
|
*p = color[V_IC_3];
|
||||||
}
|
}
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
||||||
@@ -48,9 +47,9 @@ public:
|
|||||||
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
||||||
|
|
||||||
p++; // ignore the first byte
|
p++; // ignore the first byte
|
||||||
color.B = *p++;
|
color[V_IC_1] = *p++;
|
||||||
color.G = *p++;
|
color[V_IC_2] = *p++;
|
||||||
color.R = *p;
|
color[V_IC_3] = *p;
|
||||||
|
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
@@ -61,9 +60,9 @@ public:
|
|||||||
const uint8_t* p = getPixelAddress((const uint8_t*)pPixels, indexPixel);
|
const uint8_t* p = getPixelAddress((const uint8_t*)pPixels, indexPixel);
|
||||||
|
|
||||||
pgm_read_byte(p++); // ignore the first byte
|
pgm_read_byte(p++); // ignore the first byte
|
||||||
color.B = pgm_read_byte(p++);
|
color[V_IC_1] = pgm_read_byte(p++);
|
||||||
color.G = pgm_read_byte(p++);
|
color[V_IC_2] = pgm_read_byte(p++);
|
||||||
color.R = pgm_read_byte(p);
|
color[V_IC_3] = pgm_read_byte(p);
|
||||||
|
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
@@ -1,75 +0,0 @@
|
|||||||
/*-------------------------------------------------------------------------
|
|
||||||
Lpd6803BrgFeature provides feature class to describe color order and
|
|
||||||
color depth for NeoPixelBus template class when used with DotStar like chips
|
|
||||||
|
|
||||||
Written by Michael C. Miller.
|
|
||||||
|
|
||||||
I invest time and resources providing this open source code,
|
|
||||||
please support me by dontating (see https://github.com/Makuna/NeoPixelBus)
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------
|
|
||||||
This file is part of the Makuna/NeoPixelBus library.
|
|
||||||
|
|
||||||
NeoPixelBus is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as
|
|
||||||
published by the Free Software Foundation, either version 3 of
|
|
||||||
the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
NeoPixelBus is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with NeoPixel. If not, see
|
|
||||||
<http://www.gnu.org/licenses/>.
|
|
||||||
-------------------------------------------------------------------------*/
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
|
|
||||||
class Lpd6803BrgFeature :
|
|
||||||
public NeoByteElements<2, RgbColor, uint16_t>,
|
|
||||||
public NeoElementsNoSettings,
|
|
||||||
public Neo2Byte555Elements
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
|
||||||
{
|
|
||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
uint16_t color555;
|
|
||||||
|
|
||||||
encodePixel(color.B, color.R, color.G, &color555);
|
|
||||||
*p++ = color555 >> 8;
|
|
||||||
*p = color555 & 0xff;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
|
|
||||||
uint16_t color555;
|
|
||||||
|
|
||||||
color555 = ((*p++) << 8);
|
|
||||||
color555 |= (*p);
|
|
||||||
|
|
||||||
decodePixel(color555, &color.B, &color.R, &color.G);
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor_P(PGM_VOID_P pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint8_t* p = getPixelAddress((const uint8_t*)pPixels, indexPixel);
|
|
||||||
|
|
||||||
uint16_t color555;
|
|
||||||
|
|
||||||
color555 = (pgm_read_byte(p++) << 8);
|
|
||||||
color555 |= pgm_read_byte(p);
|
|
||||||
|
|
||||||
decodePixel(color555, &color.B, &color.R, &color.G);
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
};
|
|
@@ -1,75 +0,0 @@
|
|||||||
/*-------------------------------------------------------------------------
|
|
||||||
Lpd6803GrbFeature provides feature class to describe color order and
|
|
||||||
color depth for NeoPixelBus template class when used with DotStar like chips
|
|
||||||
|
|
||||||
Written by Michael C. Miller.
|
|
||||||
|
|
||||||
I invest time and resources providing this open source code,
|
|
||||||
please support me by dontating (see https://github.com/Makuna/NeoPixelBus)
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------
|
|
||||||
This file is part of the Makuna/NeoPixelBus library.
|
|
||||||
|
|
||||||
NeoPixelBus is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as
|
|
||||||
published by the Free Software Foundation, either version 3 of
|
|
||||||
the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
NeoPixelBus is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with NeoPixel. If not, see
|
|
||||||
<http://www.gnu.org/licenses/>.
|
|
||||||
-------------------------------------------------------------------------*/
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
|
|
||||||
class Lpd6803GrbFeature :
|
|
||||||
public NeoByteElements<2, RgbColor, uint16_t>,
|
|
||||||
public NeoElementsNoSettings,
|
|
||||||
public Neo2Byte555Elements
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
|
||||||
{
|
|
||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
uint16_t color555;
|
|
||||||
|
|
||||||
encodePixel(color.G, color.R, color.B, &color555);
|
|
||||||
*p++ = color555 >> 8;
|
|
||||||
*p = color555 & 0xff;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
|
|
||||||
uint16_t color555;
|
|
||||||
|
|
||||||
color555 = ((*p++) << 8);
|
|
||||||
color555 |= (*p);
|
|
||||||
|
|
||||||
decodePixel(color555, &color.G, &color.R, &color.B);
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor_P(PGM_VOID_P pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint8_t* p = getPixelAddress((const uint8_t*)pPixels, indexPixel);
|
|
||||||
|
|
||||||
uint16_t color555;
|
|
||||||
|
|
||||||
color555 = (pgm_read_byte(p++) << 8);
|
|
||||||
color555 |= pgm_read_byte(p);
|
|
||||||
|
|
||||||
decodePixel(color555, &color.G, &color.R, &color.B);
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
};
|
|
@@ -1,76 +0,0 @@
|
|||||||
/*-------------------------------------------------------------------------
|
|
||||||
Lpd6803RgbFeature provides feature class to describe color order and
|
|
||||||
color depth for NeoPixelBus template class when used with DotStar like chips
|
|
||||||
|
|
||||||
Written by Michael C. Miller.
|
|
||||||
|
|
||||||
I invest time and resources providing this open source code,
|
|
||||||
please support me by dontating (see https://github.com/Makuna/NeoPixelBus)
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------
|
|
||||||
This file is part of the Makuna/NeoPixelBus library.
|
|
||||||
|
|
||||||
NeoPixelBus is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as
|
|
||||||
published by the Free Software Foundation, either version 3 of
|
|
||||||
the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
NeoPixelBus is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with NeoPixel. If not, see
|
|
||||||
<http://www.gnu.org/licenses/>.
|
|
||||||
-------------------------------------------------------------------------*/
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
class Lpd6803RgbFeature :
|
|
||||||
public NeoByteElements<2, RgbColor, uint16_t>,
|
|
||||||
public NeoElementsNoSettings,
|
|
||||||
public Neo2Byte555Elements
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
|
||||||
{
|
|
||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
uint16_t color555;
|
|
||||||
|
|
||||||
encodePixel(color.R, color.G, color.B, &color555);
|
|
||||||
*p++ = color555 >> 8;
|
|
||||||
*p = color555 & 0xff;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
|
|
||||||
uint16_t color555;
|
|
||||||
|
|
||||||
color555 = ((*p++) << 8);
|
|
||||||
color555 |= (*p);
|
|
||||||
|
|
||||||
decodePixel(color555, &color.R, &color.G, &color.B);
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor_P(PGM_VOID_P pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint8_t* p = getPixelAddress((const uint8_t*)pPixels, indexPixel);
|
|
||||||
|
|
||||||
uint16_t color555;
|
|
||||||
|
|
||||||
color555 = (pgm_read_byte(p++) << 8);
|
|
||||||
color555 |= pgm_read_byte(p);
|
|
||||||
|
|
||||||
decodePixel(color555, &color.R, &color.G, &color.B);
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
@@ -1,5 +1,5 @@
|
|||||||
/*-------------------------------------------------------------------------
|
/*-------------------------------------------------------------------------
|
||||||
Lpd8806GrbFeature provides feature classes to describe color order and
|
Lpd6803RgbFeature provides feature class to describe color order and
|
||||||
color depth for NeoPixelBus template class when used with DotStar like chips
|
color depth for NeoPixelBus template class when used with DotStar like chips
|
||||||
|
|
||||||
Written by Michael C. Miller.
|
Written by Michael C. Miller.
|
||||||
@@ -26,42 +26,27 @@ License along with NeoPixel. If not, see
|
|||||||
-------------------------------------------------------------------------*/
|
-------------------------------------------------------------------------*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class Lpd8806GrbFeature :
|
class Lpd6803RgbFeature :
|
||||||
public NeoByteElements<3, RgbColor, uint8_t>,
|
public Neo2Byte555Feature<ColorIndexR, ColorIndexG, ColorIndexB>,
|
||||||
|
public NeoElementsNoSettings
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class Lpd6803GrbFeature :
|
||||||
|
public Neo2Byte555Feature<ColorIndexG, ColorIndexR, ColorIndexB>,
|
||||||
|
public NeoElementsNoSettings
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
class Lpd6803GbrFeature :
|
||||||
|
public Neo2Byte555Feature<ColorIndexG, ColorIndexB, ColorIndexR>,
|
||||||
|
public NeoElementsNoSettings
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
class Lpd6803BrgFeature :
|
||||||
|
public Neo2Byte555Feature<ColorIndexB, ColorIndexR, ColorIndexG>,
|
||||||
public NeoElementsNoSettings
|
public NeoElementsNoSettings
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
|
||||||
{
|
|
||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
|
|
||||||
*p++ = (color.G >> 1) | 0x80;
|
|
||||||
*p++ = (color.R >> 1) | 0x80;
|
|
||||||
*p = (color.B >> 1) | 0x80;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
|
|
||||||
color.G = (*p++) << 1;
|
|
||||||
color.R = (*p++) << 1;
|
|
||||||
color.B = (*p) << 1;
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor_P(PGM_VOID_P pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint8_t* p = getPixelAddress((const uint8_t*)pPixels, indexPixel);
|
|
||||||
|
|
||||||
color.G = (pgm_read_byte(p++)) << 1;
|
|
||||||
color.R = (pgm_read_byte(p++)) << 1;
|
|
||||||
color.B = (pgm_read_byte(p)) << 1;
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
@@ -1,68 +0,0 @@
|
|||||||
/*-------------------------------------------------------------------------
|
|
||||||
Lpd8806BrgFeature provides feature classes to describe color order and
|
|
||||||
color depth for NeoPixelBus template class when used with DotStar like chips
|
|
||||||
|
|
||||||
Written by Michael C. Miller.
|
|
||||||
|
|
||||||
I invest time and resources providing this open source code,
|
|
||||||
please support me by dontating (see https://github.com/Makuna/NeoPixelBus)
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------
|
|
||||||
This file is part of the Makuna/NeoPixelBus library.
|
|
||||||
|
|
||||||
NeoPixelBus is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as
|
|
||||||
published by the Free Software Foundation, either version 3 of
|
|
||||||
the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
NeoPixelBus is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with NeoPixel. If not, see
|
|
||||||
<http://www.gnu.org/licenses/>.
|
|
||||||
-------------------------------------------------------------------------*/
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
class Lpd8806BrgFeature :
|
|
||||||
public NeoByteElements<3, RgbColor, uint8_t>,
|
|
||||||
public NeoElementsNoSettings
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
|
||||||
{
|
|
||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
|
|
||||||
*p++ = (color.B >> 1) | 0x80;
|
|
||||||
*p++ = (color.R >> 1) | 0x80;
|
|
||||||
*p = (color.G >> 1) | 0x80;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
|
|
||||||
color.B = (*p++) << 1;
|
|
||||||
color.R = (*p++) << 1;
|
|
||||||
color.G = (*p) << 1;
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor_P(PGM_VOID_P pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint8_t* p = getPixelAddress((const uint8_t*)pPixels, indexPixel);
|
|
||||||
|
|
||||||
color.B = (pgm_read_byte(p++)) << 1;
|
|
||||||
color.R = (pgm_read_byte(p++)) << 1;
|
|
||||||
color.G = (pgm_read_byte(p)) << 1;
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
@@ -1,6 +1,6 @@
|
|||||||
/*-------------------------------------------------------------------------
|
/*-------------------------------------------------------------------------
|
||||||
Neo2Byte555Elements provides feature base classes to describe color elements
|
Lpd8806RgbFeatures provides feature classes to describe color order and
|
||||||
with 555 encoding for NeoPixelBus Color Feature template classes
|
color depth for NeoPixelBus template class when used with DotStar like chips
|
||||||
|
|
||||||
Written by Michael C. Miller.
|
Written by Michael C. Miller.
|
||||||
|
|
||||||
@@ -25,22 +25,15 @@ License along with NeoPixel. If not, see
|
|||||||
<http://www.gnu.org/licenses/>.
|
<http://www.gnu.org/licenses/>.
|
||||||
-------------------------------------------------------------------------*/
|
-------------------------------------------------------------------------*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class Neo2Byte555Elements
|
|
||||||
{
|
|
||||||
protected:
|
|
||||||
static void encodePixel(uint8_t c1, uint8_t c2, uint8_t c3, uint16_t* color555)
|
|
||||||
{
|
|
||||||
*color555 = (0x8000 |
|
|
||||||
((c1 & 0xf8) << 7) |
|
|
||||||
((c2 & 0xf8) << 2) |
|
|
||||||
((c3 & 0xf8) >> 3));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void decodePixel(uint16_t color555, uint8_t* c1, uint8_t* c2, uint8_t* c3)
|
class Lpd8806GrbFeature :
|
||||||
{
|
public Neo3Byte777Feature<ColorIndexG, ColorIndexR, ColorIndexB>,
|
||||||
*c1 = (color555 >> 7) & 0xf8;
|
public NeoElementsNoSettings
|
||||||
*c2 = (color555 >> 2) & 0xf8;
|
{
|
||||||
*c3 = (color555 << 3) & 0xf8;
|
};
|
||||||
}
|
|
||||||
|
class Lpd8806BrgFeature :
|
||||||
|
public Neo3Byte777Feature<ColorIndexB, ColorIndexR, ColorIndexG>,
|
||||||
|
public NeoElementsNoSettings
|
||||||
|
{
|
||||||
};
|
};
|
@@ -1,6 +1,6 @@
|
|||||||
/*-------------------------------------------------------------------------
|
/*-------------------------------------------------------------------------
|
||||||
Lpd6803GbrFeature provides feature class to describe color order and
|
Neo2Byte555Feature provides feature base classes to describe color elements
|
||||||
color depth for NeoPixelBus template class when used with DotStar like chips
|
with 555 encoding for NeoPixelBus Color Feature template classes
|
||||||
|
|
||||||
Written by Michael C. Miller.
|
Written by Michael C. Miller.
|
||||||
|
|
||||||
@@ -25,12 +25,10 @@ License along with NeoPixel. If not, see
|
|||||||
<http://www.gnu.org/licenses/>.
|
<http://www.gnu.org/licenses/>.
|
||||||
-------------------------------------------------------------------------*/
|
-------------------------------------------------------------------------*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
template <uint8_t V_IC_1, uint8_t V_IC_2, uint8_t V_IC_3>
|
||||||
class Lpd6803GbrFeature :
|
class Neo2Byte555Feature :
|
||||||
public NeoByteElements<2, RgbColor, uint16_t>,
|
public NeoByteElements<2, RgbColor, uint16_t>
|
||||||
public NeoElementsNoSettings,
|
|
||||||
public Neo2Byte555Elements
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
||||||
@@ -38,7 +36,7 @@ public:
|
|||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
||||||
uint16_t color555;
|
uint16_t color555;
|
||||||
|
|
||||||
encodePixel(color.G, color.B, color.R, &color555);
|
encodePixel(&color555, color);
|
||||||
*p++ = color555 >> 8;
|
*p++ = color555 >> 8;
|
||||||
*p = color555 & 0xff;
|
*p = color555 & 0xff;
|
||||||
}
|
}
|
||||||
@@ -53,7 +51,7 @@ public:
|
|||||||
color555 = ((*p++) << 8);
|
color555 = ((*p++) << 8);
|
||||||
color555 |= (*p);
|
color555 |= (*p);
|
||||||
|
|
||||||
decodePixel(color555, &color.G, &color.B, &color.R);
|
decodePixel(&color, color555);
|
||||||
|
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
@@ -68,9 +66,24 @@ public:
|
|||||||
color555 = (pgm_read_byte(p++) << 8);
|
color555 = (pgm_read_byte(p++) << 8);
|
||||||
color555 |= pgm_read_byte(p);
|
color555 |= pgm_read_byte(p);
|
||||||
|
|
||||||
decodePixel(color555, &color.G, &color.B, &color.R);
|
decodePixel(&color, color555);
|
||||||
|
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static void encodePixel(uint16_t* color555, const ColorObject& color)
|
||||||
|
{
|
||||||
|
*color555 = (0x8000 |
|
||||||
|
((color[V_IC_1] & 0xf8) << 7) |
|
||||||
|
((color[V_IC_2] & 0xf8) << 2) |
|
||||||
|
((color[V_IC_3] & 0xf8) >> 3));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void decodePixel(ColorObject* color, uint16_t color555)
|
||||||
|
{
|
||||||
|
(*color)[V_IC_2] = (color555 >> 2) & 0xf8;
|
||||||
|
(*color)[V_IC_3] = (color555 << 3) & 0xf8;
|
||||||
|
(*color)[V_IC_1] = (color555 >> 7) & 0xf8;
|
||||||
|
}
|
||||||
|
};
|
@@ -1,6 +1,6 @@
|
|||||||
/*-------------------------------------------------------------------------
|
/*-------------------------------------------------------------------------
|
||||||
NeoGrbFeature provides feature classes to describe color order and
|
Neo3Byte777Feature provides feature base class to describe color order for
|
||||||
color depth for NeoPixelBus template class
|
3 byte features that only support 7 bits per element
|
||||||
|
|
||||||
Written by Michael C. Miller.
|
Written by Michael C. Miller.
|
||||||
|
|
||||||
@@ -26,18 +26,18 @@ License along with NeoPixel. If not, see
|
|||||||
-------------------------------------------------------------------------*/
|
-------------------------------------------------------------------------*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class NeoGrbFeature :
|
template <uint8_t V_IC_1, uint8_t V_IC_2, uint8_t V_IC_3>
|
||||||
public NeoByteElements<3, RgbColor, uint8_t>,
|
class Neo3Byte777Feature :
|
||||||
public NeoElementsNoSettings
|
public NeoByteElements<3, RgbColor, uint8_t>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
||||||
{
|
{
|
||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
||||||
|
|
||||||
*p++ = color.G;
|
*p++ = (color[V_IC_1] >> 1) | 0x80;
|
||||||
*p++ = color.R;
|
*p++ = (color[V_IC_2] >> 1) | 0x80;
|
||||||
*p = color.B;
|
*p = (color[V_IC_3] >> 1) | 0x80;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
||||||
@@ -45,21 +45,22 @@ public:
|
|||||||
ColorObject color;
|
ColorObject color;
|
||||||
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
||||||
|
|
||||||
color.G = *p++;
|
color[V_IC_1] = (*p++) << 1;
|
||||||
color.R = *p++;
|
color[V_IC_2] = (*p++) << 1;
|
||||||
color.B = *p;
|
color[V_IC_3] = (*p) << 1;
|
||||||
|
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor_P(PGM_VOID_P pPixels, uint16_t indexPixel)
|
static ColorObject retrievePixelColor_P(PGM_VOID_P pPixels, uint16_t indexPixel)
|
||||||
{
|
{
|
||||||
ColorObject color;
|
ColorObject color;
|
||||||
const uint8_t* p = getPixelAddress(reinterpret_cast<const uint8_t*>(pPixels), indexPixel);
|
const uint8_t* p = getPixelAddress(reinterpret_cast<const uint8_t*>(pPixels), indexPixel);
|
||||||
|
|
||||||
color.G = pgm_read_byte(p++);
|
color[V_IC_1] = (pgm_read_byte(p++)) << 1;
|
||||||
color.R = pgm_read_byte(p++);
|
color[V_IC_2] = (pgm_read_byte(p++)) << 1;
|
||||||
color.B = pgm_read_byte(p);
|
color[V_IC_3] = (pgm_read_byte(p)) << 1;
|
||||||
|
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
@@ -1,6 +1,6 @@
|
|||||||
/*-------------------------------------------------------------------------
|
/*-------------------------------------------------------------------------
|
||||||
NeoRbgFeature provides feature classes to describe color order and
|
Neo3ByteFeature provides feature base class to describe color order for
|
||||||
color depth for NeoPixelBus template class
|
3 byte features
|
||||||
|
|
||||||
Written by Michael C. Miller.
|
Written by Michael C. Miller.
|
||||||
|
|
||||||
@@ -26,19 +26,18 @@ License along with NeoPixel. If not, see
|
|||||||
-------------------------------------------------------------------------*/
|
-------------------------------------------------------------------------*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
template <uint8_t V_IC_1, uint8_t V_IC_2, uint8_t V_IC_3>
|
||||||
class NeoRbgFeature :
|
class Neo3ByteFeature :
|
||||||
public NeoByteElements<3, RgbColor, uint8_t>,
|
public NeoByteElements<3, RgbColor, uint8_t>
|
||||||
public NeoElementsNoSettings
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
||||||
{
|
{
|
||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
||||||
|
|
||||||
*p++ = color.R;
|
*p++ = color[V_IC_1];
|
||||||
*p++ = color.B;
|
*p++ = color[V_IC_2];
|
||||||
*p = color.G;
|
*p = color[V_IC_3];
|
||||||
}
|
}
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
||||||
@@ -46,9 +45,9 @@ public:
|
|||||||
ColorObject color;
|
ColorObject color;
|
||||||
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
||||||
|
|
||||||
color.R = *p++;
|
color[V_IC_1] = *p++;
|
||||||
color.B = *p++;
|
color[V_IC_2] = *p++;
|
||||||
color.G = *p;
|
color[V_IC_3] = *p;
|
||||||
|
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
@@ -59,9 +58,9 @@ public:
|
|||||||
ColorObject color;
|
ColorObject color;
|
||||||
const uint8_t* p = getPixelAddress(reinterpret_cast<const uint8_t*>(pPixels), indexPixel);
|
const uint8_t* p = getPixelAddress(reinterpret_cast<const uint8_t*>(pPixels), indexPixel);
|
||||||
|
|
||||||
color.R = pgm_read_byte(p++);
|
color[V_IC_1] = pgm_read_byte(p++);
|
||||||
color.B = pgm_read_byte(p++);
|
color[V_IC_2] = pgm_read_byte(p++);
|
||||||
color.G = pgm_read_byte(p);
|
color[V_IC_3] = pgm_read_byte(p);
|
||||||
|
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
@@ -1,6 +1,6 @@
|
|||||||
/*-------------------------------------------------------------------------
|
/*-------------------------------------------------------------------------
|
||||||
NeoGrb48Feature provides feature classes to describe color order and
|
Neo3WordFeature provides feature base class to describe color order for
|
||||||
color depth for NeoPixelBus template class
|
3 Word features
|
||||||
|
|
||||||
Written by Michael C. Miller.
|
Written by Michael C. Miller.
|
||||||
|
|
||||||
@@ -26,9 +26,9 @@ License along with NeoPixel. If not, see
|
|||||||
-------------------------------------------------------------------------*/
|
-------------------------------------------------------------------------*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class NeoGrb48Feature :
|
template <uint8_t V_IC_1, uint8_t V_IC_2, uint8_t V_IC_3>
|
||||||
public NeoWordElements<6, Rgb48Color, uint16_t>,
|
class Neo3WordFeature :
|
||||||
public NeoElementsNoSettings
|
public NeoWordElements<6, Rgb48Color, uint16_t>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
||||||
@@ -36,12 +36,12 @@ public:
|
|||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
||||||
|
|
||||||
// due to endianness the byte order must be copied to output
|
// due to endianness the byte order must be copied to output
|
||||||
*p++ = color.G >> 8;
|
*p++ = color[V_IC_1] >> 8;
|
||||||
*p++ = color.G & 0xff;
|
*p++ = color[V_IC_1] & 0xff;
|
||||||
*p++ = color.R >> 8;
|
*p++ = color[V_IC_2] >> 8;
|
||||||
*p++ = color.R & 0xff;
|
*p++ = color[V_IC_2] & 0xff;
|
||||||
*p++ = color.B >> 8;
|
*p++ = color[V_IC_3] >> 8;
|
||||||
*p = color.B & 0xff;
|
*p = color[V_IC_3] & 0xff;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
||||||
@@ -50,12 +50,12 @@ public:
|
|||||||
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
||||||
|
|
||||||
// due to endianness the byte order must be copied to output
|
// due to endianness the byte order must be copied to output
|
||||||
color.G = (static_cast<uint16_t>(*p++) << 8);
|
color[V_IC_1] = (static_cast<uint16_t>(*p++) << 8);
|
||||||
color.G |= *p++;
|
color[V_IC_1] |= *p++;
|
||||||
color.R = (static_cast<uint16_t>(*p++) << 8);
|
color[V_IC_2] = (static_cast<uint16_t>(*p++) << 8);
|
||||||
color.R |= *p++;
|
color[V_IC_2] |= *p++;
|
||||||
color.B = (static_cast<uint16_t>(*p++) << 8);
|
color[V_IC_3] = (static_cast<uint16_t>(*p++) << 8);
|
||||||
color.B |= *p;
|
color[V_IC_3] |= *p;
|
||||||
|
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
@@ -67,10 +67,11 @@ public:
|
|||||||
|
|
||||||
// PROGMEM unit of storage expected to be the same size as color element
|
// PROGMEM unit of storage expected to be the same size as color element
|
||||||
// so no endianness issues to worry about
|
// so no endianness issues to worry about
|
||||||
color.G = pgm_read_word(p++);
|
color[V_IC_1] = pgm_read_word(p++);
|
||||||
color.R = pgm_read_word(p++);
|
color[V_IC_2] = pgm_read_word(p++);
|
||||||
color.B = pgm_read_word(p);
|
color[V_IC_3] = pgm_read_word(p);
|
||||||
|
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
};
|
@@ -1,6 +1,6 @@
|
|||||||
/*-------------------------------------------------------------------------
|
/*-------------------------------------------------------------------------
|
||||||
NeoBrgFeature provides feature classes to describe color order and
|
Neo4ByteFeature provides feature base class to describe color order for
|
||||||
color depth for NeoPixelBus template class
|
6 byte features that only use the first 5 bytes
|
||||||
|
|
||||||
Written by Michael C. Miller.
|
Written by Michael C. Miller.
|
||||||
|
|
||||||
@@ -26,18 +26,19 @@ License along with NeoPixel. If not, see
|
|||||||
-------------------------------------------------------------------------*/
|
-------------------------------------------------------------------------*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class NeoBrgFeature :
|
template <uint8_t V_IC_1, uint8_t V_IC_2, uint8_t V_IC_3, uint8_t V_IC_4>
|
||||||
public NeoByteElements<3, RgbColor, uint8_t>,
|
class Neo4ByteFeature :
|
||||||
public NeoElementsNoSettings
|
public NeoByteElements<4, RgbwColor, uint32_t>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
||||||
{
|
{
|
||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
||||||
|
|
||||||
*p++ = color.B;
|
*p++ = color[V_IC_1];
|
||||||
*p++ = color.R;
|
*p++ = color[V_IC_2];
|
||||||
*p = color.G;
|
*p++ = color[V_IC_3];
|
||||||
|
*p = color[V_IC_4];
|
||||||
}
|
}
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
||||||
@@ -45,9 +46,10 @@ public:
|
|||||||
ColorObject color;
|
ColorObject color;
|
||||||
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
||||||
|
|
||||||
color.B = *p++;
|
color[V_IC_1] = *p++;
|
||||||
color.R = *p++;
|
color[V_IC_2] = *p++;
|
||||||
color.G = *p;
|
color[V_IC_3] = *p++;
|
||||||
|
color[V_IC_4] = *p;
|
||||||
|
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
@@ -57,10 +59,11 @@ public:
|
|||||||
ColorObject color;
|
ColorObject color;
|
||||||
const uint8_t* p = getPixelAddress(reinterpret_cast<const uint8_t*>(pPixels), indexPixel);
|
const uint8_t* p = getPixelAddress(reinterpret_cast<const uint8_t*>(pPixels), indexPixel);
|
||||||
|
|
||||||
color.B = pgm_read_byte(p++);
|
color[V_IC_1] = pgm_read_byte(p++);
|
||||||
color.R = pgm_read_byte(p++);
|
color[V_IC_2] = pgm_read_byte(p++);
|
||||||
color.G = pgm_read_byte(p);
|
color[V_IC_3] = pgm_read_byte(p++);
|
||||||
|
color[V_IC_4] = pgm_read_byte(p);
|
||||||
|
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
};
|
};
|
@@ -1,6 +1,6 @@
|
|||||||
/*-------------------------------------------------------------------------
|
/*-------------------------------------------------------------------------
|
||||||
NeoRgbw64Feature provides feature classes to describe color order and
|
Neo4WordFeature provides feature base class to describe color order for
|
||||||
color depth for NeoPixelBus template class
|
4 Word features
|
||||||
|
|
||||||
Written by Michael C. Miller.
|
Written by Michael C. Miller.
|
||||||
|
|
||||||
@@ -26,10 +26,9 @@ License along with NeoPixel. If not, see
|
|||||||
-------------------------------------------------------------------------*/
|
-------------------------------------------------------------------------*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
template <uint8_t V_IC_1, uint8_t V_IC_2, uint8_t V_IC_3, uint8_t V_IC_4>
|
||||||
class NeoRgbw64Feature :
|
class Neo4WordFeature :
|
||||||
public NeoWordElements<8, Rgbw64Color, uint32_t>,
|
public NeoWordElements<8, Rgbw64Color, uint32_t>
|
||||||
public NeoElementsNoSettings
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
||||||
@@ -37,14 +36,14 @@ public:
|
|||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
||||||
|
|
||||||
// due to endianness the byte order must be copied to output
|
// due to endianness the byte order must be copied to output
|
||||||
*p++ = color.R >> 8;
|
*p++ = color[V_IC_1] >> 8;
|
||||||
*p++ = color.R & 0xff;
|
*p++ = color[V_IC_1] & 0xff;
|
||||||
*p++ = color.G >> 8;
|
*p++ = color[V_IC_2] >> 8;
|
||||||
*p++ = color.G & 0xff;
|
*p++ = color[V_IC_2] & 0xff;
|
||||||
*p++ = color.B >> 8;
|
*p++ = color[V_IC_3] >> 8;
|
||||||
*p++ = color.B & 0xff;
|
*p++ = color[V_IC_3] & 0xff;
|
||||||
*p++ = color.W >> 8;
|
*p++ = color[V_IC_4] >> 8;
|
||||||
*p = color.W & 0xff;
|
*p = color[V_IC_4] & 0xff;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
||||||
@@ -53,14 +52,14 @@ public:
|
|||||||
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
||||||
|
|
||||||
// due to endianness the byte order must be copied to output
|
// due to endianness the byte order must be copied to output
|
||||||
color.R = (static_cast<uint16_t>(*p++) << 8);
|
color[V_IC_1] = (static_cast<uint16_t>(*p++) << 8);
|
||||||
color.R |= *p++;
|
color[V_IC_1] |= *p++;
|
||||||
color.G = (static_cast<uint16_t>(*p++) << 8);
|
color[V_IC_2] = (static_cast<uint16_t>(*p++) << 8);
|
||||||
color.G |= *p++;
|
color[V_IC_2] |= *p++;
|
||||||
color.B = (static_cast<uint16_t>(*p++) << 8);
|
color[V_IC_3] = (static_cast<uint16_t>(*p++) << 8);
|
||||||
color.B |= *p++;
|
color[V_IC_3] |= *p++;
|
||||||
color.W = (static_cast<uint16_t>(*p++) << 8);
|
color[V_IC_4] = (static_cast<uint16_t>(*p++) << 8);
|
||||||
color.W |= *p;
|
color[V_IC_4] |= *p;
|
||||||
|
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
@@ -72,11 +71,12 @@ public:
|
|||||||
|
|
||||||
// PROGMEM unit of storage expected to be the same size as color element
|
// PROGMEM unit of storage expected to be the same size as color element
|
||||||
// so no endianness issues to worry about
|
// so no endianness issues to worry about
|
||||||
color.R = pgm_read_word(p++);
|
color[V_IC_1] = pgm_read_word(p++);
|
||||||
color.G = pgm_read_word(p++);
|
color[V_IC_2] = pgm_read_word(p++);
|
||||||
color.B = pgm_read_word(p++);
|
color[V_IC_3] = pgm_read_word(p++);
|
||||||
color.W = pgm_read_word(p);
|
color[V_IC_4] = pgm_read_word(p);
|
||||||
|
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
};
|
@@ -1,6 +1,6 @@
|
|||||||
/*-------------------------------------------------------------------------
|
/*-------------------------------------------------------------------------
|
||||||
NeoGrbcwxFeature provides feature classes to describe color order and
|
Neo6xByteFeature provides feature base class to describe color order for
|
||||||
color depth for NeoPixelBus template class
|
6 byte features that only use the first 5 bytes
|
||||||
|
|
||||||
Written by Michael C. Miller.
|
Written by Michael C. Miller.
|
||||||
|
|
||||||
@@ -26,20 +26,21 @@ License along with NeoPixel. If not, see
|
|||||||
-------------------------------------------------------------------------*/
|
-------------------------------------------------------------------------*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class NeoGrbcwxFeature :
|
template <uint8_t V_IC_1, uint8_t V_IC_2, uint8_t V_IC_3, uint8_t V_IC_4, uint8_t V_IC_5>
|
||||||
public NeoByteElements<6, RgbwwColor, uint16_t>,
|
class Neo6xByteFeature :
|
||||||
public NeoElementsNoSettings
|
public NeoByteElements<6, RgbwwColor, uint16_t>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
||||||
{
|
{
|
||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
||||||
|
|
||||||
*p++ = color.G;
|
*p++ = color[V_IC_1];
|
||||||
*p++ = color.R;
|
*p++ = color[V_IC_2];
|
||||||
*p++ = color.B;
|
*p++ = color[V_IC_3];
|
||||||
*p++ = color.CW;
|
*p++ = color[V_IC_4];
|
||||||
*p++ = color.WW;
|
*p++ = color[V_IC_5];
|
||||||
|
|
||||||
*p = 0x00; // X
|
*p = 0x00; // X
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,11 +49,12 @@ public:
|
|||||||
ColorObject color;
|
ColorObject color;
|
||||||
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
||||||
|
|
||||||
color.G = *p++;
|
color[V_IC_1] = *p++;
|
||||||
color.R = *p++;
|
color[V_IC_2] = *p++;
|
||||||
color.B = *p++;
|
color[V_IC_3] = *p++;
|
||||||
color.CW = *p++;
|
color[V_IC_4] = *p++;
|
||||||
color.WW = *p;
|
color[V_IC_5] = *p;
|
||||||
|
// ignore the x
|
||||||
|
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
@@ -62,12 +64,13 @@ public:
|
|||||||
ColorObject color;
|
ColorObject color;
|
||||||
const uint8_t* p = getPixelAddress(reinterpret_cast<const uint8_t*>(pPixels), indexPixel);
|
const uint8_t* p = getPixelAddress(reinterpret_cast<const uint8_t*>(pPixels), indexPixel);
|
||||||
|
|
||||||
color.G = pgm_read_byte(p++);
|
color[V_IC_1] = pgm_read_byte(p++);
|
||||||
color.R = pgm_read_byte(p++);
|
color[V_IC_2] = pgm_read_byte(p++);
|
||||||
color.B = pgm_read_byte(p++);
|
color[V_IC_3] = pgm_read_byte(p++);
|
||||||
color.CW = pgm_read_byte(p++);
|
color[V_IC_4] = pgm_read_byte(p++);
|
||||||
color.WW = pgm_read_byte(p);
|
color[V_IC_5] = pgm_read_byte(p);
|
||||||
|
// ignore the x
|
||||||
|
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
};
|
};
|
@@ -1,6 +1,6 @@
|
|||||||
/*-------------------------------------------------------------------------
|
/*-------------------------------------------------------------------------
|
||||||
NeoRgbwxxFeature provides feature classes to describe color order and
|
Neo6xxByteFeature provides feature base class to describe color order for
|
||||||
color depth for NeoPixelBus template class
|
6 byte features that only use the first 4 bytes
|
||||||
|
|
||||||
Written by Michael C. Miller.
|
Written by Michael C. Miller.
|
||||||
|
|
||||||
@@ -26,22 +26,22 @@ License along with NeoPixel. If not, see
|
|||||||
-------------------------------------------------------------------------*/
|
-------------------------------------------------------------------------*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class NeoRgbwxxFeature :
|
template <uint8_t V_IC_1, uint8_t V_IC_2, uint8_t V_IC_3, uint8_t V_IC_4>
|
||||||
public NeoByteElements<6, RgbwColor, uint16_t>,
|
class Neo6xxByteFeature :
|
||||||
public NeoElementsNoSettings
|
public NeoByteElements<6, RgbwColor, uint16_t>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
||||||
{
|
{
|
||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
||||||
|
|
||||||
*p++ = color.R;
|
*p++ = color[V_IC_1];
|
||||||
*p++ = color.G;
|
*p++ = color[V_IC_2];
|
||||||
*p++ = color.B;
|
*p++ = color[V_IC_3];
|
||||||
*p++ = color.W;
|
*p++ = color[V_IC_4];
|
||||||
// zero the xx, this maybe unnecessary though, but its thorough
|
// zero the xx, this maybe unnecessary though, but its thorough
|
||||||
*p++ = 0;
|
*p++ = 0x00;
|
||||||
*p = 0;
|
*p = 0x00; // X
|
||||||
}
|
}
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
||||||
@@ -49,10 +49,10 @@ public:
|
|||||||
ColorObject color;
|
ColorObject color;
|
||||||
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
||||||
|
|
||||||
color.R = *p++;
|
color[V_IC_1] = *p++;
|
||||||
color.G = *p++;
|
color[V_IC_2] = *p++;
|
||||||
color.B = *p++;
|
color[V_IC_3] = *p++;
|
||||||
color.W = *p;
|
color[V_IC_4] = *p;
|
||||||
// ignore the xx
|
// ignore the xx
|
||||||
|
|
||||||
return color;
|
return color;
|
||||||
@@ -63,12 +63,11 @@ public:
|
|||||||
ColorObject color;
|
ColorObject color;
|
||||||
const uint8_t* p = getPixelAddress(reinterpret_cast<const uint8_t*>(pPixels), indexPixel);
|
const uint8_t* p = getPixelAddress(reinterpret_cast<const uint8_t*>(pPixels), indexPixel);
|
||||||
|
|
||||||
color.R = pgm_read_byte(p++);
|
color[V_IC_1] = pgm_read_byte(p++);
|
||||||
color.G = pgm_read_byte(p++);
|
color[V_IC_2] = pgm_read_byte(p++);
|
||||||
color.B = pgm_read_byte(p++);
|
color[V_IC_3] = pgm_read_byte(p++);
|
||||||
color.W = pgm_read_byte(p);
|
color[V_IC_4] = pgm_read_byte(p);
|
||||||
// ignore the xx
|
// ignore the xx
|
||||||
|
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
};
|
};
|
@@ -104,7 +104,7 @@ public:
|
|||||||
static void movePixelsInc_P(uint8_t* pPixelDest, PGM_VOID_P pPixelSrc, uint16_t count)
|
static void movePixelsInc_P(uint8_t* pPixelDest, PGM_VOID_P pPixelSrc, uint16_t count)
|
||||||
{
|
{
|
||||||
uint8_t* pEnd = pPixelDest + (count * NeoElementsBase<V_PIXEL_SIZE, T_COLOR_OBJECT, T_COPY>::PixelSize);
|
uint8_t* pEnd = pPixelDest + (count * NeoElementsBase<V_PIXEL_SIZE, T_COLOR_OBJECT, T_COPY>::PixelSize);
|
||||||
const uint8_t* pSrc = (const uint8_t*)pPixelSrc;
|
const uint8_t* pSrc = reinterpret_cast<const uint8_t*>(pPixelSrc);
|
||||||
|
|
||||||
while (pPixelDest < pEnd)
|
while (pPixelDest < pEnd)
|
||||||
{
|
{
|
||||||
|
@@ -1,70 +0,0 @@
|
|||||||
/*-------------------------------------------------------------------------
|
|
||||||
NeoGrbwFeature provides feature classes to describe color order and
|
|
||||||
color depth for NeoPixelBus template class
|
|
||||||
|
|
||||||
Written by Michael C. Miller.
|
|
||||||
|
|
||||||
I invest time and resources providing this open source code,
|
|
||||||
please support me by dontating (see https://github.com/Makuna/NeoPixelBus)
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------
|
|
||||||
This file is part of the Makuna/NeoPixelBus library.
|
|
||||||
|
|
||||||
NeoPixelBus is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as
|
|
||||||
published by the Free Software Foundation, either version 3 of
|
|
||||||
the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
NeoPixelBus is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with NeoPixel. If not, see
|
|
||||||
<http://www.gnu.org/licenses/>.
|
|
||||||
-------------------------------------------------------------------------*/
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
class NeoGrbwFeature :
|
|
||||||
public NeoByteElements<4, RgbwColor, uint32_t>,
|
|
||||||
public NeoElementsNoSettings
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
|
||||||
{
|
|
||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
|
|
||||||
*p++ = color.G;
|
|
||||||
*p++ = color.R;
|
|
||||||
*p++ = color.B;
|
|
||||||
*p = color.W;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
|
|
||||||
color.G = *p++;
|
|
||||||
color.R = *p++;
|
|
||||||
color.B = *p++;
|
|
||||||
color.W = *p;
|
|
||||||
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor_P(PGM_VOID_P pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint8_t* p = getPixelAddress(reinterpret_cast<const uint8_t*>(pPixels), indexPixel);
|
|
||||||
|
|
||||||
color.G = pgm_read_byte(p++);
|
|
||||||
color.R = pgm_read_byte(p++);
|
|
||||||
color.B = pgm_read_byte(p++);
|
|
||||||
color.W = pgm_read_byte(p);
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
};
|
|
@@ -1,76 +0,0 @@
|
|||||||
/*-------------------------------------------------------------------------
|
|
||||||
NeoRgb48Feature provides feature classes to describe color order and
|
|
||||||
color depth for NeoPixelBus template class
|
|
||||||
|
|
||||||
Written by Michael C. Miller.
|
|
||||||
|
|
||||||
I invest time and resources providing this open source code,
|
|
||||||
please support me by dontating (see https://github.com/Makuna/NeoPixelBus)
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------
|
|
||||||
This file is part of the Makuna/NeoPixelBus library.
|
|
||||||
|
|
||||||
NeoPixelBus is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as
|
|
||||||
published by the Free Software Foundation, either version 3 of
|
|
||||||
the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
NeoPixelBus is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with NeoPixel. If not, see
|
|
||||||
<http://www.gnu.org/licenses/>.
|
|
||||||
-------------------------------------------------------------------------*/
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
class NeoRgb48Feature :
|
|
||||||
public NeoWordElements<6, Rgb48Color, uint16_t>,
|
|
||||||
public NeoElementsNoSettings
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
|
||||||
{
|
|
||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
|
|
||||||
// due to endianness the byte order must be copied to output
|
|
||||||
*p++ = color.R >> 8;
|
|
||||||
*p++ = color.R & 0xff;
|
|
||||||
*p++ = color.G >> 8;
|
|
||||||
*p++ = color.G & 0xff;
|
|
||||||
*p++ = color.B >> 8;
|
|
||||||
*p = color.B & 0xff;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
|
|
||||||
// due to endianness the byte order must be copied to output
|
|
||||||
color.R = (static_cast<uint16_t>(*p++) << 8);
|
|
||||||
color.R |= *p++;
|
|
||||||
color.G = (static_cast<uint16_t>(*p++) << 8);
|
|
||||||
color.G |= *p++;
|
|
||||||
color.B = (static_cast<uint16_t>(*p++) << 8);
|
|
||||||
color.B |= *p;
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor_P(PGM_VOID_P pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint16_t* p = reinterpret_cast<const uint16_t*>(getPixelAddress(reinterpret_cast<const uint8_t*>(pPixels), indexPixel));
|
|
||||||
|
|
||||||
// PROGMEM unit of storage expected to be the same size as color element
|
|
||||||
// so no endianness issues to worry about
|
|
||||||
color.R = pgm_read_word(p++);
|
|
||||||
color.G = pgm_read_word(p++);
|
|
||||||
color.B = pgm_read_word(p);
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
};
|
|
63
src/internal/features/NeoRgb48Features.h
Normal file
63
src/internal/features/NeoRgb48Features.h
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
/*-------------------------------------------------------------------------
|
||||||
|
NeoRgb48Feature provides feature classes to describe color order and
|
||||||
|
color depth for NeoPixelBus template class
|
||||||
|
|
||||||
|
Written by Michael C. Miller.
|
||||||
|
|
||||||
|
I invest time and resources providing this open source code,
|
||||||
|
please support me by dontating (see https://github.com/Makuna/NeoPixelBus)
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------
|
||||||
|
This file is part of the Makuna/NeoPixelBus library.
|
||||||
|
|
||||||
|
NeoPixelBus is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as
|
||||||
|
published by the Free Software Foundation, either version 3 of
|
||||||
|
the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
NeoPixelBus is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with NeoPixel. If not, see
|
||||||
|
<http://www.gnu.org/licenses/>.
|
||||||
|
-------------------------------------------------------------------------*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
class NeoRgb48Feature :
|
||||||
|
public Neo3WordFeature<ColorIndexR, ColorIndexG, ColorIndexB>,
|
||||||
|
public NeoElementsNoSettings
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
class NeoRbg48Feature :
|
||||||
|
public Neo3WordFeature<ColorIndexR, ColorIndexB, ColorIndexG>,
|
||||||
|
public NeoElementsNoSettings
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
class NeoGrb48Feature :
|
||||||
|
public Neo3WordFeature<ColorIndexG, ColorIndexR, ColorIndexB>,
|
||||||
|
public NeoElementsNoSettings
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
class NeoGbr48Feature :
|
||||||
|
public Neo3WordFeature<ColorIndexG, ColorIndexB, ColorIndexR>,
|
||||||
|
public NeoElementsNoSettings
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
class NeoBgr48Feature :
|
||||||
|
public Neo3WordFeature<ColorIndexB, ColorIndexG, ColorIndexR>,
|
||||||
|
public NeoElementsNoSettings
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
class NeoBrg48Feature :
|
||||||
|
public Neo3WordFeature<ColorIndexB, ColorIndexR, ColorIndexG>,
|
||||||
|
public NeoElementsNoSettings
|
||||||
|
{
|
||||||
|
};
|
@@ -27,40 +27,38 @@ License along with NeoPixel. If not, see
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class NeoRgbFeature :
|
class NeoRgbFeature :
|
||||||
public NeoByteElements<3, RgbColor, uint8_t>,
|
public Neo3ByteFeature<ColorIndexR, ColorIndexG, ColorIndexB>,
|
||||||
public NeoElementsNoSettings
|
public NeoElementsNoSettings
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
|
||||||
{
|
|
||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
|
|
||||||
*p++ = color.R;
|
|
||||||
*p++ = color.G;
|
|
||||||
*p = color.B;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
|
|
||||||
color.R = *p++;
|
|
||||||
color.G = *p++;
|
|
||||||
color.B = *p;
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor_P(PGM_VOID_P pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint8_t* p = getPixelAddress(reinterpret_cast<const uint8_t*>(pPixels), indexPixel);
|
|
||||||
|
|
||||||
color.R = pgm_read_byte(p++);
|
|
||||||
color.G = pgm_read_byte(p++);
|
|
||||||
color.B = pgm_read_byte(p);
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class NeoRbgFeature :
|
||||||
|
public Neo3ByteFeature<ColorIndexR, ColorIndexB, ColorIndexG>,
|
||||||
|
public NeoElementsNoSettings
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
class NeoGbrFeature :
|
||||||
|
public Neo3ByteFeature<ColorIndexG, ColorIndexB, ColorIndexR>,
|
||||||
|
public NeoElementsNoSettings
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
class NeoGrbFeature :
|
||||||
|
public Neo3ByteFeature<ColorIndexG, ColorIndexR, ColorIndexB>,
|
||||||
|
public NeoElementsNoSettings
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
class NeoBgrFeature :
|
||||||
|
public Neo3ByteFeature<ColorIndexB, ColorIndexG, ColorIndexR>,
|
||||||
|
public NeoElementsNoSettings
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
class NeoBrgFeature :
|
||||||
|
public Neo3ByteFeature<ColorIndexB, ColorIndexR, ColorIndexG>,
|
||||||
|
public NeoElementsNoSettings
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
33
src/internal/features/NeoRgbcwxFeatures.h
Normal file
33
src/internal/features/NeoRgbcwxFeatures.h
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
/*-------------------------------------------------------------------------
|
||||||
|
NeoRgbcwxFeature provides feature classes to describe color order and
|
||||||
|
color depth for NeoPixelBus template class
|
||||||
|
|
||||||
|
Written by Michael C. Miller.
|
||||||
|
|
||||||
|
I invest time and resources providing this open source code,
|
||||||
|
please support me by dontating (see https://github.com/Makuna/NeoPixelBus)
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------
|
||||||
|
This file is part of the Makuna/NeoPixelBus library.
|
||||||
|
|
||||||
|
NeoPixelBus is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as
|
||||||
|
published by the Free Software Foundation, either version 3 of
|
||||||
|
the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
NeoPixelBus is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with NeoPixel. If not, see
|
||||||
|
<http://www.gnu.org/licenses/>.
|
||||||
|
-------------------------------------------------------------------------*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
class NeoGrbcwxFeature :
|
||||||
|
public Neo6xByteFeature<ColorIndexG, ColorIndexR, ColorIndexB, ColorIndexCW, ColorIndexWW>,
|
||||||
|
public NeoElementsNoSettings
|
||||||
|
{
|
||||||
|
};
|
@@ -1,5 +1,5 @@
|
|||||||
/*-------------------------------------------------------------------------
|
/*-------------------------------------------------------------------------
|
||||||
NeoBgrFeature provides feature classes to describe color order and
|
NeoRgbw64Feature provides feature classes to describe color order and
|
||||||
color depth for NeoPixelBus template class
|
color depth for NeoPixelBus template class
|
||||||
|
|
||||||
Written by Michael C. Miller.
|
Written by Michael C. Miller.
|
||||||
@@ -27,42 +27,40 @@ License along with NeoPixel. If not, see
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
class NeoBgrFeature :
|
class NeoRgbw64Feature :
|
||||||
public NeoByteElements<3, RgbColor, uint8_t>,
|
public Neo4WordFeature<ColorIndexR, ColorIndexG, ColorIndexB, ColorIndexW>,
|
||||||
public NeoElementsNoSettings
|
public NeoElementsNoSettings
|
||||||
{
|
{
|
||||||
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<const uint8_t*>(pPixels), indexPixel);
|
|
||||||
|
|
||||||
color.B = pgm_read_byte(p++);
|
|
||||||
color.G = pgm_read_byte(p++);
|
|
||||||
color.R = pgm_read_byte(p);
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class NeoRbgw64Feature :
|
||||||
|
public Neo4WordFeature<ColorIndexR, ColorIndexB, ColorIndexG, ColorIndexW>,
|
||||||
|
public NeoElementsNoSettings
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
class NeoGbrw64Feature :
|
||||||
|
public Neo4WordFeature<ColorIndexG, ColorIndexB, ColorIndexR, ColorIndexW>,
|
||||||
|
public NeoElementsNoSettings
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
class NeoGrbw64Feature :
|
||||||
|
public Neo4WordFeature<ColorIndexG, ColorIndexR, ColorIndexB, ColorIndexW>,
|
||||||
|
public NeoElementsNoSettings
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
class NeoBgrw64Feature :
|
||||||
|
public Neo4WordFeature<ColorIndexB, ColorIndexG, ColorIndexR, ColorIndexW>,
|
||||||
|
public NeoElementsNoSettings
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
class NeoBrgw64Feature :
|
||||||
|
public Neo4WordFeature<ColorIndexB, ColorIndexR, ColorIndexG, ColorIndexW>,
|
||||||
|
public NeoElementsNoSettings
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
|
@@ -27,43 +27,37 @@ License along with NeoPixel. If not, see
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class NeoRgbwFeature :
|
class NeoRgbwFeature :
|
||||||
public NeoByteElements<4, RgbwColor, uint32_t>,
|
public Neo4ByteFeature<ColorIndexR, ColorIndexG, ColorIndexB, ColorIndexW>,
|
||||||
public NeoElementsNoSettings
|
public NeoElementsNoSettings
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
|
||||||
{
|
|
||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
|
|
||||||
*p++ = color.R;
|
|
||||||
*p++ = color.G;
|
|
||||||
*p++ = color.B;
|
|
||||||
*p = color.W;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
|
|
||||||
color.R = *p++;
|
|
||||||
color.G = *p++;
|
|
||||||
color.B = *p++;
|
|
||||||
color.W = *p;
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor_P(PGM_VOID_P pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint8_t* p = getPixelAddress(reinterpret_cast<const uint8_t*>(pPixels), indexPixel);
|
|
||||||
|
|
||||||
color.R = pgm_read_byte(p++);
|
|
||||||
color.G = pgm_read_byte(p++);
|
|
||||||
color.B = pgm_read_byte(p++);
|
|
||||||
color.W = pgm_read_byte(p);
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class NeoRbgwFeature :
|
||||||
|
public Neo4ByteFeature<ColorIndexR, ColorIndexB, ColorIndexG, ColorIndexW>,
|
||||||
|
public NeoElementsNoSettings
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
class NeoGbrwFeature :
|
||||||
|
public Neo4ByteFeature<ColorIndexG, ColorIndexB, ColorIndexR, ColorIndexW>,
|
||||||
|
public NeoElementsNoSettings
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
class NeoGrbwFeature :
|
||||||
|
public Neo4ByteFeature<ColorIndexG, ColorIndexR, ColorIndexB, ColorIndexW>,
|
||||||
|
public NeoElementsNoSettings
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
class NeoBgrwFeature :
|
||||||
|
public Neo4ByteFeature<ColorIndexB, ColorIndexG, ColorIndexR, ColorIndexW>,
|
||||||
|
public NeoElementsNoSettings
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
class NeoBrgwFeature :
|
||||||
|
public Neo4ByteFeature<ColorIndexB, ColorIndexR, ColorIndexG, ColorIndexW>,
|
||||||
|
public NeoElementsNoSettings
|
||||||
|
{
|
||||||
|
};
|
33
src/internal/features/NeoRgbwxxFeatures.h
Normal file
33
src/internal/features/NeoRgbwxxFeatures.h
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
/*-------------------------------------------------------------------------
|
||||||
|
NeoRgbwxxFeatures provides feature classes to describe color order and
|
||||||
|
color depth for NeoPixelBus template class
|
||||||
|
|
||||||
|
Written by Michael C. Miller.
|
||||||
|
|
||||||
|
I invest time and resources providing this open source code,
|
||||||
|
please support me by dontating (see https://github.com/Makuna/NeoPixelBus)
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------
|
||||||
|
This file is part of the Makuna/NeoPixelBus library.
|
||||||
|
|
||||||
|
NeoPixelBus is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as
|
||||||
|
published by the Free Software Foundation, either version 3 of
|
||||||
|
the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
NeoPixelBus is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with NeoPixel. If not, see
|
||||||
|
<http://www.gnu.org/licenses/>.
|
||||||
|
-------------------------------------------------------------------------*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
class NeoRgbwxxFeature :
|
||||||
|
public Neo6xxByteFeature<ColorIndexR, ColorIndexG, ColorIndexB, ColorIndexW>,
|
||||||
|
public NeoElementsNoSettings
|
||||||
|
{
|
||||||
|
};
|
@@ -50,11 +50,29 @@ public:
|
|||||||
GreenGain(greenGain & 0x0f),
|
GreenGain(greenGain & 0x0f),
|
||||||
BlueGain(blueGain & 0x0f) {}
|
BlueGain(blueGain & 0x0f) {}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
// operator [] - readonly
|
||||||
|
// access elements in order by index rather than member name
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
uint8_t operator[](size_t idx) const
|
||||||
|
{
|
||||||
|
switch (idx)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
return RedGain;
|
||||||
|
case 1:
|
||||||
|
return GreenGain;
|
||||||
|
default:
|
||||||
|
return BlueGain;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const uint8_t RedGain : 4;
|
const uint8_t RedGain : 4;
|
||||||
const uint8_t GreenGain : 4;
|
const uint8_t GreenGain : 4;
|
||||||
const uint8_t BlueGain : 4;
|
const uint8_t BlueGain : 4;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <uint8_t V_IC_1, uint8_t V_IC_2, uint8_t V_IC_3>
|
||||||
class NeoSm16803pbSettings : public NeoSm168x3SettingsBase
|
class NeoSm16803pbSettings : public NeoSm168x3SettingsBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -71,8 +89,8 @@ public:
|
|||||||
void Encode(uint8_t* encoded) const
|
void Encode(uint8_t* encoded) const
|
||||||
{
|
{
|
||||||
// 0RGB 4 bits each
|
// 0RGB 4 bits each
|
||||||
encoded[0] = RedGain;
|
*encoded++ = operator[](V_IC_1);
|
||||||
encoded[1] = GreenGain << 4 | BlueGain;
|
*encoded = operator[](V_IC_2) << 4 | operator[](V_IC_3);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -81,6 +99,7 @@ protected:
|
|||||||
110, 133, 145, 156, 168, 179, 190};
|
110, 133, 145, 156, 168, 179, 190};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <uint8_t V_IC_1, uint8_t V_IC_2, uint8_t V_IC_3>
|
||||||
class NeoSm16823eSettings : public NeoSm168x3SettingsBase
|
class NeoSm16823eSettings : public NeoSm168x3SettingsBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -98,8 +117,8 @@ public:
|
|||||||
void Encode(uint8_t* encoded) const
|
void Encode(uint8_t* encoded) const
|
||||||
{
|
{
|
||||||
// RGB0 4 bits each
|
// RGB0 4 bits each
|
||||||
encoded[0] = RedGain << 4 | GreenGain;
|
*encoded++ = operator[](V_IC_1) << 4 | operator[](V_IC_2);
|
||||||
encoded[1] = BlueGain << 4;
|
*encoded = operator[](V_IC_3) << 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -131,12 +150,32 @@ public:
|
|||||||
BlueGain(blueGain & 0x0f),
|
BlueGain(blueGain & 0x0f),
|
||||||
WhiteGain(whiteGain & 0x0f) {}
|
WhiteGain(whiteGain & 0x0f) {}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
// operator [] - readonly
|
||||||
|
// access elements in order by index rather than member name
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
uint8_t operator[](size_t idx) const
|
||||||
|
{
|
||||||
|
switch (idx)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
return RedGain;
|
||||||
|
case 1:
|
||||||
|
return GreenGain;
|
||||||
|
case 2:
|
||||||
|
return BlueGain;
|
||||||
|
default:
|
||||||
|
return WhiteGain;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const uint8_t RedGain : 4;
|
const uint8_t RedGain : 4;
|
||||||
const uint8_t GreenGain : 4;
|
const uint8_t GreenGain : 4;
|
||||||
const uint8_t BlueGain : 4;
|
const uint8_t BlueGain : 4;
|
||||||
const uint8_t WhiteGain : 4;
|
const uint8_t WhiteGain : 4;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <uint8_t V_IC_1, uint8_t V_IC_2, uint8_t V_IC_3, uint8_t V_IC_4>
|
||||||
class NeoSm16804ebSettings : public NeoSm168x4SettingsBase
|
class NeoSm16804ebSettings : public NeoSm168x4SettingsBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -155,8 +194,8 @@ public:
|
|||||||
void Encode(uint8_t* encoded) const
|
void Encode(uint8_t* encoded) const
|
||||||
{
|
{
|
||||||
// RGBW 4 bits each
|
// RGBW 4 bits each
|
||||||
encoded[0] = RedGain << 4 | GreenGain;
|
*encoded++ = operator[](V_IC_1) << 4 | operator[](V_IC_2);
|
||||||
encoded[1] = BlueGain << 4 | WhiteGain;
|
*encoded = operator[](V_IC_3) << 4 | operator[](V_IC_4);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -165,6 +204,7 @@ protected:
|
|||||||
110, 133, 145, 156, 168, 179, 190 };
|
110, 133, 145, 156, 168, 179, 190 };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <uint8_t V_IC_1, uint8_t V_IC_2, uint8_t V_IC_3, uint8_t V_IC_4>
|
||||||
class NeoSm16824eSettings : public NeoSm168x4SettingsBase
|
class NeoSm16824eSettings : public NeoSm168x4SettingsBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -184,8 +224,8 @@ public:
|
|||||||
void Encode(uint8_t* encoded) const
|
void Encode(uint8_t* encoded) const
|
||||||
{
|
{
|
||||||
// RGBW 4 bits each
|
// RGBW 4 bits each
|
||||||
encoded[0] = RedGain << 4 | GreenGain;
|
*encoded++ = operator[](V_IC_1) << 4 | operator[](V_IC_2);
|
||||||
encoded[1] = BlueGain << 4 | WhiteGain;
|
*encoded = operator[](V_IC_3) << 4 | operator[](V_IC_4);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -199,7 +239,10 @@ protected:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T_SETTINGS> class NeoRgbwSm168x4Elements : public NeoByteElements<4, RgbwColor, uint32_t>
|
// CAUTION: Make sure ColorIndex order for Neo4ByteFeature matches T_SETTINGS
|
||||||
|
template<typename T_SETTINGS>
|
||||||
|
class NeoRgbwSm168x4Elements :
|
||||||
|
public Neo4ByteFeature<ColorIndexR, ColorIndexG, ColorIndexB, ColorIndexW>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef T_SETTINGS SettingsObject;
|
typedef T_SETTINGS SettingsObject;
|
||||||
@@ -222,45 +265,11 @@ public:
|
|||||||
{
|
{
|
||||||
return pData;
|
return pData;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
|
||||||
{
|
|
||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
|
|
||||||
*p++ = color.R;
|
|
||||||
*p++ = color.G;
|
|
||||||
*p++ = color.B;
|
|
||||||
*p = color.W;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
|
|
||||||
color.R = *p++;
|
|
||||||
color.G = *p++;
|
|
||||||
color.B = *p++;
|
|
||||||
color.W = *p;
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor_P(PGM_VOID_P pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint8_t* p = getPixelAddress((const uint8_t*)pPixels, indexPixel);
|
|
||||||
|
|
||||||
color.R = pgm_read_byte(p++);
|
|
||||||
color.G = pgm_read_byte(p++);
|
|
||||||
color.B = pgm_read_byte(p++);
|
|
||||||
color.W = pgm_read_byte(p);
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T_SETTINGS> class NeoRgbSm168x3Elements : public NeoByteElements<3, RgbColor, uint8_t>
|
// CAUTION: Make sure ColorIndex order for Neo3ByteFeature matches T_SETTINGS
|
||||||
|
template<typename T_SETTINGS> class NeoRgbSm168x3Elements :
|
||||||
|
public Neo3ByteFeature<ColorIndexR, ColorIndexG, ColorIndexB>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef T_SETTINGS SettingsObject;
|
typedef T_SETTINGS SettingsObject;
|
||||||
@@ -283,44 +292,11 @@ public:
|
|||||||
{
|
{
|
||||||
return pData;
|
return pData;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
|
||||||
{
|
|
||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
|
|
||||||
*p++ = color.R;
|
|
||||||
*p++ = color.G;
|
|
||||||
*p = color.B;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
|
|
||||||
color.R = *p++;
|
|
||||||
color.G = *p++;
|
|
||||||
color.B = *p;
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor_P(PGM_VOID_P pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint8_t* p = getPixelAddress((const uint8_t*)pPixels, indexPixel);
|
|
||||||
|
|
||||||
color.R = pgm_read_byte(p++);
|
|
||||||
color.G = pgm_read_byte(p++);
|
|
||||||
color.B = pgm_read_byte(p);
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef NeoRgbSm168x3Elements<NeoSm16803pbSettings> NeoRgbSm16803pbFeature;
|
typedef NeoRgbSm168x3Elements<NeoSm16803pbSettings<ColorIndexR, ColorIndexG, ColorIndexB>> NeoRgbSm16803pbFeature;
|
||||||
typedef NeoRgbSm168x3Elements<NeoSm16823eSettings> NeoRgbSm16823eFeature;
|
typedef NeoRgbSm168x3Elements<NeoSm16823eSettings<ColorIndexR, ColorIndexG, ColorIndexB>> NeoRgbSm16823eFeature;
|
||||||
typedef NeoRgbwSm168x4Elements<NeoSm16804ebSettings> NeoRgbwSm16804ebFeature;
|
typedef NeoRgbwSm168x4Elements<NeoSm16804ebSettings<ColorIndexR, ColorIndexG, ColorIndexB, ColorIndexW>> NeoRgbwSm16804ebFeature;
|
||||||
typedef NeoRgbwSm168x4Elements<NeoSm16824eSettings> NeoRgbwSm16824eFeature;
|
typedef NeoRgbwSm168x4Elements<NeoSm16824eSettings<ColorIndexR, ColorIndexG, ColorIndexB, ColorIndexW>> NeoRgbwSm16824eFeature;
|
||||||
|
|
||||||
|
|
||||||
|
@@ -51,7 +51,8 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class Neo4ByteElementsTm1814Settings : public NeoByteElements<4, RgbwColor, uint32_t>
|
template <uint8_t V_IC_1, uint8_t V_IC_2, uint8_t V_IC_3, uint8_t V_IC_4>
|
||||||
|
class NeoElementsTm1814Settings
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
const static uint16_t EncodeDivisor = 5;
|
const static uint16_t EncodeDivisor = 5;
|
||||||
@@ -66,10 +67,10 @@ public:
|
|||||||
uint8_t* pSet = pData;
|
uint8_t* pSet = pData;
|
||||||
|
|
||||||
// C1
|
// C1
|
||||||
*pSet++ = (SettingsObject::LimitCurrent(settings.WhiteTenthMilliAmpere) - SettingsObject::MinCurrent) / EncodeDivisor;
|
*pSet++ = (SettingsObject::LimitCurrent(settings[V_IC_1]) - SettingsObject::MinCurrent) / EncodeDivisor;
|
||||||
*pSet++ = (SettingsObject::LimitCurrent(settings.RedTenthMilliAmpere) - SettingsObject::MinCurrent) / EncodeDivisor;
|
*pSet++ = (SettingsObject::LimitCurrent(settings[V_IC_2]) - SettingsObject::MinCurrent) / EncodeDivisor;
|
||||||
*pSet++ = (SettingsObject::LimitCurrent(settings.GreenTenthMilliAmpere) - SettingsObject::MinCurrent) / EncodeDivisor;
|
*pSet++ = (SettingsObject::LimitCurrent(settings[V_IC_3]) - SettingsObject::MinCurrent) / EncodeDivisor;
|
||||||
*pSet++ = (SettingsObject::LimitCurrent(settings.BlueTenthMilliAmpere) - SettingsObject::MinCurrent) / EncodeDivisor;
|
*pSet++ = (SettingsObject::LimitCurrent(settings[V_IC_4]) - SettingsObject::MinCurrent) / EncodeDivisor;
|
||||||
|
|
||||||
uint8_t* pC1 = pData;
|
uint8_t* pC1 = pData;
|
||||||
|
|
||||||
@@ -94,44 +95,9 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class NeoWrgbTm1814Feature : public Neo4ByteElementsTm1814Settings
|
class NeoWrgbTm1814Feature :
|
||||||
{
|
public Neo4ByteFeature<ColorIndexW, ColorIndexR, ColorIndexG, ColorIndexB>,
|
||||||
public:
|
public NeoElementsTm1814Settings<ColorIndexW, ColorIndexR, ColorIndexG, ColorIndexB>
|
||||||
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
{
|
||||||
{
|
|
||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
|
|
||||||
*p++ = color.W;
|
|
||||||
*p++ = color.R;
|
|
||||||
*p++ = color.G;
|
|
||||||
*p = color.B;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
|
|
||||||
color.W = *p++;
|
|
||||||
color.R = *p++;
|
|
||||||
color.G = *p++;
|
|
||||||
color.B = *p;
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor_P(PGM_VOID_P pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint8_t* p = getPixelAddress((const uint8_t*)pPixels, indexPixel);
|
|
||||||
|
|
||||||
color.W = pgm_read_byte(p++);
|
|
||||||
color.R = pgm_read_byte(p++);
|
|
||||||
color.G = pgm_read_byte(p++);
|
|
||||||
color.B = pgm_read_byte(p);
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -44,7 +44,7 @@ public:
|
|||||||
NeoTm1914_Mode Mode;
|
NeoTm1914_Mode Mode;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Neo3ByteElementsTm1914Settings : public NeoByteElements<3, RgbColor, uint8_t>
|
class Neo3ByteElementsTm1914Settings
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef NeoTm1914Settings SettingsObject;
|
typedef NeoTm1914Settings SettingsObject;
|
||||||
@@ -99,79 +99,15 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class NeoRgbTm1914Feature : public Neo3ByteElementsTm1914Settings
|
class NeoRgbTm1914Feature :
|
||||||
|
public Neo3ByteFeature<ColorIndexR, ColorIndexG, ColorIndexB>,
|
||||||
|
public Neo3ByteElementsTm1914Settings
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
|
||||||
{
|
|
||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
|
|
||||||
*p++ = color.R;
|
|
||||||
*p++ = color.G;
|
|
||||||
*p = color.B;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
|
|
||||||
color.R = *p++;
|
|
||||||
color.G = *p++;
|
|
||||||
color.B = *p;
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor_P(PGM_VOID_P pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint8_t* p = getPixelAddress((const uint8_t*)pPixels, indexPixel);
|
|
||||||
|
|
||||||
color.R = pgm_read_byte(p++);
|
|
||||||
color.G = pgm_read_byte(p++);
|
|
||||||
color.B = pgm_read_byte(p);
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class NeoGrbTm1914Feature : public Neo3ByteElementsTm1914Settings
|
class NeoGrbTm1914Feature :
|
||||||
|
public Neo3ByteFeature<ColorIndexG, ColorIndexR, ColorIndexB>,
|
||||||
|
public Neo3ByteElementsTm1914Settings
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
|
||||||
{
|
|
||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
|
|
||||||
*p++ = color.G;
|
|
||||||
*p++ = color.R;
|
|
||||||
*p = color.B;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
|
||||||
|
|
||||||
color.G = *p++;
|
|
||||||
color.R = *p++;
|
|
||||||
color.B = *p;
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ColorObject retrievePixelColor_P(PGM_VOID_P pPixels, uint16_t indexPixel)
|
|
||||||
{
|
|
||||||
ColorObject color;
|
|
||||||
const uint8_t* p = getPixelAddress((const uint8_t*)pPixels, indexPixel);
|
|
||||||
|
|
||||||
color.G = pgm_read_byte(p++);
|
|
||||||
color.R = pgm_read_byte(p++);
|
|
||||||
color.B = pgm_read_byte(p);
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
@@ -367,7 +367,7 @@ public:
|
|||||||
: T_BASE(pixelCount, elementSize, settingsSize)
|
: T_BASE(pixelCount, elementSize, settingsSize)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
NeoEsp8266UartMethodBase(uint8_t pin, uint16_t pixelCount, size_t elementSize, size_t settingsSize)
|
NeoEsp8266UartMethodBase([[maybe_unused]] uint8_t pin, uint16_t pixelCount, size_t elementSize, size_t settingsSize)
|
||||||
: T_BASE(pixelCount, elementSize, settingsSize)
|
: T_BASE(pixelCount, elementSize, settingsSize)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user