summaryrefslogtreecommitdiffstats
path: root/quantum
diff options
context:
space:
mode:
authorjpe230 <pablin.123.ra@gmail.com>2023-02-01 21:31:54 -0600
committerGitHub <noreply@github.com>2023-02-02 14:31:54 +1100
commit49c912f9b4148dea4499db30438fe8465bce401a (patch)
treedf314912417af8992f3210577668725fb1be636a /quantum
parent771763039076af2481b65a2823bbb57670beb995 (diff)
QP: Correct rotation and offset when using LVGL (#19713)
Co-authored-by: Nick Brassel <nick@tzarc.org> Co-authored-by: Joel Challis <git@zvecr.com>
Diffstat (limited to 'quantum')
-rw-r--r--quantum/painter/lvgl/qp_lvgl.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/quantum/painter/lvgl/qp_lvgl.c b/quantum/painter/lvgl/qp_lvgl.c
index 41ca3f98c2..c6dd08ef97 100644
--- a/quantum/painter/lvgl/qp_lvgl.c
+++ b/quantum/painter/lvgl/qp_lvgl.c
@@ -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;
+ 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;
}