How to change RGB order ? im using the old library for 6803,

How to change RGB order ?

im using the old library for 6803, but at the same time the new color functions .
everything works “almost” fine, but I have to change the LED color order , and the old definition :
struct CRGB { unsigned char b; unsigned char r; unsigned char g; } shows and error as CRGB has already been defined on other library . Then my question is : , where should I change the code in order to make it work as BRG , and modifying as less as possible?,

thankyou

You have to go into pixeltypes.h, for the definition for CRGB - and change the ordering/names of the r/red, g/green, and b/blue unions.

Note that you will have to make this change every time you update the library version. Also note that you will have to undo this change if you ever want to use the library to drive other led types (because a lot of the low level driver code in FastLED relies on the assumption of the byte ordering of rgb in the CRGB class).

Underdtand.; I will keep two versions separated; thankyou.

@Daniel_Garcia Daniel, at the same time do I have to make the conversions from 8 bits, to 5 bits for the 6803 color codes? , in order to be able to use for example … = CRGB::Green;

No, the library (even the old one) does that internally.

ok, thanks, will check again, because after changing pixeltypes led color assignment remains in bad order…

DAniel, on the version of the old library im using (last version compatible with 6803), CRGB was not even defined .

the definition was made on the program itself,
// Sometimes chipsets wire in a backwards sort of way
struct CRGB { unsigned char b; unsigned char r; unsigned char g; };

that of course im not using, because I do have the pixeltypes.h in my program; then I don’t see where the color conversion could have been done.

Because the old library just used a raw array of 8-bit data, a red followed by a green, followed by a blue, and so on and so forth, if you looked in the old library code at the lpd6803 handler, you’d see this:

ISR(spilpd6803)
{
static unsigned char nState=1;
if(FastSPI_LED.m_eChip == CFastSPI_LED::SPI_LPD6803)
{
if(nState==1)
{
SPI_A(0);
if(FastSPI_LED.m_nDirty==1) {
nState = 0;
FastSPI_LED.m_nDirty = 0;
SPI_B;
SPI_A(0);
pData = FastSPI_LED.m_pData;
return;
}
SPI_B;
SPI_A(0);
return;
}
else
{
register unsigned int command;
command = 0x8000;
command |= ((pData++) & 0xF8) << 7; // red is the high 5 bits
command |= (
(pData++) & 0xF8) << 2; // green is the middle 5 bits
command |= *(pData++) >> 3 ; // blue is the low 5 bits
SPI_B;
SPI_A( (command>>8) &0xFF);
if(pData == FastSPI_LED.m_pDataEnd) {
nState = 1;
}
SPI_B;
SPI_A( command & 0xFF);
return;
}
}
}

(Seriously, though, I stopped supporting the LPD6803 two years ago - who is even still selling them?)

It was , my mistake, I bought one in china, and installed them in an hexacopter , have an arduino nano reading the mavlink telemetry data and changing leds according to the copter state.

already bought 2811s, but I will make it work with the 6803, and then move on to the new library .

I also added the fades library developed by alex leone for the TLC5840 ( I made a lamp 4 years ago), and converted the functions to make it work with your library .

anyway, trying to understand, why my “Red”, is still “Blue” …