FastLED 3.9.15
Loading...
Searching...
No Matches
cpixel_ledcontroller.h
Go to the documentation of this file.
1#pragma once
2
5
6#include "FastLED.h"
7#include "led_sysdefs.h"
8#include "pixeltypes.h"
9#include "color.h"
10#include "eorder.h"
11
12#include "fl/force_inline.h"
13#include "fl/int.h"
14#include "pixel_controller.h"
15#include "cled_controller.h"
16
18
19
20
25template<EOrder RGB_ORDER, int LANES=1, fl::u32 MASK=0xFFFFFFFF> class CPixelLEDController : public CLEDController {
26protected:
27
28
33 virtual void showColor(const CRGB& data, int nLeds, fl::u8 brightness) override {
34 // CRGB premixed, color_correction;
35 // getAdjustmentData(brightness, &premixed, &color_correction);
36 // ColorAdjustment color_adjustment = {premixed, color_correction, brightness};
38 PixelController<RGB_ORDER, LANES, MASK> pixels(data, nLeds, color_adjustment, getDither());
39 showPixels(pixels);
40 }
41
46 virtual void show(const struct CRGB *data, int nLeds, fl::u8 brightness) override {
48 PixelController<RGB_ORDER, LANES, MASK> pixels(data, nLeds < 0 ? -nLeds : nLeds, color_adjustment, getDither());
49 if(nLeds < 0) {
50 // nLeds < 0 implies that we want to show them in reverse
51 pixels.mAdvance = -pixels.mAdvance;
52 }
53 showPixels(pixels);
54 }
55
56public:
57 static const EOrder RGB_ORDER_VALUE = RGB_ORDER;
58 static const int LANES_VALUE = LANES;
59 static const fl::u32 MASK_VALUE = MASK;
61
65
68 int lanes() override { return LANES; }
69};
70
71
central include file for FastLED, defines the CFastLED class/object
UISlider brightness("Brightness", 128, 0, 255, 1)
fl::u8 getDither()
Get the dithering option currently set for this controller.
CLEDController()
Create an led controller object, add it to the chain of controllers.
ColorAdjustment getAdjustmentData(fl::u8 brightness)
virtual void showPixels(PixelController< RGB_ORDER, LANES, MASK > &pixels)=0
Send the LED data to the strip.
int lanes() override
Get the number of lanes of the Controller.
static const fl::u32 MASK_VALUE
The mask for the lanes for this controller.
static const EOrder RGB_ORDER_VALUE
The RGB ordering for this controller.
static const int LANES_VALUE
The number of lanes for this controller.
virtual void showColor(const CRGB &data, int nLeds, fl::u8 brightness) override
Set all the LEDs on the controller to a given color.
virtual void show(const struct CRGB *data, int nLeds, fl::u8 brightness) override
Write the passed in RGB data out to the LEDs managed by this controller.
base definitions used by led controllers for writing out led data
fl::EOrder EOrder
Definition eorder.h:9
Defines color channel ordering enumerations.
Determines which platform system definitions to include.
#define FASTLED_NAMESPACE_END
Definition namespace.h:23
#define FASTLED_NAMESPACE_BEGIN
Definition namespace.h:22
unsigned char u8
Definition int.h:17
Low level pixel data writing class.
Includes defintions for RGB and HSV pixels.
Contains definitions for color correction and temperature.
Representation of an RGB pixel (Red, Green, Blue)
Definition crgb.h:86
int8_t mAdvance
how many bytes to advance the pointer by each time. For CRGB this is 3.
Pixel controller class.