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

Allow LVGL timer to be set from Rust #81

Merged
merged 2 commits into from
Apr 1, 2023
Merged

Allow LVGL timer to be set from Rust #81

merged 2 commits into from
Apr 1, 2023

Conversation

nia-e
Copy link
Collaborator

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

Implements a new trait, LvClock, which can be implemented to define a clock. I adapted the bar example so far but I'll make it its own example (+ write docs), and also I need to fix a bunch of compiler warnings. But, it's already functional :D

Closes #25

@nia-e nia-e changed the title [WIP] Allow LVGL timer to be set from Rust Allow LVGL timer to be set from Rust Mar 29, 2023
@nia-e
Copy link
Collaborator Author

nia-e commented Mar 29, 2023

This should be finished now. The approach I had to take to enable this is somewhat hacky unfortunately so I'll wait for a second opinion before merging, but in short to enable this functionality a feature must be set and a magic file must be placed in the LVGL config directory. This is because this line absolutely, positively has to be included with double quotes and not angle brackets. I tried everything to avoid this, but alas. See the documentation in lvgl/src/timer.rs

It's fine. I had just made a typo in testing. Hackiness resolved

@nia-e nia-e marked this pull request as ready for review March 29, 2023 21:28
@nia-e
Copy link
Collaborator Author

nia-e commented Mar 29, 2023

I had also experimented with the embedded-time crate but it caused me nothing but headaches :/ On the bright side, it should be relatively easy to work in a concrete embedded_time::Clock with this API - I just gave up on doing so generically after an hour or so of failing.

@nia-e
Copy link
Collaborator Author

nia-e commented Apr 1, 2023

Figured out how to make the usage much better. I think I'll merge this; the setup isn't that cumbersome anymore, just requires setting the feature flag in Rust and C, no copying weird files.

@nia-e nia-e removed the request for review from rafaelcaricio April 1, 2023 15:41
@nia-e nia-e merged commit 16e3421 into master Apr 1, 2023
@nia-e nia-e deleted the rust-timer branch April 1, 2023 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow LV_TICK_CUSTOM to be used with a Rust function
1 participant