diff --git a/README.md b/README.md index c20ea4490..adc47a6bf 100644 --- a/README.md +++ b/README.md @@ -40,9 +40,8 @@ LittlevGL provides everything you need to create a Graphical User Interface (GUI Basically, every modern controller - which is able to drive a display - is suitable to run LittlevGL. The minimal requirements: - **16, 32 or 64-bit** microcontroller or processor - **> 16 MHz** clock speed -- **> 8 kB RAM for static data** and **> 2 KB RAM for dynamic data** (graphical objects) -- **> 64 kB flash** program memory -- **Optionally ~1/10 screen sized memory** for buffered drawing (on 240 × 320, 16-bit colors it's 15 kB) +- **> 16 kB RAM** for static data, dynamic data (heap), stack and display buffer (> 32 kB is recommended) +- **> 64 kB flash** program memory (> 180 kB is recommended) Just to mention some **platforms**: - STM32F1, STM32F3, [STM32F4](https://blog.littlevgl.com/2017-07-15/stm32f429_disco_port), [STM32F7](https://github.com/littlevgl/stm32f746_disco_no_os_sw4stm32) @@ -200,7 +199,7 @@ Check out the [Documentation](https://docs.littlevgl.com/) for more! ### Contributing To ask questions please use the [Forum](https://forum.littlevgl.com). -FOr development related things (bug reports, feature suggestions) use [GitHub's Issue tracker](https://github.com/littlevgl/lvgl/issues). +For development related things (bug reports, feature suggestions) use [GitHub's Issue tracker](https://github.com/littlevgl/lvgl/issues). You can contribute in several ways: - **Answer other's question** in the Forum - **Report and/or fix bugs** using the issue tracker and in Pull-request diff --git a/lv_conf_template.h b/lv_conf_template.h index db0b729e0..7fd64b138 100644 --- a/lv_conf_template.h +++ b/lv_conf_template.h @@ -152,7 +152,7 @@ typedef void * lv_fs_drv_user_data_t; #endif /*1: Add a `user_data` to drivers and objects*/ -#define LV_USE_USER_DATA 1 +#define LV_USE_USER_DATA 0 /*======================== * Image decoder and cache @@ -213,13 +213,14 @@ typedef void * lv_indev_drv_user_data_t; /*Type of user data in the i *===============*/ /*1: Enable the log module*/ -#define LV_USE_LOG 1 +#define LV_USE_LOG 0 #if LV_USE_LOG /* How important log should be added: * LV_LOG_LEVEL_TRACE A lot of logs to give detailed information * LV_LOG_LEVEL_INFO Log important events * LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem * LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail + * LV_LOG_LEVEL_NONE Do not log anything */ # define LV_LOG_LEVEL LV_LOG_LEVEL_WARN @@ -325,7 +326,7 @@ typedef void * lv_obj_user_data_t; #define LV_USE_BTN 1 #if LV_USE_BTN != 0 /*Enable button-state animations - draw a circle on click (dependencies: LV_USE_ANIMATION)*/ -# define LV_BTN_INK_EFFECT 1 +# define LV_BTN_INK_EFFECT 0 #endif /*Button matrix (dependencies: -)*/ diff --git a/src/lv_conf_checker.h b/src/lv_conf_checker.h index 470ccf64b..00ad94492 100644 --- a/src/lv_conf_checker.h +++ b/src/lv_conf_checker.h @@ -206,7 +206,7 @@ /*1: Add a `user_data` to drivers and objects*/ #ifndef LV_USE_USER_DATA -#define LV_USE_USER_DATA 1 +#define LV_USE_USER_DATA 0 #endif /*======================== @@ -286,7 +286,7 @@ /*1: Enable the log module*/ #ifndef LV_USE_LOG -#define LV_USE_LOG 1 +#define LV_USE_LOG 0 #endif #if LV_USE_LOG /* How important log should be added: @@ -294,6 +294,7 @@ * LV_LOG_LEVEL_INFO Log important events * LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem * LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail + * LV_LOG_LEVEL_NONE Do not log anything */ #ifndef LV_LOG_LEVEL # define LV_LOG_LEVEL LV_LOG_LEVEL_WARN @@ -448,7 +449,7 @@ #if LV_USE_BTN != 0 /*Enable button-state animations - draw a circle on click (dependencies: LV_USE_ANIMATION)*/ #ifndef LV_BTN_INK_EFFECT -# define LV_BTN_INK_EFFECT 1 +# define LV_BTN_INK_EFFECT 0 #endif #endif diff --git a/src/lv_core/lv_style.h b/src/lv_core/lv_style.h index f8eb79b10..83c46f123 100644 --- a/src/lv_core/lv_style.h +++ b/src/lv_core/lv_style.h @@ -240,36 +240,6 @@ static inline void lv_style_anim_clear_repeat(lv_anim_t * a) lv_anim_clear_repeat(a); } -/** - * Set a user specific data for the animation - * @param a pointer to an initialized `lv_anim_t` variable - * @param user_data the user data - */ -static inline void lv_style_anim_set_user_data(lv_anim_t * a, lv_anim_user_data_t user_data) -{ - lv_anim_set_user_data(a, user_data); -} - -/** - * Get the user data - * @param a pointer to an initialized `lv_anim_t` variable - * @return the user data - */ -static inline lv_anim_user_data_t lv_style_anim_get_user_data(lv_anim_t * a) -{ - return lv_anim_get_user_data(a); -} - -/** - * Get pointer to the user data - * @param a pointer to an initialized `lv_anim_t` variable - * @return pointer to the user data - */ -static inline lv_anim_user_data_t * lv_style_anim_get_user_data_ptr(lv_anim_t * a) -{ - return lv_anim_get_user_data_ptr(a); -} - /** * Create an animation * @param a an initialized 'anim_t' variable. Not required after call. diff --git a/src/lv_draw/lv_draw.c b/src/lv_draw/lv_draw.c index 9fae8806d..85a1f7a39 100644 --- a/src/lv_draw/lv_draw.c +++ b/src/lv_draw/lv_draw.c @@ -14,6 +14,11 @@ #include "../lv_misc/lv_log.h" #include "../lv_misc/lv_math.h" #include "../lv_misc/lv_mem.h" +#include "../lv_misc/lv_gc.h" + +#if defined(LV_GC_INCLUDE) +#include LV_GC_INCLUDE +#endif /* LV_ENABLE_GC */ /********************* * DEFINES @@ -30,7 +35,6 @@ /********************** * STATIC VARIABLES **********************/ -static void * draw_buf = NULL; static uint32_t draw_buf_size = 0; /********************** @@ -48,21 +52,21 @@ static uint32_t draw_buf_size = 0; */ void * lv_draw_get_buf(uint32_t size) { - if(size <= draw_buf_size) return draw_buf; + if(size <= draw_buf_size) return LV_GC_ROOT(_lv_draw_buf); LV_LOG_TRACE("lv_draw_get_buf: allocate"); draw_buf_size = size; - if(draw_buf == NULL) { - draw_buf = lv_mem_alloc(size); - lv_mem_assert(draw_buf); - return draw_buf; + if(LV_GC_ROOT(_lv_draw_buf) == NULL) { + LV_GC_ROOT(_lv_draw_buf) = lv_mem_alloc(size); + lv_mem_assert(LV_GC_ROOT(_lv_draw_buf)); + return LV_GC_ROOT(_lv_draw_buf); } - draw_buf = lv_mem_realloc(draw_buf, size); - lv_mem_assert(draw_buf); - return draw_buf; + LV_GC_ROOT(_lv_draw_buf) = lv_mem_realloc(LV_GC_ROOT(_lv_draw_buf), size); + lv_mem_assert(LV_GC_ROOT(_lv_draw_buf)); + return LV_GC_ROOT(_lv_draw_buf); } /** @@ -70,9 +74,9 @@ void * lv_draw_get_buf(uint32_t size) */ void lv_draw_free_buf(void) { - if(draw_buf) { - lv_mem_free(draw_buf); - draw_buf = NULL; + if(LV_GC_ROOT(_lv_draw_buf)) { + lv_mem_free(LV_GC_ROOT(_lv_draw_buf)); + LV_GC_ROOT(_lv_draw_buf) = NULL; draw_buf_size = 0; } } diff --git a/src/lv_font/lv_font_roboto_12.c b/src/lv_font/lv_font_roboto_12.c index 6f08594fa..d5aa4bc85 100644 --- a/src/lv_font/lv_font_roboto_12.c +++ b/src/lv_font/lv_font_roboto_12.c @@ -1,4 +1,4 @@ -#include "lvgl/lvgl.h" +#include "../../lvgl.h" /******************************************************************************* * Size: 12 px diff --git a/src/lv_font/lv_font_roboto_16.c b/src/lv_font/lv_font_roboto_16.c index cde1768ad..1f453427f 100644 --- a/src/lv_font/lv_font_roboto_16.c +++ b/src/lv_font/lv_font_roboto_16.c @@ -1,4 +1,4 @@ -#include "lvgl/lvgl.h" +#include "../../lvgl.h" /******************************************************************************* * Size: 16 px diff --git a/src/lv_font/lv_font_roboto_22.c b/src/lv_font/lv_font_roboto_22.c index 614bbfead..72421cbdb 100644 --- a/src/lv_font/lv_font_roboto_22.c +++ b/src/lv_font/lv_font_roboto_22.c @@ -1,4 +1,4 @@ -#include "lvgl/lvgl.h" +#include "../../lvgl.h" /******************************************************************************* * Size: 22 px diff --git a/src/lv_font/lv_font_roboto_28.c b/src/lv_font/lv_font_roboto_28.c index 55edad88a..7229a9761 100644 --- a/src/lv_font/lv_font_roboto_28.c +++ b/src/lv_font/lv_font_roboto_28.c @@ -1,4 +1,4 @@ -#include "lvgl/lvgl.h" +#include "../../lvgl.h" /******************************************************************************* * Size: 28 px diff --git a/src/lv_font/lv_font_unscii_8.c b/src/lv_font/lv_font_unscii_8.c index 9044b4463..e94da5133 100644 --- a/src/lv_font/lv_font_unscii_8.c +++ b/src/lv_font/lv_font_unscii_8.c @@ -1,4 +1,4 @@ -#include "lvgl/lvgl.h" +#include "../../lvgl.h" /******************************************************************************* * Size: 8 px diff --git a/src/lv_misc/lv_anim.h b/src/lv_misc/lv_anim.h index 13487d2ba..299f7c455 100644 --- a/src/lv_misc/lv_anim.h +++ b/src/lv_misc/lv_anim.h @@ -222,36 +222,6 @@ static inline void lv_anim_clear_repeat(lv_anim_t * a) a->repeat = 0; } -/** - * Set a user specific data for the animation - * @param a pointer to an initialized `lv_anim_t` variable - * @param user_data the user data - */ -static inline void lv_anim_set_user_data(lv_anim_t * a, lv_anim_user_data_t user_data) -{ - memcpy(&a->user_data, &user_data, sizeof(user_data)); -} - -/** - * Get the user data - * @param a pointer to an initialized `lv_anim_t` variable - * @return the user data - */ -static inline lv_anim_user_data_t lv_anim_get_user_data(lv_anim_t * a) -{ - return a->user_data; -} - -/** - * Get pointer to the user data - * @param a pointer to an initialized `lv_anim_t` variable - * @return pointer to the user data - */ -static inline lv_anim_user_data_t * lv_anim_get_user_data_ptr(lv_anim_t * a) -{ - return &a->user_data; -} - /** * Create an animation * @param a an initialized 'anim_t' variable. Not required after call. diff --git a/src/lv_misc/lv_gc.h b/src/lv_misc/lv_gc.h index cd7efb460..0db9f5cb9 100644 --- a/src/lv_misc/lv_gc.h +++ b/src/lv_misc/lv_gc.h @@ -40,7 +40,8 @@ extern "C" { prefix lv_ll_t _lv_group_ll; \ prefix lv_ll_t _lv_img_defoder_ll; \ prefix lv_img_cache_entry_t * _lv_img_cache_array; \ - prefix void * _lv_task_act; + prefix void * _lv_task_act; \ + prefix void * _lv_draw_buf; #define LV_NO_PREFIX #define LV_ROOTS LV_GC_ROOTS(LV_NO_PREFIX) diff --git a/src/lv_misc/lv_log.h b/src/lv_misc/lv_log.h index 5c7450fe3..6a6c2d2a4 100644 --- a/src/lv_misc/lv_log.h +++ b/src/lv_misc/lv_log.h @@ -30,7 +30,8 @@ extern "C" { #define LV_LOG_LEVEL_INFO 1 /**< Log important events*/ #define LV_LOG_LEVEL_WARN 2 /**< Log if something unwanted happened but didn't caused problem*/ #define LV_LOG_LEVEL_ERROR 3 /**< Only critical issue, when the system may fail*/ -#define _LV_LOG_LEVEL_NUM 4 /**< Number of log levels */ +#define LV_LOG_LEVEL_NONE 4 /**< Do not log anything*/ +#define _LV_LOG_LEVEL_NUM 5 /**< Number of log levels */ typedef int8_t lv_log_level_t;