Jump to content

WS2812 driver problem


Recommended Posts

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!

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

 
Link to post
Share on other sites
  • 2 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...