forked from Makuna/NeoPixelBus
const correctness (#334)
This commit is contained in:
@ -389,6 +389,12 @@ protected:
|
|||||||
return T_COLOR_FEATURE::pixels(_method.getData());
|
return T_COLOR_FEATURE::pixels(_method.getData());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const uint8_t* _pixels() const
|
||||||
|
{
|
||||||
|
// get pixels data within the data stream
|
||||||
|
return T_COLOR_FEATURE::pixels(_method.getData());
|
||||||
|
}
|
||||||
|
|
||||||
void _rotateLeft(uint16_t rotationCount, uint16_t first, uint16_t last)
|
void _rotateLeft(uint16_t rotationCount, uint16_t first, uint16_t last)
|
||||||
{
|
{
|
||||||
// store in temp
|
// store in temp
|
||||||
|
@ -175,6 +175,11 @@ public:
|
|||||||
{
|
{
|
||||||
return pData;
|
return pData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const uint8_t* pixels(const uint8_t* pData)
|
||||||
|
{
|
||||||
|
return pData;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class DotStar4ElementsNoSettings : public DotStar4Elements
|
class DotStar4ElementsNoSettings : public DotStar4Elements
|
||||||
@ -191,6 +196,11 @@ public:
|
|||||||
{
|
{
|
||||||
return pData;
|
return pData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const uint8_t* pixels(const uint8_t* pData)
|
||||||
|
{
|
||||||
|
return pData;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class DotStarBgrFeature : public DotStar3ElementsNoSettings
|
class DotStarBgrFeature : public DotStar3ElementsNoSettings
|
||||||
@ -206,10 +216,10 @@ public:
|
|||||||
*p = color.R;
|
*p = color.R;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
|
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
||||||
{
|
{
|
||||||
ColorObject color;
|
ColorObject color;
|
||||||
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.B = *p++;
|
||||||
@ -247,10 +257,10 @@ public:
|
|||||||
*p = color.R;
|
*p = color.R;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
|
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
||||||
{
|
{
|
||||||
ColorObject color;
|
ColorObject color;
|
||||||
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.B = *p++;
|
||||||
@ -288,10 +298,10 @@ public:
|
|||||||
*p = color.B;
|
*p = color.B;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
|
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
||||||
{
|
{
|
||||||
ColorObject color;
|
ColorObject color;
|
||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
||||||
|
|
||||||
p++; // ignore the first byte
|
p++; // ignore the first byte
|
||||||
color.G = *p++;
|
color.G = *p++;
|
||||||
@ -329,10 +339,10 @@ public:
|
|||||||
*p = color.B;
|
*p = color.B;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
|
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
||||||
{
|
{
|
||||||
ColorObject color;
|
ColorObject color;
|
||||||
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.G = *p++;
|
color.G = *p++;
|
||||||
@ -371,10 +381,10 @@ public:
|
|||||||
*p = color.B;
|
*p = color.B;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
|
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
||||||
{
|
{
|
||||||
ColorObject color;
|
ColorObject color;
|
||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
||||||
|
|
||||||
p++; // ignore the first byte
|
p++; // ignore the first byte
|
||||||
color.R = *p++;
|
color.R = *p++;
|
||||||
@ -412,10 +422,10 @@ public:
|
|||||||
*p = color.B;
|
*p = color.B;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
|
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
||||||
{
|
{
|
||||||
ColorObject color;
|
ColorObject color;
|
||||||
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.R = *p++;
|
color.R = *p++;
|
||||||
@ -453,10 +463,10 @@ public:
|
|||||||
*p = color.G;
|
*p = color.G;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
|
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
||||||
{
|
{
|
||||||
ColorObject color;
|
ColorObject color;
|
||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
||||||
|
|
||||||
p++; // ignore the first byte
|
p++; // ignore the first byte
|
||||||
color.R = *p++;
|
color.R = *p++;
|
||||||
@ -494,10 +504,10 @@ public:
|
|||||||
*p = color.G;
|
*p = color.G;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
|
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
||||||
{
|
{
|
||||||
ColorObject color;
|
ColorObject color;
|
||||||
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.R = *p++;
|
color.R = *p++;
|
||||||
@ -536,10 +546,10 @@ public:
|
|||||||
*p = color.R;
|
*p = color.R;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
|
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
||||||
{
|
{
|
||||||
ColorObject color;
|
ColorObject color;
|
||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
||||||
|
|
||||||
p++; // ignore the first byte
|
p++; // ignore the first byte
|
||||||
color.G = *p++;
|
color.G = *p++;
|
||||||
@ -577,10 +587,10 @@ public:
|
|||||||
*p = color.R;
|
*p = color.R;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
|
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
||||||
{
|
{
|
||||||
ColorObject color;
|
ColorObject color;
|
||||||
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.G = *p++;
|
color.G = *p++;
|
||||||
@ -618,10 +628,10 @@ public:
|
|||||||
*p = color.G;
|
*p = color.G;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
|
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
||||||
{
|
{
|
||||||
ColorObject color;
|
ColorObject color;
|
||||||
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.B = *p++;
|
||||||
@ -659,10 +669,10 @@ public:
|
|||||||
*p = color.G;
|
*p = color.G;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
|
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
||||||
{
|
{
|
||||||
ColorObject color;
|
ColorObject color;
|
||||||
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.B = *p++;
|
||||||
|
@ -101,10 +101,10 @@ public:
|
|||||||
*p = (color.G >> 1) | 0x80;
|
*p = (color.G >> 1) | 0x80;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
|
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
||||||
{
|
{
|
||||||
ColorObject color;
|
ColorObject color;
|
||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
||||||
|
|
||||||
color.B = (*p++) << 1;
|
color.B = (*p++) << 1;
|
||||||
color.R = (*p++) << 1;
|
color.R = (*p++) << 1;
|
||||||
@ -139,10 +139,10 @@ public:
|
|||||||
*p = (color.B >> 1) | 0x80;
|
*p = (color.B >> 1) | 0x80;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
|
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
||||||
{
|
{
|
||||||
ColorObject color;
|
ColorObject color;
|
||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
||||||
|
|
||||||
color.G = (*p++) << 1;
|
color.G = (*p++) << 1;
|
||||||
color.R = (*p++) << 1;
|
color.R = (*p++) << 1;
|
||||||
|
@ -162,6 +162,11 @@ public:
|
|||||||
{
|
{
|
||||||
return pData;
|
return pData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const uint8_t* pixels(const uint8_t* pData)
|
||||||
|
{
|
||||||
|
return pData;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class Neo4ElementsNoSettings : public Neo4Elements
|
class Neo4ElementsNoSettings : public Neo4Elements
|
||||||
@ -178,6 +183,11 @@ public:
|
|||||||
{
|
{
|
||||||
return pData;
|
return pData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const uint8_t* pixels(const uint8_t* pData)
|
||||||
|
{
|
||||||
|
return pData;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class NeoGrbFeature : public Neo3ElementsNoSettings
|
class NeoGrbFeature : public Neo3ElementsNoSettings
|
||||||
@ -192,10 +202,10 @@ public:
|
|||||||
*p = color.B;
|
*p = color.B;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
|
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
||||||
{
|
{
|
||||||
ColorObject color;
|
ColorObject color;
|
||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
||||||
|
|
||||||
color.G = *p++;
|
color.G = *p++;
|
||||||
color.R = *p++;
|
color.R = *p++;
|
||||||
@ -231,10 +241,10 @@ public:
|
|||||||
*p = color.W;
|
*p = color.W;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
|
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
||||||
{
|
{
|
||||||
ColorObject color;
|
ColorObject color;
|
||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
||||||
|
|
||||||
color.G = *p++;
|
color.G = *p++;
|
||||||
color.R = *p++;
|
color.R = *p++;
|
||||||
@ -273,10 +283,10 @@ public:
|
|||||||
*p = color.W;
|
*p = color.W;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
|
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
||||||
{
|
{
|
||||||
ColorObject color;
|
ColorObject color;
|
||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
||||||
|
|
||||||
color.R = *p++;
|
color.R = *p++;
|
||||||
color.G = *p++;
|
color.G = *p++;
|
||||||
@ -313,10 +323,10 @@ public:
|
|||||||
*p = color.B;
|
*p = color.B;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
|
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
||||||
{
|
{
|
||||||
ColorObject color;
|
ColorObject color;
|
||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
||||||
|
|
||||||
color.R = *p++;
|
color.R = *p++;
|
||||||
color.G = *p++;
|
color.G = *p++;
|
||||||
@ -351,10 +361,10 @@ public:
|
|||||||
*p = color.G;
|
*p = color.G;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
|
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
||||||
{
|
{
|
||||||
ColorObject color;
|
ColorObject color;
|
||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
||||||
|
|
||||||
color.B = *p++;
|
color.B = *p++;
|
||||||
color.R = *p++;
|
color.R = *p++;
|
||||||
@ -389,10 +399,10 @@ public:
|
|||||||
*p = color.G;
|
*p = color.G;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
|
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
||||||
{
|
{
|
||||||
ColorObject color;
|
ColorObject color;
|
||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
||||||
|
|
||||||
color.R = *p++;
|
color.R = *p++;
|
||||||
color.B = *p++;
|
color.B = *p++;
|
||||||
|
@ -98,10 +98,10 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
|
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
||||||
{
|
{
|
||||||
ColorObject color;
|
ColorObject color;
|
||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
||||||
uint8_t commonSize = (PixelSize < color.SegmentCount) ? PixelSize : color.SegmentCount;
|
uint8_t commonSize = (PixelSize < color.SegmentCount) ? PixelSize : color.SegmentCount;
|
||||||
|
|
||||||
for (uint8_t iSegment = 0; iSegment < commonSize; iSegment++)
|
for (uint8_t iSegment = 0; iSegment < commonSize; iSegment++)
|
||||||
|
@ -80,6 +80,11 @@ public:
|
|||||||
{
|
{
|
||||||
return pData + SettingsSize;
|
return pData + SettingsSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const uint8_t* pixels(const uint8_t* pData)
|
||||||
|
{
|
||||||
|
return pData;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -96,10 +101,10 @@ public:
|
|||||||
*p = color.B;
|
*p = color.B;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
|
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
|
||||||
{
|
{
|
||||||
ColorObject color;
|
ColorObject color;
|
||||||
uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
|
||||||
|
|
||||||
color.W = *p++;
|
color.W = *p++;
|
||||||
color.R = *p++;
|
color.R = *p++;
|
||||||
|
Reference in New Issue
Block a user