Replies: 2 comments 4 replies
-
|
you need to adjust the _ORIENTATION table for the display driver. That is where the parameters are stored for the rotation. |
Beta Was this translation helpful? Give feedback.
4 replies
-
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Uh oh!
There was an error while loading. Please reload this page.
-
I got the display running 90 degrees rotated, but the text is mirrored. I tried to play with the MADCTL value at the display_driver_framework.py without any success. Finally I tried any MADCTL values from 0x00 to 0xFF, but I can't get the text the right way.
I also tried any options of set_style_base_dir, but this is without any effect.
This Image is MADCTL value 0x36
Here is my code
import lcd_bus
from micropython import const
import machine
import jd9853
import lvgl as lv
import task_handler
_WIDTH = const(172)
_HEIGHT = const(320)
_BL = const(23)
_RST = const(22)
_DC = const(15)
_MOSI = const(2)
_MISO = const(5)
_SCK = const(1)
_HOST = const(1)
_LCD_CS = const(14)
_LCD_FREQ = const(80000000)
_OFFSET_X = const(0)
_OFFSET_Y = const(34)
spi_bus = machine.SPI.Bus(
host=_HOST,
mosi=_MOSI,
miso=_MISO,
sck=_SCK
)
display_bus = lcd_bus.SPIBus(
spi_bus=spi_bus,
freq=_LCD_FREQ,
dc=_DC,
cs=_LCD_CS,
)
display = jd9853.JD9853(
data_bus=display_bus,
display_width=_WIDTH,
display_height=_HEIGHT,
backlight_pin=_BL,
reset_pin=_RST,
reset_state=jd9853.STATE_LOW,
backlight_on_state=jd9853.STATE_PWM,
color_space=lv.COLOR_FORMAT.RGB565,
color_byte_order=jd9853.BYTE_ORDER_RGB,
rgb565_byte_swap=True,
offset_x=_OFFSET_X,
offset_y=_OFFSET_Y
)
display.set_power(True)
display.init()
display.set_rotation(lv.DISPLAY_ROTATION._90)
display.set_backlight(100)
th = task_handler.TaskHandler()
scrn = lv.screen_active()
scrn.set_style_bg_color(lv.color_hex(0x000000), 0)
rect1 = lv.obj(scrn)
rect1.set_size(100, 100)
rect1.set_style_bg_color(lv.color_hex(0x00aa00), 0)
rect1.set_style_border_color(lv.color_hex(0xffffff), 0)
rect1.set_style_border_width(1, 0)
rect1.set_style_radius(5, 5)
rect1.align(lv.ALIGN.TOP_LEFT, 10,10)
rect2 = lv.obj(scrn)
rect2.set_size(100, 100)
rect2.set_style_bg_color(lv.color_hex(0xff00ff), 0)
rect2.set_style_border_color(lv.color_hex(0xffffff), 0)
rect2.set_style_border_width(1, 0)
rect2.set_style_radius(5, 5)
rect2.align(lv.ALIGN.TOP_LEFT, 210,10)
label1 = lv.label(rect1)
label1.set_text('Test 1')
label1.align(lv.ALIGN.CENTER, 0, 0)
label1.set_style_base_dir(lv.BASE_DIR.LTR, 0)
label2 = lv.label(rect2)
label2.set_text('Test 2')
label2.align(lv.ALIGN.CENTER, 0, 0)
label2.set_style_base_dir(lv.BASE_DIR.RTL, 0)
label3 = lv.label(scrn)
label3.set_text('HELLO WORLD!')
label3.align(lv.ALIGN.CENTER, 0, 50)
label3.set_style_base_dir(lv.BASE_DIR.AUTO, 0)
Any idea?
Beta Was this translation helpful? Give feedback.
All reactions