|
29 | 29 | time.sleep(3) |
30 | 30 | machine.reset() |
31 | 31 |
|
32 | | -_BUFFER_SIZE = const(28800) |
| 32 | +#_BUFFER_SIZE = const(28800) |
| 33 | +_BUFFER_SIZE = const(170 * 320 * 2) # without the + 1 this triggers render_mode = lv.DISPLAY_RENDER_MODE.FULL which is broken on emulated hardware (actual hardware still to test) |
33 | 34 | fb1 = display_bus.allocate_framebuffer(_BUFFER_SIZE, lcd_bus.MEMORY_INTERNAL | lcd_bus.MEMORY_DMA) |
34 | | -fb2 = display_bus.allocate_framebuffer(_BUFFER_SIZE, lcd_bus.MEMORY_INTERNAL | lcd_bus.MEMORY_DMA) |
| 35 | +#fb1_aligned = lv.draw_buf_align(fb1, lv.COLOR_FORMAT.RGB565) |
| 36 | +#fb2 = display_bus.allocate_framebuffer(_BUFFER_SIZE, lcd_bus.MEMORY_INTERNAL | lcd_bus.MEMORY_DMA) |
35 | 37 |
|
36 | 38 | import drivers.display.st7789 as st7789 |
37 | 39 | import mpos.ui |
38 | 40 | mpos.ui.main_display = st7789.ST7789( |
39 | 41 | data_bus=display_bus, |
40 | 42 | frame_buffer1=fb1, |
41 | | - frame_buffer2=fb2, |
42 | | - display_width=170, |
43 | | - display_height=320, |
| 43 | + #frame_buffer2=fb2, |
| 44 | + display_width=320, |
| 45 | + display_height=170, |
44 | 46 | color_space=lv.COLOR_FORMAT.RGB565, |
45 | 47 | # color_space=lv.COLOR_FORMAT.RGB888, # not supported on qemu |
46 | 48 | color_byte_order=st7789.BYTE_ORDER_BGR, |
|
51 | 53 | backlight_pin=38, # needed |
52 | 54 | backlight_on_state=st7789.STATE_PWM, |
53 | 55 | offset_x=0, |
54 | | - offset_y=35 |
| 56 | + offset_y=0 |
55 | 57 | ) # this will trigger lv.init() |
56 | 58 | mpos.ui.main_display.set_power(True) # set RD pin to high before the rest, otherwise garbled output |
57 | 59 | mpos.ui.main_display.init() |
58 | 60 | mpos.ui.main_display.set_backlight(100) # works |
59 | 61 |
|
60 | | -mpos.ui.main_display.set_rotation(lv.DISPLAY_ROTATION._270) # must be done after initializing display and creating the touch drivers, to ensure proper handling |
| 62 | +#mpos.ui.main_display.set_rotation(lv.DISPLAY_ROTATION._270) # must be done after initializing display and creating the touch drivers, to ensure proper handling |
| 63 | +mpos.ui.main_display.set_rotation(lv.DISPLAY_ROTATION._180) |
61 | 64 | mpos.ui.main_display.set_color_inversion(True) |
62 | 65 |
|
| 66 | +mpos.ui.frame_buffer1 = fb1 |
63 | 67 |
|
64 | 68 | # Button handling code: |
65 | 69 | from machine import Pin |
|
0 commit comments