5-way tactile switch as input device sufficient?

Good morning everybody,

I would like to use lvgl in a hobby project with a common 1.14 inch 240x135px display and a 5-way tactile switch (https://tech.alpsalpine.com/prod/e/html/multicontrol/switch/skrh/skrhabe010.html) as input device.

I tried out the “lv_demo_keypad_encoder” example in the windows simulator. If my analysis of this example is correct, it would be a good idea to map the hardware switches as follows.

  • Switch up -->LV_KEY_PREV (and not LV_KEY_UP!)
  • Switch down -->LV_KEY_PREV (and not LV_KEY_DOWN!)
  • Switch left → LV_KEY_LEFT
  • Switch right -->LV_KEY_RIGHT
  • Switch center -->LV_KEY_ENTER

If I mapped the Switch up/down to LV_KEY_UP/DOWN, (e.g. if I only use the arrow keys in the windows simulation and NOT the “Page Up”/“Page Down” keys) it would not be possible to navigate between the widgets.

If I map the keys according to the list above, I found no way to modify the value in the spinner widget…

My question are:

  • Is a 5-way tactile switch basically sufficient to reach and edit all input widgets?
  • If no: which further buttons do you recommend?
  • If yes: What would be the best key mapping?

Thanks in advance!

Klaus

Hi, yeah, infact 3 state is enough too, if you map it as an encoder instead of keypad.

Hi Ali,
but this would mean, that two of the five switches are useless. Or do you recommend a “hybrid” mapping, e.g. three switches imitate encoder behaviour and the two remaining are LV_KEY_PREV/NEXT (or anything else?)?

Regards, Klaus