Rpi SPI does not seem to Work Correctly With WS2812 #1794
Unanswered
jliriano2000
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is this a known error?
I can't set all the LED's to Red, Blue or Green solidly. When I set Red, it becomes Yellow, Blue -> Cyan, Green -> Magenta.
Looking at LedDeviceWs2812SPI.cpp under dev_spi, it looks like it is a copy of the same code that is under dev_ftdi. Further, the byte order seems off for WS2812:
uint32_t colorBits = ((unsigned int)color.red << 16)
| ((unsigned int)color.green << 8)
| color.blue;
When packing colors together, green goes into the higher byte, then red, then blue.
Then it does not look like the amount of buffer space is correct:
_ledBuffer.resize(_ledRGBCount * SPI_BYTES_PER_COLOUR + SPI_FRAME_END_LATCH_BYTES, 0x00);
SPI_BYTES_PER_COLOUR = 4. But this should be:
_ledBuffer.resize((_ledRGBCount * SPI_BYTES_PER_COLOUR * 3) + SPI_FRAME_END_LATCH_BYTES, 0x00);
Beta Was this translation helpful? Give feedback.
All reactions