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

QP: Correct rotation and offset when using LVGL #19713

Merged
merged 3 commits into from
Feb 2, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions quantum/painter/lvgl/qp_lvgl.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,20 @@ bool qp_lvgl_attach(painter_device_t device) {

selected_display = device;

uint16_t panel_width, panel_height, offset_x, offset_y;
Jpe230 marked this conversation as resolved.
Show resolved Hide resolved
qp_get_geometry(selected_display, &panel_width, &panel_height, NULL, &offset_x, &offset_y);

panel_width -= offset_x;
panel_height -= offset_y;

// Setting up display driver
static lv_disp_drv_t disp_drv; /*Descriptor of a display driver*/
lv_disp_drv_init(&disp_drv); /*Basic initialization*/
disp_drv.flush_cb = qp_lvgl_flush; /*Set your driver function*/
disp_drv.draw_buf = &draw_buf; /*Assign the buffer to the display*/
disp_drv.hor_res = driver->panel_width; /*Set the horizontal resolution of the display*/
disp_drv.ver_res = driver->panel_height; /*Set the vertical resolution of the display*/
lv_disp_drv_register(&disp_drv); /*Finally register the driver*/
static lv_disp_drv_t disp_drv; /*Descriptor of a display driver*/
lv_disp_drv_init(&disp_drv); /*Basic initialization*/
disp_drv.flush_cb = qp_lvgl_flush; /*Set your driver function*/
disp_drv.draw_buf = &draw_buf; /*Assign the buffer to the display*/
disp_drv.hor_res = panel_width; /*Set the horizontal resolution of the display*/
disp_drv.ver_res = panel_height; /*Set the vertical resolution of the display*/
lv_disp_drv_register(&disp_drv); /*Finally register the driver*/

return true;
}
Expand Down