-
Notifications
You must be signed in to change notification settings - Fork 45
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
Lvgl input sink #43
Lvgl input sink #43
Conversation
Move the LVGL pointer input driver initialization code to lvgl_input_sink file. Also prepare the code for direct usage of the input subsystem instead of proxying it through the kscan handler. Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
Adds the implementation for the option to use the input subsystem directly for touch input. Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
Add a general mechanism for creating a mapping of the zephyr `device` struct to lvgls `indev` type. All information for the creation of the `indev` is stored in an iterable struct section. Generally one entry in said section is created per mappable `device`. Currently the exception to that rule is the touch input device, for which only one instance is created according to the chosen `zephyr,keyboard-scan` or `zephyr,touch-input` node. Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
Add a zephyr specific header to lvgl which allows applications to query the `device` to `indev` mapping for a certain device. This is needed by advanced lvgl features, like focus changing via encoder or setting up the coordinates a button `indev` is mapped to. Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
This patch adds support for mapping zephyr gpio input devices to lvgl indevs. Button `indevs` may be used to trigger click events on configured coordinates on the screen. Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
Hey so cool you are working on it! Haven't gone to the details but I think you overcomplicated things a fair bit for the sake of building on top of existing device definitions ( This is what I had in mind instead (mind you I did not write any code, that's your project now :-))
At that point I don't really think you need the custom section anymore, so that would simplify things a bit. For the implementation and compatibility, maybe it make sense to move the kscan one in its own file and go from scratch with |
Thanks for the review :^).
Yeah, my goal was essentially to have most of the changes be in the lvgl module, but I guess the addition in zephyr can be conditional on
That sounds great, felt a bit weird to have this as a Kconfig option in the first place. I'd like to have one device binding and give it a type property to decide on it's
Sounds good 👍 |
You can have bindings in the module, I think if you create a
Not really, a device is just a device and can generate anything. Linux has the concept of capabilities where an input device has to declare what event it intends to generate and then the client can see if it's happy with it, but we did not port it over. It's not like there's anything like that in the rest of the rtos, you could link a wrong device phandle anywhere and the system would just crash. I'd say just add some strategic As for single binding with type vs multiple bindings: I'm thinking you may get a cleaner result with a binding per indev type, cause you'll probably have different properties for each type and you could more easily have some |
@fabiobaltieri thanks for the input 😄, I implemented your suggested changes over at: |
The goal of this change is to allow for the zephyr
device
notion to be mappable to the lvglindev
concept.Previously this was done for
kscan
devices to allow for touch input. However LVGL offers more input devices for HMIs which only have hardware input capabilites (buttons, encoder, keypad) https://docs.lvgl.io/latest/en/html/porting/indev.html.In theory today using those lvgl concepts is possible put it requires user app code to "plumb" together this mapping and set it up correctly. Since we are already providing the "compatiblity" layer between kscan devices and the lvgl pointer
indev
I figured that we might as well generalize the mechanism to accomodate it for the other ones.This PR is my attempt to create a compile time mapping of the zephyr device tree to lvgl
indevs
. Things that I am still not completely sure about:CONFIG_LV_Z_BUTTON
is set an mapping entry for eachgpio-keys
is created, which "wastes" memory since the the button might not be related to the HMI input but other functions. They will not do any harm however since theindev
has to be configured to act on alv_group_t
or trigger a press on a givenlv_coor_t
.indev
. However in the process I changed thebool
Kconfig option to a choice to also allow input devices directly without proxying them through a kscan instance.I would really love to hear some suggestions/comments on this especially by you @fabiobaltieri since you are the maintainer of the input subsystem :^).