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 <stddef.h>
7
8#include "FastLED.h"
9#include "led_sysdefs.h"
10#include "pixeltypes.h"
11#include "color.h"
12#include "eorder.h"
13
14#include "fl/force_inline.h"
15#include "pixel_controller.h"
16#include "cled_controller.h"
17
19
20
21
26template<EOrder RGB_ORDER, int LANES=1, uint32_t MASK=0xFFFFFFFF> class CPixelLEDController : public CLEDController {
27protected:
28
29
34 virtual void showColor(const CRGB& data, int nLeds, uint8_t brightness) override {
35 // CRGB premixed, color_correction;
36 // getAdjustmentData(brightness, &premixed, &color_correction);
37 // ColorAdjustment color_adjustment = {premixed, color_correction, brightness};
39 PixelController<RGB_ORDER, LANES, MASK> pixels(data, nLeds, color_adjustment, getDither());
40 showPixels(pixels);
41 }
42
47 virtual void show(const struct CRGB *data, int nLeds, uint8_t brightness) override {
49 PixelController<RGB_ORDER, LANES, MASK> pixels(data, nLeds < 0 ? -nLeds : nLeds, color_adjustment, getDither());
50 if(nLeds < 0) {
51 // nLeds < 0 implies that we want to show them in reverse
52 pixels.mAdvance = -pixels.mAdvance;
53 }
54 showPixels(pixels);
55 }
56
57public:
58 static const EOrder RGB_ORDER_VALUE = RGB_ORDER;
59 static const int LANES_VALUE = LANES;
60 static const uint32_t MASK_VALUE = MASK;
62
66
69 int lanes() override { return LANES; }
70};
71
72
74
central include file for FastLED, defines the CFastLED class/object
UISlider brightness("Brightness", 255, 0, 255, 1)
uint8_t getDither()
Get the dithering option currently set for this controller.
ColorAdjustment getAdjustmentData(uint8_t brightness)
CLEDController()
Create an led controller object, add it to the chain of controllers.
virtual void show(const struct CRGB *data, int nLeds, uint8_t brightness) override
Write the passed in RGB data out to the LEDs managed by this controller.
virtual void showPixels(PixelController< RGB_ORDER, LANES, MASK > &pixels)=0
Send the LED data to the strip.
static const uint32_t MASK_VALUE
The mask for the lanes for this controller.
int lanes() override
Get the number of lanes of the 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, uint8_t brightness) override
Set all the LEDs on the controller to a given color.
base definitions used by led controllers for writing out led data
EOrder
RGB color channel orderings, used when instantiating controllers to determine what order the controll...
Definition eorder.h:14
Defines color channel ordering enumerations.
Determines which platform system definitions to include.
#define FASTLED_NAMESPACE_END
Definition namespace.h:22
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:54
int8_t mAdvance
how many bytes to advance the pointer by each time. For CRGB this is 3.
Pixel controller class.