HitLib 1.3.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
46
47#include "hitlib/led_strand.hpp"
50
52
53// ============================================================================
56
57// ============================================================================
58// Classic
59// ============================================================================
60
66inline void classicIdle (LedStrand& s) { s.flow(0xFF00DD, 0x000000, 1); }
67inline void classicRed (LedStrand& s) { s.pulse(0xFF0000, 5, 1); }
68inline void classicBlue (LedStrand& s) { s.pulse(0x0000FF, 5, 1); }
69inline void classicScore (LedStrand& s) { s.pulse(0x00FF00, 5, 1); }
70inline void classicMatchloader (LedStrand& s) { s.pulse(0xEED202, 5, 1); }
71inline void showoff (LedStrand& s) { s.rainbow(1); }
72
73inline void classicEgWarn (LedStrand& s) { s.flash(0xFFFF00, 120, 120); }
74inline void classicEgWhite (LedStrand& s) { s.setColor(0xFFFFFF); }
75inline void classicEgCycle (LedStrand& s) { s.pulse(0xFF0000, 5, 1); }
77
79inline const Sequencer::Phase classicEgPhases[] = {
80 {1500, classicEgWarn},
81 {8500, classicEgWhite},
82 {2000, classicEgCycle},
83};
84inline Sequencer classicEndgameSeq(classicEgPhases, 3);
85inline void classicEgActivate(LedStrand& s) { classicEndgameSeq.start(s); }
86inline void classicEgTick (LedStrand& s) { classicEndgameSeq.update(s); }
88
89inline const ProfileMode classicModes[] = {
90 {"Showoff", 15, showoff, nullptr},
91 {"Idle", 10, classicIdle, nullptr},
92 {"Red", 20, classicRed, nullptr},
93 {"Blue", 20, classicBlue, nullptr},
94 {"Scoring", 70, classicScore, nullptr},
95 {"Matchloading", 90, classicMatchloader, nullptr},
96 {"Endgame", 100, classicEgActivate, classicEgTick},
97};
98
106inline const Profile classic = {"Classic", classicModes, 7};
107
108// ============================================================================
109// Modern
110// ============================================================================
111
113inline void modernIdle (LedStrand& s) { s.pulse(0xFF66CC, 8, 1); }
114inline void modernRed (LedStrand& s) { s.pulse(0xFF0000, 14, 1, 0xFF6200); }
115inline void modernBlue (LedStrand& s) { s.pulse(0x0000FF, 14, 1, 0x009DFF); }
116inline void modernScore (LedStrand& s) { s.flash(0x11FF00, 100, 100); }
117inline void modernMatchloader (LedStrand& s) { s.pulse(0xEED202, 5, 1); }
118inline void modernEgGreen (LedStrand& s) { s.setColor(0x11FF00); }
119inline void modernEgPulse (LedStrand& s) { s.pulse(0x11FF00, 8, 2); }
120
121inline const Sequencer::Phase modernEgPhases[] = {
122 {15000, modernEgGreen},
123 {4000, modernEgPulse},
124};
125inline Sequencer modernEndgameSeq(modernEgPhases, 2);
126inline void modernEgActivate(LedStrand& s) { modernEndgameSeq.start(s); }
127inline void modernEgTick (LedStrand& s) { modernEndgameSeq.update(s); }
129
130inline const ProfileMode modernModes[] = {
131 {"Showoff", 15, showoff, nullptr},
132 {"Idle", 10, modernIdle, nullptr},
133 {"Red", 20, modernRed, nullptr},
134 {"Blue", 20, modernBlue, nullptr},
135 {"Scoring", 70, modernScore, nullptr},
136 {"Matchloading", 90, modernMatchloader, nullptr},
137 {"Endgame", 100, modernEgActivate, modernEgTick},
138};
139
146inline const Profile modern = {"Modern", modernModes, 7};
147
148// ============================================================================
149// Showy
150// ============================================================================
151
153inline void showyIdle (LedStrand& s) { s.flow(0xAC00FF, 0x000000, 1); }
154inline void showyRed (LedStrand& s) { s.pulse(0xFFFFFF, 4, 1, 0xFF0000); }
155inline void showyBlue (LedStrand& s) { s.pulse(0xFFFFFF, 4, 1, 0x0000FF); }
156inline void showyScore (LedStrand& s) { s.pulse(0x00FF88, 6, 2); }
157inline void showyEgPulse (LedStrand& s) { s.pulse(0xFFFF00, 6, 1); }
158inline void showyEgRainbow (LedStrand& s) { s.rainbow(2); }
159
160inline const Sequencer::Phase showyEgPhases[] = {
161 {2000, showyEgPulse},
162 {8000, showyEgRainbow},
163};
164inline Sequencer showyEndgameSeq(showyEgPhases, 2);
165inline void showyEgActivate(LedStrand& s) { showyEndgameSeq.start(s); }
166inline void showyEgTick (LedStrand& s) { showyEndgameSeq.update(s); }
168
169inline const ProfileMode showyModes[] = {
170 {"Idle", 10, showyIdle, nullptr},
171 {"Red", 20, showyRed, nullptr},
172 {"Blue", 20, showyBlue, nullptr},
173 {"Scoring", 90, showyScore, nullptr},
174 {"Endgame", 100, showyEgActivate, showyEgTick},
175};
176
183inline const Profile showy = {"Showy", showyModes, 5};
184
186
187} // namespace hitlib::profiles
Driver for a single WS2812B-compatible LED strip on a VEX ADI port.
Definition led_strand.hpp:53
void flash(uint32_t color, uint32_t onMs, uint32_t offMs, uint32_t bgColor=0x000000)
Blink the whole strip on and off.
void rainbow(uint8_t speed)
Scroll a full HSV rainbow across the strip.
void flow(uint32_t color1, uint32_t color2, uint8_t speed, bool invert=false, bool seamless=true)
Scroll a two-color gradient across the strip.
void pulse(uint32_t color, uint8_t runLength, uint8_t speed, uint32_t bgColor=0x000000, bool invert=false, bool bounce=false)
Animate a run of color moving across a background.
void setColor(uint32_t color)
Set all LEDs to a solid color.
const ProfileMode showyModes[]
Definition classic.hpp:169
void classicRed(LedStrand &s)
Definition classic.hpp:67
void classicEgCycle(LedStrand &s)
Definition classic.hpp:75
void classicIdle(LedStrand &s)
Definition classic.hpp:66
void classicScore(LedStrand &s)
Definition classic.hpp:69
const Profile modern
Modern profile instance.
Definition classic.hpp:146
const Profile classic
Classic profile instance.
Definition classic.hpp:106
void showoff(LedStrand &s)
Definition classic.hpp:71
const ProfileMode modernModes[]
Definition classic.hpp:130
void classicEgWarn(LedStrand &s)
Definition classic.hpp:73
const ProfileMode classicModes[]
Definition classic.hpp:89
const Profile showy
Showy profile instance.
Definition classic.hpp:183
void classicEgWhite(LedStrand &s)
Definition classic.hpp:74
void classicMatchloader(LedStrand &s)
Definition classic.hpp:70
void classicBlue(LedStrand &s)
Definition classic.hpp:68
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:51
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:53