Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added compatibility with esp-idf ver5 and latest MicroPython #11

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ubidefeo
Copy link

Recently MicroPython has moved some things into modmachine.h and this project still relies on machine_spi.h.
Moreover ESP-IDF ver5 has broken the reference to GPIO because it's not part of the public API anyway.
On this issue I found suggestion to include hal/gpio_ll.h but while fixing the build it is still prone to breakage in case they move things around again.
espressif/esp-idf#9184

I have yet to test this, but I managed to make it build on ESP-IDF ver5 and the latest main on MicroPython.

Goes without saying that these changes will break builds on older version of MicroPython using IDF ver 4.x

@ubidefeo
Copy link
Author

Yeah... it works :D

IMG_9362

@ubidefeo
Copy link
Author

ubidefeo commented Jan 1, 2024

in case you want to test the firmware, I've taken the liberty to change a few things, such as freezing the romfonts as a module as well as renaming tft_config.py as tdisplay.py, in order to have better semantics for a frozen module which belongs to this particular board.
I have also made a build for the T-QT Pro which freezes parts of your st7759py_mpy module (https://github.com/russhughes/st7789py_mpy) and it works great :)

In these changes I made, I added the class Buttons to the same frozen module and changed the config(rotation=0, buffer_size=0, options=0) method to Display(rotation=0, buffer_size=0, options=0)

This allows the user to do the following

from time import sleep_ms
from romfonts import vga1_16x32 as font
from tdisplay import Display, Buttons
import st7789

screen = Display(0)
buttons = Buttons()

screen.deinit()
screen.init()
screen.text(font, "ciao!", 5, 10, st7789.WHITE)
counter = 0

while True:
  if buttons.left.value() == 0:
    print(f'{buttons.name} :: LEFT')
    counter -= 1
  if buttons.right.value() == 0:
    print(f'{buttons.name} :: RIGHT')
    counter += 1
  if counter < 0:
    counter = 0
  screen.text(font, f'{counter:>3}', screen.width() - 48, 10, st7789.WHITE, st7789.color565(0x8f, 0xbb, 0xf8))
  sleep_ms(30)

Goes without saying that I accept change requests on this PR and I'm happy to share findings.
I'm planning on submitting the 2 boards to MicroPython upstream :)

firmware.bin.zip

@ubidefeo
Copy link
Author

hi @russhughes

I was trying to figure out if this library was superseded by https://github.com/russhughes/s3lcd
I see more recent activity here than there.
Any pointers?
I only realised after making this PR that you mentioned the other repo and it had changes for modmachine.h

Hope you can shed some light on this :)
u.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant