Driver for WS2812

Questions and discussion about The WiPy 1.0 board and CC3200 boards.
Target audience: Users with a WiPy 1.0 or CC3200 board.
nui_de
Posts: 40
Joined: Fri Oct 23, 2015 3:27 pm

Re: Driver for WS2812

Post by nui_de » Mon Dec 07, 2015 10:19 pm

Hi Oliv'

just wanted to ask if you already made any progress :roll:

Oliv'
Posts: 13
Joined: Fri Oct 30, 2015 9:18 am

Re: Driver for WS2812

Post by Oliv' » Mon Dec 07, 2015 10:53 pm

nui_de wrote:just wanted to ask if you already made any progress :roll:
Hello !
No I didn't because I do not need a lot of leds, for now.
So I did not tried to improve speed, and I think that the most efficient way is to activate DMA.

User avatar
danicampora
Posts: 342
Joined: Tue Sep 30, 2014 7:20 am
Contact:

Re: Driver for WS2812

Post by danicampora » Tue Dec 08, 2015 9:51 am

DMA will come, but we need the asynchronous API as well. DMA by itself won't save anytime if you still have to wait for the transfer to complete before moving on. ;-)

Oliv'
Posts: 13
Joined: Fri Oct 30, 2015 9:18 am

Re: Driver for WS2812

Post by Oliv' » Tue Dec 08, 2015 12:06 pm

danicampora wrote:DMA will come, but we need the asynchronous API as well. DMA by itself won't save anytime if you still have to wait for the transfer to complete before moving on. ;-)
Yes asynchronous is mandatory, I thought it was included as for the PyBoard.
By the way it is good to know, thanks :)

User avatar
danicampora
Posts: 342
Joined: Tue Sep 30, 2014 7:20 am
Contact:

Re: Driver for WS2812

Post by danicampora » Tue Dec 08, 2015 4:33 pm

The pyboard doesn't have an asynchronous API yet...

Oliv'
Posts: 13
Joined: Fri Oct 30, 2015 9:18 am

Re: Driver for WS2812

Post by Oliv' » Tue Dec 08, 2015 5:14 pm

danicampora wrote:The pyboard doesn't have an asynchronous API yet...
My bad !
I have misread this post, sorry ! :oops:

nui_de
Posts: 40
Joined: Fri Oct 23, 2015 3:27 pm

Re: Driver for WS2812

Post by nui_de » Fri Apr 01, 2016 1:26 pm

Hi Daniel,

I only wanted to report two obvious bugs in your source:
https://github.com/danicampora/wipy/blo ... /ws2812.py

First, please look at the SPI values: (corrected version)

Code: Select all

    # values to put inside the SPI register for each bit of color
    bits = (bytearray((0xE0, 0xE0)), bytearray((0xE0, 0xFC)),
            bytearray((0xFC, 0xE0)), bytearray((0xFC, 0xFC)))
You have to interchange bits[1] and bits[2]

Second thing I found in function 'update' it should be:

Code: Select all

for bit in range (0, 8, 2):
else the two LSB get never set.

Now I have really smooth color fading and brightness control !
This also affects the Library by Oliv' since it uses the same bytearray :mrgreen:

Post Reply