FastLED 3.9.3
Loading...
Searching...
No Matches
dmx.h
Go to the documentation of this file.
1
3
4#pragma once
5
6#include "FastLED.h"
7
10
13
14#if defined(DmxSimple_h) || defined(FASTLED_DOXYGEN)
15#include <DmxSimple.h>
16
18#define HAS_DMX_SIMPLE
19
20FASTLED_NAMESPACE_BEGIN
21
28template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB> class DMXSimpleController : public CPixelLEDController<RGB_ORDER> {
29public:
31 virtual void init() { DmxSimple.usePin(DATA_PIN); }
32
33protected:
35 virtual void showPixels(PixelController<RGB_ORDER> & pixels) {
36 int iChannel = 1;
37 while(pixels.has(1)) {
38 DmxSimple.write(iChannel++, pixels.loadAndScale0());
39 DmxSimple.write(iChannel++, pixels.loadAndScale1());
40 DmxSimple.write(iChannel++, pixels.loadAndScale2());
41 pixels.advanceData();
42 pixels.stepDithering();
43 }
44 }
45};
46
47FASTLED_NAMESPACE_END
48
49#endif
50
51#if defined(DmxSerial_h) || defined(FASTLED_DOXYGEN)
52#include <DMXSerial.h>
53
55#define HAS_DMX_SERIAL
56
57FASTLED_NAMESPACE_BEGIN
58
64template <EOrder RGB_ORDER = RGB> class DMXSerialController : public CPixelLEDController<RGB_ORDER> {
65public:
67 virtual void init() { DMXSerial.init(DMXController); }
68
70 virtual void showPixels(PixelController<RGB_ORDER> & pixels) {
71 int iChannel = 1;
72 while(pixels.has(1)) {
73 DMXSerial.write(iChannel++, pixels.loadAndScale0());
74 DMXSerial.write(iChannel++, pixels.loadAndScale1());
75 DMXSerial.write(iChannel++, pixels.loadAndScale2());
76 pixels.advanceData();
77 pixels.stepDithering();
78 }
79 }
80};
81
82FASTLED_NAMESPACE_END
83
86
87#endif
88
central include file for FastLED, defines the CFastLED class/object
Template extension of the CLEDController class.
DMX512 based LED controller class, using the DMXSerial library.
Definition dmx.h:64
virtual void init()
Initialize the LED controller.
Definition dmx.h:67
virtual void showPixels(PixelController< RGB_ORDER > &pixels)
Send the LED data to the strip.
Definition dmx.h:70
DMX512 based LED controller class, using the DmxSimple library.
Definition dmx.h:28
virtual void init()
Initialize the LED controller.
Definition dmx.h:31
virtual void showPixels(PixelController< RGB_ORDER > &pixels)
Send the LED data to the strip.
Definition dmx.h:35
Pixel controller class.
FASTLED_FORCE_INLINE uint8_t loadAndScale1(int lane, uint8_t scale)
non-template alias of loadAndScale<1>()
FASTLED_FORCE_INLINE uint8_t loadAndScale2(int lane, uint8_t scale)
non-template alias of loadAndScale<2>()
FASTLED_FORCE_INLINE uint8_t loadAndScale0(int lane, uint8_t scale)
non-template alias of loadAndScale<0>()
FASTLED_FORCE_INLINE void advanceData()
Advance the data pointer forward, adjust position counter.
FASTLED_FORCE_INLINE bool has(int n)
Do we have n pixels left to process?
FASTLED_FORCE_INLINE void stepDithering()
Step the dithering forward.