FastLED  3.1
dmx.h
1 #ifndef __INC_DMX_H
2 #define __INC_DMX_H
3 
4 #include "FastLED.h"
5 
6 #ifdef DmxSimple_h
7 #include<DmxSimple.h>
8 #define HAS_DMX_SIMPLE
9 
12 FASTLED_NAMESPACE_BEGIN
13 
14 // note - dmx simple must be included before FastSPI for this code to be enabled
15 template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB> class DMXSimpleController : public CPixelLEDController<RGB_ORDER> {
16 public:
17  // initialize the LED controller
18  virtual void init() { DmxSimple.usePin(DATA_PIN); }
19 
20 protected:
21  virtual void showPixels(PixelController<RGB_ORDER> & pixels) {
22  int iChannel = 1;
23  while(pixels.has(1)) {
24  DmxSimple.write(iChannel++, pixels.loadAndScale0());
25  DmxSimple.write(iChannel++, pixels.loadAndScale1());
26  DmxSimple.write(iChannel++, pixels.loadAndScale2());
27  pixels.advanceData();
28  pixels.stepDithering();
29  }
30  }
31 };
32 
33 FASTLED_NAMESPACE_END
34 
35 #endif
36 
37 #ifdef DmxSerial_h
38 #include<DMXSerial.h>
39 
40 FASTLED_NAMESPACE_BEGIN
41 
42 template <EOrder RGB_ORDER = RGB> class DMXSerialController : public CPixelLEDController<RGB_ORDER> {
43 public:
44  // initialize the LED controller
45  virtual void init() { DMXSerial.init(DMXController); }
46 
47  virtual void showPixels(PixelController<RGB_ORDER> & pixels) {
48  int iChannel = 1;
49  while(pixels.has(1)) {
50  DMXSerial.write(iChannel++, pixels.loadAndScale0());
51  DMXSerial.write(iChannel++, pixels.loadAndScale1());
52  DMXSerial.write(iChannel++, pixels.loadAndScale2());
53  pixels.advanceData();
54  pixels.stepDithering();
55  }
56  }
57 };
58 
59 FASTLED_NAMESPACE_END
61 
62 #define HAS_DMX_SERIAL
63 #endif
64 
65 #endif
virtual void init()
initialize the LED controller
Definition: dmx.h:45
virtual void init()
initialize the LED controller
Definition: dmx.h:18
central include file for FastLED, defines the CFastLED class/object