Can the Smartmatrix take advantage of any of these new features?
No, not really. At least not anything on the 3.1 branch so far.
Would it be possible to add support for other types of chips, or is parallel output only a ws2811-thing?
I hooked up 3.1 to my CupHead which has a very odd mapping
// pin, length
pin1 9, 26
pin2 10, 39
pin3 11, 23
pin4 12, 22
pin5 13, 17
pin6 15, 17
To use the parallel stuff I’m defining it as a 39x8 (wasting two lines completely and with almost 50% ‘unused’ pixels.
To do it serial I’m defining it as a 23x9 array (wasting about 1/3rd).
For parallel it’s taking 6.7ms to do your rainbow and for serial it’s 17ms! Nice work!
uint16_t XY( uint8_t x, uint8_t y)
{
//Serial.print(“XY(”);Serial.print(x);Serial.print(",");Serial.print(y);Serial.print(")");Serial.println();
const uint16_t mappedTable[kRows * kColumns] =
{
// 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
/* 0 / 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 23, 23, 23, 23, 23, 23, 23, 25, 25,
/ 1 / 20, 19, 19, 18, 18, 18, 17, 17, 16, 16, 16, 15, 15, 14, 14, 14, 22, 22, 22, 21, 21, 21, 20,
/ 2 / 8, 7, 7, 6, 6, 5, 4, 4, 3, 3, 2, 1, 1, 0, 0, 13, 12, 12, 11, 10, 10, 9, 9,
/ 3 / 57, 56, 55, 54, 54, 53, 52, 52, 51, 50, 49, 48, 48, 47, 64, 63, 62, 62, 61, 60, 59, 59, 58,
/ 4 / 37, 36, 35, 34, 33, 32, 31, 31, 30, 29, 28, 27, 26, 46, 45, 44, 43, 42, 41, 40, 39, 39, 38,
/ 5 / 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77,
/ 6 / 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100, 100, 99,
/ 7 / 116, 115, 114, 113, 113, 112, 111, 110, 143, 142, 126, 125, 124, 123, 123, 122, 121, 120, 119, 118, 118, 117, 117,
/ 8 */ 132, 131, 131, 130, 130, 129, 129, 128, 127, 141, 140, 139, 139, 138, 138, 137, 136, 135, 135, 134, 134, 133, 133,
};
// lazy bounds checking
if (x >= kColumns)
x = 0;
if (y >= kRows)
y = 0;
uint16_t i;
i = (y * kColumns) + x;
//Serial.print(“i(”);Serial.print(i);Serial.print(") = “);Serial.print(y);Serial.print(” * “);Serial.print(kColumns);Serial.print(” + “);Serial.print(x);Serial.print(” — ");
//Serial.flush();
if( i >= sizeof(mappedTable) ) return 0;
uint16_t j = mappedTable[i];
//Serial.println(j);
return j;
}
I’m eventually going to add support for other types of chips. For the three wire chips it is just a matter of putting in different timings. The four wire chips will take a slight bit more to wire up the clock line in the parallel output the way I’d like.
@Zeke_Koch @Daniel_Garcia How did you setup() your strips? I’m wondering how to define different ranges of LEDs on different pins for parallel output.
There’s an example in the Examples directory, but basically I picked my longest strip (which happened to be 39 pixels and made an leds array that was 8x39
Then in parallel mode I used
LEDS.addLeds<WS2811_PORTC,8>(leds, longestStrip).setCorrection(TypicalSMD5050);
in serial mode I used:
LEDS.addLeds<WS2812B, pin1, GRB>(leds, strip1).setCorrection(TypicalSMD5050);
LEDS.addLeds<WS2812B, pin2, GRB>(leds, strip1, strip2).setCorrection(TypicalSMD5050);
LEDS.addLeds<WS2812B, pin3, GRB>(leds, strip1 + strip2, strip3).setCorrection(TypicalSMD5050);
LEDS.addLeds<WS2812B, pin4, GRB>(leds, strip1 + strip2 + strip3, strip4).setCorrection(TypicalSMD5050);
LEDS.addLeds<WS2812B, pin5, GRB>(leds, strip1 + strip2 + strip3 + strip4, strip5).setCorrection(TypicalSMD5050);
LEDS.addLeds<WS2812B, pin6, GRB>(leds, strip1 + strip2 + strip3 + strip4 + strip5, strip6).setCorrection(TypicalSMD5050);
and made sure that I used pins that were on PORTC. It’s wasteful (from both a size of the led array and the fact that other other pins are being banged on, but I didn’t need them for anything else and the teensy has plenty of ram for me to use.
I built the cuphead before the parallel stuff came out so I didn’t optimize for that (I’m also not running into perf issues even in serial mode).
hope that helps.
@Zeke_Koch just saw a comment in here that I wanted to respond to: " It’s wasteful (from both a size of the led array and the fact that other other pins are being banged on, but I didn’t need them for anything else" - the way the block code is done on the k20, if you’re only using the first 6 pins of PORTC, those are the only ones that I bit bang, I mask the other two bits out entirely, so you could, in theory, use those pins for other things.
Hi @Daniel_Garcia is there a way of using 16 channel parallel (Teensy 3.1) not only on compiled code. Instead of that, I want to “stream” or “pipe” my led array data via USB to Teensy 3.1?..
Would be great. Before I use OctoWS2811 (with DMA)
I want to interact and modify my colors on (f.e. Raspberry Pi) and stream the led data to Teensy board which uses FastLED 3.1 to make everything else.
@Mark_Kriegsman perhaps, you can answer my question too?
Yes, I believe you could write a simple loop on the teensy to read data from USB and send it to the LEDs. Although as noted elsewhere, the Fadecandy board and software can often be a better starting point for that sort of design. Not always, but very often it’s worth a look.
thanks @Mark_Kriegsman . I used fadecandy for my last panel - it is awesome; but it has the limitation of 8 ports depending on the OctoWS2811 library.