WS2812 driver problem

I’m away from my usual development computer so I’ve set up all the tools on my laptop and compiled an app that I’m developing.

In this new context I’m finding that the blue colour component is showing on the previous LED in the chain.

extern "C" void APP\_Init(void){ // mled.test(); // Initialise all LEDs MIOS32\_BOARD\_LED\_Init(0xffffffff); WS2812\_Init(0); WS2812\_LED\_SetRGB(10,0,100); WS2812\_LED\_SetRGB(10,1,000); WS2812\_LED\_SetRGB(10,2,100);

So here we see LED #9 is blue and LED #10 is red. This also happens with WS2812_LED_SetHSV(..).

I’m left with the fact that it seems to be a problem in the driver that wasn’t in my other setup which I don’t have access to ATM.

Any help appreciated!

 

Like I said the previous index of blue led is addressed.

I’m not saying there’s a bug in the repo, because I used it fine in the recent past.

The problem affects both 

**WS2812_LED_SetRGB(led,2,val), **and WS2812_LED_GetRGB(led,2,val)

i.e getting and setting the Blue led.

To make things work right I have made the following changes to ws2812.c (to get me out of trouble…)

 if( colour == 0 ) colour\_ix = 2; else if( colour == 1 ) colour\_ix = 0; else if( colour == 2 ){ colour\_ix = 1; led++; } else return -2; // unsupported colour

i.e increment led   for the blue (and only blue) LED.

in both  the Get and Set function.

This is obviously a problem of my own making but I can’t see what i could have done to cause it! :slight_smile:

 

Found the bug - fixed! :slight_smile:

Best Regards, Thorsten.