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

Posix lvgl fixes #2812

Merged
merged 3 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion app/src/display/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 8 additions & 0 deletions app/src/display/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
15 changes: 15 additions & 0 deletions app/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion app/src/usb_hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down