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

Keypad input integration #6

Open
everedero opened this issue Feb 13, 2024 · 1 comment
Open

Keypad input integration #6

everedero opened this issue Feb 13, 2024 · 1 comment

Comments

@everedero
Copy link

Hi! I have been using the 2048 app with Zephyr RTOS on a board with keypad buttons.

In order to make it work, I had to add an object group (lv_group_t ), as mentionned in LVGL Readme . Then I put the 2048 button matrix in it:

lv_group_add_obj(btn_matrix_group, game_2048->btnm);

and then link it to the keypad input object:

lv_indev_set_group(lvgl_input_get_indev(lvgl_keypad), btn_matrix_group);

The whole commit is here.

Do you think it could be missing in your lvgl port too?

@100ask
Copy link
Contributor

100ask commented Apr 7, 2024

hi,

You need to register your input device. For 2048 games, you need to register keypads:

static lv_indev_drv_t keypad_driver;
lv_indev_drv_init(&keypad_driver);      /*Basic initialization*/
keypad_driver.type =LV_INDEV_TYPE_KEYPAD;                 /*See below.*/
keypad_driver.read_cb =you_read_cb ;             /*See below.*/
/*Register the driver in LVGL and save the created input device object*/
lv_indev_t * keypad_indev = lv_indev_drv_register(&keypad_driver);

Then:

lv_group_t * g = lv_group_create();
lv_group_set_default(g);
lv_indev_set_group(keypad_indev, g);

Reference:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants