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

SUNTON 1732S019 ESP32S3 board with ST7789 170x320 display #24

Open
SvenMb opened this issue Feb 10, 2024 · 0 comments
Open

SUNTON 1732S019 ESP32S3 board with ST7789 170x320 display #24

SvenMb opened this issue Feb 10, 2024 · 0 comments

Comments

@SvenMb
Copy link

SvenMb commented Feb 10, 2024

Just tried your Micropython firmware 'ESP32_GENERIC_S3_SPIRAM_OCT_16MiB' with the Sunton 1732S019 board and it instant worked. Very nice!

1707581371599

Maybe you like to add this config to your examples.

tft_config.py

""" SUNTON 1732S070 ESP32S3 170x320 ST7789 display """

from machine import Pin, freq
import s3lcd

BL = Pin(14, Pin.OUT)

TFA = 0
BFA = 0
WIDE = 1
TALL = 0

freq(240_000_000)


def config(rotation=0, options=0):
    """Configure the display and return an ESPLCD instance."""

    BL.value(1)

    bus = s3lcd.SPI_BUS(
        2, mosi=13, sck=12, dc=11, cs=10, pclk=50000000, swap_color_bytes=True
    )

    return s3lcd.ESPLCD(
        bus,
        170,
        320,
        inversion_mode=True,
        color_space=s3lcd.RGB,
        reset=1,
        rotation=rotation,
        dma_rows=32,
        options=options,
    )


def deinit(tft, display_off=False):
    """Take an ESPLCD instance and Deinitialize the display."""
    tft.deinit()
    if display_off:
        BL.value(0)

tft_buttons.py

since this board has no inbuild buttons, but a lot free GPIOs, here only the definition I used for the pinball example:

# use GPIO 21 and 20 for left and right button, just as example

from machine import Pin

class Buttons:
    def __init__(self):
        self.name = "1732S019"
        self.left = Pin(21, Pin.IN, Pin.PULL_UP)
        self.right = Pin(20, Pin.IN, Pin.PULL_UP)
        self.hyper = 0
        self.thrust = 0
        self.fire = 0
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

No branches or pull requests

1 participant