mirror of https://github.com/zmkfirmware/zmk.git
fix(display): POSIX lvgl fixes (#2812)
fix(display): Do LVGL task processing in main on POSIX. An SDL/Zephyr bug prevents proper display when SDL calls are made from anything but the main thread, so add task handling in our simple main function when on POSIX. fix(usb): Compilation fix for 64-bit targets Properly handle differences in the size of `size_t` on 64-bit architectures. fix(display): Imply, but don't force, LVGL mono theme Some targets may be using color displays, so instead of forcing on the mono theme, merely imply it to default it
This commit is contained in:
parent
0f7c11248a
commit
4b4a8a35f3
|
|
@ -5,7 +5,7 @@ menuconfig ZMK_DISPLAY
|
|||
bool "Enable ZMK Display"
|
||||
select DISPLAY
|
||||
select LVGL
|
||||
select LV_CONF_MINIMAL
|
||||
imply LV_CONF_MINIMAL
|
||||
|
||||
if ZMK_DISPLAY
|
||||
|
||||
|
|
|
|||
|
|
@ -56,13 +56,17 @@ K_TIMER_DEFINE(display_timer, display_timer_cb, NULL);
|
|||
|
||||
void unblank_display_cb(struct k_work *work) {
|
||||
display_blanking_off(display);
|
||||
#if !IS_ENABLED(CONFIG_ARCH_POSIX)
|
||||
k_timer_start(&display_timer, K_MSEC(TICK_MS), K_MSEC(TICK_MS));
|
||||
#endif // !IS_ENABLED(CONFIG_ARCH_POSIX)
|
||||
}
|
||||
|
||||
#if IS_ENABLED(CONFIG_ZMK_DISPLAY_BLANK_ON_IDLE)
|
||||
|
||||
void blank_display_cb(struct k_work *work) {
|
||||
#if !IS_ENABLED(CONFIG_ARCH_POSIX)
|
||||
k_timer_stop(&display_timer);
|
||||
#endif // !IS_ENABLED(CONFIG_ARCH_POSIX)
|
||||
display_blanking_on(display);
|
||||
}
|
||||
K_WORK_DEFINE(blank_display_work, blank_display_cb);
|
||||
|
|
@ -132,7 +136,11 @@ int zmk_display_init() {
|
|||
CONFIG_ZMK_DISPLAY_DEDICATED_THREAD_PRIORITY, NULL);
|
||||
#endif
|
||||
|
||||
#if IS_ENABLED(CONFIG_ARCH_POSIX)
|
||||
initialize_display(NULL);
|
||||
#else
|
||||
k_work_submit_to_queue(zmk_display_work_q(), &init_work);
|
||||
#endif
|
||||
|
||||
LOG_DBG("");
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,12 @@
|
|||
#include <zephyr/logging/log.h>
|
||||
LOG_MODULE_REGISTER(zmk, CONFIG_ZMK_LOG_LEVEL);
|
||||
|
||||
#if IS_ENABLED(CONFIG_ZMK_DISPLAY)
|
||||
|
||||
#include <zmk/display.h>
|
||||
#include <lvgl.h>
|
||||
|
||||
#endif
|
||||
|
||||
int main(void) {
|
||||
LOG_INF("Welcome to ZMK!\n");
|
||||
|
|
@ -24,6 +29,16 @@ int main(void) {
|
|||
|
||||
#ifdef CONFIG_ZMK_DISPLAY
|
||||
zmk_display_init();
|
||||
|
||||
#if IS_ENABLED(CONFIG_ARCH_POSIX)
|
||||
// Workaround for an SDL display issue:
|
||||
// https://github.com/zephyrproject-rtos/zephyr/issues/71410
|
||||
while (1) {
|
||||
lv_task_handler();
|
||||
k_sleep(K_MSEC(10));
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_ZMK_DISPLAY */
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -89,7 +89,9 @@ static int get_report_cb(const struct device *dev, struct usb_setup_packet *setu
|
|||
case HID_REPORT_TYPE_INPUT:
|
||||
switch (setup->wValue & HID_GET_REPORT_ID_MASK) {
|
||||
case ZMK_HID_REPORT_ID_KEYBOARD: {
|
||||
*data = get_keyboard_report(len);
|
||||
size_t size;
|
||||
*data = get_keyboard_report(&size);
|
||||
*len = (int32_t)size;
|
||||
break;
|
||||
}
|
||||
case ZMK_HID_REPORT_ID_CONSUMER: {
|
||||
|
|
|
|||
Loading…
Reference in New Issue