Skip to content

This driver is not slow #7

@antirez

Description

@antirez

Hello, thank you for writing this driver. Initially I used it with MicroPython SoftSPI, and performances where terrible. I did some profiling and found that it was the SoftSPI implementation itself that is so show, but at least with the ESP32-S3, if we switch to the hardware SPI, it goes from 1100 ticks to fill the screen to... 53! Basically more or less the performance of the C driver if I understand correctly.

Now the trick is that sometimes you can use the SPI() constructor and still use the SoftSPI() thing (and get a deprecation message). This depends on the first parameter, that must be a number, the hardware SPI identifier basically. To really use the hardware SPI, you need to do something like that when constructing the object:

    # Our display does not have a MISO pin, but the MicroPython
    # SPI implementation does not allow to avoid specifying one, so
    # we use just a not used pin in the device.
    spi = SPI(1, baudrate=40000000, polarity=1, sck=18, mosi=13, miso=37)
    display = st7789.ST7789(
        spi, 240, 240,
        reset=False,
        dc=Pin(38, Pin.OUT),
        cs=Pin(12, Pin.OUT),
    )
    display.init()

Note that the S3 seems able to use any pin for hardware SPI! I don't think that before ESP32-S3 it was like that, but I'm not sure.

I hope this helps! And I believe it would be cool to document this in the project README file. Others may benefit from this information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions