Description
I have a five key keypad, that is left/right/up/down/ok, and I have several UIs.
In main screen, it is a navigation screen, I use a button matrix to present several choices that I want to provide to the user, Here is the mapping I want to use,
LEFT --> LV_KEY_LEFT
RIGHT --> LV_KEY_RIGHT
UP --> LV_KEY_UP
DOWN --> LV_KEY_DOWN
OK --> LV_KEY_ENTER
The reason that why I do not mapping some of keys to LV_KEY_PREV/NEXT is that in that way, I cannot use up/down key to switch rows between choices, while that is another question
While in another screen, I want to use these keys to navigate between buttons in a same group, the mapping is,
LEFT --> LV_KEY_PREV
RIGHT --> LV_KEY_NEXT
UP --> LV_KEY_PREV
DOWN --> LV_KEY_NEXT
OK --> LV_KEY_ENTER
I tried several choices to achieve this,
Choice 1
Create two drivers(type of lv_indev_drv_t
), register one during system initialization, and switch to another using lv_indev_drv_update()
, while seems it does not work, I tried to search a sample to use this API and failed.
Choice 2
Directly change the driver( lv_indev_drv_t
)'s callback function , read_cb
, and failed too.
Choice 3
Register two input devices for the same keypad, and bind to the group when they are displayed. In some scenario, it works well, while I cannot work out below issue,
In screen A, “OK” key is used to switch to screen B to display a list with several choices to select, in screen B, “OK” key is used to confirm the choice, and back to screen A.
The reality is that after I pressed the OK key in screen A, it sticks to the same screen. After I adding some debug code, I found that it actually switched to screen B, and back to A very quick.
What might the solution or workaround?
What MCU/Processor/Board and compiler are you using?
stm32f412
What LVGL version are you using?
v7.7.2
What do you want to achieve?
As said in above.
What have you tried so far?
As I said above.
Code to reproduce
Screenshot and/or video
If possible, add screenshots and/or videos about the current state.