Duggle

WS2812 driver problem

2 posts in this topic

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!

Share this post


Link to post
Share on other sites

 

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! :-)

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now