Skip to content
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

Integrate bindings to lv_drivers into lvgl-sys #64

Merged
merged 18 commits into from
Mar 20, 2023
Merged

Integrate bindings to lv_drivers into lvgl-sys #64

merged 18 commits into from
Mar 20, 2023

Conversation

nia-e
Copy link
Collaborator

@nia-e nia-e commented Mar 1, 2023

Currently not mergeable as core functionality is missing, but opening to be able to track progress and discuss relevant points.

I decided to integrate drivers into lvgl-sys behind a feature gate as splitting them into their own crate(s) appeared to just result in a lot of pointless code duplication. Current absolutely-must-do TODOs before I mark this as ready:

  • Make sure lv_drv_conf.h only gets compiled in and reexported if the drivers feature is enabled Done!
  • Actually reexport driver functions and values Done!
  • Figure out libraries that must be included to get certain drivers building (e.g. evdev, libinput, drm) Done!
  • Merge Bump LVGL version to 8.3.5 #67 and rebase Done!
  • Merge Rust bindings API review #51 and work functionality into the new API Done!
  • Basic unit tests Done!

Other things I am more willing to procrastinate on but still need to be done:

  • Create examples Done!
  • Write documentation on how to use these features
  • Update the main README.md with progress on input devices Done!
  • Test cross-compilation and real-world use

Closes:

@nia-e
Copy link
Collaborator Author

nia-e commented Mar 1, 2023

What's the situation with regard to display support? I updated the README to state that both lv_drivers and embedded-graphics can be used for driving the actual panel/window. Is this desirable behavior? I have not looked into the code integrating with the panel itself, but if it strictly depends on having a struct implementing DrawTarget then I assume I should add a method on UI such as disp_drv_register_raw() which simply takes in the lv_drivers functions as parameters and bypasses embedded-graphics completely?

@rafaelcaricio
Copy link
Collaborator

@nia-e I think the way forward would be to change the public API as in the PR #51

@nia-e
Copy link
Collaborator Author

nia-e commented Mar 2, 2023

Alrighty. In that case I'll shelve this temporarily while I get #51 sorted and come back to it after. Will keep this open as I suspect it shouldn't take that long.

@nia-e nia-e marked this pull request as draft March 2, 2023 16:46
@nia-e nia-e linked an issue Mar 2, 2023 that may be closed by this pull request
@nia-e nia-e added the enhancement New feature or request label Mar 2, 2023
@nia-e
Copy link
Collaborator Author

nia-e commented Mar 8, 2023

Going to get back to work on this now; my current idea after familiarizing myself with lv_drivers somewhat is to bypass the way we normally register display/input drivers since I don't see a good justification for creating safe abstractions for the lv_drivers functions. Also, making a function that just returns an initialized Display or InputDriver would be unnecessary overhead. I'm thinking of instead defining a macro (which expands to some unsafe C FFI code) for each supported driver so that we can do more complex arbitrary logic entirely inline - is there any reason I shouldn't do this?

@nia-e
Copy link
Collaborator Author

nia-e commented Mar 9, 2023

This is almost ready; all that's left is to write some unit tests and mess with the build script to link in libraries for certain features. I'll also write some docs before merging.

@nia-e nia-e requested a review from rafaelcaricio March 9, 2023 18:12
@nia-e nia-e marked this pull request as ready for review March 20, 2023 13:57
@nia-e
Copy link
Collaborator Author

nia-e commented Mar 20, 2023

I had to take a short break for personal reasons but this is done and verified working. I ported the button_click example to rely on SDL through lv_drivers instead of embedded-graphics and it works perfectly. So, I think this is good to go as-is

@rafaelcaricio rafaelcaricio merged commit e4e31b1 into lvgl:master Mar 20, 2023
@rafaelcaricio
Copy link
Collaborator

rafaelcaricio commented Mar 20, 2023

@nia-e Thank you for all the work. I just noticed that I pressed "rebase & merge" and I got added as co-author of your commits. 🤦🏽 Next time I will just ask you to merge yourself. Sorry about that!

@nia-e
Copy link
Collaborator Author

nia-e commented Mar 20, 2023

Don't worry! Plus, I forgot to squash... oops, I have a lot of commits in the tree now

@nia-e nia-e mentioned this pull request Mar 25, 2023
@nia-e nia-e changed the title [WIP] Integrate bindings to lv_drivers into lvgl-sys Integrate bindings to lv_drivers into lvgl-sys Mar 27, 2023
@nia-e nia-e deleted the drivers branch March 29, 2023 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LVGL-rs on Raspberry Pi
2 participants