Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Blinkt! support
#1
Hello,

I'm new to Python development and I'm trying to use the BiblioPixel library with the Blinkt! device described here: https://github.com/pimoroni/blinkt. It has 8 APA102 LEDs and covers all of the GPIO pins of a Raspberry Pi. I tried to use the APA102 driver because I read that the SPI-based drivers can be faster, but I didn't have any luck even after enabling the SPI config on my RPi. Could anyone advise on how to tell if the device is compatible with SPI?

I was able to get Blinkt to work by writing my own driver which just called the device's python library (below, if it helps anyone else), but if I could get even a little more performance by using SPI I would be interested. By the way, I'm really enjoying using the framework! Awesome work!



Code:
from blinkt import set_clear_on_exit, set_brightness, set_pixel, show

class BlinktDriver(DriverBase):


    def __init__(self, delay=0):
        super(BlinktDriver, self).__init__(num = 8, c_order=ChannelOrder.RGB)

    def update(self, data):
        p, r, g, b = 0, 0, 0, 0

        for i in range(len(data)):
            p = int(i / 3.0)
            if i % 3 == 0:
                r, g, b = data[i], data[i + 1], data[i + 2]
                set_pixel(p, r, g, b)
                show()
#2
It looks like, per their code, that they are not using the actual SPI pins:
https://github.com/pimoroni/blinkt/blob/master/library/blinkt.py#L6
23 and 24 are just regular GPIO pins (SPI is GPIO 10 and 11).
This is probably because they didn't want to steal the SPI interface for such a small display. And no... you won't really get any performance boost with only 8 LEDs. It would be on the order of microseconds. If your driver works, go for it Smile Happy to put it in the official BiblioPixel release if that's OK with you.
#3
(09-26-2016, 08:54 PM)Adam Wrote: It looks like, per their code, that they are not using the actual SPI pins:
https://github.com/pimoroni/blinkt/blob/master/library/blinkt.py#L6
23 and 24 are just regular GPIO pins (SPI is GPIO 10 and 11).
This is probably because they didn't want to steal the SPI interface for such a small display. And no... you won't really get any performance boost with only 8 LEDs. It would be on the order of microseconds. If your driver works, go for it Smile Happy to put it in the official BiblioPixel release if that's OK with you.

Thanks Adam! I knew there was something I had to be missing.

And sure, if you want to include the driver in the official release feel free. I'm happy to contribute. Just let me know if there is anything further you would need from me to make the driver up to par.


Forum Jump:


Users browsing this thread: 1 Guest(s)