Closed rm-hull closed 4 years ago
I've been trying to use this branch to get a ST7789 device working. However, all I seem to get is :-
from luma.lcd.device import st7789 ModuleNotFoundError: No module named 'luma.lcd'
my pip show has a sumary that includes ST7789 :-
pip3 show luma.lcd Name: luma.lcd Version: 2.0.0 Summary: A library to drive PCD8544, HT1621, ST7735, ST7789, ST7567 and UC1701X-based LCDs Home-page: https://github.com/rm-hull/luma.lcd Author: Richard Hull Author-email: richard.hull@destructuring-bind.org License: MIT Location: /usr/local/lib/python3.7/dist-packages/luma.lcd-2.0.0-py3.7.egg Requires: luma.core Required-by:
the python 2 version says :-
pip show luma.lcd Name: luma.lcd Version: 2.0.0 Summary: A library to drive PCD8544, HT1621, ST7735, ST7789, ST7567 and UC1701X-based LCDs Home-page: https://github.com/rm-hull/luma.lcd Author: Richard Hull Author-email: richard.hull@destructuring-bind.org License: MIT Location: /usr/local/lib/python2.7/dist-packages/luma.lcd-2.0.0-py2.7.egg Requires: luma.core Required-by: luma.examples
I know I'm doing something wrong, so any assistance would be much appreciated.
Anything on a brach is definitely a work-in-progress I'm afraid.
Unfortunately I've been greatly sidetracked by work (and moving house, and building an extension on the new house) this year so I've not been able spend anywhere near as much time as I would've liked on this project or my other GitHub projects. I'm not even sure where my collection of RPi's and small screens are .. they will be in a packing box somewhere...
Hopelly come January or February I will be able to start picking things up again
We now have a range of boards - Pirate Audio - that use an ST7789 display and would benefit from this support. I'm similarly stacked at the moment, but I'd be happy to lend an extra pair of eyes for testing/feedback where I can.
For Pirate Audio I'm running with:
python3 example.py --display st7789 --interface spi --gpio-data-command 9 --spi-device 1 --spi-bus-speed 32000000
Some observations:
I usually run Pirate Audio boards are 80MHz (which probably clamps to the nearest available freq on the Pi) since it's a lot of pixels to push at any reasonable framerate. However it looks like Luma will only let me drive up to 32MHz. Might be worth adding support for 62 (62.5 MHz) and 125MHz.
As an aside, since Luma uses runtime asserts the error generated for an "invalid" SPI frequency is a little opaque (The Pi will pick the nearest anyway, not sure about other platforms):
Traceback (most recent call last):
File "examples/matrix.py", line 69, in <module>
matrix(get_device())
File "/home/pi/luma.examples/examples/demo_opts.py", line 63, in get_device
device = cmdline.create_device(args)
File "/usr/local/lib/python3.7/dist-packages/luma/core/cmdline.py", line 194, in create_device
serial = getattr(make_serial(args), args.interface)()
File "/usr/local/lib/python3.7/dist-packages/luma/core/cmdline.py", line 160, in spi
gpio=self.gpio or GPIO)
File "/usr/local/lib/python3.7/dist-packages/luma/core/interface/serial.py", line 276, in __init__
assert(bus_speed_hz in [mhz * 1000000 for mhz in [0.5, 1, 2, 4, 8, 16, 32]])
AssertionError
--rotate
is not supported.
By default the width/height are 128x64
which is incorrect for this display- I can't recall if there's any way for the display width/height defaults to override this?
A purly aesthetic observation is that the code is somewhat opaque- observe these lines:
Yes, this problem is systemic in Luma and my code isn't much better (https://github.com/pimoroni/st7789-python/blob/master/library/ST7789/__init__.py), but it might be handy to normalise using defines or comments to indicate what these commands are actually doing.
Sorry, bit of a dump of random things. The code seems to work and successfully drive the ST7789.
I have rebased this feature branch, implemented the changes kindly suggested by @AlessioMorale and raised a replacement for this PR at #109
ok, lets close this PR and focus on #109
Not ready for review yet
https://www.aliexpress.com/item/1-3-inch-IPS-HD-TFT-ST7789-Drive-IC-240-240-SPI-Communication-3-3V-Voltage/32880846744.html