![]() |
HitLib 1.3.0
VEX V5 LED animation library for PROS
|
Forward declaration. More...
#include <led_sequencer.hpp>
Classes | |
| struct | Phase |
| One phase in the animation sequence. More... | |
Public Member Functions | |
| constexpr | Sequencer (const Phase *phases, uint8_t count) |
| Construct a Sequencer from a static phase array. | |
| void | start (LedStrand &strand) |
| Start the sequence from phase 0. | |
| void | stop () |
| Stop the sequence without advancing. | |
| void | update (LedStrand &strand) |
Advance the sequence, call every tick from an onTick callback. | |
| bool | isRunning () const |
Returns true if the sequence is currently running. | |
Forward declaration.
Drives a looping sequence of timed animation phases on a LedStrand.
A Sequencer holds a pointer to a statically-allocated array of Phase descriptors. It carries its own runtime state (current phase, timestamp, running flag) so that multiple Sequencer instances can run independently on different strands without interfering with each other.
onTick, so no additional locking is required in normal use.
|
inlineconstexpr |
| void hitlib::Sequencer::start | ( | LedStrand & | strand | ) |
Start the sequence from phase 0.
Calls phases[0].startFn(strand) immediately. Typically called from a ProfileMode onActivate callback.
| strand | The strand to animate. |
| void hitlib::Sequencer::stop | ( | ) |
Stop the sequence without advancing.
The strand animation is not changed, it simply stops being updated.
| void hitlib::Sequencer::update | ( | LedStrand & | strand | ) |
Advance the sequence, call every tick from an onTick callback.
Checks whether the current phase has expired. If so, advances to the next phase (wrapping to 0) and calls its startFn. Does nothing if the sequencer is not running.
| strand | The strand to animate. |
|
inline |
Returns true if the sequence is currently running.