@@ -12,6 +12,66 @@ FASTLED_NAMESPACE_BEGIN
12
12
// /
13
13
// /@{
14
14
15
+ #if defined(ARDUINO)
16
+ #include " SoftwareSerial.h"
17
+
18
+ // / Adafruit Pixie controller class
19
+ // / @tparam DATAPIN the pin to write data out on
20
+ // / @tparam RGB_ORDER the RGB ordering for the led data
21
+ template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
22
+ class PixieController : public CLEDController {
23
+ SoftwareSerial Serial;
24
+ public:
25
+ PixieController () : Serial(-1 , DATA_PIN) {}
26
+
27
+ virtual void clearLeds (int nLeds) { showColor (CRGB (0 ,0 ,0 ), nLeds, CRGB (0 ,0 ,0 )); };
28
+
29
+ protected:
30
+ virtual void init () {
31
+
32
+ Serial.begin (115200 );
33
+ }
34
+
35
+ void show (PixelController<RGB_ORDER> & pixels) {
36
+ while (pixels.has (1 )) {
37
+ uint8_t r = pixels.loadAndScale0 ();
38
+ Serial.write (r);
39
+ uint8_t g = pixels.loadAndScale1 ();
40
+ Serial.write (g);
41
+ uint8_t b = pixels.loadAndScale2 ();
42
+ Serial.write (b);
43
+ pixels.advanceData ();
44
+ pixels.stepDithering ();
45
+ }
46
+ }
47
+
48
+ virtual void showColor (const struct CRGB & data, int nLeds, CRGB scale) {
49
+ PixelController<RGB_ORDER> pixels (data, nLeds, scale, getDither ());
50
+ show (pixels);
51
+ }
52
+
53
+ virtual void show (const struct CRGB *data, int nLeds, CRGB scale) {
54
+ PixelController<RGB_ORDER> pixels (data, nLeds, scale, getDither ());
55
+ show (pixels);
56
+ }
57
+
58
+ #ifdef SUPPORT_ARGB
59
+ virtual void show (const struct CRGB *data, int nLeds, CRGB scale) {
60
+ PixelController<RGB_ORDER> pixels (data, nLeds,, scale, getDither ());
61
+ show (pixels);
62
+ }
63
+ #endif
64
+ };
65
+
66
+ // template<SoftwareSerial & STREAM, EOrder RGB_ORDER = RGB>
67
+ // class PixieController : public PixieBaseController<STREAM, RGB_ORDER> {
68
+ // public:
69
+ // virtual void init() {
70
+ // STREAM.begin(115200);
71
+ // }
72
+ // };
73
+ #endif
74
+
15
75
// /@name Clocked chipsets - nominally SPI based these chipsets have a data and a clock line.
16
76
// /@{
17
77
// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -478,7 +538,7 @@ template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
478
538
class GW6205Controller800Khz : public ClocklessController <DATA_PIN, 2 * FMUL, 4 * FMUL, 4 * FMUL, RGB_ORDER, 4 > {};
479
539
480
540
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
481
- class PL9823Controller : public ClocklessController <DATA_PIN, 3 * FMUL, 8 * FMUL, 3 * FMUL, RGB_ORDER> {};
541
+ class PL9823Controller : public ClocklessController <DATA_PIN, 3 * FMUL, 8 * FMUL, 3 * FMUL, RGB_ORDER> {};
482
542
483
543
#else
484
544
// GW6205@400khz - 800ns, 800ns, 800ns
@@ -534,7 +594,7 @@ template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
534
594
class SK6812Controller : public ClocklessController <DATA_PIN, NS(300 ), NS(300 ), NS(600 ), RGB_ORDER> {};
535
595
536
596
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
537
- class PL9823Controller : public ClocklessController <DATA_PIN, NS(350 ), NS(1010 ), NS(350 ), RGB_ORDER> {};
597
+ class PL9823Controller : public ClocklessController <DATA_PIN, NS(350 ), NS(1010 ), NS(350 ), RGB_ORDER> {};
538
598
#endif
539
599
// /@}
540
600
0 commit comments