FastLED 3.9.15
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);
41
45 ~FastLEDAdapter() FL_NOEXCEPT override = default;
46
47 // IFastLED interface implementation
48
49 fl::span<CRGB> getLEDs() override;
50 size_t getNumLEDs() const override;
51
52 void show() override;
53 void show(u8 brightness) override;
54 void clear(bool writeToStrip = false) override;
55
56 void setBrightness(u8 brightness) override;
57 u8 getBrightness() const override;
58
59 void setCorrection(CRGB correction) override;
60 void setTemperature(CRGB temperature) override;
61
62 void delay(unsigned long ms) override;
63 void setMaxRefreshRate(u16 fps) override;
64 u16 getMaxRefreshRate() const override;
65
66 void setSegment(size_t start, size_t end) override;
67 void clearSegment() 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
88fl::shared_ptr<IFastLED> createFastLEDController(u8 controllerIndex = 0);
89
90} // namespace fl
fl::UISlider brightness("Brightness", BRIGHTNESS, 0, 255)
size_t mSegmentEnd
Definition adapter.h:72
void setBrightness(u8 brightness) override
Set the global brightness.
void setTemperature(CRGB temperature) override
Set color temperature.
void delay(unsigned long ms) override
Delay for a specified number of milliseconds.
void clear(bool writeToStrip=false) override
Clear all LEDs (set to black)
void setMaxRefreshRate(u16 fps) override
Set the maximum refresh rate.
u16 getMaxRefreshRate() const override
Get the maximum refresh rate.
~FastLEDAdapter() FL_NOEXCEPT override=default
Destructor.
size_t getNumLEDs() const override
Get the number of LEDs.
void clearSegment() override
Clear the segment range (operate on full LED array)
FastLEDAdapter(u8 controllerIndex=0)
Construct adapter wrapping the global FastLED object.
void show() override
Send the LED data to the strip Uses the current brightness setting.
u8 getBrightness() const override
Get the current global brightness.
size_t mSegmentStart
Definition adapter.h:71
void setSegment(size_t start, size_t end) override
Set a segment range for subsequent operations.
void setCorrection(CRGB correction) override
Set color correction.
fl::span< CRGB > getLEDs() override
Get the LED array as a span.
Pure virtual interface for FastLED operations.
Definition ifastled.h:24
unsigned char u8
Definition stdint.h:131
constexpr T * end(T(&array)[N]) FL_NOEXCEPT
fl::shared_ptr< IFastLED > createFastLEDController(u8 controllerIndex)
Create a FastLED controller adapter.
Base definition for an LED controller.
Definition crgb.hpp:179
#define FL_NOEXCEPT
Representation of an 8-bit RGB pixel (Red, Green, Blue)
Definition crgb.h:38