FastLED 3.9.3
Loading...
Searching...
No Matches
cpixel_ledcontroller.h
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 "force_inline.h"
15#include "pixel_controller.h"
16#include "cled_controller.h"
17
18FASTLED_NAMESPACE_BEGIN
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) {
35 // CRGB premixed, color_correction;
36 // getAdjustmentData(brightness, &premixed, &color_correction);
37 // ColorAdjustment color_adjustment = {premixed, color_correction, brightness};
38 ColorAdjustment color_adjustment = getAdjustmentData(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) {
48 ColorAdjustment color_adjustment = getAdjustmentData(brightness);
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() { return LANES; }
70};
71
72
73FASTLED_NAMESPACE_END
74
central include file for FastLED, defines the CFastLED class/object
Base definition for an LED controller.
uint8_t getDither()
Get the dithering option currently set for this controller.
Template extension of the CLEDController class.
virtual void showPixels(PixelController< RGB_ORDER, LANES, MASK > &pixels)=0
Send the LED data to the strip.
int lanes()
Get the number of lanes of the Controller.
static const uint32_t 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 show(const struct CRGB *data, int nLeds, uint8_t brightness)
Write the passed in RGB data out to the LEDs managed by this controller.
virtual void showColor(const CRGB &data, int nLeds, uint8_t brightness)
Set all the LEDs on the controller to a given color.
Contains definitions for color correction and temperature.
Determines which platform system definitions to include.
Representation of an RGB pixel (Red, Green, Blue)
Definition crgb.h:39
Pixel controller class.
int8_t mAdvance
how many bytes to advance the pointer by each time. For CRGB this is 3.