forked from Makuna/NeoPixelBus
buffer examples rework
This commit is contained in:
@@ -16,28 +16,23 @@
|
|||||||
|
|
||||||
const int chipSelect = 8; // make sure to set this to your SD carder reader CS
|
const int chipSelect = 8; // make sure to set this to your SD carder reader CS
|
||||||
|
|
||||||
//typedef NeoGrbFeature MyPixelColorFeature;
|
|
||||||
typedef NeoGrbwFeature MyPixelColorFeature;
|
|
||||||
|
|
||||||
const uint16_t PixelCount = 144; // the sample images are meant for 144 pixels
|
const uint16_t PixelCount = 144; // the sample images are meant for 144 pixels
|
||||||
const uint16_t PixelPin = 2;
|
const uint16_t PixelPin = 2; // for esp8266 the pin is ignored with most methods
|
||||||
const uint16_t AnimCount = 1; // we only need one
|
const uint16_t AnimCount = 1; // we only need one
|
||||||
|
|
||||||
NeoPixelBus<MyPixelColorFeature, NeoWs2812xMethod> strip(PixelCount, PixelPin);
|
NeoPixelBus<NeoGrbFeature, NeoWs2812xMethod> strip(PixelCount, PixelPin);
|
||||||
// for esp8266 omit the pin
|
|
||||||
//NeoPixelBus<MyPixelColorFeature, NeoWs2812xMethod> strip(PixelCount);
|
|
||||||
NeoPixelAnimator animations(AnimCount); // NeoPixel animation management object
|
NeoPixelAnimator animations(AnimCount); // NeoPixel animation management object
|
||||||
|
|
||||||
// our NeoBitmapFile will use the same color feature as NeoPixelBus and
|
// our NeoBitmapFile will use the RgbColor
|
||||||
// we want it to use the SD File object
|
NeoBitmapFile<RgbColor, File> image;
|
||||||
NeoBitmapFile<MyPixelColorFeature::ColorObject, File> image;
|
|
||||||
|
|
||||||
|
// animation state
|
||||||
uint16_t animState;
|
uint16_t animState;
|
||||||
|
|
||||||
void LoopAnimUpdate(const AnimationParam& param)
|
void LoopAnimUpdate(const AnimationParam& param)
|
||||||
{
|
{
|
||||||
// wait for this animation to complete,
|
// wait for this animation to complete,
|
||||||
// we are using it as a timer of sorts
|
// we are using it as a timer
|
||||||
if (param.state == AnimationState_Completed)
|
if (param.state == AnimationState_Completed)
|
||||||
{
|
{
|
||||||
// done, time to restart this position tracking animation/timer
|
// done, time to restart this position tracking animation/timer
|
||||||
@@ -49,7 +44,8 @@ void LoopAnimUpdate(const AnimationParam& param)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup() {
|
void setup()
|
||||||
|
{
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
while (!Serial); // wait for serial attach
|
while (!Serial); // wait for serial attach
|
||||||
|
|
||||||
@@ -89,10 +85,11 @@ void setup() {
|
|||||||
animations.StartAnimation(0, 30, LoopAnimUpdate);
|
animations.StartAnimation(0, 30, LoopAnimUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop()
|
||||||
|
{
|
||||||
// this is all that is needed to keep it running
|
// this is all that is needed to keep it running
|
||||||
// and avoiding using delay() is always a good thing for
|
// and avoiding using delay() is always a good thing for
|
||||||
// any timing related routines
|
// any timing related solutions
|
||||||
animations.UpdateAnimations();
|
animations.UpdateAnimations();
|
||||||
strip.Show();
|
strip.Show();
|
||||||
}
|
}
|
@@ -1,30 +0,0 @@
|
|||||||
// To recreate the data below, use the Paint.Net plugin "Arduino Progmem NeoPixel FileType"
|
|
||||||
// to save as/export the included Cylon.pdn
|
|
||||||
// Paint.Net - http://www.getpaint.net/download.html#download
|
|
||||||
// Plugin - http://forums.getpaint.net/index.php?/topic/107921-arduino-neopixel-sketch-exporter/
|
|
||||||
// This uses Flatten, GRBW, Hexadecimal
|
|
||||||
//
|
|
||||||
|
|
||||||
const uint16_t myImageWidth = 16;
|
|
||||||
const uint16_t myImageHeight = 20;
|
|
||||||
const uint8_t PROGMEM myImage[] = { // (16 x 20) GRBW in Hexadecimal
|
|
||||||
0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x3f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
|
@@ -1,6 +1,6 @@
|
|||||||
// NeoPixelBufferShader
|
// NeoPixelBufferShader
|
||||||
// This example will provide a shader class to the NeoPixelBuffer that will dim and brighten
|
// This example will provide a shader class to the NeoPixelBuffer that will dim and brighten
|
||||||
// the pixels that are in the buffer (a device independant bitmap)
|
// the pixels that are in the buffer
|
||||||
// It is just a demonstration of using a custom shader
|
// It is just a demonstration of using a custom shader
|
||||||
|
|
||||||
#include <NeoPixelBus.h>
|
#include <NeoPixelBus.h>
|
||||||
@@ -11,10 +11,10 @@ const uint8_t PixelPin = 2; // make sure to set this to the correct pin, ignore
|
|||||||
// three element GRB pixels, change to your needs
|
// three element GRB pixels, change to your needs
|
||||||
NeoPixelBus<NeoGrbFeature, NeoWs2812xMethod> strip(PixelCount, PixelPin);
|
NeoPixelBus<NeoGrbFeature, NeoWs2812xMethod> strip(PixelCount, PixelPin);
|
||||||
|
|
||||||
// the buffer object,
|
// the buffer object, a NeoDib
|
||||||
// defined to use memory with the same feature as the strip
|
// defined to use memory with the same color object as the strip
|
||||||
// initialized with the same number of pixels as our strip
|
// initialized with the same number of pixels as our strip
|
||||||
NeoBuffer<NeoBufferMethod<RgbColor>> image(8, 8, NULL);
|
NeoDib<RgbColor> image(8, 8, NULL);
|
||||||
|
|
||||||
const RgbColor BrightRed(255, 0, 0);
|
const RgbColor BrightRed(255, 0, 0);
|
||||||
const RgbColor BrightGreen(0, 255, 0);
|
const RgbColor BrightGreen(0, 255, 0);
|
||||||
@@ -45,11 +45,11 @@ public:
|
|||||||
|
|
||||||
// required for a shader object, it will be called for
|
// required for a shader object, it will be called for
|
||||||
// every pixel
|
// every pixel
|
||||||
RgbColor Apply(const RgbColor& color)
|
RgbColor Apply(const RgbColor& colorSrc, [[maybe_unused]] const RgbColor& colorDest)
|
||||||
{
|
{
|
||||||
// to apply our brightness shader,
|
// to apply our brightness shader,
|
||||||
// use the source color, modify, and return it
|
// use the source color, modify, and return it
|
||||||
return color.Dim(_brightness);
|
return colorSrc.Dim(_brightness);
|
||||||
}
|
}
|
||||||
|
|
||||||
// provide an accessor to set brightness
|
// provide an accessor to set brightness
|
||||||
|
@@ -2,29 +2,31 @@
|
|||||||
// to save as/export the included Cylon.pdn
|
// to save as/export the included Cylon.pdn
|
||||||
// Paint.Net - http://www.getpaint.net/download.html#download
|
// Paint.Net - http://www.getpaint.net/download.html#download
|
||||||
// Plugin - http://forums.getpaint.net/index.php?/topic/107921-arduino-neopixel-sketch-exporter/
|
// Plugin - http://forums.getpaint.net/index.php?/topic/107921-arduino-neopixel-sketch-exporter/
|
||||||
// This uses Flatten, GRB, Hexadecimal
|
// This uses Flatten, RGB, Hexadecimal
|
||||||
//
|
//
|
||||||
|
|
||||||
const uint16_t myImageWidth = 16;
|
const uint16_t myImageWidth = 16;
|
||||||
const uint16_t myImageHeight = 20;
|
const uint16_t myImageHeight = 20;
|
||||||
const uint8_t PROGMEM myImage[] = { // (16 x 20) GRB in Hexadecimal
|
const uint8_t PROGMEM myImage[] = { // (16 x 20) RGB in Hexadecimal
|
||||||
0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
// R0 G0 B0 R1 G1 B1 R2 G2 B2 R3 G3 B3 R4 G4 B4 R5 G5 B5 R6 G6 B6 R7 G7 B7 R8 G8 B8 R9 G9 B9 R10 G10 B10 R11 G11 B11 R12 G12 B12 R13 G13 B13 R14 G14 B14 R15 G15 B15
|
||||||
0x00, 0x3f, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x7f, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x3f, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x7f, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x7f, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x7f, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x7f, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x7f, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x7f, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x7f, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x7f, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x7f, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x7f, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x7f, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x3f, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0xff, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x3f, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0xff, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0xff, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0xff, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0xff, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0xff, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0xff, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0xff, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0xff, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0xff, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||||
|
};
|
@@ -1,45 +1,37 @@
|
|||||||
// NeoPixelBufferCylon
|
// NeoPixelSpriteSheet
|
||||||
// This example will move a Cylon Red Eye back and forth across the
|
// This example will use a NeoVerticalSpriteSheet to animate a
|
||||||
|
// moving Cylon Red Eye back and forth across the
|
||||||
// the full collection of pixels on the strip.
|
// the full collection of pixels on the strip.
|
||||||
//
|
//
|
||||||
// This will demonstrate the use of the NeoVerticalSpriteSheet
|
|
||||||
//
|
|
||||||
|
|
||||||
#include <NeoPixelBus.h>
|
#include <NeoPixelBus.h>
|
||||||
#include <NeoPixelAnimator.h>
|
#include <NeoPixelAnimator.h>
|
||||||
|
|
||||||
// The actual image is contained in the data structure in one of the Cylon*.h files
|
// The actual image is contained in the data structure in the CylonRgb.h file
|
||||||
// You will need to use the one that has the same color feature as your NeoPixelBus
|
#include "CylonRgb.h"
|
||||||
// There are two provided, but you can create your own easily enough using
|
|
||||||
// free versions of Paint.Net and the plugin
|
|
||||||
#include "CylonGrb.h"
|
|
||||||
typedef NeoGrbFeature MyPixelColorFeature;
|
|
||||||
|
|
||||||
// #include "CylonGrbw.h"
|
const uint16_t PixelCount = myImageWidth; // the sample images are meant for 16 pixels, so we use the same for pixelcount
|
||||||
// typedef NeoGrbwFeature MyPixelColorFeature;
|
const uint16_t PixelPin = 2; // for esp8266 the pin is ignored in most methods
|
||||||
|
|
||||||
const uint16_t PixelCount = 16; // the sample images are meant for 16 pixels
|
|
||||||
const uint16_t PixelPin = 2;
|
|
||||||
const uint16_t AnimCount = 1; // we only need one
|
const uint16_t AnimCount = 1; // we only need one
|
||||||
|
|
||||||
NeoPixelBus<MyPixelColorFeature, NeoWs2812xMethod> strip(PixelCount, PixelPin);
|
NeoPixelBus<NeoGrbFeature, NeoWs2812xMethod> strip(PixelCount, PixelPin);
|
||||||
// for esp8266 omit the pin
|
|
||||||
//NeoPixelBus<MyPixelColorFeature, NeoWs2812xMethod> strip(PixelCount);
|
|
||||||
NeoPixelAnimator animations(AnimCount); // NeoPixel animation management object
|
NeoPixelAnimator animations(AnimCount); // NeoPixel animation management object
|
||||||
|
|
||||||
// sprite sheet stored in progmem using the same pixel feature as the NeoPixelBus
|
// sprite sheet stored in progmem using the same pixel feature as the NeoPixelBus
|
||||||
NeoVerticalSpriteSheet<NeoBufferProgmemMethod<MyPixelColorFeature::ColorObject>> spriteSheet(
|
NeoVerticalSpriteSheet_P<RgbColor> spriteSheet(
|
||||||
myImageWidth, // image width and sprite width since its vertical sprite sheet
|
myImageWidth, // image width and sprite width since its vertical sprite sheet
|
||||||
myImageHeight, // image height
|
myImageHeight, // image height
|
||||||
1, // sprite is only one pixel high
|
1, // sprite is only one pixel high in this example
|
||||||
myImage);
|
myImage);
|
||||||
|
|
||||||
|
// animation state
|
||||||
uint16_t indexSprite;
|
uint16_t indexSprite;
|
||||||
|
|
||||||
void LoopAnimUpdate(const AnimationParam& param)
|
void LoopAnimUpdate(const AnimationParam& param)
|
||||||
{
|
{
|
||||||
// wait for this animation to complete,
|
// wait for this animation to complete,
|
||||||
// we are using it as a timer of sorts
|
// we are using it as a timer
|
||||||
if (param.state == AnimationState_Completed)
|
if (param.state == AnimationState_Completed)
|
||||||
{
|
{
|
||||||
// done, time to restart this position tracking animation/timer
|
// done, time to restart this position tracking animation/timer
|
||||||
@@ -67,7 +59,7 @@ void loop()
|
|||||||
{
|
{
|
||||||
// this is all that is needed to keep it running
|
// this is all that is needed to keep it running
|
||||||
// and avoiding using delay() is always a good thing for
|
// and avoiding using delay() is always a good thing for
|
||||||
// any timing related routines
|
// any timing related solutions
|
||||||
animations.UpdateAnimations();
|
animations.UpdateAnimations();
|
||||||
strip.Show();
|
strip.Show();
|
||||||
}
|
}
|
@@ -63,15 +63,11 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
SevenSegDigit Apply(uint16_t indexDigit, SevenSegDigit digit)
|
SevenSegDigit Apply(const SevenSegDigit& digitSrcA, const SevenSegDigit& digitSrcB)
|
||||||
{
|
{
|
||||||
// since we call EndingDigits.Render below, the digit argument is
|
|
||||||
// from the EndingDigits so no need to call GetPixelColor to get it
|
|
||||||
// create a digit that is a blend between the last seconds
|
|
||||||
// value and the next seconds value using the BlendAmount
|
|
||||||
SevenSegDigit blendDigit = SevenSegDigit::LinearBlend(
|
SevenSegDigit blendDigit = SevenSegDigit::LinearBlend(
|
||||||
StartingDigits.GetPixelColor(indexDigit),
|
digitSrcA,
|
||||||
digit,
|
digitSrcB,
|
||||||
BlendAmount);
|
BlendAmount);
|
||||||
|
|
||||||
return blendDigit;
|
return blendDigit;
|
||||||
@@ -88,7 +84,8 @@ void FadeAnimation(const AnimationParam& param)
|
|||||||
// set the shader property BlendAmount to the animation progress
|
// set the shader property BlendAmount to the animation progress
|
||||||
blendShader.BlendAmount = param.progress;
|
blendShader.BlendAmount = param.progress;
|
||||||
// apply it to the strip at the SecondsDigit location
|
// apply it to the strip at the SecondsDigit location
|
||||||
EndingDigits.Render<SevenSegmentFeature, DigitBlendShader>(strip,
|
StartingDigits.Render<SevenSegDigit, DigitBlendShader>(strip,
|
||||||
|
EndingDigits, // using a second source
|
||||||
blendShader,
|
blendShader,
|
||||||
SecondsDigit);
|
SecondsDigit);
|
||||||
}
|
}
|
||||||
|
@@ -214,7 +214,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (readPixel(&color))
|
if (readPixel(&color))
|
||||||
{
|
{
|
||||||
color = shader.Apply(color);
|
color = shader.Apply(color, destBuffer.Pixels[indexPixel]);
|
||||||
xSrc++;
|
xSrc++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -230,9 +230,9 @@ public:
|
|||||||
int16_t ySrc,
|
int16_t ySrc,
|
||||||
int16_t wSrc)
|
int16_t wSrc)
|
||||||
{
|
{
|
||||||
NeoShaderNop<T_COLOR_OBJECT, T_COLOR_OBJECT> shaderNop;
|
NeoShaderNop<T_COLOR_OBJECT> shaderNop;
|
||||||
|
|
||||||
Render<NeoShaderNop<T_COLOR_OBJECT, T_COLOR_OBJECT>>(destBuffer, shaderNop, indexPixel, xSrc, ySrc, wSrc);
|
Render<NeoShaderNop<T_COLOR_OBJECT>>(destBuffer, shaderNop, indexPixel, xSrc, ySrc, wSrc);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T_SHADER> void Render(NeoBufferContext<T_COLOR_OBJECT> destBuffer,
|
template <typename T_SHADER> void Render(NeoBufferContext<T_COLOR_OBJECT> destBuffer,
|
||||||
@@ -261,17 +261,16 @@ public:
|
|||||||
|
|
||||||
if (static_cast<uint16_t>(xFile) < _width)
|
if (static_cast<uint16_t>(xFile) < _width)
|
||||||
{
|
{
|
||||||
if (readPixel(&color))
|
if (indexDest < destPixelCount)
|
||||||
{
|
{
|
||||||
color = shader.Apply(indexDest, color);
|
if (readPixel(&color))
|
||||||
xFile++;
|
{
|
||||||
|
color = shader.Apply(color, destBuffer.Pixels[indexDest]);
|
||||||
|
xFile++;
|
||||||
|
}
|
||||||
|
destBuffer.Pixels[indexDest] = color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (indexDest < destPixelCount)
|
|
||||||
{
|
|
||||||
destBuffer.Pixels[indexDest] = color;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -286,9 +285,9 @@ public:
|
|||||||
int16_t hSrc,
|
int16_t hSrc,
|
||||||
LayoutMapCallback layoutMap)
|
LayoutMapCallback layoutMap)
|
||||||
{
|
{
|
||||||
NeoShaderNop<T_COLOR_OBJECT, T_COLOR_OBJECT> shaderNop;
|
NeoShaderNop<T_COLOR_OBJECT> shaderNop;
|
||||||
|
|
||||||
Render<NeoShaderNop<T_COLOR_OBJECT, T_COLOR_OBJECT>>(destBuffer,
|
Render<NeoShaderNop<T_COLOR_OBJECT>>(destBuffer,
|
||||||
shaderNop,
|
shaderNop,
|
||||||
xDest,
|
xDest,
|
||||||
yDest,
|
yDest,
|
||||||
|
@@ -157,7 +157,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename T_SHADER>
|
template <typename T_SHADER>
|
||||||
void Render(NeoBufferContext<typename T_BUFFER_METHOD::ColorObject> destBuffer, T_SHADER& shader)
|
void Render(NeoBufferContext<typename T_BUFFER_METHOD::ColorObject> destBuffer, T_SHADER& shader, uint16_t startIndex = 0)
|
||||||
{
|
{
|
||||||
uint16_t countPixels = destBuffer.PixelCount;
|
uint16_t countPixels = destBuffer.PixelCount;
|
||||||
|
|
||||||
@@ -169,7 +169,27 @@ public:
|
|||||||
for (uint16_t indexPixel = 0; indexPixel < countPixels; indexPixel++)
|
for (uint16_t indexPixel = 0; indexPixel < countPixels; indexPixel++)
|
||||||
{
|
{
|
||||||
typename T_BUFFER_METHOD::ColorObject color = _method.GetPixelColor(indexPixel);
|
typename T_BUFFER_METHOD::ColorObject color = _method.GetPixelColor(indexPixel);
|
||||||
destBuffer.Pixels[indexPixel] = shader.Apply(color);
|
destBuffer.Pixels[indexPixel + startIndex] = shader.Apply(color, destBuffer.Pixels[indexPixel + startIndex]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T_SHADER>
|
||||||
|
void Render(NeoBufferContext<typename T_BUFFER_METHOD::ColorObject> destBuffer,
|
||||||
|
NeoBufferContext<typename T_BUFFER_METHOD::ColorObject> srcBufferB,
|
||||||
|
T_SHADER& shader,
|
||||||
|
uint16_t startIndex = 0)
|
||||||
|
{
|
||||||
|
uint16_t countPixels = destBuffer.PixelCount;
|
||||||
|
|
||||||
|
if (countPixels > _method.PixelCount())
|
||||||
|
{
|
||||||
|
countPixels = _method.PixelCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (uint16_t indexPixel = 0; indexPixel < countPixels; indexPixel++)
|
||||||
|
{
|
||||||
|
typename T_BUFFER_METHOD::ColorObject color = _method.GetPixelColor(indexPixel);
|
||||||
|
destBuffer.Pixels[indexPixel + startIndex] = shader.Apply(color, srcBufferB.Pixels[indexPixel]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -192,3 +212,4 @@ public:
|
|||||||
private:
|
private:
|
||||||
T_BUFFER_METHOD _method;
|
T_BUFFER_METHOD _method;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -153,5 +153,16 @@ private:
|
|||||||
T_COLOR_OBJECT* _pixels;
|
T_COLOR_OBJECT* _pixels;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <typename T_COLOR_OBJECT>
|
||||||
|
class NeoDib : public NeoBuffer<NeoBufferMethod<T_COLOR_OBJECT>>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
NeoDib(uint16_t width,
|
||||||
|
uint16_t height = 1,
|
||||||
|
PGM_VOID_P pixels = nullptr) :
|
||||||
|
NeoBuffer<NeoBufferMethod<T_COLOR_OBJECT>>(width, height, pixels)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
@@ -112,3 +112,16 @@ private:
|
|||||||
const uint16_t _height;
|
const uint16_t _height;
|
||||||
PGM_VOID_P _pixels;
|
PGM_VOID_P _pixels;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <typename T_COLOR_OBJECT>
|
||||||
|
class NeoDib_P : public NeoBuffer<NeoBufferProgmemMethod<T_COLOR_OBJECT>>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
NeoDib_P(uint16_t width,
|
||||||
|
uint16_t height,
|
||||||
|
PGM_VOID_P pixels) :
|
||||||
|
NeoBuffer<NeoBufferProgmemMethod<T_COLOR_OBJECT>>(width, height, pixels)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
@@ -25,13 +25,23 @@ License along with NeoPixel. If not, see
|
|||||||
-------------------------------------------------------------------------*/
|
-------------------------------------------------------------------------*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
template <typename T_EXPOSED_COLOR_OBJECT, typename T_FEATURE_COLOR_OBJECT>
|
template <typename T_SRC_COLOR_OBJECT, typename T_DEST_COLOR_OBJECT = T_SRC_COLOR_OBJECT>
|
||||||
class NeoShaderNop
|
class NeoShaderNop
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static T_FEATURE_COLOR_OBJECT Apply(const T_EXPOSED_COLOR_OBJECT& color)
|
// This method signature is used by NeoPixelBus/NeoPixelBusLg where the
|
||||||
|
// destination color is never considered as its just not available
|
||||||
|
static T_DEST_COLOR_OBJECT Apply(const T_SRC_COLOR_OBJECT& color)
|
||||||
{
|
{
|
||||||
return color;
|
return color;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// This method segnature is used by Render methods where the
|
||||||
|
// colorSrcB color is either the previous destination color or a
|
||||||
|
// secondary source color
|
||||||
|
static T_DEST_COLOR_OBJECT Apply(const T_SRC_COLOR_OBJECT& colorSrc, [[maybe_unused]] const T_DEST_COLOR_OBJECT& colorAlternate)
|
||||||
|
{
|
||||||
|
return colorSrc;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -29,10 +29,10 @@ License along with NeoPixel. If not, see
|
|||||||
// NeoBufferMethod
|
// NeoBufferMethod
|
||||||
// NeoBufferProgmemMethod
|
// NeoBufferProgmemMethod
|
||||||
//
|
//
|
||||||
template<typename T_BUFFER_METHOD> class NeoVerticalSpriteSheet
|
template<typename T_BUFFER_METHOD> class NeoVerticalSpriteSheetBuffer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NeoVerticalSpriteSheet(uint16_t width,
|
NeoVerticalSpriteSheetBuffer(uint16_t width,
|
||||||
uint16_t height,
|
uint16_t height,
|
||||||
uint16_t spriteHeight,
|
uint16_t spriteHeight,
|
||||||
PGM_VOID_P pixels) :
|
PGM_VOID_P pixels) :
|
||||||
@@ -178,3 +178,29 @@ private:
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <typename T_COLOR_OBJECT>
|
||||||
|
class NeoVerticalSpriteSheet : public NeoVerticalSpriteSheetBuffer<NeoBufferMethod<T_COLOR_OBJECT>>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
NeoVerticalSpriteSheet(uint16_t width,
|
||||||
|
uint16_t height,
|
||||||
|
uint16_t spriteHeight,
|
||||||
|
PGM_VOID_P pixels) :
|
||||||
|
NeoVerticalSpriteSheetBuffer<NeoBufferMethod<T_COLOR_OBJECT>>(width, height, spriteHeight, pixels)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T_COLOR_OBJECT>
|
||||||
|
class NeoVerticalSpriteSheet_P : public NeoVerticalSpriteSheetBuffer<NeoBufferProgmemMethod<T_COLOR_OBJECT>>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
NeoVerticalSpriteSheet_P(uint16_t width,
|
||||||
|
uint16_t height,
|
||||||
|
uint16_t spriteHeight,
|
||||||
|
PGM_VOID_P pixels) :
|
||||||
|
NeoVerticalSpriteSheetBuffer<NeoBufferProgmemMethod<T_COLOR_OBJECT>>(width, height, spriteHeight, pixels)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
Reference in New Issue
Block a user