Merge branch 'dev-6.0' of https://github.com/littlevgl/lvgl into dev-6.0

This commit is contained in:
Amir Gonnen
2019-03-18 01:04:34 +02:00
186 changed files with 709 additions and 484 deletions

View File

@@ -1,11 +0,0 @@
CSRCS += lv_group.c
CSRCS += lv_indev.c
CSRCS += lv_disp.c
CSRCS += lv_obj.c
CSRCS += lv_refr.c
CSRCS += lv_style.c
DEPPATH += --dep-path $(LVGL_DIR)/lvgl/lv_core
VPATH += :$(LVGL_DIR)/lvgl/lv_core
CFLAGS += "-I$(LVGL_DIR)/lvgl/lv_core"

View File

@@ -1,8 +0,0 @@
CSRCS += lv_hal_disp.c
CSRCS += lv_hal_indev.c
CSRCS += lv_hal_tick.c
DEPPATH += --dep-path $(LVGL_DIR)/lvgl/lv_hal
VPATH += :$(LVGL_DIR)/lvgl/lv_hal
CFLAGS += "-I$(LVGL_DIR)/lvgl/lv_hal"

83
lvgl.h
View File

@@ -14,53 +14,54 @@ extern "C" {
* INCLUDES * INCLUDES
*********************/ *********************/
#include "lv_version.h" #include "src/lv_version.h"
#include "lv_misc/lv_log.h" #include "src/lv_misc/lv_log.h"
#include "lv_misc/lv_task.h" #include "src/lv_misc/lv_task.h"
#include "src/lv_misc/lv_math.h"
#include "lv_hal/lv_hal.h" #include "src/lv_hal/lv_hal.h"
#include "lv_core/lv_obj.h" #include "src/lv_core/lv_obj.h"
#include "lv_core/lv_group.h" #include "src/lv_core/lv_group.h"
#include "lv_core/lv_refr.h" #include "src/lv_core/lv_refr.h"
#include "lv_core/lv_disp.h" #include "src/lv_core/lv_disp.h"
#include "lv_themes/lv_theme.h" #include "src/lv_themes/lv_theme.h"
#include "lv_objx/lv_btn.h" #include "src/lv_objx/lv_btn.h"
#include "lv_objx/lv_imgbtn.h" #include "src/lv_objx/lv_imgbtn.h"
#include "lv_objx/lv_img.h" #include "src/lv_objx/lv_img.h"
#include "lv_objx/lv_label.h" #include "src/lv_objx/lv_label.h"
#include "lv_objx/lv_line.h" #include "src/lv_objx/lv_line.h"
#include "lv_objx/lv_page.h" #include "src/lv_objx/lv_page.h"
#include "lv_objx/lv_cont.h" #include "src/lv_objx/lv_cont.h"
#include "lv_objx/lv_list.h" #include "src/lv_objx/lv_list.h"
#include "lv_objx/lv_chart.h" #include "src/lv_objx/lv_chart.h"
#include "lv_objx/lv_table.h" #include "src/lv_objx/lv_table.h"
#include "lv_objx/lv_cb.h" #include "src/lv_objx/lv_cb.h"
#include "lv_objx/lv_bar.h" #include "src/lv_objx/lv_bar.h"
#include "lv_objx/lv_slider.h" #include "src/lv_objx/lv_slider.h"
#include "lv_objx/lv_led.h" #include "src/lv_objx/lv_led.h"
#include "lv_objx/lv_btnm.h" #include "src/lv_objx/lv_btnm.h"
#include "lv_objx/lv_kb.h" #include "src/lv_objx/lv_kb.h"
#include "lv_objx/lv_ddlist.h" #include "src/lv_objx/lv_ddlist.h"
#include "lv_objx/lv_roller.h" #include "src/lv_objx/lv_roller.h"
#include "lv_objx/lv_ta.h" #include "src/lv_objx/lv_ta.h"
#include "lv_objx/lv_canvas.h" #include "src/lv_objx/lv_canvas.h"
#include "lv_objx/lv_win.h" #include "src/lv_objx/lv_win.h"
#include "lv_objx/lv_tabview.h" #include "src/lv_objx/lv_tabview.h"
#include "lv_objx/lv_tileview.h" #include "src/lv_objx/lv_tileview.h"
#include "lv_objx/lv_mbox.h" #include "src/lv_objx/lv_mbox.h"
#include "lv_objx/lv_gauge.h" #include "src/lv_objx/lv_gauge.h"
#include "lv_objx/lv_lmeter.h" #include "src/lv_objx/lv_lmeter.h"
#include "lv_objx/lv_sw.h" #include "src/lv_objx/lv_sw.h"
#include "lv_objx/lv_kb.h" #include "src/lv_objx/lv_kb.h"
#include "lv_objx/lv_arc.h" #include "src/lv_objx/lv_arc.h"
#include "lv_objx/lv_preload.h" #include "src/lv_objx/lv_preload.h"
#include "lv_objx/lv_calendar.h" #include "src/lv_objx/lv_calendar.h"
#include "lv_objx/lv_spinbox.h" #include "src/lv_objx/lv_spinbox.h"
/********************* /*********************
* DEFINES * DEFINES

14
lvgl.mk
View File

@@ -1,8 +1,8 @@
include $(LVGL_DIR)/lvgl/lv_core/lv_core.mk include $(LVGL_DIR)/lvgl/src/lv_core/lv_core.mk
include $(LVGL_DIR)/lvgl/lv_hal/lv_hal.mk include $(LVGL_DIR)/lvgl/src/lv_hal/lv_hal.mk
include $(LVGL_DIR)/lvgl/lv_objx/lv_objx.mk include $(LVGL_DIR)/lvgl/src/lv_objx/lv_objx.mk
include $(LVGL_DIR)/lvgl/lv_fonts/lv_fonts.mk include $(LVGL_DIR)/lvgl/src/lv_fonts/lv_fonts.mk
include $(LVGL_DIR)/lvgl/lv_misc/lv_misc.mk include $(LVGL_DIR)/lvgl/src/lv_misc/lv_misc.mk
include $(LVGL_DIR)/lvgl/lv_themes/lv_themes.mk include $(LVGL_DIR)/lvgl/src/lv_themes/lv_themes.mk
include $(LVGL_DIR)/lvgl/lv_draw/lv_draw.mk include $(LVGL_DIR)/lvgl/src/lv_draw/lv_draw.mk

View File

@@ -5,8 +5,8 @@ Generates a chechker file for lv_conf.h from lv_conf_templ.h define all the not
import re import re
fin = open("lv_conf_templ.h", "r"); fin = open("../src/lv_conf_templ.h", "r");
fout = open("lv_conf_checker.h", "w"); fout = open("../src/lv_conf_checker.h", "w");
fout.write( fout.write(

View File

@@ -330,7 +330,7 @@
* LV_OBJ SETTINGS * LV_OBJ SETTINGS
*==================*/ *==================*/
#ifndef LV_OBJ_REALIGN #ifndef LV_OBJ_REALIGN
#define LV_OBJ_REALIGN 0 /*Enable `lv_obj_realaign()` based on `lv_obj_align()` parameters*/ #define LV_OBJ_REALIGN 0 /*Enable `lv_obj_realign()` based on `lv_obj_align()` parameters*/
#endif #endif
/*================== /*==================
@@ -570,6 +570,9 @@
#ifndef LV_ROLLER_ANIM_TIME #ifndef LV_ROLLER_ANIM_TIME
# define LV_ROLLER_ANIM_TIME 200 /*Focus animation time [ms] (0: no animation)*/ # define LV_ROLLER_ANIM_TIME 200 /*Focus animation time [ms] (0: no animation)*/
#endif #endif
#ifndef LV_ROLLER_INF_PAGES
# define LV_ROLLER_INF_PAGES 7 /*With inifinite rollers the options are added multiple times (on select positioned back to the center)*/
#endif
#endif #endif
/*Slider (dependencies: lv_bar)*/ /*Slider (dependencies: lv_bar)*/

View File

@@ -334,6 +334,7 @@ typedef void * lv_obj_user_data_t; /*Declare the type of the user data
#define LV_USE_ROLLER 1 #define LV_USE_ROLLER 1
#if LV_USE_ROLLER != 0 #if LV_USE_ROLLER != 0
# define LV_ROLLER_ANIM_TIME 200 /*Focus animation time [ms] (0: no animation)*/ # define LV_ROLLER_ANIM_TIME 200 /*Focus animation time [ms] (0: no animation)*/
# define LV_ROLLER_INF_PAGES 7 /*With inifinite rollers the options are added multiple times (on select positioned back to the center)*/
#endif #endif
/*Slider (dependencies: lv_bar)*/ /*Slider (dependencies: lv_bar)*/
@@ -352,7 +353,7 @@ typedef void * lv_obj_user_data_t; /*Declare the type of the user data
/*--END OF LV_CONF_H--*/ /*--END OF LV_CONF_H--*/
/*Be sure every define has a default value*/ /*Be sure every define has a default value*/
#include "lvgl/lv_conf_checker.h" #include "lvgl/src/lv_conf_checker.h"
#endif /*LV_CONF_H*/ #endif /*LV_CONF_H*/

11
src/lv_core/lv_core.mk Normal file
View File

@@ -0,0 +1,11 @@
CSRCS += lv_group.c
CSRCS += lv_indev.c
CSRCS += lv_disp.c
CSRCS += lv_obj.c
CSRCS += lv_refr.c
CSRCS += lv_style.c
DEPPATH += --dep-path $(LVGL_DIR)/lvgl/src/lv_core
VPATH += :$(LVGL_DIR)/lvgl/src/lv_core
CFLAGS += "-I$(LVGL_DIR)/lvgl/src/lv_core"

View File

@@ -16,7 +16,7 @@ extern "C" {
#ifdef LV_CONF_INCLUDE_SIMPLE #ifdef LV_CONF_INCLUDE_SIMPLE
#include "lv_conf.h" #include "lv_conf.h"
#else #else
#include "../../lv_conf.h" #include "../../../lv_conf.h"
#endif #endif
#include "lv_obj.h" #include "lv_obj.h"

View File

@@ -198,7 +198,7 @@ void lv_indev_get_point(const lv_indev_t * indev, lv_point_t * point)
} }
/** /**
* Get the last key of an input device (for LV_INDEV_TYPE_KEYPAD) * Get the last pressed key of an input device (for LV_INDEV_TYPE_KEYPAD)
* @param indev pointer to an input device * @param indev pointer to an input device
* @return the last pressed key (0 on error) * @return the last pressed key (0 on error)
*/ */
@@ -386,6 +386,13 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
lv_obj_t * focused = lv_group_get_focused(g); lv_obj_t * focused = lv_group_get_focused(g);
if(focused == NULL) return; if(focused == NULL) return;
/*Save the last key to compare it with the current latter on RELEASE*/
uint32_t prev_key = i->proc.types.keypad.last_key;
/* Save the last key.
* It must be done here else `lv_indev_get_key` will return the last key in events and signals*/
i->proc.types.keypad.last_key = data->key;
/*Key press happened*/ /*Key press happened*/
if(data->state == LV_INDEV_STATE_PR && if(data->state == LV_INDEV_STATE_PR &&
i->proc.types.keypad.last_state == LV_INDEV_STATE_REL) i->proc.types.keypad.last_state == LV_INDEV_STATE_REL)
@@ -468,7 +475,7 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
else if(data->state == LV_INDEV_STATE_REL && i->proc.types.keypad.last_state == LV_INDEV_STATE_PR) else if(data->state == LV_INDEV_STATE_REL && i->proc.types.keypad.last_state == LV_INDEV_STATE_PR)
{ {
/*The user might clear the key when it was released. Always release the pressed key*/ /*The user might clear the key when it was released. Always release the pressed key*/
data->key = i->proc.types.keypad.last_key; data->key = prev_key;
if(data->key == LV_GROUP_KEY_ENTER) { if(data->key == LV_GROUP_KEY_ENTER) {
focused->signal_cb(focused, LV_SIGNAL_RELEASED, NULL); focused->signal_cb(focused, LV_SIGNAL_RELEASED, NULL);
@@ -489,7 +496,6 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
} }
i->proc.types.keypad.last_state = data->state; i->proc.types.keypad.last_state = data->state;
i->proc.types.keypad.last_key = data->key;
#else #else
(void)data; /*Unused*/ (void)data; /*Unused*/
(void)i; /*Unused*/ (void)i; /*Unused*/

View File

@@ -106,7 +106,7 @@ void lv_indev_set_feedback(lv_indev_t *indev, lv_indev_feedback_t feedback);
void lv_indev_get_point(const lv_indev_t * indev, lv_point_t * point); void lv_indev_get_point(const lv_indev_t * indev, lv_point_t * point);
/** /**
* Get the last key of an input device (for LV_INDEV_TYPE_KEYPAD) * Get the last pressed key of an input device (for LV_INDEV_TYPE_KEYPAD)
* @param indev pointer to an input device * @param indev pointer to an input device
* @return the last pressed key (0 on error) * @return the last pressed key (0 on error)
*/ */

View File

@@ -16,7 +16,7 @@ extern "C" {
#ifdef LV_CONF_INCLUDE_SIMPLE #ifdef LV_CONF_INCLUDE_SIMPLE
#include "lv_conf.h" #include "lv_conf.h"
#else #else
#include "../../lv_conf.h" #include "../../../lv_conf.h"
#endif #endif
#include <stddef.h> #include <stddef.h>

View File

@@ -94,17 +94,17 @@ void lv_style_init(void)
lv_style_scr.body.shadow.width = 0; lv_style_scr.body.shadow.width = 0;
lv_style_scr.text.opa = LV_OPA_COVER; lv_style_scr.text.opa = LV_OPA_COVER;
lv_style_scr.text.color = LV_COLOR_MAKE(0x30, 0x30, 0x30); lv_style_scr.text.color = lv_color_make(0x30, 0x30, 0x30);
lv_style_scr.text.font = LV_FONT_DEFAULT; lv_style_scr.text.font = LV_FONT_DEFAULT;
lv_style_scr.text.letter_space = 2; lv_style_scr.text.letter_space = 2;
lv_style_scr.text.line_space = 2; lv_style_scr.text.line_space = 2;
lv_style_scr.image.opa = LV_OPA_COVER; lv_style_scr.image.opa = LV_OPA_COVER;
lv_style_scr.image.color = LV_COLOR_MAKE(0x20, 0x20, 0x20); lv_style_scr.image.color = lv_color_make(0x20, 0x20, 0x20);
lv_style_scr.image.intense = LV_OPA_TRANSP; lv_style_scr.image.intense = LV_OPA_TRANSP;
lv_style_scr.line.opa = LV_OPA_COVER; lv_style_scr.line.opa = LV_OPA_COVER;
lv_style_scr.line.color = LV_COLOR_MAKE(0x20, 0x20, 0x20); lv_style_scr.line.color = lv_color_make(0x20, 0x20, 0x20);
lv_style_scr.line.width = 2; lv_style_scr.line.width = 2;
lv_style_scr.line.rounded = 0; lv_style_scr.line.rounded = 0;
@@ -117,32 +117,32 @@ void lv_style_init(void)
/*Plain color style*/ /*Plain color style*/
memcpy(&lv_style_plain_color, &lv_style_plain, sizeof(lv_style_t)); memcpy(&lv_style_plain_color, &lv_style_plain, sizeof(lv_style_t));
lv_style_plain_color.text.color = LV_COLOR_MAKE(0xf0, 0xf0, 0xf0); lv_style_plain_color.text.color = lv_color_make(0xf0, 0xf0, 0xf0);
lv_style_plain_color.image.color = LV_COLOR_MAKE(0xf0, 0xf0, 0xf0); lv_style_plain_color.image.color = lv_color_make(0xf0, 0xf0, 0xf0);
lv_style_plain_color.line.color = LV_COLOR_MAKE(0xf0, 0xf0, 0xf0); lv_style_plain_color.line.color = lv_color_make(0xf0, 0xf0, 0xf0);
lv_style_plain_color.body.main_color = LV_COLOR_MAKE(0x55, 0x96, 0xd8); lv_style_plain_color.body.main_color = lv_color_make(0x55, 0x96, 0xd8);
lv_style_plain_color.body.grad_color = lv_style_plain_color.body.main_color; lv_style_plain_color.body.grad_color = lv_style_plain_color.body.main_color;
/*Pretty style */ /*Pretty style */
memcpy(&lv_style_pretty, &lv_style_plain, sizeof(lv_style_t)); memcpy(&lv_style_pretty, &lv_style_plain, sizeof(lv_style_t));
lv_style_pretty.text.color = LV_COLOR_MAKE(0x20, 0x20, 0x20); lv_style_pretty.text.color = lv_color_make(0x20, 0x20, 0x20);
lv_style_pretty.image.color = LV_COLOR_MAKE(0x20, 0x20, 0x20); lv_style_pretty.image.color = lv_color_make(0x20, 0x20, 0x20);
lv_style_pretty.line.color = LV_COLOR_MAKE(0x20, 0x20, 0x20); lv_style_pretty.line.color = lv_color_make(0x20, 0x20, 0x20);
lv_style_pretty.body.main_color = LV_COLOR_WHITE; lv_style_pretty.body.main_color = LV_COLOR_WHITE;
lv_style_pretty.body.grad_color = LV_COLOR_SILVER; lv_style_pretty.body.grad_color = LV_COLOR_SILVER;
lv_style_pretty.body.radius = LV_DPI / 15; lv_style_pretty.body.radius = LV_DPI / 15;
lv_style_pretty.body.border.color = LV_COLOR_MAKE(0x40, 0x40, 0x40); lv_style_pretty.body.border.color = lv_color_make(0x40, 0x40, 0x40);
lv_style_pretty.body.border.width = LV_DPI / 50 >= 1 ? LV_DPI / 50 : 1; lv_style_pretty.body.border.width = LV_DPI / 50 >= 1 ? LV_DPI / 50 : 1;
lv_style_pretty.body.border.opa = LV_OPA_30; lv_style_pretty.body.border.opa = LV_OPA_30;
/*Pretty color style*/ /*Pretty color style*/
memcpy(&lv_style_pretty_color, &lv_style_pretty, sizeof(lv_style_t)); memcpy(&lv_style_pretty_color, &lv_style_pretty, sizeof(lv_style_t));
lv_style_pretty_color.text.color = LV_COLOR_MAKE(0xe0, 0xe0, 0xe0); lv_style_pretty_color.text.color = lv_color_make(0xe0, 0xe0, 0xe0);
lv_style_pretty_color.image.color = LV_COLOR_MAKE(0xe0, 0xe0, 0xe0); lv_style_pretty_color.image.color = lv_color_make(0xe0, 0xe0, 0xe0);
lv_style_pretty_color.line.color = LV_COLOR_MAKE(0xc0, 0xc0, 0xc0); lv_style_pretty_color.line.color = lv_color_make(0xc0, 0xc0, 0xc0);
lv_style_pretty_color.body.main_color = LV_COLOR_MAKE(0x6b, 0x9a, 0xc7); lv_style_pretty_color.body.main_color = lv_color_make(0x6b, 0x9a, 0xc7);
lv_style_pretty_color.body.grad_color = LV_COLOR_MAKE(0x2b, 0x59, 0x8b); lv_style_pretty_color.body.grad_color = lv_color_make(0x2b, 0x59, 0x8b);
lv_style_pretty_color.body.border.color = LV_COLOR_MAKE(0x15, 0x2c, 0x42); lv_style_pretty_color.body.border.color = lv_color_make(0x15, 0x2c, 0x42);
/*Transparent style*/ /*Transparent style*/
memcpy(&lv_style_transp, &lv_style_plain, sizeof(lv_style_t)); memcpy(&lv_style_transp, &lv_style_plain, sizeof(lv_style_t));
@@ -163,55 +163,55 @@ void lv_style_init(void)
/*Button released style*/ /*Button released style*/
memcpy(&lv_style_btn_rel, &lv_style_plain, sizeof(lv_style_t)); memcpy(&lv_style_btn_rel, &lv_style_plain, sizeof(lv_style_t));
lv_style_btn_rel.body.main_color = LV_COLOR_MAKE(0x76, 0xa2, 0xd0); lv_style_btn_rel.body.main_color = lv_color_make(0x76, 0xa2, 0xd0);
lv_style_btn_rel.body.grad_color = LV_COLOR_MAKE(0x19, 0x3a, 0x5d); lv_style_btn_rel.body.grad_color = lv_color_make(0x19, 0x3a, 0x5d);
lv_style_btn_rel.body.radius = LV_DPI / 15; lv_style_btn_rel.body.radius = LV_DPI / 15;
lv_style_btn_rel.body.padding.left= LV_DPI / 4; lv_style_btn_rel.body.padding.left= LV_DPI / 4;
lv_style_btn_rel.body.padding.right = LV_DPI / 4; lv_style_btn_rel.body.padding.right = LV_DPI / 4;
lv_style_btn_rel.body.padding.top = LV_DPI / 6; lv_style_btn_rel.body.padding.top = LV_DPI / 6;
lv_style_btn_rel.body.padding.bottom = LV_DPI / 6; lv_style_btn_rel.body.padding.bottom = LV_DPI / 6;
lv_style_btn_rel.body.padding.inner = LV_DPI / 10; lv_style_btn_rel.body.padding.inner = LV_DPI / 10;
lv_style_btn_rel.body.border.color = LV_COLOR_MAKE(0x0b, 0x19, 0x28); lv_style_btn_rel.body.border.color = lv_color_make(0x0b, 0x19, 0x28);
lv_style_btn_rel.body.border.width = LV_DPI / 50 >= 1 ? LV_DPI / 50 : 1; lv_style_btn_rel.body.border.width = LV_DPI / 50 >= 1 ? LV_DPI / 50 : 1;
lv_style_btn_rel.body.border.opa = LV_OPA_70; lv_style_btn_rel.body.border.opa = LV_OPA_70;
lv_style_btn_rel.body.shadow.color = LV_COLOR_GRAY; lv_style_btn_rel.body.shadow.color = LV_COLOR_GRAY;
lv_style_btn_rel.body.shadow.width = 0; lv_style_btn_rel.body.shadow.width = 0;
lv_style_btn_rel.text.color = LV_COLOR_MAKE(0xff, 0xff, 0xff); lv_style_btn_rel.text.color = lv_color_make(0xff, 0xff, 0xff);
lv_style_btn_rel.image.color = LV_COLOR_MAKE(0xff, 0xff, 0xff); lv_style_btn_rel.image.color = lv_color_make(0xff, 0xff, 0xff);
/*Button pressed style*/ /*Button pressed style*/
memcpy(&lv_style_btn_pr, &lv_style_btn_rel, sizeof(lv_style_t)); memcpy(&lv_style_btn_pr, &lv_style_btn_rel, sizeof(lv_style_t));
lv_style_btn_pr.body.main_color = LV_COLOR_MAKE(0x33, 0x62, 0x94); lv_style_btn_pr.body.main_color = lv_color_make(0x33, 0x62, 0x94);
lv_style_btn_pr.body.grad_color = LV_COLOR_MAKE(0x10, 0x26, 0x3c); lv_style_btn_pr.body.grad_color = lv_color_make(0x10, 0x26, 0x3c);
lv_style_btn_pr.text.color = LV_COLOR_MAKE(0xa4, 0xb5, 0xc6); lv_style_btn_pr.text.color = lv_color_make(0xa4, 0xb5, 0xc6);
lv_style_btn_pr.image.color = LV_COLOR_MAKE(0xa4, 0xb5, 0xc6); lv_style_btn_pr.image.color = lv_color_make(0xa4, 0xb5, 0xc6);
lv_style_btn_pr.line.color = LV_COLOR_MAKE(0xa4, 0xb5, 0xc6); lv_style_btn_pr.line.color = lv_color_make(0xa4, 0xb5, 0xc6);
/*Button toggle released style*/ /*Button toggle released style*/
memcpy(&lv_style_btn_tgl_rel, &lv_style_btn_rel, sizeof(lv_style_t)); memcpy(&lv_style_btn_tgl_rel, &lv_style_btn_rel, sizeof(lv_style_t));
lv_style_btn_tgl_rel.body.main_color = LV_COLOR_MAKE(0x0a, 0x11, 0x22); lv_style_btn_tgl_rel.body.main_color = lv_color_make(0x0a, 0x11, 0x22);
lv_style_btn_tgl_rel.body.grad_color = LV_COLOR_MAKE(0x37, 0x62, 0x90); lv_style_btn_tgl_rel.body.grad_color = lv_color_make(0x37, 0x62, 0x90);
lv_style_btn_tgl_rel.body.border.color = LV_COLOR_MAKE(0x01, 0x07, 0x0d); lv_style_btn_tgl_rel.body.border.color = lv_color_make(0x01, 0x07, 0x0d);
lv_style_btn_tgl_rel.text.color = LV_COLOR_MAKE(0xc8, 0xdd, 0xf4); lv_style_btn_tgl_rel.text.color = lv_color_make(0xc8, 0xdd, 0xf4);
lv_style_btn_tgl_rel.image.color = LV_COLOR_MAKE(0xc8, 0xdd, 0xf4); lv_style_btn_tgl_rel.image.color = lv_color_make(0xc8, 0xdd, 0xf4);
lv_style_btn_tgl_rel.line.color = LV_COLOR_MAKE(0xc8, 0xdd, 0xf4); lv_style_btn_tgl_rel.line.color = lv_color_make(0xc8, 0xdd, 0xf4);
/*Button toggle pressed style*/ /*Button toggle pressed style*/
memcpy(&lv_style_btn_tgl_pr, &lv_style_btn_tgl_rel, sizeof(lv_style_t)); memcpy(&lv_style_btn_tgl_pr, &lv_style_btn_tgl_rel, sizeof(lv_style_t));
lv_style_btn_tgl_pr.body.main_color = LV_COLOR_MAKE(0x02, 0x14, 0x27); lv_style_btn_tgl_pr.body.main_color = lv_color_make(0x02, 0x14, 0x27);
lv_style_btn_tgl_pr.body.grad_color = LV_COLOR_MAKE(0x2b, 0x4c, 0x70); lv_style_btn_tgl_pr.body.grad_color = lv_color_make(0x2b, 0x4c, 0x70);
lv_style_btn_tgl_pr.text.color = LV_COLOR_MAKE(0xa4, 0xb5, 0xc6); lv_style_btn_tgl_pr.text.color = lv_color_make(0xa4, 0xb5, 0xc6);
lv_style_btn_tgl_pr.image.color = LV_COLOR_MAKE(0xa4, 0xb5, 0xc6); lv_style_btn_tgl_pr.image.color = lv_color_make(0xa4, 0xb5, 0xc6);
lv_style_btn_tgl_pr.line.color = LV_COLOR_MAKE(0xa4, 0xb5, 0xc6); lv_style_btn_tgl_pr.line.color = lv_color_make(0xa4, 0xb5, 0xc6);
/*Button inactive style*/ /*Button inactive style*/
memcpy(&lv_style_btn_ina, &lv_style_btn_rel, sizeof(lv_style_t)); memcpy(&lv_style_btn_ina, &lv_style_btn_rel, sizeof(lv_style_t));
lv_style_btn_ina.body.main_color = LV_COLOR_MAKE(0xd8, 0xd8, 0xd8); lv_style_btn_ina.body.main_color = lv_color_make(0xd8, 0xd8, 0xd8);
lv_style_btn_ina.body.grad_color = LV_COLOR_MAKE(0xd8, 0xd8, 0xd8); lv_style_btn_ina.body.grad_color = lv_color_make(0xd8, 0xd8, 0xd8);
lv_style_btn_ina.body.border.color = LV_COLOR_MAKE(0x90, 0x90, 0x90); lv_style_btn_ina.body.border.color = lv_color_make(0x90, 0x90, 0x90);
lv_style_btn_ina.text.color = LV_COLOR_MAKE(0x70, 0x70, 0x70); lv_style_btn_ina.text.color = lv_color_make(0x70, 0x70, 0x70);
lv_style_btn_ina.image.color = LV_COLOR_MAKE(0x70, 0x70, 0x70); lv_style_btn_ina.image.color = lv_color_make(0x70, 0x70, 0x70);
lv_style_btn_ina.line.color = LV_COLOR_MAKE(0x70, 0x70, 0x70); lv_style_btn_ina.line.color = lv_color_make(0x70, 0x70, 0x70);
} }

View File

@@ -16,7 +16,7 @@ extern "C" {
#ifdef LV_CONF_INCLUDE_SIMPLE #ifdef LV_CONF_INCLUDE_SIMPLE
#include "lv_conf.h" #include "lv_conf.h"
#else #else
#include "../../lv_conf.h" #include "../../../lv_conf.h"
#endif #endif
#include "../lv_core/lv_style.h" #include "../lv_core/lv_style.h"

View File

@@ -7,7 +7,7 @@ CSRCS += lv_draw_img.c
CSRCS += lv_draw_arc.c CSRCS += lv_draw_arc.c
CSRCS += lv_draw_triangle.c CSRCS += lv_draw_triangle.c
DEPPATH += --dep-path $(LVGL_DIR)/lvgl/lv_draw DEPPATH += --dep-path $(LVGL_DIR)/lvgl/src/lv_draw
VPATH += :$(LVGL_DIR)/lvgl/lv_draw VPATH += :$(LVGL_DIR)/lvgl/src/lv_draw
CFLAGS += "-I$(LVGL_DIR)/lvgl/lv_draw" CFLAGS += "-I$(LVGL_DIR)lvgl/src/lv_draw"

View File

@@ -16,7 +16,7 @@ extern "C" {
#ifdef LV_CONF_INCLUDE_SIMPLE #ifdef LV_CONF_INCLUDE_SIMPLE
#include "lv_conf.h" #include "lv_conf.h"
#else #else
#include "../../lv_conf.h" #include "../../../lv_conf.h"
#endif #endif
#include "../lv_misc/lv_color.h" #include "../lv_misc/lv_color.h"

View File

@@ -439,7 +439,7 @@ static const uint8_t * lv_img_decoder_open(const void * src, const lv_style_t *
uint32_t i; uint32_t i;
for(i = 0; i < palette_size; i++) { for(i = 0; i < palette_size; i++) {
decoder_index_map[i] = LV_COLOR_MAKE(palette_p[i].ch.red, palette_p[i].ch.green, palette_p[i].ch.blue); decoder_index_map[i] = lv_color_make(palette_p[i].ch.red, palette_p[i].ch.green, palette_p[i].ch.blue);
} }
return NULL; return NULL;
#else #else

View File

@@ -161,7 +161,7 @@ void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, const lv_st
r = (hex_char_to_num(buf[0]) << 4) + hex_char_to_num(buf[1]); r = (hex_char_to_num(buf[0]) << 4) + hex_char_to_num(buf[1]);
g = (hex_char_to_num(buf[2]) << 4) + hex_char_to_num(buf[3]); g = (hex_char_to_num(buf[2]) << 4) + hex_char_to_num(buf[3]);
b = (hex_char_to_num(buf[4]) << 4) + hex_char_to_num(buf[5]); b = (hex_char_to_num(buf[4]) << 4) + hex_char_to_num(buf[5]);
recolor = LV_COLOR_MAKE(r, g, b); recolor = lv_color_make(r, g, b);
} else { } else {
recolor.full = style->text.color.full; recolor.full = style->text.color.full;
} }

View File

@@ -33,14 +33,14 @@ static void point_swap(lv_point_t * p1, lv_point_t * p2);
/********************** /**********************
* GLOBAL FUNCTIONS * GLOBAL FUNCTIONS
**********************/ **********************/
#if LV_USE_TRIANGLE != 0
/** /**
* *
* @param points pointer to an array with 3 points * @param points pointer to an array with 3 points
* @param mask the triangle will be drawn only in this mask * @param mask the triangle will be drawn only in this mask
* @param color color of the triangle * @param color color of the triangle
* @param opa_scale scale down all opacities by the factor
*/ */
void lv_draw_triangle(const lv_point_t * points, const lv_area_t * mask, lv_color_t color) void lv_draw_triangle(const lv_point_t * points, const lv_area_t * mask, lv_color_t color, lv_opa_t opa_scale)
{ {
lv_point_t tri[3]; lv_point_t tri[3];
@@ -138,14 +138,12 @@ void lv_draw_triangle(const lv_point_t * points, const lv_area_t * mask, lv_colo
} while(edge2.y == y2_tmp); } while(edge2.y == y2_tmp);
} }
} }
#endif
/********************** /**********************
* STATIC FUNCTIONS * STATIC FUNCTIONS
**********************/ **********************/
#if LV_USE_TRIANGLE != 0
/** /**
* Swap two points * Swap two points
* p1 pointer to the first point * p1 pointer to the first point
@@ -164,5 +162,3 @@ static void point_swap(lv_point_t * p1, lv_point_t * p2)
p2->y = tmp.y; p2->y = tmp.y;
} }
#endif

View File

@@ -26,18 +26,15 @@ extern "C" {
/********************** /**********************
* GLOBAL PROTOTYPES * GLOBAL PROTOTYPES
**********************/ **********************/
/*Experimental use for 3D modeling*/
#define LV_USE_TRIANGLE 1
#if LV_USE_TRIANGLE != 0
/** /**
* *
* @param points pointer to an array with 3 points * @param points pointer to an array with 3 points
* @param mask the triangle will be drawn only in this mask * @param mask the triangle will be drawn only in this mask
* @param color color of the triangle * @param color color of the triangle
* @param opa_scale scale down all opacities by the factor
*/ */
void lv_draw_triangle(const lv_point_t * points, const lv_area_t * mask, lv_color_t color); void lv_draw_triangle(const lv_point_t * points, const lv_area_t * mask, lv_color_t color, lv_opa_t opa_scale);
#endif
/********************** /**********************
* MACROS * MACROS

View File

@@ -16,7 +16,7 @@ extern "C" {
#ifdef LV_CONF_INCLUDE_SIMPLE #ifdef LV_CONF_INCLUDE_SIMPLE
#include "lv_conf.h" #include "lv_conf.h"
#else #else
#include "../../lv_conf.h" #include "../../../lv_conf.h"
#endif #endif
#include "../lv_misc/lv_font.h" #include "../lv_misc/lv_font.h"

View File

@@ -17,7 +17,7 @@ CSRCS += lv_font_symbol_30.c
CSRCS += lv_font_symbol_40.c CSRCS += lv_font_symbol_40.c
CSRCS += lv_font_monospace_8.c CSRCS += lv_font_monospace_8.c
DEPPATH += --dep-path $(LVGL_DIR)/lvgl/lv_fonts DEPPATH += --dep-path $(LVGL_DIR)/lvgl/src/lv_fonts
VPATH += :$(LVGL_DIR)/lvgl/lv_fonts VPATH += :$(LVGL_DIR)/lvgl/src/lv_fonts
CFLAGS += "-I$(LVGL_DIR)/lvgl/lv_fonts" CFLAGS += "-I$(LVGL_DIR)/lvgl/src/lv_fonts"

8
src/lv_hal/lv_hal.mk Normal file
View File

@@ -0,0 +1,8 @@
CSRCS += lv_hal_disp.c
CSRCS += lv_hal_indev.c
CSRCS += lv_hal_tick.c
DEPPATH += --dep-path $(LVGL_DIR)/lvgl/src/lv_hal
VPATH += :$(LVGL_DIR)/lvgl/src/lv_hal
CFLAGS += "-I$(LVGL_DIR)/lvgl/src/lv_hal"

View File

@@ -116,6 +116,10 @@ bool lv_indev_read(lv_indev_t * indev, lv_indev_data_t * data)
data->point.x = indev->proc.types.pointer.act_point.x; data->point.x = indev->proc.types.pointer.act_point.x;
data->point.y = indev->proc.types.pointer.act_point.y; data->point.y = indev->proc.types.pointer.act_point.y;
} }
/*Similarly set at least the last key in case of the the user doesn't set it on release*/
else if(indev->driver.type == LV_INDEV_TYPE_KEYPAD) {
data->key = indev->proc.types.keypad.last_key;
}
if(indev->driver.read_cb) { if(indev->driver.read_cb) {
LV_LOG_TRACE("idnev read started"); LV_LOG_TRACE("idnev read started");

View File

@@ -18,7 +18,7 @@ extern "C" {
#ifdef LV_CONF_INCLUDE_SIMPLE #ifdef LV_CONF_INCLUDE_SIMPLE
#include "lv_conf.h" #include "lv_conf.h"
#else #else
#include "../../lv_conf.h" #include "../../../lv_conf.h"
#endif #endif
#include <stdbool.h> #include <stdbool.h>

View File

@@ -9,7 +9,7 @@
#ifdef LV_CONF_INCLUDE_SIMPLE #ifdef LV_CONF_INCLUDE_SIMPLE
#include "lv_conf.h" #include "lv_conf.h"
#else #else
#include "../../lv_conf.h" #include "../../../lv_conf.h"
#endif #endif
#include "lv_hal_tick.h" #include "lv_hal_tick.h"

View File

@@ -16,7 +16,7 @@ extern "C" {
#ifdef LV_CONF_INCLUDE_SIMPLE #ifdef LV_CONF_INCLUDE_SIMPLE
#include "lv_conf.h" #include "lv_conf.h"
#else #else
#include "../../lv_conf.h" #include "../../../lv_conf.h"
#endif #endif
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>

View File

@@ -17,7 +17,7 @@ extern "C" {
#ifdef LV_CONF_INCLUDE_SIMPLE #ifdef LV_CONF_INCLUDE_SIMPLE
#include "lv_conf.h" #include "lv_conf.h"
#else #else
#include "../../lv_conf.h" #include "../../../lv_conf.h"
#endif #endif
#if LV_USE_ANIMATION #if LV_USE_ANIMATION

View File

@@ -57,7 +57,7 @@ lv_color_t lv_color_hsv_to_rgb(uint16_t h, uint8_t s, uint8_t v)
r = v; r = v;
g = v; g = v;
b = v; b = v;
return LV_COLOR_MAKE(v, v, v); return lv_color_make(v, v, v);
} }
region = h / 43; region = h / 43;
@@ -100,7 +100,7 @@ lv_color_t lv_color_hsv_to_rgb(uint16_t h, uint8_t s, uint8_t v)
break; break;
} }
lv_color_t result = LV_COLOR_MAKE(r, g, b); lv_color_t result = lv_color_make(r, g, b);
return result; return result;
} }

