lvgl / lv_binding_micropython

LVGL binding for MicroPython
MIT License
237 stars 156 forks source link

Generic/ili9341 Driver #238

Closed BrianPugh closed 1 year ago

BrianPugh commented 1 year ago

Here's a working generic driver for the ILI9341 chip. I couldn't figure out how to get the rp2_dma stuff working in general, but if it works for the St77xx chips, I imagine it would also work for this one.

BrianPugh commented 1 year ago

Addressed some comments; will wait to write up examples until we determine if we want to change the interface.

amirgon commented 1 year ago

will wait to write up examples until we determine if we want to change the interface.

Examples can be very short and simple. Just a boilerplate for using the driver.
See the example I gave above for ESP32:

>>> import ili9xxx
>>> from machine import SPI, Pin
>>> spi = SPI(1, baudrate=20000000, sck=Pin(19, Pin.OUT), miso=Pin(5, Pin.OUT), mosi=Pin(18, Pin.OUT))
>>> drv = ili9xxx.Ili9341((240,320), dc=32, cs=33, rst=4, spi=spi)

You use it on rp2 right? Or on some other port? Is SPI initialized the same way there?

eudoxos commented 1 year ago

For hardware driver minimum, it is something like this (same as what you suggested, @amirgon): https://github.com/lvgl/lv_binding_micropython/blob/a69f4b514e426a129fc3e891e0bf22a5f88845a9/driver/generic/st77xx-test.py#L44-L58

@BrianPugh nice work, BTW, and I am glad the st77xx was useful as inspiration :)

BrianPugh commented 1 year ago

@amirgon I believe I have addressed all the feedback, with the register command being the only item remaining.

amirgon commented 1 year ago

Merged. Thank you very much for this contribution!