78 void init(uint32_t refreshMs = 20);
110 uint32_t bgColor = 0x000000,
bool invert =
false,
bool bounce =
false);
113 void flash(uint32_t color, uint32_t onMs, uint32_t offMs, uint32_t bgColor = 0x000000);
117 bool seamless =
true);
123 void twinkle(
const std::vector<uint32_t>& colors, uint8_t densityPct = 30,
124 uint8_t fadeStep = 16, uint32_t bgColor = 0x000000);
128 bool invert =
false, uint32_t bgColor = 0x000000,
bool bounce =
false,
129 uint8_t spacing = 5,
bool repeating =
true);
132 void levelFill(uint32_t color, uint32_t color2 = 0x000000,
bool gradient =
false,
133 uint32_t bgColor = 0x000000,
bool invert =
false);
140 uint8_t smoothing = 0);
147 bool gradient =
false, uint32_t bgColor = 0x000000,
bool invert =
false,
148 uint8_t sensitivity = 100,
bool loop =
false);
160 void spliceMask(uint8_t sections,
bool invert =
false,
bool alternating =
false,
161 uint32_t altPeriodMs = 100, uint32_t bgColor = 0x000000,
162 bool useOverlay =
false);
184 uint32_t bgColor = 0x000000);
188 uint32_t bgColor = 0x000000);
241 std::vector<LedStrand*> strands;
242 uint32_t refreshMs = 20;
243 bool initialized =
false;
244 bool started =
false;
251 static void taskEntry(
void* group);
254 template <
typename Fn>
255 void forEach(Fn fn) {
Owns a set of LedStrand pointers and fans all animation commands out to each strand simultaneously.
Definition led_group.hpp:43
void levelFill(uint32_t color, uint32_t color2=0x000000, bool gradient=false, uint32_t bgColor=0x000000, bool invert=false)
Configure the strip as a level meter, and take manual control of it.
void flow(uint32_t color1, uint32_t color2, LedStrand::Speed speed, bool invert=false, bool seamless=true)
Scroll a two-color gradient across the strip.
void setBrightness(uint8_t pct)
Set global brightness for this strand.
void overlayFlow(uint32_t color1, uint32_t color2, LedStrand::Speed speed, bool seamless=true)
Scroll a gradient in the overlay buffer.
void overlaySetColor(uint32_t color)
Set the overlay buffer to a solid color.
void twinkle(const std::vector< uint32_t > &colors, uint8_t densityPct=30, uint8_t fadeStep=16, uint32_t bgColor=0x000000)
Spawn randomly fading sparkles from a color palette.
void overlayPulse(uint32_t color, uint8_t runLength, LedStrand::Speed speed, uint32_t bgColor=0x000000)
Animate a moving run in the overlay buffer.
LedStrand * operator[](size_t i)
Access an individual strand by index.
void levelSource(LedStrand::LevelFn read, double emptyAt, double fullAt, bool wrap=false, uint8_t smoothing=0)
Point the meter at a live value and let it follow it on its own.
void musicSync(const LedStrand::MusicTrack &track, uint32_t color, uint32_t color2=0x000000, bool gradient=false, uint32_t bgColor=0x000000, bool invert=false, uint8_t sensitivity=100, bool loop=false)
Fill the meter from a baked music envelope, and start playing it.
void setColor(uint32_t color)
Set all LEDs to a solid color.
void off()
Turn all LEDs off (set to black).
void overlayFlash(uint32_t color, uint32_t onMs, uint32_t offMs, uint32_t bgColor=0x000000)
Blink the overlay buffer on and off (see flash()).
void spliceMask(uint8_t sections, bool invert=false, bool alternating=false, uint32_t altPeriodMs=100, uint32_t bgColor=0x000000, bool useOverlay=false)
Apply a splice mask that overrides alternating equal-width bins.
size_t size() const
Return the number of strands in this group.
void overlayRainbow(LedStrand::Speed speed)
Scroll a rainbow in the overlay buffer.
void rainbow(LedStrand::Speed speed)
Scroll a full HSV rainbow across the strip.
void add(LedStrand *strand)
Register a strand with this group.
void init(uint32_t refreshMs=20)
Initialize hardware on all registered strands.
void pulse(uint32_t color, uint8_t runLength, LedStrand::Speed speed, uint32_t bgColor=0x000000, bool invert=false, bool bounce=false)
Animate a run of color moving across a background.
void bitscroll(const std::vector< LedStrand::BitScrollSegment > &segments, LedStrand::Speed speed, bool invert=false, uint32_t bgColor=0x000000, bool bounce=false, uint8_t spacing=5, bool repeating=true)
Scroll a pattern of colored segments across the strip.
void spliceMaskCustom(const std::vector< LedStrand::SpliceRegion > ®ions)
Apply a splice mask made of independently placed/sized regions, each running its own animation.
void setLevel(uint8_t level)
Set how full the meter is.
void attachProfile(const Profile *profile)
Attach a Profile and reset the mode stack.
void setSensitivity(uint8_t pct)
Change the gain applied to envelope samples without restarting.
void start()
Start the group refresh task.
void clearSpliceMask()
Remove the active splice mask, whichever kind is active.
void activateModeTimed(uint8_t modeIdx, uint32_t durationMs)
Push a timed mode onto the mode stack.
void musicPause(bool paused=true)
Pause or resume playback, holding the meter where it is.
void detachProfile()
Detach the active profile and turn the strand off.
void clearLevelSource()
Stop following a levelSource() reader, leaving the fill where it is.
void musicSeek(uint32_t positionMs)
Jump playback to a position in the song.
void flash(uint32_t color, uint32_t onMs, uint32_t offMs, uint32_t bgColor=0x000000)
Blink the whole strip on and off.
void deactivateMode(uint8_t modeIdx)
Remove a mode from the stack immediately.
void activateMode(uint8_t modeIdx)
Push a persistent mode onto the mode stack.
Driver for a single WS2812B-compatible LED strip on a VEX ADI port.
Definition led_strand.hpp:53
double(*)() LevelFn
Signature for the reader a fill meter follows, see levelSource().
Definition led_strand.hpp:138
Profile and mode descriptors for the hitlib event-driven animation system.
Single addressable LED strip driver with layered animation engine.
Definition led_group.hpp:12
A song's intensity envelope, baked ahead of time into one 8-bit sample per frame.
Definition led_strand.hpp:267
How fast a moving animation travels: so many pixels, so often.
Definition led_strand.hpp:101
An immutable, statically-allocated collection of ProfileMode entries.
Definition led_profile.hpp:68