HitLib 1.5.0
VEX V5 LED animation library for PROS
Loading...
Searching...
No Matches
classic.hpp
Go to the documentation of this file.
1#pragma once
2
51
52#include "hitlib/led_strand.hpp"
55
57
58// ============================================================================
61
62// ============================================================================
63// Classic
64// ============================================================================
65
71inline void classicIdle (LedStrand& s) { s.flow(0xFF00DD, 0x000000, 1); }
72inline void classicRed (LedStrand& s) { s.pulse(0xFF0000, 5, 1); }
73inline void classicBlue (LedStrand& s) { s.pulse(0x0000FF, 5, 1); }
74inline void classicScore (LedStrand& s) { s.pulse(0x00FF00, 5, 1); }
75inline void classicMatchloader (LedStrand& s) { s.pulse(0xEED202, 5, 1); }
76inline void showoff (LedStrand& s) { s.rainbow(1); }
77
78inline void classicEgWarn (LedStrand& s) { s.flash(0xFFFF00, 120, 120); }
79inline void classicEgWhite (LedStrand& s) { s.setColor(0xFFFFFF); }
80inline void classicEgCycle (LedStrand& s) { s.pulse(0xFF0000, 5, 1); }
82
84inline const Sequencer::Phase classicEgPhases[] = {
85 {1500, classicEgWarn},
86 {8500, classicEgWhite},
87 {2000, classicEgCycle},
88};
89inline Sequencer classicEndgameSeq(classicEgPhases, 3);
90inline void classicEgActivate(LedStrand& s) { classicEndgameSeq.start(s); }
91inline void classicEgTick (LedStrand& s) { classicEndgameSeq.update(s); }
93
94inline const ProfileMode classicModes[] = {
95 {"Showoff", 15, showoff, nullptr},
96 {"Idle", 10, classicIdle, nullptr},
97 {"Red", 20, classicRed, nullptr},
98 {"Blue", 20, classicBlue, nullptr},
99 {"Scoring", 70, classicScore, nullptr},
100 {"Matchloading", 90, classicMatchloader, nullptr},
101 {"Endgame", 100, classicEgActivate, classicEgTick},
102};
103
111inline const Profile classic = {"Classic", classicModes, 7};
112
113// ============================================================================
114// Modern
115// ============================================================================
116
118inline void modernIdle (LedStrand& s) { s.pulse(0xFF66CC, 8, 1); }
119inline void modernRed (LedStrand& s) { s.pulse(0xFF0000, 14, 1, 0xFF6200); }
120inline void modernBlue (LedStrand& s) { s.pulse(0x0000FF, 14, 1, 0x009DFF); }
121inline void modernScore (LedStrand& s) { s.flash(0x11FF00, 100, 100); }
122inline void modernMatchloader (LedStrand& s) { s.pulse(0xEED202, 5, 1); }
123inline void modernEgGreen (LedStrand& s) { s.setColor(0x11FF00); }
124inline void modernEgPulse (LedStrand& s) { s.pulse(0x11FF00, 8, 2); }
125
126inline const Sequencer::Phase modernEgPhases[] = {
127 {15000, modernEgGreen},
128 {4000, modernEgPulse},
129};
130inline Sequencer modernEndgameSeq(modernEgPhases, 2);
131inline void modernEgActivate(LedStrand& s) { modernEndgameSeq.start(s); }
132inline void modernEgTick (LedStrand& s) { modernEndgameSeq.update(s); }
134
135inline const ProfileMode modernModes[] = {
136 {"Showoff", 15, showoff, nullptr},
137 {"Idle", 10, modernIdle, nullptr},
138 {"Red", 20, modernRed, nullptr},
139 {"Blue", 20, modernBlue, nullptr},
140 {"Scoring", 70, modernScore, nullptr},
141 {"Matchloading", 90, modernMatchloader, nullptr},
142 {"Endgame", 100, modernEgActivate, modernEgTick},
143};
144
151inline const Profile modern = {"Modern", modernModes, 7};
152
153// ============================================================================
154// Showy
155// ============================================================================
156
158inline void showyIdle (LedStrand& s) { s.flow(0xAC00FF, 0x000000, 1); }
159inline void showyRed (LedStrand& s) { s.pulse(0xFFFFFF, 4, 1, 0xFF0000); }
160inline void showyBlue (LedStrand& s) { s.pulse(0xFFFFFF, 4, 1, 0x0000FF); }
161inline void showyScore (LedStrand& s) { s.pulse(0x00FF88, 6, 2); }
162inline void showyEgPulse (LedStrand& s) { s.pulse(0xFFFF00, 6, 1); }
163inline void showyEgRainbow (LedStrand& s) { s.rainbow(2); }
164
165inline const Sequencer::Phase showyEgPhases[] = {
166 {2000, showyEgPulse},
167 {8000, showyEgRainbow},
168};
169inline Sequencer showyEndgameSeq(showyEgPhases, 2);
170inline void showyEgActivate(LedStrand& s) { showyEndgameSeq.start(s); }
171inline void showyEgTick (LedStrand& s) { showyEndgameSeq.update(s); }
173
174inline const ProfileMode showyModes[] = {
175 {"Idle", 10, showyIdle, nullptr},
176 {"Red", 20, showyRed, nullptr},
177 {"Blue", 20, showyBlue, nullptr},
178 {"Scoring", 90, showyScore, nullptr},
179 {"Endgame", 100, showyEgActivate, showyEgTick},
180};
181
188inline const Profile showy = {"Showy", showyModes, 5};
189
191
192} // namespace hitlib::profiles
Driver for a single WS2812B-compatible LED strip on a VEX ADI port.
Definition led_strand.hpp:53
void flow(uint32_t color1, uint32_t color2, Speed speed, bool invert=false, bool seamless=true)
Scroll a two-color gradient across the strip.
void flash(uint32_t color, uint32_t onMs, uint32_t offMs, uint32_t bgColor=0x000000)
Blink the whole strip on and off.
void rainbow(Speed speed)
Scroll a full HSV rainbow across the strip.
void setColor(uint32_t color)
Set all LEDs to a solid color.
void pulse(uint32_t color, uint8_t runLength, Speed speed, uint32_t bgColor=0x000000, bool invert=false, bool bounce=false)
Animate a run of color moving across a background.
const ProfileMode showyModes[]
Definition classic.hpp:174
void classicRed(LedStrand &s)
Definition classic.hpp:72
void classicEgCycle(LedStrand &s)
Definition classic.hpp:80
void classicIdle(LedStrand &s)
Definition classic.hpp:71
void classicScore(LedStrand &s)
Definition classic.hpp:74
const Profile modern
Modern profile instance.
Definition classic.hpp:151
const Profile classic
Classic profile instance.
Definition classic.hpp:111
void showoff(LedStrand &s)
Definition classic.hpp:76
const ProfileMode modernModes[]
Definition classic.hpp:135
void classicEgWarn(LedStrand &s)
Definition classic.hpp:78
const ProfileMode classicModes[]
Definition classic.hpp:94
const Profile showy
Showy profile instance.
Definition classic.hpp:188
void classicEgWhite(LedStrand &s)
Definition classic.hpp:79
void classicMatchloader(LedStrand &s)
Definition classic.hpp:75
void classicBlue(LedStrand &s)
Definition classic.hpp:73
Profile and mode descriptors for the hitlib event-driven animation system.
Multi-phase timed animation sequencer.
Single addressable LED strip driver with layered animation engine.
Definition classic.hpp:56
Describes a single named animation mode within a Profile.
Definition led_profile.hpp:38
An immutable, statically-allocated collection of ProfileMode entries.
Definition led_profile.hpp:68
One phase in the animation sequence.
Definition led_sequencer.hpp:59