diff --git a/lvgl/Cargo.toml b/lvgl/Cargo.toml index 15069d1..7964310 100644 --- a/lvgl/Cargo.toml +++ b/lvgl/Cargo.toml @@ -73,6 +73,9 @@ nightly = [] # function before constructing or using anything LVGL-related. unsafe_no_autoinit = [] +# This feature is required to use the custom allocator in lvgl (`LV_MEM_CUSTOM=1` in `lv_conf.h`). +custom_allocator = [] + [build-dependencies] quote = "1.0.23" proc-macro2 = "1.0.51" diff --git a/lvgl/src/lib.rs b/lvgl/src/lib.rs index 1417abc..9766d19 100644 --- a/lvgl/src/lib.rs +++ b/lvgl/src/lib.rs @@ -97,6 +97,7 @@ pub fn init() { /// /// After calling, ensure existing LVGL-related values are not accessed even if /// LVGL is reinitialized. +#[cfg(not(feature = "custom_allocator"))] pub unsafe fn deinit() { unsafe { if IS_INIT {