-
Notifications
You must be signed in to change notification settings - Fork 214
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
Support Keyboard / Switch instead of Touch #66
Comments
Current status: I now have a working prototype that enables keyboard navigation between the selectable UI elements. This currently works with a keyboard in SDL1 mode, but it should be easily extended to accept an API call from GPIO button inputs in Arduino mode. I need further thought on how to best support keyboard / physical button control over dynamic elements like sliders. I’m open to suggestions! |
Keyboard control (in SDL1 mode) is now working for the basic UI elements (eg. buttons, checkboxes, radio buttons) as well as the slider element. The user code can register key mappings to GUI actions. The GUI actions currently include the following:
For example, the following code is all it takes to add keyboard control to the GUI:
On devices that are very constrained in number of physical buttons (eg. 3 or fewer physical buttons / keys), navigation is still possible, but adjusting controls such as sliders requires some further thought. Perhaps the select button (when engaged on a slider control) would swap between "focus navigate" mode and "set value" mode. Once the value has been configured, the select button is used again to return to navigate mode. |
Preliminary support for GPIO button controls over the GUI has now been implemented (for all devices), in addition to the user-defined keyboard controls (for SDL mode). Once I have incorporated pin input debouncing and completed some further testing, I'll be able to integrate the feature into the repo soon. All in all, these features should enable GUIslice to be a lot more useful when driving non-touch displays such as OLEDs and e-Ink. |
- Enable with GSLC_FEATURE_INPUT 1 - Add new example ex21
Support for GPIO & keyboard control has now been integrated into the master branch (in abff04b). An example (ex21) has been created to demonstrate its usage:
The associated APIs should be regarded as tentative at the moment and subject to change, but should be stable enough to test out. Snippet of example code to use GPIO pin control over GUIslice (in Arduino mode):
Notes on the examples:
|
Support has now been added (in Decrement / increment on slider controls is currently mapped to long-presses on button A & C, but I am exploring some other ideas that might involve introducing a new element focus state ("edit" state?) that then uses A & C for decrement / increment. Button B long-press could potentially be used to toggle between focus and edit states. For M5stack, since the button handlers are already built-in to its library, adding user control over the GUI is very easy with only the following lines added to one's sketch: gslc_InitInputMap(&m_gui, m_asInputMap, MAX_INPUT_MAP);
gslc_InputMapAdd(&m_gui, GSLC_INPUT_PIN_ASSERT, GSLC_PIN_BTN_A, GSLC_ACTION_FOCUS_PREV, 0);
gslc_InputMapAdd(&m_gui, GSLC_INPUT_PIN_ASSERT, GSLC_PIN_BTN_B, GSLC_ACTION_SELECT, 0);
gslc_InputMapAdd(&m_gui, GSLC_INPUT_PIN_ASSERT, GSLC_PIN_BTN_C, GSLC_ACTION_FOCUS_NEXT, 0); The remaining issue to resolve is how to indicate to the user the difference between the focus state and edit state (I am currently using the "glowing" element state to indicate the GUI focus). @Sakabin or @0x1abin -- if either of you are interested in testing out this feature or have ideas on a suitable convention for how you'd prefer to see the M5stack buttons navigate a GUI, please let me know. (I also have a simplified GUIslice config file specific to M5stack here: m5-m5-default-btn3.h ) thanks! |
M5stack built-in button navigation per #66
Support for button control without any existing touch drivers (ie.
|
GUIslice is currently most useful for displays that have touchscreens. However, it should also be possible to enable the GUI elements to be selected using either a keyboard (for Raspberry Pi) or buttons / switches (on Arduino, M5Stack and similar devices).
I was thinking of adding modes for these (such as
DRV_TOUCH_KEY
andDRV_TOUCH_PIN
) and they would probably operate along these ways:With the above, it may be possible to expand the usability of GUIslice to many other displays. In fact, I could enable the M5Stack driver to connect directly to this capability as the device has integrated buttons. E-ink displays could also benefit as they usually don't have touch screens.
Any feedback or suggestions on this idea would be greatly appreciated!
The text was updated successfully, but these errors were encountered: