rm-hull/luma.led_matrix

Support for Scroll pHAT HD

Opened this issue · 8 comments

I'll be able to get my hands on one later this week and test it.

Looks like it is an i2c device, so should be easy to drive

Finally got one on my desk, will test this now. @rm-hull where do I start, how do I test this?

First things first, connect it up, and do i2cdetect -y 1 and see what address(es) it responds with.

Looking at the datasheet and adafruit arduino code, I'd be inclined to hack a little script first to understand it a bit more before diving into writing the display driver. The hack script should:

for x in range(17):
    for y in range(7):
        bus.write_byte(y, x, 0xFF)
        time.sleep(1)

and see what happens - if that worked (in some sense), you should see the LEDs progressively lighting up one by one - and that should give us a clue how to map the display (it will either be a raster scan or snake scan - similar to the WS2812 neopixel mapping on the unicorn HAT - https://github.com/rm-hull/luma.led_matrix/blob/master/luma/led_matrix/device.py#L281-L292)

Once we understand how to address it, writing a luma.led_matrix driver will be pretty simple, and we should be able to convert RGB colored images into greyscale so that the pixels have different brightness levels.

Quite happy to try organising a remote coding session (hangouts / slack / remote desktop
/ screenhero) ?

Is there some status update on this?
I have that hardware and there is a library from @pimoroni .
Do you want a (a) pure independent implementation, (b) it is OK to call their library, (c) it is OK to adapt their code and reuse it (they use MIT license) while removing all the unnecessary part (font, ...)?

I most emphatically promote borrowing and re-purposing our code!

If you need any help getting Scroll pHAT HD up and running, I'd be happy to test/review your code and answer any questions you might have.

I'd also love to see support for the Unicorn HAT HD, which uses SPI.

The Scroll pHAT HD pixels aren't addressed in any way that would make sense to standardise, but you can convert X/Y coordinates into an X index into the pixel memory using the _pixel_addr method on this class:

class ScrollPhatHD(Matrix):
    width = 17
    height = 7

    def _pixel_addr(self, x, y):
        if x > 8:
            x = x - 8
            y = 6 - (y + 8)
        else:
            x = 8 - x

        return x * 16 + y

https://github.com/pimoroni/scroll-phat-hd/blob/1637fce37f9d8c353ef8d658792164e1e1ea02a2/library/scrollphathd/is31fl3731.py#L647-L658

I'd also love to see support for the Unicorn HAT HD, which uses SPI.

@Gadgetoid - see #188 - wip, but is working