including light effects from different project
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* @file EffectProcessor.h
|
||||
* @author Gustice
|
||||
* @brief Effect-Processor-Class for processing effect scenarios and switching actions
|
||||
*
|
||||
* @copyright Copyright (c) 2024
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "Color.hpp"
|
||||
#include "Macro.hpp"
|
||||
#include "StateMachine.hpp"
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
|
||||
namespace Effect {
|
||||
|
||||
/**
|
||||
* @brief EffectProcessor Class
|
||||
* @details Maintains State-Machines, Processes effect-switching, and invokes generation
|
||||
* of raw data stream for LEDs.
|
||||
* \li If effect scenarios are changed a cross-fading is executed
|
||||
* \li Raw-data-stream for each Color object is generated
|
||||
*/
|
||||
class EffectProcessor {
|
||||
public:
|
||||
///@brief Constructor
|
||||
///@param fadeSteps Steps count for cross fade
|
||||
EffectProcessor(uint8_t const fadeSteps = 8);
|
||||
|
||||
/// @brief Set next effect sequence
|
||||
/// @param sequence reference to sequence that has to be processed next
|
||||
/// @param sColor Start color. Use noColor to start with default color
|
||||
/// @param intens Idle intensity for effect. Use NULL to start with default intensity
|
||||
void setEffect(const Macro &sequence, Color const *sColor = noColor, uint8_t delay = 0, uint8_t intens = gu8_idleIntensity);
|
||||
|
||||
/// @brief Execute step of effect processor
|
||||
/// @return Reference to color result
|
||||
Color tick(void);
|
||||
|
||||
private:
|
||||
StateMachine::Parameter _parameter;
|
||||
std::array<StateMachine, 2> _effectMachines;
|
||||
uint8_t _fadeSteps;
|
||||
uint8_t _fadingCnt;
|
||||
StateMachine *_EffPV;
|
||||
StateMachine *_EffPV_old;
|
||||
|
||||
Color crossFadeColors(Color &cNew, Color &cOld, uint8_t k);
|
||||
EffectProcessor();
|
||||
};
|
||||
|
||||
} // namespace Effect
|
||||
Reference in New Issue
Block a user