I like documentation in comments. Here's my config file with lots of comments added for all the templates for the presets, color names, etc.
#ifdef CONFIG_TOP
#include "v3_config.h"
// Number of simultaneously connected blades. (For interchangeable blades, see the blades[] array.)
#define NUM_BLADES 1
// Number of buttons
#define NUM_BUTTONS 1
// Dual power buttons means that clicking AUX will also turn the saber on. If not defined, AUX will go to next preset when off.
// #define DUAL_POWER_BUTTONS
// Volume, useful range is about 0-2000.
#define VOLUME 1000
// Number of LEDs connected together in the blade.
// If you have two 144 LED/m strips in your blade, connect both of them to bladePin and drive them in parallel.
const unsigned int maxLedsPerStrip = 81;
// This defines how sensetive the clash detection is.
#define CLASH_THRESHOLD_G 1.2
// If the TeensySaber is backward (SD card toward blade), define this. The drag effect won't work if this is wrong.
// #define INVERT_X
// Define this if your power button is a touch button.
// #define POWER_TOUCHBUTTON_SENSITIVITY 1700
// #define AUX_TOUCHBUTTON_SENSITIVITY 1700
// #define AUX2_TOUCHBUTTON_SENSITIVITY 1700
// For V1 electronics, there is an external pullup resistor to measure battery voltage. This specifies how many Ohms it is.
#define BATTERY_PULLUP_OHMS 23000
// If your electonics inverts the bladePin for some reason, define this.
// #define INVERT_WS2811
// Feature defines, these let you turn off large blocks of code used for debugging.
#define ENABLE_AUDIO
#define ENABLE_MOTION
// #define ENABLE_SNOOZE
#define ENABLE_WS2811
// FASTLED is experimental and untested right now
// #define ENABLE_FASTLED
// #define ENABLE_WATCHDOG
#define ENABLE_SD
// #define ENABLE_SERIALFLASH
#define ENABLE_SERIAL
#endif // CONFIG_TOP
#ifdef CONFIG_PRESETS
// *** CONFIGURABLE ***
// PRESETS
// Each preset line consists of:
// { "font directory", "sound track", Style, "name" },
// The first entry is a directory containing a sound font.
// The second entry is a sound track that can be played in the background.
// The third entry is a BladeStyle pointer, which specifies what the blade will actually look like.
// The forth entry is an optional name for the preset.
// Style may be one of these standard styles:
// StyleNormalPtr<BaseColor, FlashColor, out millis, in millis>()
// StyleFirePtr<LowHeatColor, HighHeatColor>()
// StyleRainBowPtr<out millis, in millis>()
// StyleStrobePtr<BaseColor, FlashColor, out millis, in millis>()
// &style_charging
// Or Style may be a template built of these components:
// Rgb<R, G, B> - Solid 8-bit color. (Rgb<255,255,255> is white)
// Rgb16<R, G, B> - Solid 16-bit color. (Rgb<65536,65536,65536> is white)
// Gradient<BASE_COLOR, TIP_COLOR> - smooth fade from base to tip
// Rainbow - scrolling RGB rainbow
// Pulsing<COLOR1, COLOR2, pulse_millis> - smoothly translate between COLOR1 and COLOR2 every pulse_millis.
// RandomFlicker<COLOR1, COLOR2> - Randomly mixes between COLOR1 and COLOR2, mix is even over entire blade.
// RandomPerLEDFlicker<COLOR1, COLOR2> - Randomly mixes between COLOR1 and COLOR2, mix is different for each LED.
// AudioFlicker<COLOR1, COLOR2> - Like RandomFlicker, but chooses based on audio, quiet audio means more COLOR1, loud audio means more COLOR2. The choice is made based on a single sample to make it flickery.
// OnSpark<COLOR, SPARK_COLOR, MILLIS> - Normally defaults to "COLOR", but right as you turn on the saber, it uses SPARK_COLOR, then fads back to COLOR.
// SimpleClash<COLOR, CLASH_COLOR, CLASH_MILLIS> - Normally defaults to "COLOR", but when you whack the saber, it will use CLASH_COLOR for CLASH_MILLIS millseconds.
// Lockup<COLOR, LOCKUP_COLOR> - Normally uses "COLOR", but during lockup, use "LOCKUP_COLOR" instead.
// Strobe<COLOR, STROBE_COLOR, FREQUENCY, STROBE_MILLIS> - Similar to SimpleClash, but flickers at a fixed frequency.
// InOutHelper<COLOR, OUT_MILLIS, IN_MILLIS> - Makes part of the blade black to make in/out/on/off work the way you expect.
// InOutSparkTip<COLOR, OUT_MILLIS, IN_MILLIS, SPARK_COLOR> - Similar to InOutHelper, but as the blade is extended, the part closest to the tip will be SPARK_COLOR. (usually white)
// BrownNoiseFlicker<COLOR1, COLOR2, GRADE> - Randomly selects between COLOR1 and COLOR2, but keeps nearby pixels looking similar.
// HumpFlicker<COLOR1, COLOR2, HUMP_WIDTH> - Makes a random "hump" which is about 2xHUMP_WIDTH leds wide.
// RGBCycle - Very fast Red, Green, Blue cycle, result should essentially be white until you start swinging it around.
// EasyBlade<COLOR, CLASH_COLOR> = SimpleClash<Lockup<Blast<COLOR, WHITE>, AudioFlicker<COLOR, WHITE> >, CLASH_COLOR>;
// StylePtr<COLOR> - Converts one of the templates from above to a BladeStylePtr so you can use it in a preset array.
// Now here's the really cool part: Anywhere where you can specify a color above, you can also specify a component, making a LOT of combinations possible.
// All colors can be specified as three numbers or using one the handy macros below.
// If you wish to have different presets for different blades, copy this array and
// name it something other than "preset", then use the new name inside the blade
// configuration array below. See "simple_presets" and "charging_presets"
// below for examples.
// Basic color macros: RED, GREEN, BLUE, YELLOW, CYAN, MAGENTA, WHITE, GRAY, BLACK
// Extended color macros: AliceBlue, Aqua, Aquamarine, Azure, Bisque, Black, BlanchedAlmond, Blue
// Chartreuse, Coral, Cornsilk, Cyan, DarkOrange, DeepPink, DeepSkyBlue, DodgerBlue
// FloralWhite, Fuchsia, GhostWhite, Green, GreenYellow, HoneyDew, HotPink, Ivory
// LavenderBlush, LemonChiffon, LightCyan, LightPink, LightSalmon, LightYellow, Lime
// Magenta, MintCream, MistyRose, Moccasin, NavajoWhite, Orange, OrangeRed
// PapayaWhip, PeachPuff, Pink, Red, SeaShell, Snow, SpringGreen, SteelBlue
// Tomato, White, Yellow
Preset presets[] = {
{ "f-stndrd", "tracks/cantina.wav", StylePtr<InOutSparkTip<EasyBlade<BLUE, WHITE>, 300, 800> >(), "blue" },
{ "f-stndrd", "tracks/track.wav", StyleNormalPtr<RED, WHITE, 300, 800>(), "red" },
{ "f-stndrd", "tracks/cantina.wav", StylePtr<InOutSparkTip<EasyBlade<DarkOrange, YELLOW>, 300, 800> >(), "orange" },
{ "f-stndrd", "tracks/swtheme.wav", StyleNormalPtr<CYAN, WHITE, 300, 800>(), "cyan" },
{ "f-stndrd", "tracks/cantina.wav", StylePtr<InOutSparkTip<EasyBlade<BLUE, WHITE>, 300, 800> >(), "blue" },
{ "f-stndrd", "tracks/track.wav", StylePtr<InOutHelper<EasyBlade<OnSpark<GREEN>, WHITE>, 300, 800> >(), "green" },
{ "f-stndrd", "tracks/impmarch.wav", StyleFirePtr<RED, YELLOW>(), "fire" },
{ "f-stndrd", "tracks/track.wav", StyleFirePtr<BLUE, CYAN>(), "blue fire" },
{ "f-stndrd", "tracks/track.wav", StyleNormalPtr<WHITE, RED, 300, 800, RED>(), "white" },
{ "f-stndrd", "tracks/track.wav", StyleNormalPtr<AudioFlicker<YELLOW, WHITE>, BLUE, 300, 800>(), "yellow" },
{ "f-stndrd", "tracks/cantina.wav", StyleRainbowPtr<300, 800>(), "rainbow" },
{ "f-stndrd", "tracks/track.wav", StylePtr<InOutSparkTip<EasyBlade<MAGENTA, WHITE>, 300, 800> >(), "magenta" },
{ "f-stndrd", "tracks/track.wav", StyleStrobePtr<WHITE, Rainbow, 15, 300, 800>(), "strobe"},
// { "f-stndrd", "tracks/track.wav", &style_pov, "POV"},
{ "f-stndrd", "tracks/track.wav", &style_charging, "Battery\nLevel"},
{ "charging", "tracks/duel.wav", &style_charging, "battery" },
};
Preset charging_presets[] = {
{ "charging", "", &style_charging },
};
// WS2811_800kHz 0x00 // Nearly all WS2811 are 800 kHz
// WS2811_400kHz 0x10 // Adafruit's Flora Pixels
// WS2813_800kHz 0x20 // WS2813 are close to 800 kHz but has 300 us frame set delay
// WS2811_580kHz 0x30 // PL9823
// WS2811_ACTUALLY_800kHz 0x40 // Normally we use 740kHz instead of 800, this uses 800.
// WS2811_RGB // The WS2811 datasheet documents this way
// WS2811_RBG
// WS2811_GRB // Most LED strips are wired this way
// WS2811_GBR
BladeConfig blades[] = {
// PL9823 blade. Resistor is 2.6k but is measuring way higher. Blade measures: ID: 680 volts 2.19 resistance= 65232.56, ID: 708 volts 2.28 resistance= 73936.70
{ 65000, WS2811BladePtr<maxLedsPerStrip, WS2811_580kHz | WS2811_RGB>(), CONFIGARRAY(presets) },
// Charging adapter, single PL9823 LED. Charger measures: ID: 489 volts 1.58 resistance= 30162.62
{ 30000, WS2811BladePtr<1, WS2811_580kHz | WS2811_RGB>(), CONFIGARRAY(charging_presets) },
// For testing (makes the charging blade behave like a normal blade.)
// { 30000, WS2811BladePtr<1, WS2811_580kHz | WS2811_RGB>(), CONFIGARRAY(presets) },
};
#endif // CONFIG_PRESETS
#ifdef CONFIG_BUTTONS
Button PowerButton(BUTTON_POWER, powerButtonPin, "pow");
// TouchButton PowerButton(BUTTON_POWER, powerButtonPin, 1700, "pow");
// Button AuxButton(BUTTON_AUX, auxPin, "aux");
#endif