Skip to content

Commit

Permalink
fix: gate tick_inc function by feature custom_timer (#170)
Browse files Browse the repository at this point in the history
lv_tick_inc function is available only when default (non-custom) timer
implementation is used.
  • Loading branch information
elrafoon authored Jan 22, 2025
1 parent bdc49f7 commit d83b374
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lvgl-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ bindgen = "0.65.1"
use-vendored-config = []
drivers = []
rust_timer = []
# if LV_TICK_CUSTOM = 1, then lv_tick_inc function is unavailable
custom_timer = []
3 changes: 3 additions & 0 deletions lvgl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ use-vendored-config = ["lvgl-sys/use-vendored-config"]
# on the timer module for usage notes.
rust_timer = ["lvgl-sys/rust_timer"]

# Enables using a custom tick function supplied in lv_conf.h
custom_timer = ["lvgl-sys/custom_timer"]

# Enables some unstable features. Currently, #![feature(cfg_accessible)] and
# #![feature(error_in_core)] are used.
# This feature will currently allow:
Expand Down
2 changes: 1 addition & 1 deletion lvgl/src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub(crate) fn get_str_act(disp: Option<&Display>) -> Result<Obj> {
/// Runs an LVGL tick lasting a given `core::time::Duration`. This function
/// should be called periodically.
#[inline]
#[cfg(not(feature = "rust_timer"))]
#[cfg(not(any(feature = "rust_timer", feature = "custom_timer")))]
pub fn tick_inc(tick_period: Duration) {
unsafe {
lvgl_sys::lv_tick_inc(tick_period.as_millis() as u32);
Expand Down

0 comments on commit d83b374

Please sign in to comment.