From 1a40bd20209d12d89ed436459665494484f20b71 Mon Sep 17 00:00:00 2001 From: Daniel Garcia Date: Mon, 12 Aug 2019 18:39:58 -0700 Subject: Wiring parallel clockless support for the Teensy 4 into FastLED.addLeds - updaitng parallel output example - time to merge back to master\! --- FastLED.h | 8 ++++++++ .../Multiple/ParallelOutputDemo/ParallelOutputDemo.ino | 15 ++++++++++++--- platforms/arm/mxrt1062/block_clockless_arm_mxrt1062.h | 6 +++++- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/FastLED.h b/FastLED.h index b4302662..3903eaa6 100644 --- a/FastLED.h +++ b/FastLED.h @@ -315,6 +315,14 @@ public: return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); } +#if defined(__FASTLED_HAS_FIBCC) && (__FASTLED_HAS_FIBCC == 1) + template class CHIPSET, uint8_t DATA_PIN, EOrder RGB_ORDER=RGB> + static CLEDController &addLeds(struct CRGB *data, int nLeds) { + static __FIBCC c; + return addLeds(&c, data, nLeds); + } +#endif + #ifdef FASTSPI_USE_DMX_SIMPLE template static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) diff --git a/examples/Multiple/ParallelOutputDemo/ParallelOutputDemo.ino b/examples/Multiple/ParallelOutputDemo/ParallelOutputDemo.ino index fc7c9e77..8c447b54 100644 --- a/examples/Multiple/ParallelOutputDemo/ParallelOutputDemo.ino +++ b/examples/Multiple/ParallelOutputDemo/ParallelOutputDemo.ino @@ -1,6 +1,6 @@ #include -#define NUM_LEDS_PER_STRIP 64 +#define NUM_LEDS_PER_STRIP 16 // Note: this can be 12 if you're using a teensy 3 and don't mind soldering the pads on the back #define NUM_STRIPS 16 @@ -17,15 +17,24 @@ CRGB leds[NUM_STRIPS * NUM_LEDS_PER_STRIP]; // WS2811_PORTD: 25,26,27,28,14,15,29,11 // + +// IBCC outputs; + void setup() { + delay(5000); + Serial.begin(57600); + Serial.println("Starting..."); // LEDS.addLeds(leds, NUM_LEDS_PER_STRIP); // LEDS.addLeds(leds, NUM_LEDS_PER_STRIP); // LEDS.addLeds(leds, NUM_LEDS_PER_STRIP).setCorrection(TypicalLEDStrip); LEDS.addLeds(leds, NUM_LEDS_PER_STRIP); - LEDS.setBrightness(32); + + // Teensy 4 parallel output example + // LEDS.addLeds(leds,NUM_LEDS_PER_STRIP); } void loop() { + Serial.println("Loop...."); static uint8_t hue = 0; for(int i = 0; i < NUM_STRIPS; i++) { for(int j = 0; j < NUM_LEDS_PER_STRIP; j++) { @@ -43,5 +52,5 @@ void loop() { hue++; LEDS.show(); - LEDS.delay(10); + // LEDS.delay(100); } diff --git a/platforms/arm/mxrt1062/block_clockless_arm_mxrt1062.h b/platforms/arm/mxrt1062/block_clockless_arm_mxrt1062.h index 6655ca79..5ee22458 100644 --- a/platforms/arm/mxrt1062/block_clockless_arm_mxrt1062.h +++ b/platforms/arm/mxrt1062/block_clockless_arm_mxrt1062.h @@ -9,7 +9,7 @@ FASTLED_NAMESPACE_BEGIN #define __FL_T4_MASK ((1<<(LANES))-1) template -class InlineBlockClocklessController : public CPixelLEDController { +class FlexibleInlineBlockClocklessController : public CPixelLEDController { uint8_t m_bitOffsets[16]; uint8_t m_nActualLanes; @@ -202,6 +202,10 @@ public: } }; +template class CHIPSET, uint8_t DATA_PIN, int NUM_LANES, EOrder RGB_ORDER=GRB> +class __FIBCC : public FlexibleInlineBlockClocklessController::__T1(),CHIPSET::__T2(),CHIPSET::__T3(),RGB_ORDER,CHIPSET::__XTRA0(),CHIPSET::__FLIP(),CHIPSET::__WAIT_TIME()> {}; + +#define __FASTLED_HAS_FIBCC 1 #endif //defined(FASTLED_TEENSY4) FASTLED_NAMESPACE_END -- cgit v1.2.3