View File

@@ -16,7 +16,7 @@ extern "C" {
#ifdef LV_CONF_INCLUDE_SIMPLE #ifdef LV_CONF_INCLUDE_SIMPLE
#include "lv_conf.h" #include "lv_conf.h"
#else #else
#include "../../lv_conf.h" #include "../../../lv_conf.h"
#endif #endif
/*Error checking*/ /*Error checking*/
@@ -364,53 +364,68 @@ static inline uint8_t lv_color_brightness(lv_color_t color)
return (uint16_t) bright >> 3; return (uint16_t) bright >> 3;
} }
/* The most simple macro to create a color from R,G and B values /* The most simple macro to create a color from R,G and B values */
* The order of bit field is different on Big-endian and Little-endian machines*/
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
#if LV_COLOR_DEPTH == 1 #if LV_COLOR_DEPTH == 1
#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){(b8 >> 7 | g8 >> 7 | r8 >> 7)}) #define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){(b8 >> 7 | g8 >> 7 | r8 >> 7)})
static inline lv_color_t lv_color_make(int r8, int g8, int b8){
lv_color_t color;
color.full = (b8 >> 7 | g8 >> 7 | r8 >> 7);
return color;
}
#elif LV_COLOR_DEPTH == 8 #elif LV_COLOR_DEPTH == 8
#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{b8 >> 6, g8 >> 5, r8 >> 5}}) #define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{b8 >> 6, g8 >> 5, r8 >> 5}})
static inline lv_color_t lv_color_make(uint8_t r8, int g8, int b8){
lv_color_t color;
color.ch.blue = b8 >> 6;
color.ch.green = g8 >> 5;
color.ch.red = r8 >> 5;
return color;
}
#elif LV_COLOR_DEPTH == 16 #elif LV_COLOR_DEPTH == 16
# if LV_COLOR_16_SWAP == 0 # if LV_COLOR_16_SWAP == 0
# define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{b8 >> 3, g8 >> 2, r8 >> 3}}) # define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{b8 >> 3, g8 >> 2, r8 >> 3}})
static inline lv_color_t lv_color_make(uint8_t r8, uint8_t g8, uint8_t b8){
lv_color_t color;
color.ch.blue = (uint16_t)(b8 >> 3);
color.ch.green = (uint16_t)(g8 >> 2);
color.ch.red = (uint16_t)(r8 >> 3);
return color;
}
# else # else
# define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{g8 >> 5, r8 >> 3, b8 >> 3, (g8 >> 2) & 0x7}}) # define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{g8 >> 5, r8 >> 3, b8 >> 3, (g8 >> 2) & 0x7}})
static inline lv_color_t lv_color_make(uint8_t r8, uint8_t g8, uint8_t b8){
lv_color_t color;
color.ch.green_h = (uint16_t)(g8 >> 5);
color.ch.red = (uint16_t)(r8 >> 3);
color.ch.blue = (uint16_t)(b8 >> 3);
color.ch.green_l = (uint16_t)((g8 >> 2) & 0x7);
return color;
}
# endif # endif
#elif LV_COLOR_DEPTH == 32 #elif LV_COLOR_DEPTH == 32
#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{b8, g8, r8, 0xff}}) /*Fix 0xff alpha*/ #define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{b8, g8, r8, 0xff}}) /*Fix 0xff alpha*/
static inline lv_color_t lv_color_make(uint8_t r8, uint8_t g8, uint8_t b8){
lv_color_t color;
color.ch.blue = b8;
color.ch.green = g8;
color.ch.red = r8;
color.ch.alpha = 0xff;
return color;
}
#endif #endif
#else
#if LV_COLOR_DEPTH == 1
#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){(r8 >> 7 | g8 >> 7 | b8 >> 7)})
#elif LV_COLOR_DEPTH == 8
#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{r8 >> 6, g8 >> 5, b8 >> 5}})
#elif LV_COLOR_DEPTH == 16
#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{r8 >> 3, g8 >> 2, b8 >> 3}})
#elif LV_COLOR_DEPTH == 32
#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{0xff, r8, g8, b8}}) /*Fix 0xff alpha*/
#endif
#endif
#define LV_COLOR_HEX(c) LV_COLOR_MAKE((uint8_t) ((uint32_t)((uint32_t)c >> 16) & 0xFF), \
(uint8_t) ((uint32_t)((uint32_t)c >> 8) & 0xFF), \
(uint8_t) ((uint32_t) c & 0xFF))
/*Usage LV_COLOR_HEX3(0x16C) which means LV_COLOR_HEX(0x1166CC)*/
#define LV_COLOR_HEX3(c) LV_COLOR_MAKE((uint8_t) (((c >> 4) & 0xF0) | ((c >> 8) & 0xF)), \
(uint8_t) ((uint32_t)(c & 0xF0) | ((c & 0xF0) >> 4)), \
(uint8_t) ((uint32_t)(c & 0xF) | ((c & 0xF) << 4)))
static inline lv_color_t lv_color_hex(uint32_t c) { static inline lv_color_t lv_color_hex(uint32_t c) {
return LV_COLOR_HEX(c); return lv_color_make((uint8_t) ((c >> 16) & 0xFF),
(uint8_t) ((c >> 8) & 0xFF),
(uint8_t) (c & 0xFF));
} }
static inline lv_color_t lv_color_hex3(uint32_t c) { static inline lv_color_t lv_color_hex3(uint32_t c) {
return LV_COLOR_HEX3(c); return lv_color_make((uint8_t) (((c >> 4) & 0xF0) | ((c >> 8) & 0xF)),
(uint8_t) ((c & 0xF0) | ((c & 0xF0) >> 4)),
(uint8_t) ((c & 0xF) | ((c & 0xF) << 4)));
} }
/** /**
* Convert a HSV color to RGB * Convert a HSV color to RGB
* @param h hue [0..359] * @param h hue [0..359]

View File

@@ -17,7 +17,7 @@ extern "C" {
#ifdef LV_CONF_INCLUDE_SIMPLE #ifdef LV_CONF_INCLUDE_SIMPLE
#include "lv_conf.h" #include "lv_conf.h"
#else #else
#include "../../lv_conf.h" #include "../../../lv_conf.h"
#endif #endif
#include <stdint.h> #include <stdint.h>

View File

@@ -16,7 +16,7 @@ extern "C" {
#ifdef LV_CONF_INCLUDE_SIMPLE #ifdef LV_CONF_INCLUDE_SIMPLE
#include "lv_conf.h" #include "lv_conf.h"
#else #else
#include "../../lv_conf.h" #include "../../../lv_conf.h"
#endif #endif
#if LV_USE_FILESYSTEM #if LV_USE_FILESYSTEM

View File

@@ -17,7 +17,7 @@ extern "C" {
#ifdef LV_CONF_INCLUDE_SIMPLE #ifdef LV_CONF_INCLUDE_SIMPLE
#include "lv_conf.h" #include "lv_conf.h"
#else #else
#include "../../lv_conf.h" #include "../../../lv_conf.h"
#endif #endif
#include <stdint.h> #include <stdint.h>

View File

@@ -16,7 +16,7 @@ extern "C" {
#ifdef LV_CONF_INCLUDE_SIMPLE #ifdef LV_CONF_INCLUDE_SIMPLE
#include "lv_conf.h" #include "lv_conf.h"
#else #else
#include "../../lv_conf.h" #include "../../../lv_conf.h"
#endif #endif
#include <stdint.h> #include <stdint.h>

View File

@@ -39,7 +39,7 @@ typedef union {
struct { struct {
MEM_UNIT used: 1; //1: if the entry is used MEM_UNIT used: 1; //1: if the entry is used
MEM_UNIT d_size: 31; //Size off the data (1 means 4 bytes) MEM_UNIT d_size: 31; //Size off the data (1 means 4 bytes)
}; } s;
MEM_UNIT header; //The header (used + d_size) MEM_UNIT header; //The header (used + d_size)
} lv_mem_header_t; } lv_mem_header_t;
@@ -92,9 +92,9 @@ void lv_mem_init(void)
#endif #endif
lv_mem_ent_t * full = (lv_mem_ent_t *)work_mem; lv_mem_ent_t * full = (lv_mem_ent_t *)work_mem;
full->header.used = 0; full->header.s.used = 0;
/*The total mem size id reduced by the first header and the close patterns */ /*The total mem size id reduced by the first header and the close patterns */
full->header.d_size = LV_MEM_SIZE - sizeof(lv_mem_header_t); full->header.s.d_size = LV_MEM_SIZE - sizeof(lv_mem_header_t);
#endif #endif
} }
@@ -147,8 +147,8 @@ void * lv_mem_alloc(uint32_t size)
/*Allocate a header too to store the size*/ /*Allocate a header too to store the size*/
alloc = LV_MEM_CUSTOM_ALLOC(size + sizeof(lv_mem_header_t)); alloc = LV_MEM_CUSTOM_ALLOC(size + sizeof(lv_mem_header_t));
if(alloc != NULL) { if(alloc != NULL) {
((lv_mem_ent_t *) alloc)->header.d_size = size; ((lv_mem_ent_t *) alloc)->header.s.d_size = size;
((lv_mem_ent_t *) alloc)->header.used = 1; ((lv_mem_ent_t *) alloc)->header.s.used = 1;
alloc = &((lv_mem_ent_t *) alloc)->first_data; alloc = &((lv_mem_ent_t *) alloc)->first_data;
} }
#endif /* LV_ENABLE_GC */ #endif /* LV_ENABLE_GC */
@@ -180,7 +180,7 @@ void lv_mem_free(const void * data)
#if LV_ENABLE_GC==0 #if LV_ENABLE_GC==0
/*e points to the header*/ /*e points to the header*/
lv_mem_ent_t * e = (lv_mem_ent_t *)((uint8_t *) data - sizeof(lv_mem_header_t)); lv_mem_ent_t * e = (lv_mem_ent_t *)((uint8_t *) data - sizeof(lv_mem_header_t));
e->header.used = 0; e->header.s.used = 0;
#endif #endif
#if LV_MEM_CUSTOM == 0 #if LV_MEM_CUSTOM == 0
@@ -190,8 +190,8 @@ void lv_mem_free(const void * data)
lv_mem_ent_t * e_next; lv_mem_ent_t * e_next;
e_next = ent_get_next(e); e_next = ent_get_next(e);
while(e_next != NULL) { while(e_next != NULL) {
if(e_next->header.used == 0) { if(e_next->header.s.used == 0) {
e->header.d_size += e_next->header.d_size + sizeof(e->header); e->header.s.d_size += e_next->header.s.d_size + sizeof(e->header);
} else { } else {
break; break;
} }
@@ -222,7 +222,7 @@ void * lv_mem_realloc(void * data_p, uint32_t new_size)
/*data_p could be previously freed pointer (in this case it is invalid)*/ /*data_p could be previously freed pointer (in this case it is invalid)*/
if(data_p != NULL) { if(data_p != NULL) {
lv_mem_ent_t * e = (lv_mem_ent_t *)((uint8_t *) data_p - sizeof(lv_mem_header_t)); lv_mem_ent_t * e = (lv_mem_ent_t *)((uint8_t *) data_p - sizeof(lv_mem_header_t));
if(e->header.used == 0) { if(e->header.s.used == 0) {
data_p = NULL; data_p = NULL;
} }
} }
@@ -281,7 +281,7 @@ void lv_mem_defrag(void)
while(1) { while(1) {
/*Search the next free entry*/ /*Search the next free entry*/
while(e_free != NULL) { while(e_free != NULL) {
if(e_free->header.used != 0) { if(e_free->header.s.used != 0) {
e_free = ent_get_next(e_free); e_free = ent_get_next(e_free);
} else { } else {
break; break;
@@ -293,8 +293,8 @@ void lv_mem_defrag(void)
/*Joint the following free entries to the free*/ /*Joint the following free entries to the free*/
e_next = ent_get_next(e_free); e_next = ent_get_next(e_free);
while(e_next != NULL) { while(e_next != NULL) {
if(e_next->header.used == 0) { if(e_next->header.s.used == 0) {
e_free->header.d_size += e_next->header.d_size + sizeof(e_next->header); e_free->header.s.d_size += e_next->header.s.d_size + sizeof(e_next->header);
} else { } else {
break; break;
} }
@@ -326,11 +326,11 @@ void lv_mem_monitor(lv_mem_monitor_t * mon_p)
e = ent_get_next(e); e = ent_get_next(e);
while(e != NULL) { while(e != NULL) {
if(e->header.used == 0) { if(e->header.s.used == 0) {
mon_p->free_cnt++; mon_p->free_cnt++;
mon_p->free_size += e->header.d_size; mon_p->free_size += e->header.s.d_size;
if(e->header.d_size > mon_p->free_biggest_size) { if(e->header.s.d_size > mon_p->free_biggest_size) {
mon_p->free_biggest_size = e->header.d_size; mon_p->free_biggest_size = e->header.s.d_size;
} }
} else { } else {
mon_p->used_cnt++; mon_p->used_cnt++;
@@ -360,7 +360,7 @@ uint32_t lv_mem_get_size(const void * data)
lv_mem_ent_t * e = (lv_mem_ent_t *)((uint8_t *) data - sizeof(lv_mem_header_t)); lv_mem_ent_t * e = (lv_mem_ent_t *)((uint8_t *) data - sizeof(lv_mem_header_t));
return e->header.d_size; return e->header.s.d_size;
} }
#else /* LV_ENABLE_GC */ #else /* LV_ENABLE_GC */
@@ -390,7 +390,7 @@ static lv_mem_ent_t * ent_get_next(lv_mem_ent_t * act_e)
next_e = (lv_mem_ent_t *) work_mem; next_e = (lv_mem_ent_t *) work_mem;
} else { /*Get the next entry */ } else { /*Get the next entry */
uint8_t * data = &act_e->first_data; uint8_t * data = &act_e->first_data;
next_e = (lv_mem_ent_t *)&data[act_e->header.d_size]; next_e = (lv_mem_ent_t *)&data[act_e->header.s.d_size];
if(&next_e->first_data >= &work_mem[LV_MEM_SIZE]) next_e = NULL; if(&next_e->first_data >= &work_mem[LV_MEM_SIZE]) next_e = NULL;
} }
@@ -410,11 +410,11 @@ static void * ent_alloc(lv_mem_ent_t * e, uint32_t size)
void * alloc = NULL; void * alloc = NULL;
/*If the memory is free and big enough then use it */ /*If the memory is free and big enough then use it */
if(e->header.used == 0 && e->header.d_size >= size) { if(e->header.s.used == 0 && e->header.s.d_size >= size) {
/*Truncate the entry to the desired size */ /*Truncate the entry to the desired size */
ent_trunc(e, size), ent_trunc(e, size),
e->header.used = 1; e->header.s.used = 1;
/*Save the allocated data*/ /*Save the allocated data*/
alloc = &e->first_data; alloc = &e->first_data;
@@ -445,20 +445,20 @@ static void ent_trunc(lv_mem_ent_t * e, uint32_t size)
#endif #endif
/*Don't let empty space only for a header without data*/ /*Don't let empty space only for a header without data*/
if(e->header.d_size == size + sizeof(lv_mem_header_t)) { if(e->header.s.d_size == size + sizeof(lv_mem_header_t)) {
size = e->header.d_size; size = e->header.s.d_size;
} }
/* Create the new entry after the current if there is space for it */ /* Create the new entry after the current if there is space for it */
if(e->header.d_size != size) { if(e->header.s.d_size != size) {
uint8_t * e_data = &e->first_data; uint8_t * e_data = &e->first_data;
lv_mem_ent_t * after_new_e = (lv_mem_ent_t *)&e_data[size]; lv_mem_ent_t * after_new_e = (lv_mem_ent_t *)&e_data[size];
after_new_e->header.used = 0; after_new_e->header.s.used = 0;
after_new_e->header.d_size = e->header.d_size - size - sizeof(lv_mem_header_t); after_new_e->header.s.d_size = e->header.s.d_size - size - sizeof(lv_mem_header_t);
} }
/* Set the new size for the original entry */ /* Set the new size for the original entry */
e->header.d_size = size; e->header.s.d_size = size;
} }
#endif #endif

View File

@@ -17,7 +17,7 @@ extern "C" {
#ifdef LV_CONF_INCLUDE_SIMPLE #ifdef LV_CONF_INCLUDE_SIMPLE
#include "lv_conf.h" #include "lv_conf.h"
#else #else
#include "../../lv_conf.h" #include "../../../lv_conf.h"
#endif #endif
#include <stdint.h> #include <stdint.h>

View File

@@ -12,7 +12,7 @@ CSRCS += lv_math.c
CSRCS += lv_log.c CSRCS += lv_log.c
CSRCS += lv_gc.c CSRCS += lv_gc.c
DEPPATH += --dep-path $(LVGL_DIR)/lvgl/lv_misc DEPPATH += --dep-path $(LVGL_DIR)/lvgl/src/lv_misc
VPATH += :$(LVGL_DIR)/lvgl/lv_misc VPATH += :$(LVGL_DIR)/lvgl/src/lv_misc
CFLAGS += "-I$(LVGL_DIR)/lvgl/lv_misc" CFLAGS += "-I$(LVGL_DIR)/lvgl/src/lv_misc"

View File

@@ -7,7 +7,7 @@ extern "C" {
#ifdef LV_CONF_INCLUDE_SIMPLE #ifdef LV_CONF_INCLUDE_SIMPLE
#include "lv_conf.h" #include "lv_conf.h"
#else #else
#include "../../lv_conf.h" #include "../../../lv_conf.h"
#endif #endif
/* /*

View File

@@ -17,7 +17,7 @@ extern "C" {
#ifdef LV_CONF_INCLUDE_SIMPLE #ifdef LV_CONF_INCLUDE_SIMPLE
#include "lv_conf.h" #include "lv_conf.h"
#else #else
#include "../../lv_conf.h" #include "../../../lv_conf.h"
#endif #endif
#include <stdint.h> #include <stdint.h>

View File

@@ -15,6 +15,10 @@
* TYPEDEFS * TYPEDEFS
**********************/ **********************/
/* This typedef exists purely to keep -Wpedantic happy when the file is empty. */
/* It can be removed. */
typedef int keep_pedantic_happy;
/********************** /**********************
* STATIC PROTOTYPES * STATIC PROTOTYPES
**********************/ **********************/

View File

@@ -16,7 +16,7 @@ extern "C" {
#ifdef LV_CONF_INCLUDE_SIMPLE #ifdef LV_CONF_INCLUDE_SIMPLE
#include "lv_conf.h" #include "lv_conf.h"
#else #else
#include "../../lv_conf.h" #include "../../../lv_conf.h"
#endif #endif
#include <stdbool.h> #include <stdbool.h>

View File

@@ -17,7 +17,7 @@ extern "C" {
#ifdef LV_CONF_INCLUDE_SIMPLE #ifdef LV_CONF_INCLUDE_SIMPLE
#include "lv_conf.h" #include "lv_conf.h"
#else #else
#include "../../lv_conf.h" #include "../../../lv_conf.h"
#endif #endif
#if LV_USE_ARC != 0 #if LV_USE_ARC != 0

View File

@@ -16,7 +16,7 @@ extern "C" {
#ifdef LV_CONF_INCLUDE_SIMPLE #ifdef LV_CONF_INCLUDE_SIMPLE
#include "lv_conf.h" #include "lv_conf.h"
#else #else
#include "../../lv_conf.h" #include "../../../lv_conf.h"
#endif #endif
#if LV_USE_BAR != 0 #if LV_USE_BAR != 0

Some files were not shown because too many files have changed in this diff Show More