FastLED 3.10.8
Loading...
Searching...
No Matches
adapter.h
Go to the documentation of this file.
1#pragma once
2
4#include "fl/stl/noexcept.h"
5
6namespace fl {
7
33class FastLEDAdapter : public IFastLED {
34public:
40 explicit FastLEDAdapter(u8 controllerIndex = 0) FL_NO_EXCEPT;
41
45 ~FastLEDAdapter() FL_NO_EXCEPT override = default;
46
47 // IFastLED interface implementation
48
49 fl::span<CRGB> getLEDs() FL_NO_EXCEPT override;
50 size_t getNumLEDs() const FL_NO_EXCEPT override;
51
52 void show() FL_NO_EXCEPT override;
53 void show(u8 brightness) FL_NO_EXCEPT override;
54 void clear(bool writeToStrip = false) FL_NO_EXCEPT override;
55
57 u8 getBrightness() const FL_NO_EXCEPT override;
58
59 void setCorrection(CRGB correction) FL_NO_EXCEPT override;
60 void setTemperature(CRGB temperature) FL_NO_EXCEPT override;
61
62 void delay(unsigned long ms) FL_NO_EXCEPT override;
63 void setMaxRefreshRate(u16 fps) FL_NO_EXCEPT override;
64 u16 getMaxRefreshRate() const FL_NO_EXCEPT override;
65
66 void setSegment(size_t start, size_t end) FL_NO_EXCEPT override;
67 void clearSegment() FL_NO_EXCEPT override;
68
69private:
70 u8 mControllerIndex; // Index of the LED controller in FastLED
71 size_t mSegmentStart; // Start of current segment (0 if no segment)
72 size_t mSegmentEnd; // End of current segment (numLeds if no segment)
73 bool mHasSegment; // True if a segment is active
74};
75
89
90} // namespace fl
fl::UISlider brightness("Brightness", BRIGHTNESS, 0, 255)
fl::span< CRGB > getLEDs() FL_NO_EXCEPT override
Get the LED array as a span.
~FastLEDAdapter() FL_NO_EXCEPT override=default
Destructor.
size_t mSegmentEnd
Definition adapter.h:72
void setCorrection(CRGB correction) FL_NO_EXCEPT override
Set color correction.
size_t getNumLEDs() const FL_NO_EXCEPT override
Get the number of LEDs.
void setMaxRefreshRate(u16 fps) FL_NO_EXCEPT override
Set the maximum refresh rate.
void clearSegment() FL_NO_EXCEPT override
Clear the segment range (operate on full LED array)
void show() FL_NO_EXCEPT override
Send the LED data to the strip Uses the current brightness setting.
void clear(bool writeToStrip=false) FL_NO_EXCEPT override
Clear all LEDs (set to black)
void setTemperature(CRGB temperature) FL_NO_EXCEPT override
Set color temperature.
void delay(unsigned long ms) FL_NO_EXCEPT override
Delay for a specified number of milliseconds.
FastLEDAdapter(u8 controllerIndex=0) FL_NO_EXCEPT
Construct adapter wrapping the global FastLED object.
void setBrightness(u8 brightness) FL_NO_EXCEPT override
Set the global brightness.
size_t mSegmentStart
Definition adapter.h:71
u16 getMaxRefreshRate() const FL_NO_EXCEPT override
Get the maximum refresh rate.
u8 getBrightness() const FL_NO_EXCEPT override
Get the current global brightness.
void setSegment(size_t start, size_t end) FL_NO_EXCEPT override
Set a segment range for subsequent operations.
Pure virtual interface for FastLED operations.
Definition ifastled.h:24
constexpr T * end(T(&array)[N]) FL_NO_EXCEPT
unsigned char u8
Definition stdint.h:131
u8 u8 fract8 blur_amount FL_NO_EXCEPT
Definition blur.h:186
fl::shared_ptr< IFastLED > createFastLEDController(u8 controllerIndex) FL_NO_EXCEPT
Create a FastLED controller adapter.
Base definition for an LED controller.
Definition crgb.hpp:179
Representation of an 8-bit RGB pixel (Red, Green, Blue)
Definition crgb.h:38