adafruit / Adafruit_CircuitPython_RGB_Display

Drivers for RGB displays for Adafruit CircuitPython.
MIT License
131 stars 52 forks source link

Use numpy for bulk pixel data conversion #47

Closed Johennes closed 4 years ago

Johennes commented 4 years ago

This brings back the Numpy approach to converting pixel data for the SPI interface from the original Adafruit_Python_ILI9341 library. The use of Numpy instead of the previous double loop results in a performance boost of a factor >10 when testing on a Raspberry Pi Zero.

Fixes #46

ladyada commented 4 years ago

ok cool - small request - put the numpy import into image_to_data so that this code will still run on circuitpyboards that don't have numpy available!

Johennes commented 4 years ago

Ah sorry, didn't realize that was a requirement. I wasn't able to put the import inside of image_to_data since that is used as a generator for list. Instead I made the top-level import conditional and changed image to use the old double loop when Numpy was not imported.

ladyada commented 4 years ago

rad thanks!

makermelissa commented 4 years ago

I should be able to test in the next couple of days after I get back.