How do I make the btnmatrix assign the hardware digital keys

Before posting

  • Get familiar with Markdown to format and structure your post
  • Be sure to update lvgl from the latest version from the master branch.
  • Be sure you have checked the relevant part of the documentation.
  • If applicable use the Simulator to eliminate hardware related issues.

Delete this section if you read and applied the mentioned points.


What LVGL version are you using?


What do you want to achieve?

i want usr btnmatrix assign the hardware digital keys,but btnmarix just have LV_KEY_RIGHT/UP/LEFT/RIGHT and LV_KEY_ENTER event. How can i use the lv_btn to usr the lv_btnmarix?

Now i can use the LV_KEY_RIGHT/UP/LEFT/RIGHT and LV_KEY_ENTER event to choise buttons in matrix keys, but it is too difficult for my code。 If possible i want to use the buttons in the matrix keys can be specified directly, rather than being determined by up, down, left, and right orientation.

What have you tried so far?

two day

Code to reproduce

lv_btn assign keys like:

    /*Register a keypad input device*/
    indev_drv.type = LV_INDEV_TYPE_KEYPAD;
    indev_drv.read_cb = keypad_read;
    indev_keypad = lv_indev_drv_register(&indev_drv);
    // static lv_group_t* group;
    lv_group_t* group = lv_group_create();
    lv_group_add_obj(group, menu.b1.btn);
    lv_indev_set_group(indev_keypad, group);

I would like to use similar steps to implement lv_btnmatrix key assign the hardware keys.

Best regards.

I’ve answered on GitHub: