[Core] Quantum Painter - LVGL Integration (#18499)
Co-authored-by: Nick Brassel <nick@tzarc.org>
This commit is contained in:
parent
2d19e59d78
commit
102f22f7e9
4
.gitmodules
vendored
4
.gitmodules
vendored
@ -21,3 +21,7 @@
|
|||||||
[submodule "lib/pico-sdk"]
|
[submodule "lib/pico-sdk"]
|
||||||
path = lib/pico-sdk
|
path = lib/pico-sdk
|
||||||
url = https://github.com/qmk/pico-sdk.git
|
url = https://github.com/qmk/pico-sdk.git
|
||||||
|
[submodule "lib/lvgl"]
|
||||||
|
path = lib/lvgl
|
||||||
|
url = https://github.com/qmk/lvgl.git
|
||||||
|
branch = release/v8.2
|
||||||
|
2
Makefile
2
Makefile
@ -402,6 +402,7 @@ ifndef SKIP_GIT
|
|||||||
if [ ! -e lib/vusb ]; then git submodule sync lib/vusb && git submodule update --depth 50 --init lib/vusb; fi
|
if [ ! -e lib/vusb ]; then git submodule sync lib/vusb && git submodule update --depth 50 --init lib/vusb; fi
|
||||||
if [ ! -e lib/printf ]; then git submodule sync lib/printf && git submodule update --depth 50 --init lib/printf; fi
|
if [ ! -e lib/printf ]; then git submodule sync lib/printf && git submodule update --depth 50 --init lib/printf; fi
|
||||||
if [ ! -e lib/pico-sdk ]; then git submodule sync lib/pico-sdk && git submodule update --depth 50 --init lib/pico-sdk; fi
|
if [ ! -e lib/pico-sdk ]; then git submodule sync lib/pico-sdk && git submodule update --depth 50 --init lib/pico-sdk; fi
|
||||||
|
if [ ! -e lib/lvgl ]; then git submodule sync lib/lvgl && git submodule update --depth 50 --init lib/lvgl; fi
|
||||||
git submodule status --recursive 2>/dev/null | \
|
git submodule status --recursive 2>/dev/null | \
|
||||||
while IFS= read -r x; do \
|
while IFS= read -r x; do \
|
||||||
case "$$x" in \
|
case "$$x" in \
|
||||||
@ -432,6 +433,7 @@ git-submodule:
|
|||||||
[ -e lib/ugfx ] && rm -rf lib/ugfx || true
|
[ -e lib/ugfx ] && rm -rf lib/ugfx || true
|
||||||
[ -e lib/pico-sdk ] && rm -rf lib/pico-sdk || true
|
[ -e lib/pico-sdk ] && rm -rf lib/pico-sdk || true
|
||||||
[ -e lib/chibios-contrib/ext/mcux-sdk ] && rm -rf lib/chibios-contrib/ext/mcux-sdk || true
|
[ -e lib/chibios-contrib/ext/mcux-sdk ] && rm -rf lib/chibios-contrib/ext/mcux-sdk || true
|
||||||
|
[ -e lib/lvgl ] && rm -rf lib/lvgl || true
|
||||||
git submodule sync --recursive
|
git submodule sync --recursive
|
||||||
git submodule update --init --recursive --progress
|
git submodule update --init --recursive --progress
|
||||||
|
|
||||||
|
10
data/templates/config-overrides/common/lv_conf.h
Normal file
10
data/templates/config-overrides/common/lv_conf.h
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
// Copyright 2022 Nick Brassel (@tzarc)
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// #define LV_DITHER_GRADIENT 1
|
||||||
|
|
||||||
|
#include_next <lv_conf.h>
|
||||||
|
|
||||||
|
// #undef LV_COLOR_16_SWAP
|
||||||
|
// #define LV_COLOR_16_SWAP 0
|
@ -100,6 +100,7 @@
|
|||||||
* Hardware Features
|
* Hardware Features
|
||||||
* Displays
|
* Displays
|
||||||
* [Quantum Painter](quantum_painter.md)
|
* [Quantum Painter](quantum_painter.md)
|
||||||
|
* [Quantum Painter LVGL Integration](quantum_painter_lvgl.md)
|
||||||
* [HD44780 LCD Driver](feature_hd44780.md)
|
* [HD44780 LCD Driver](feature_hd44780.md)
|
||||||
* [ST7565 LCD Driver](feature_st7565.md)
|
* [ST7565 LCD Driver](feature_st7565.md)
|
||||||
* [OLED Driver](feature_oled_driver.md)
|
* [OLED Driver](feature_oled_driver.md)
|
||||||
|
55
docs/quantum_painter_lvgl.md
Normal file
55
docs/quantum_painter_lvgl.md
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
# Quantum Painter LVGL Integration :id=lvgl
|
||||||
|
|
||||||
|
LVGL (Light and Versatile Graphics Library) is an open-source graphics library providing everything you need to create an embedded GUI for your board with easy-to-use graphical elements.
|
||||||
|
|
||||||
|
LVGL integrates with [Quantum Painter's](quantum_painter.md) API and drivers to render to the display, the hardware supported by Quantum Painter is also supported by LVGL.
|
||||||
|
|
||||||
|
?> Keep in mind that enabling the LVGL integration has a big impact in firmware size, it is recommeded to use a supported MCU with >256 kB of flash space.
|
||||||
|
|
||||||
|
To learn more about LVGL and how to use it please take a look at their [official documentation](https://docs.lvgl.io/8.2/intro/)
|
||||||
|
|
||||||
|
## Enabling LVGL :id=lvgl-enabling
|
||||||
|
To enable LVGL to be built into your firmware, add the following to `rules.mk`:
|
||||||
|
|
||||||
|
```make
|
||||||
|
QUANTUM_PAINTER_ENABLE = yes
|
||||||
|
QUANTUM_PAINTER_DRIVERS = ......
|
||||||
|
QUANTUM_PAINTER_LVGL_INTEGRATION = yes
|
||||||
|
```
|
||||||
|
To configure the Quantum Painter Display Drivers please read the [Quantum Painter Display Drivers](quantum_painter.md#quantum-painter-drivers) section.
|
||||||
|
|
||||||
|
## Quantum Painter LVGL API :id=lvgl-api
|
||||||
|
|
||||||
|
### Quantum Painter LVGL Attach :id=lvgl-api-init
|
||||||
|
|
||||||
|
```c
|
||||||
|
bool qp_lvgl_attach(painter_device_t device);
|
||||||
|
```
|
||||||
|
|
||||||
|
The `qp_lvgl_attach` function is used to set up LVGL with the supplied display, and requires an already configured display.
|
||||||
|
|
||||||
|
```c
|
||||||
|
static painter_device_t display;
|
||||||
|
void keyboard_post_init_kb(void) {
|
||||||
|
display = qp_make_.......; // Create the display
|
||||||
|
qp_init(display, QP_ROTATION_0); // Initialise the display
|
||||||
|
|
||||||
|
if (qp_lvgl_attach(display)) { // Attach LVGL to the display
|
||||||
|
...Your code to draw // Run LVGL specific code to draw
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
To init. the display please read the [Display Initialisation](quantum_painter.md#quantum-painter-api-init) section.
|
||||||
|
|
||||||
|
!> Attaching LVGL to a display means LVGL subsequently "owns" the display. Using standard Quantum Painter drawing operations with the display after LVGL attachment will likely result in display artifacts.
|
||||||
|
### Quantum Painter LVGL Detach :id=lvgl-api-init
|
||||||
|
|
||||||
|
```c
|
||||||
|
void qp_lvgl_detach()
|
||||||
|
```
|
||||||
|
|
||||||
|
The `qp_lvgl_detach` function stops the internal LVGL ticks and releases resources related to it.
|
||||||
|
|
||||||
|
## Enabling/Disabling LVGL features :id=lvgl-configuring
|
||||||
|
|
||||||
|
You can overwrite LVGL specific features in your `lv_conf.h` file.
|
15
keyboards/handwired/onekey/keymaps/lvgl/config.h
Normal file
15
keyboards/handwired/onekey/keymaps/lvgl/config.h
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
// Copyright 2022 Jose Pablo Ramirez (@jpe230)
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
/* SPI pins */
|
||||||
|
#define SPI_DRIVER SPID0
|
||||||
|
#define SPI_SCK_PIN GP18
|
||||||
|
#define SPI_MOSI_PIN GP19
|
||||||
|
#define SPI_MISO_PIN GP20
|
||||||
|
|
||||||
|
/* LCD Configuration */
|
||||||
|
#define LCD_RST_PIN GP0
|
||||||
|
#define LCD_DC_PIN GP1
|
||||||
|
#define LCD_CS_PIN GP2
|
12
keyboards/handwired/onekey/keymaps/lvgl/halconf.h
Normal file
12
keyboards/handwired/onekey/keymaps/lvgl/halconf.h
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
// Copyright 2022 Jose Pablo Ramirez (@jpe230)
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include_next <halconf.h>
|
||||||
|
|
||||||
|
#undef HAL_USE_SPI
|
||||||
|
#define HAL_USE_SPI TRUE
|
||||||
|
|
||||||
|
#undef SPI_USE_WAIT
|
||||||
|
#define SPI_USE_WAIT TRUE
|
50
keyboards/handwired/onekey/keymaps/lvgl/keymap.c
Normal file
50
keyboards/handwired/onekey/keymaps/lvgl/keymap.c
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
// Copyright 2022 Jose Pablo Ramirez (@jpe230)
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include QMK_KEYBOARD_H
|
||||||
|
#include "qp.h"
|
||||||
|
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
LAYOUT_ortho_1x1(JS_BUTTON0)
|
||||||
|
};
|
||||||
|
|
||||||
|
painter_device_t lcd;
|
||||||
|
|
||||||
|
void lv_example_arc_2(void);
|
||||||
|
|
||||||
|
void keyboard_post_init_user(void) {
|
||||||
|
lcd = qp_gc9a01_make_spi_device(240, 240, LCD_CS_PIN, LCD_DC_PIN, LCD_RST_PIN, 4, 0);
|
||||||
|
qp_init(lcd, QP_ROTATION_0);
|
||||||
|
qp_rect(lcd, 0, 0, 239, 319, 0, 255, 255, true);
|
||||||
|
|
||||||
|
if (qp_lvgl_attach(lcd)) {
|
||||||
|
lv_example_arc_2();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void set_angle(void* obj, int32_t v) {
|
||||||
|
lv_arc_set_value(obj, v);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an arc which acts as a loader.
|
||||||
|
*/
|
||||||
|
void lv_example_arc_2(void) {
|
||||||
|
/*Create an Arc*/
|
||||||
|
lv_obj_t* arc = lv_arc_create(lv_scr_act());
|
||||||
|
lv_arc_set_rotation(arc, 270);
|
||||||
|
lv_arc_set_bg_angles(arc, 0, 360);
|
||||||
|
lv_obj_remove_style(arc, NULL, LV_PART_KNOB); /*Be sure the knob is not displayed*/
|
||||||
|
lv_obj_clear_flag(arc, LV_OBJ_FLAG_CLICKABLE); /*To not allow adjusting by click*/
|
||||||
|
lv_obj_center(arc);
|
||||||
|
|
||||||
|
static lv_anim_t a;
|
||||||
|
lv_anim_init(&a);
|
||||||
|
lv_anim_set_var(&a, arc);
|
||||||
|
lv_anim_set_exec_cb(&a, set_angle);
|
||||||
|
lv_anim_set_time(&a, 1000);
|
||||||
|
lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE); /*Just for the demo*/
|
||||||
|
lv_anim_set_repeat_delay(&a, 500);
|
||||||
|
lv_anim_set_values(&a, 0, 100);
|
||||||
|
lv_anim_start(&a);
|
||||||
|
}
|
9
keyboards/handwired/onekey/keymaps/lvgl/mcuconf.h
Normal file
9
keyboards/handwired/onekey/keymaps/lvgl/mcuconf.h
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
// Copyright 2022 Jose Pablo Ramirez (@jpe230)
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include_next <mcuconf.h>
|
||||||
|
|
||||||
|
#undef RP_SPI_USE_SPI0
|
||||||
|
#define RP_SPI_USE_SPI0 TRUE
|
3
keyboards/handwired/onekey/keymaps/lvgl/rules.mk
Normal file
3
keyboards/handwired/onekey/keymaps/lvgl/rules.mk
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
QUANTUM_PAINTER_ENABLE = yes
|
||||||
|
QUANTUM_PAINTER_LVGL_INTEGRATION = yes
|
||||||
|
QUANTUM_PAINTER_DRIVERS = gc9a01_spi
|
1
lib/lvgl
Submodule
1
lib/lvgl
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit e19410f8f8a256609da72cff549598e0df6fa4cf
|
756
platforms/lv_conf.h
Normal file
756
platforms/lv_conf.h
Normal file
File diff suppressed because it is too large
Load Diff
@ -60,9 +60,9 @@ int main(void) {
|
|||||||
protocol_task();
|
protocol_task();
|
||||||
|
|
||||||
#ifdef QUANTUM_PAINTER_ENABLE
|
#ifdef QUANTUM_PAINTER_ENABLE
|
||||||
// Run Quantum Painter animations
|
// Run Quantum Painter task
|
||||||
void qp_internal_animation_tick(void);
|
void qp_internal_task(void);
|
||||||
qp_internal_animation_tick();
|
qp_internal_task();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEFERRED_EXEC_ENABLE
|
#ifdef DEFERRED_EXEC_ENABLE
|
||||||
|
144
quantum/painter/lvgl/qp_lvgl.c
Normal file
144
quantum/painter/lvgl/qp_lvgl.c
Normal file
@ -0,0 +1,144 @@
|
|||||||
|
// Copyright 2022 Jose Pablo Ramirez (@jpe230)
|
||||||
|
// Copyright 2022 Nick Brassel (@tzarc)
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include "qp_lvgl.h"
|
||||||
|
#include "timer.h"
|
||||||
|
#include "deferred_exec.h"
|
||||||
|
#include "lvgl.h"
|
||||||
|
|
||||||
|
typedef struct lvgl_state_t {
|
||||||
|
uint8_t fnc_id; // Ideally this should be the pointer of the function to run
|
||||||
|
uint16_t delay_ms;
|
||||||
|
deferred_token defer_token;
|
||||||
|
} lvgl_state_t;
|
||||||
|
|
||||||
|
static deferred_executor_t lvgl_executors[2] = {0}; // For lv_tick_inc and lv_task_handler
|
||||||
|
static lvgl_state_t lvgl_states[2] = {0}; // For lv_tick_inc and lv_task_handler
|
||||||
|
|
||||||
|
painter_device_t selected_display = NULL;
|
||||||
|
void * color_buffer = NULL;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Quantum Painter LVGL Integration Internal: qp_lvgl_flush
|
||||||
|
|
||||||
|
void qp_lvgl_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p) {
|
||||||
|
if (selected_display) {
|
||||||
|
uint32_t number_pixels = (area->x2 - area->x1 + 1) * (area->y2 - area->y1 + 1);
|
||||||
|
qp_viewport(selected_display, area->x1, area->y1, area->x2, area->y2);
|
||||||
|
qp_pixdata(selected_display, (void *)color_p, number_pixels);
|
||||||
|
qp_flush(selected_display);
|
||||||
|
lv_disp_flush_ready(disp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint32_t tick_task_callback(uint32_t trigger_time, void *cb_arg) {
|
||||||
|
lvgl_state_t * state = (lvgl_state_t *)cb_arg;
|
||||||
|
static uint32_t last_tick = 0;
|
||||||
|
switch (state->fnc_id) {
|
||||||
|
case 0: {
|
||||||
|
uint32_t now = timer_read32();
|
||||||
|
lv_tick_inc(TIMER_DIFF_32(now, last_tick));
|
||||||
|
last_tick = now;
|
||||||
|
} break;
|
||||||
|
case 1:
|
||||||
|
lv_task_handler();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The tasks should run indefinitely
|
||||||
|
return state->delay_ms;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Quantum Painter LVGL Integration API: qp_lvgl_attach
|
||||||
|
|
||||||
|
bool qp_lvgl_attach(painter_device_t device) {
|
||||||
|
qp_dprintf("qp_lvgl_start: entry\n");
|
||||||
|
qp_lvgl_detach();
|
||||||
|
|
||||||
|
struct painter_driver_t *driver = (struct painter_driver_t *)device;
|
||||||
|
if (!driver->validate_ok) {
|
||||||
|
qp_dprintf("qp_lvgl_attach: fail (validation_ok == false)\n");
|
||||||
|
qp_lvgl_detach();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setting up the tasks
|
||||||
|
lvgl_state_t *lv_tick_inc_state = &lvgl_states[0];
|
||||||
|
lv_tick_inc_state->fnc_id = 0;
|
||||||
|
lv_tick_inc_state->delay_ms = 1;
|
||||||
|
lv_tick_inc_state->defer_token = defer_exec_advanced(lvgl_executors, 2, 1, tick_task_callback, lv_tick_inc_state);
|
||||||
|
|
||||||
|
if (lv_tick_inc_state->defer_token == INVALID_DEFERRED_TOKEN) {
|
||||||
|
qp_dprintf("qp_lvgl_attach: fail (could not set up qp_lvgl executor)\n");
|
||||||
|
qp_lvgl_detach();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
lvgl_state_t *lv_task_handler_state = &lvgl_states[1];
|
||||||
|
lv_task_handler_state->fnc_id = 1;
|
||||||
|
lv_task_handler_state->delay_ms = 5;
|
||||||
|
lv_task_handler_state->defer_token = defer_exec_advanced(lvgl_executors, 2, 5, tick_task_callback, lv_task_handler_state);
|
||||||
|
|
||||||
|
if (lv_task_handler_state->defer_token == INVALID_DEFERRED_TOKEN) {
|
||||||
|
qp_dprintf("qp_lvgl_attach: fail (could not set up qp_lvgl executor)\n");
|
||||||
|
qp_lvgl_detach();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Init LVGL
|
||||||
|
lv_init();
|
||||||
|
|
||||||
|
// Set up lvgl display buffer
|
||||||
|
static lv_disp_draw_buf_t draw_buf;
|
||||||
|
// Allocate a buffer for 1/10 screen size
|
||||||
|
const size_t count_required = driver->panel_width * driver->panel_height / 10;
|
||||||
|
color_buffer = color_buffer ? realloc(color_buffer, sizeof(lv_color_t) * count_required) : malloc(sizeof(lv_color_t) * count_required);
|
||||||
|
if (!color_buffer) {
|
||||||
|
qp_dprintf("qp_lvgl_attach: fail (could not set up memory buffer)\n");
|
||||||
|
qp_lvgl_detach();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
memset(color_buffer, 0, sizeof(lv_color_t) * count_required);
|
||||||
|
// Initialize the display buffer.
|
||||||
|
lv_disp_draw_buf_init(&draw_buf, color_buffer, NULL, count_required);
|
||||||
|
|
||||||
|
selected_display = device;
|
||||||
|
|
||||||
|
// 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*/
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Quantum Painter LVGL Integration API: qp_lvgl_detach
|
||||||
|
|
||||||
|
void qp_lvgl_detach(void) {
|
||||||
|
for (int i = 0; i < 2; ++i) {
|
||||||
|
cancel_deferred_exec_advanced(lvgl_executors, 2, lvgl_states[i].defer_token);
|
||||||
|
}
|
||||||
|
if (color_buffer) {
|
||||||
|
free(color_buffer);
|
||||||
|
color_buffer = NULL;
|
||||||
|
}
|
||||||
|
selected_display = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Quantum Painter LVGL Integration Internal: qp_lvgl_internal_tick
|
||||||
|
|
||||||
|
void qp_lvgl_internal_tick(void) {
|
||||||
|
static uint32_t last_lvgl_exec = 0;
|
||||||
|
deferred_exec_advanced_task(lvgl_executors, 2, &last_lvgl_exec);
|
||||||
|
}
|
25
quantum/painter/lvgl/qp_lvgl.h
Normal file
25
quantum/painter/lvgl/qp_lvgl.h
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
// Copyright 2022 Jose Pablo Ramirez (@jpe230)
|
||||||
|
// Copyright 2022 Nick Brassel (@tzarc)
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "qp.h"
|
||||||
|
#include "lvgl.h"
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Quantum Painter - LVGL External API
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets up LVGL with the supplied display.
|
||||||
|
*
|
||||||
|
* @param device[in] the handle of the device to control
|
||||||
|
* @return true if init. of LVGL succeeded
|
||||||
|
* @return false if init. of LVGL failed
|
||||||
|
*/
|
||||||
|
bool qp_lvgl_attach(painter_device_t device);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disconnects LVGL from any attached display
|
||||||
|
*/
|
||||||
|
void qp_lvgl_detach(void);
|
24
quantum/painter/lvgl/rules.mk
Normal file
24
quantum/painter/lvgl/rules.mk
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# LVGL Integration
|
||||||
|
|
||||||
|
OPT_DEFS += -DQUANTUM_PAINTER_LVGL_INTEGRATION_ENABLE -DLV_CONF_INCLUDE_SIMPLE
|
||||||
|
DEFERRED_EXEC_ENABLE := yes
|
||||||
|
|
||||||
|
LVGL_DIR_NAME = lvgl
|
||||||
|
LVGL_DIR = $(LIB_DIR)
|
||||||
|
LVGL_PATH = $(LVGL_DIR)/$(LVGL_DIR_NAME)
|
||||||
|
|
||||||
|
COMMON_VPATH += $(PLATFORM_PATH) \
|
||||||
|
$(QUANTUM_DIR)/painter/$(LVGL_DIR_NAME) \
|
||||||
|
$(LVGL_PATH)
|
||||||
|
|
||||||
|
include $(LVGL_PATH)/src/extra/extra.mk
|
||||||
|
include $(LVGL_PATH)/src/core/lv_core.mk
|
||||||
|
include $(LVGL_PATH)/src/draw/lv_draw.mk
|
||||||
|
include $(LVGL_PATH)/src/draw/sw/lv_draw_sw.mk
|
||||||
|
include $(LVGL_PATH)/src/font/lv_font.mk
|
||||||
|
include $(LVGL_PATH)/src/hal/lv_hal.mk
|
||||||
|
include $(LVGL_PATH)/src/misc/lv_misc.mk
|
||||||
|
include $(LVGL_PATH)/src/widgets/lv_widgets.mk
|
||||||
|
|
||||||
|
SRC += qp_lvgl.c \
|
||||||
|
$(CSRCS)
|
@ -463,3 +463,10 @@ int16_t qp_drawtext_recolor(painter_device_t device, uint16_t x, uint16_t y, pai
|
|||||||
#ifdef QUANTUM_PAINTER_SSD1351_ENABLE
|
#ifdef QUANTUM_PAINTER_SSD1351_ENABLE
|
||||||
# include "qp_ssd1351.h"
|
# include "qp_ssd1351.h"
|
||||||
#endif // QUANTUM_PAINTER_SSD1351_ENABLE
|
#endif // QUANTUM_PAINTER_SSD1351_ENABLE
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Quantum Painter Extras
|
||||||
|
|
||||||
|
#ifdef QUANTUM_PAINTER_LVGL_INTEGRATION_ENABLE
|
||||||
|
# include "qp_lvgl.h"
|
||||||
|
#endif // QUANTUM_PAINTER_LVGL_INTEGRATION_ENABLE
|
||||||
|
@ -399,3 +399,15 @@ void qp_internal_animation_tick(void) {
|
|||||||
static uint32_t last_anim_exec = 0;
|
static uint32_t last_anim_exec = 0;
|
||||||
deferred_exec_advanced_task(animation_executors, QUANTUM_PAINTER_CONCURRENT_ANIMATIONS, &last_anim_exec);
|
deferred_exec_advanced_task(animation_executors, QUANTUM_PAINTER_CONCURRENT_ANIMATIONS, &last_anim_exec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Quantum Painter Core API: qp_internal_task
|
||||||
|
|
||||||
|
void qp_internal_task(void) {
|
||||||
|
qp_internal_animation_tick();
|
||||||
|
#ifdef QUANTUM_PAINTER_LVGL_INTEGRATION_ENABLE
|
||||||
|
// Run LVGL ticks
|
||||||
|
void qp_lvgl_internal_tick(void);
|
||||||
|
qp_lvgl_internal_tick();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
QUANTUM_PAINTER_DRIVERS ?=
|
QUANTUM_PAINTER_DRIVERS ?=
|
||||||
QUANTUM_PAINTER_ANIMATIONS_ENABLE ?= yes
|
QUANTUM_PAINTER_ANIMATIONS_ENABLE ?= yes
|
||||||
|
|
||||||
|
QUANTUM_PAINTER_LVGL_INTEGRATION ?= no
|
||||||
|
|
||||||
# The list of permissible drivers that can be listed in QUANTUM_PAINTER_DRIVERS
|
# The list of permissible drivers that can be listed in QUANTUM_PAINTER_DRIVERS
|
||||||
VALID_QUANTUM_PAINTER_DRIVERS := \
|
VALID_QUANTUM_PAINTER_DRIVERS := \
|
||||||
rgb565_surface \
|
rgb565_surface \
|
||||||
@ -152,3 +154,7 @@ ifeq ($(strip $(QUANTUM_PAINTER_NEEDS_COMMS_SPI)), yes)
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Check if LVGL needs to be enabled
|
||||||
|
ifeq ($(strip $(QUANTUM_PAINTER_LVGL_INTEGRATION)), yes)
|
||||||
|
include $(QUANTUM_DIR)/painter/lvgl/rules.mk
|
||||||
|
endif
|
||||||
|
@ -64,6 +64,7 @@ fixup_submodules() {
|
|||||||
[ -e lib/ugfx ] && rm -rf lib/ugfx
|
[ -e lib/ugfx ] && rm -rf lib/ugfx
|
||||||
[ -e lib/pico-sdk ] && rm -rf lib/pico-sdk
|
[ -e lib/pico-sdk ] && rm -rf lib/pico-sdk
|
||||||
[ -e lib/chibios-contrib/ext/mcux-sdk ] && rm -rf lib/chibios-contrib/ext/mcux-sdk
|
[ -e lib/chibios-contrib/ext/mcux-sdk ] && rm -rf lib/chibios-contrib/ext/mcux-sdk
|
||||||
|
[ -e lib/lvgl ] && rm -rf lib/lvgl
|
||||||
make git-submodule
|
make git-submodule
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user