From 4dfec31e84ff96dce047bfda3532012c40c91683 Mon Sep 17 00:00:00 2001 From: Alix ANNERAUD Date: Sun, 30 Jun 2024 20:46:56 -0400 Subject: [PATCH] Add custom allocator feature --- lvgl/Cargo.toml | 3 +++ lvgl/src/lib.rs | 1 + 2 files changed, 4 insertions(+) diff --git a/lvgl/Cargo.toml b/lvgl/Cargo.toml index 15069d1c..7964310d 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 1417abc9..9766d198 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 {