forked from Makuna/NeoPixelBus
FiveByteFeature (#765)
This commit is contained in:
@@ -36,6 +36,7 @@ License along with NeoPixel. If not, see
|
||||
#include "features/Neo3ByteFeature.h"
|
||||
#include "features/Neo3Byte777Feature.h"
|
||||
#include "features/Neo4ByteFeature.h"
|
||||
#include "features/Neo5ByteFeature.h"
|
||||
#include "features/DotStarX4ByteFeature.h"
|
||||
#include "features/DotStarL4ByteFeature.h"
|
||||
#include "features/Neo6ByteFeature.h"
|
||||
@@ -49,6 +50,7 @@ License along with NeoPixel. If not, see
|
||||
//
|
||||
#include "features/NeoRgbFeatures.h"
|
||||
#include "features/NeoRgbwFeatures.h"
|
||||
#include "features/NeoRgbwwFeatures.h"
|
||||
#include "features/NeoRgb48Features.h"
|
||||
#include "features/NeoRgbw64Features.h"
|
||||
|
||||
|
72
src/internal/features/Neo5ByteFeature.h
Normal file
72
src/internal/features/Neo5ByteFeature.h
Normal file
@@ -0,0 +1,72 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
Neo5ByteFeature provides feature base class to describe color order for
|
||||
5 byte features that all 5 bytes are used
|
||||
|
||||
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
|
||||
|
||||
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>
|
||||
class Neo5ByteFeature :
|
||||
public NeoByteElements<5, RgbwwColor, uint8_t>
|
||||
{
|
||||
public:
|
||||
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
||||
{
|
||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
||||
|
||||
*p++ = color[V_IC_1];
|
||||
*p++ = color[V_IC_2];
|
||||
*p++ = color[V_IC_3];
|
||||
*p++ = color[V_IC_4];
|
||||
*p = color[V_IC_5];
|
||||
}
|
||||
|
||||
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
||||
{
|
||||
ColorObject color;
|
||||
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
||||
|
||||
color[V_IC_1] = *p++;
|
||||
color[V_IC_2] = *p++;
|
||||
color[V_IC_3] = *p++;
|
||||
color[V_IC_4] = *p++;
|
||||
color[V_IC_5] = *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[V_IC_1] = pgm_read_byte(p++);
|
||||
color[V_IC_2] = pgm_read_byte(p++);
|
||||
color[V_IC_3] = pgm_read_byte(p++);
|
||||
color[V_IC_4] = pgm_read_byte(p++);
|
||||
color[V_IC_5] = pgm_read_byte(p);
|
||||
|
||||
return color;
|
||||
}
|
||||
};
|
51
src/internal/features/NeoRgbwwFeatures.h
Normal file
51
src/internal/features/NeoRgbwwFeatures.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
NeoRgbwwFeature 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 NeoGrbwwFeature :
|
||||
public Neo5ByteFeature<ColorIndexG, ColorIndexR, ColorIndexB, ColorIndexW1, ColorIndexW2>,
|
||||
public NeoElementsNoSettings
|
||||
{
|
||||
};
|
||||
|
||||
class NeoGbrwwFeature :
|
||||
public Neo5ByteFeature<ColorIndexG, ColorIndexB, ColorIndexR, ColorIndexW1, ColorIndexW2>,
|
||||
public NeoElementsNoSettings
|
||||
{
|
||||
};
|
||||
|
||||
class NeoRgbwwFeature :
|
||||
public Neo5ByteFeature<ColorIndexR, ColorIndexG, ColorIndexB, ColorIndexW1, ColorIndexW2>,
|
||||
public NeoElementsNoSettings
|
||||
{
|
||||
};
|
||||
|
||||
class NeoRbgwwFeature :
|
||||
public Neo5ByteFeature<ColorIndexR, ColorIndexB, ColorIndexG, ColorIndexW1, ColorIndexW2>,
|
||||
public NeoElementsNoSettings
|
||||
{
|
||||
};
|
Reference in New Issue
Block a user