Skip to content

C6 can't drive ST7789 correctly. #434

@Vincent1-python

Description

@Vincent1-python

Describe the bug
C6 can't drive ST7789 correctly.
Images
Image
Use easydispaly driver:
Image

import lcd_bus
from micropython import const
import machine
import lcd_utils


# display settings
_WIDTH = const(240)
_HEIGHT = const(280)
_BL = const(3)
_RST = const(2) #no such pin
_DC = const(0)

_MOSI = const(7)
_MISO = const(2)#no such pin
_SCK = const(6)
_HOST = const(1)  # SPI2

_LCD_CS = const(1)
_LCD_FREQ = const(30000000)

spi_bus = machine.SPI.Bus(
    host=_HOST,
    mosi=_MOSI,
    sck=_SCK,    
)

display_bus = lcd_bus.SPIBus(
    spi_bus=spi_bus,
    freq=_LCD_FREQ,
    dc=_DC,
    cs=_LCD_CS,
)


import st7789  # NOQA
import lvgl as lv  # NOQA

display = st7789.ST7789(
    data_bus=display_bus,
    display_width=_WIDTH,
    display_height=_HEIGHT,
    backlight_pin=_BL,
    color_space=lv.COLOR_FORMAT.RGB565,
    color_byte_order=st7789.BYTE_ORDER_RGB,
    rgb565_byte_swap=True,
)

import task_handler  # NOQA

display.init()

#display.set_rotation(lv.DISPLAY_ROTATION._90)

display.set_backlight(1)

th = task_handler.TaskHandler()

scrn = lv.screen_active()
scrn.set_style_bg_color(lv.color_hex(0x000000), 0)
slider = lv.slider(scrn)
slider.set_size(300, 50)
slider.center()

label = lv.label(scrn)
label.set_text('HELLO WORLD!')
label.align(lv.ALIGN.CENTER, 0, -50)

use esp32c6.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions