Skip to content

Commit 7cd056f

Browse files
Daniel GarciaDaniel Garcia
authored andcommitted
Preliminary pixie support
1 parent d404d08 commit 7cd056f

File tree

3 files changed

+65
-2
lines changed

3 files changed

+65
-2
lines changed

FastLED.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ enum ESPIChipsets {
7171
enum ESM { SMART_MATRIX };
7272
enum OWS2811 { OCTOWS2811,OCTOWS2811_400 };
7373

74+
template<uint8_t DATA_PIN, EOrder RGB_ORDER> class Pixie : public PixieController<DATA_PIN, RGB_ORDER> {};
7475
#ifdef FASTLED_HAS_CLOCKLESS
7576
template<uint8_t DATA_PIN> class NEOPIXEL : public WS2812Controller800Khz<DATA_PIN, GRB> {};
7677
template<uint8_t DATA_PIN, EOrder RGB_ORDER> class TM1829 : public TM1829Controller800Khz<DATA_PIN, RGB_ORDER> {};

chipsets.h

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,66 @@ FASTLED_NAMESPACE_BEGIN
1212
///
1313
///@{
1414

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+
1575
///@name Clocked chipsets - nominally SPI based these chipsets have a data and a clock line.
1676
///@{
1777
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -478,7 +538,7 @@ template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
478538
class GW6205Controller800Khz : public ClocklessController<DATA_PIN, 2 * FMUL, 4 * FMUL, 4 * FMUL, RGB_ORDER, 4> {};
479539

480540
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> {};
482542

483543
#else
484544
// GW6205@400khz - 800ns, 800ns, 800ns
@@ -534,7 +594,7 @@ template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
534594
class SK6812Controller : public ClocklessController<DATA_PIN, NS(300), NS(300), NS(600), RGB_ORDER> {};
535595

536596
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> {};
538598
#endif
539599
///@}
540600

release_notes.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ FastLED3.1.1pre
55
* Fix power management issue w/parallel output
66
* Use static_asserts for some more useful compile time errors around bad pins
77
* Roll power management into FastLED.show/delay directly
8+
* Support for adafruit pixies on arduino type platforms that have SoftwareSerial
9+
* TODO: support hardware serial on platforms that have it available
810

911
FastLED3.1.0
1012
============

0 commit comments

Comments
 (0)