FastSPI_LED2 Teensy 3 and const array access


I am moving my Graphic (Pixel) POI over to using a different LED and Microprocessor. The reason for this is to experiment with using a high density prebuilt strip of LEDs. These strips are 144led/m, individually addressable. To do this I need to use the new driver library for FastSPI. The new library is called FastSPI_LED2 and drives the WS2811 pixels slightly differently.

This meant that the syntax for determining the colour of each of the pixels has now changed. I thought that you might be able to use the new syntax and save yourself many hours of head scratching.

I posted the question on PJRC Forum for some support and got some great pointers.

I have ben using Teensy 2++ for running an LPD6803 Led array with the colour values to be displayed stored in PROGMEM. I have been using the FastSPI lib to drive these. My code for this was along the lines of:

in setup

in loop
unsigned int array0[] PROGMEM = {0x7fff, 0x7fff, 0x7fff, 0x7fff, etc (these are 15bit colour leds)

Led[led_number1]= pgm_read_dword((uint32_t)(&(array[i])));
etc for the Led array locations, where i is the incremented value to find the array location.

It may not have been the most efficient, and was probably incorrect but, hey, it worked. (I think that I should have declared uint16_t).

I am moving over to the new FastSPI_LED2 lib and am using 24bit colour ws2811 leds, but am having issues with accessing the array values. I the Teensy 3 and leds up and running with non array values, producing patterns mathematically. However, I have the array of 0x123456 colour values, but can’t seem to get the correct syntax for FastSPI_LED2 to access the correct location in flash. I have been reading the examples, but not found anything that makes sense to me for this issue.

I have declared the array as:
const unsigned int array[] = { 0x00FF00, 0xFFFF00, 0xFF00FF, etc

and am trying to access the value by using:
leds[led_number1]= CRGB{array[i]};

Any idea whether this syntax is correct?
I’m thinking that as CRGB struct is in the for of {byte g, byte r, byte b}, I must have to do some for of bit shift:
leds[led_number1]= CRGB{(array[i])??16,((array[i])??8),(array[i])};

So, the answer I managed to get working was:

I declared the array as const, and used a bit shift in getting the value out:

const unsigned int array[] = {0x00FFFF, 0x00ff00, 0x0000FF, 0xffFFff, 0x000000, …etc

The array can stay as int, and does not need to be long. (probably a great sin to not explicitly declare as long…)

and then used (where i is the array location):

leds[led_number1]= CRGB{(array[i]>>16), (array[i]>>8), (array[i])};