Skip to content
Permalink
Browse files

Wiring parallel clockless support for the Teensy 4 into FastLED.addLe…

…ds - updaitng parallel output example - time to merge back to master\!
  • Loading branch information...
Daniel Garcia
Daniel Garcia committed Aug 13, 2019
1 parent 526f7f5 commit 1a40bd20209d12d89ed436459665494484f20b71
@@ -315,6 +315,14 @@ class CFastLED {
return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset);
}

#if defined(__FASTLED_HAS_FIBCC) && (__FASTLED_HAS_FIBCC == 1)
template<uint8_t NUM_LANES, template<uint8_t DATA_PIN, EOrder RGB_ORDER> class CHIPSET, uint8_t DATA_PIN, EOrder RGB_ORDER=RGB>
static CLEDController &addLeds(struct CRGB *data, int nLeds) {
static __FIBCC<CHIPSET, DATA_PIN, NUM_LANES, RGB_ORDER> c;
return addLeds(&c, data, nLeds);
}
#endif

#ifdef FASTSPI_USE_DMX_SIMPLE
template<EClocklessChipsets CHIPSET, uint8_t DATA_PIN, EOrder RGB_ORDER=RGB>
static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0)
@@ -1,6 +1,6 @@
#include <FastLED.h>

#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<WS2811, 1, 16> outputs;

void setup() {
delay(5000);
Serial.begin(57600);
Serial.println("Starting...");
// LEDS.addLeds<WS2811_PORTA,NUM_STRIPS>(leds, NUM_LEDS_PER_STRIP);
// LEDS.addLeds<WS2811_PORTB,NUM_STRIPS>(leds, NUM_LEDS_PER_STRIP);
// LEDS.addLeds<WS2811_PORTD,NUM_STRIPS>(leds, NUM_LEDS_PER_STRIP).setCorrection(TypicalLEDStrip);
LEDS.addLeds<WS2811_PORTDC,NUM_STRIPS>(leds, NUM_LEDS_PER_STRIP);
LEDS.setBrightness(32);

// Teensy 4 parallel output example
// LEDS.addLeds<NUM_STRIPS, WS2811, 1>(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);
}
@@ -9,7 +9,7 @@ FASTLED_NAMESPACE_BEGIN

#define __FL_T4_MASK ((1<<(LANES))-1)
template <uint8_t LANES, int FIRST_PIN, int T1, int T2, int T3, EOrder RGB_ORDER = GRB, int XTRA0 = 0, bool FLIP = false, int WAIT_TIME = 50>
class InlineBlockClocklessController : public CPixelLEDController<RGB_ORDER, LANES, __FL_T4_MASK> {
class FlexibleInlineBlockClocklessController : public CPixelLEDController<RGB_ORDER, LANES, __FL_T4_MASK> {

uint8_t m_bitOffsets[16];
uint8_t m_nActualLanes;
@@ -202,6 +202,10 @@ class InlineBlockClocklessController : public CPixelLEDController<RGB_ORDER, LAN
}
};

template<template<uint8_t DATA_PIN, EOrder RGB_ORDER> class CHIPSET, uint8_t DATA_PIN, int NUM_LANES, EOrder RGB_ORDER=GRB>
class __FIBCC : public FlexibleInlineBlockClocklessController<NUM_LANES,DATA_PIN,CHIPSET<DATA_PIN,RGB_ORDER>::__T1(),CHIPSET<DATA_PIN,RGB_ORDER>::__T2(),CHIPSET<DATA_PIN,RGB_ORDER>::__T3(),RGB_ORDER,CHIPSET<DATA_PIN,RGB_ORDER>::__XTRA0(),CHIPSET<DATA_PIN,RGB_ORDER>::__FLIP(),CHIPSET<DATA_PIN,RGB_ORDER>::__WAIT_TIME()> {};

#define __FASTLED_HAS_FIBCC 1
#endif //defined(FASTLED_TEENSY4)

FASTLED_NAMESPACE_END

0 comments on commit 1a40bd2

Please sign in to comment.
You can’t perform that action at this time.