Color interpolation effect
This commit is contained in:
@@ -26,6 +26,15 @@ public:
|
||||
data_[idx] = (g << 0) | (r << 8) | (b << 16) | (w << 24);
|
||||
}
|
||||
|
||||
void getRGBW(int idx, uint8_t &r, uint8_t &g, uint8_t &b, uint8_t &w)
|
||||
{
|
||||
idx = normalizeIdx(idx);
|
||||
g = (data_[idx] >> 0) & 0xff;
|
||||
r = (data_[idx] >> 8) & 0xff;
|
||||
b = (data_[idx] >> 16) & 0xff;
|
||||
w = (data_[idx] >> 24) & 0xff;
|
||||
}
|
||||
|
||||
const uint32_t *rawData() const { return data_; }
|
||||
constexpr static int numLeds() { return TNumLeds; }
|
||||
|
||||
@@ -89,4 +98,12 @@ void clear(LedStripRGBW<TNumLeds> &s)
|
||||
{
|
||||
for (int i = 0; i < TNumLeds; ++i)
|
||||
s.set(i, 0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
template <int TNumLeds>
|
||||
ColorRGBW getLedRGBW(LedStripRGBW<TNumLeds> &s, int idx)
|
||||
{
|
||||
ColorRGBW res;
|
||||
s.getRGBW(idx, res.r, res.g, res.b, res.w);
|
||||
return res;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user