From d1d3ef4305c0255b1d72f305cb714b7f496ee7ba Mon Sep 17 00:00:00 2001 From: Amir Gonnen Date: Thu, 3 Oct 2019 23:20:50 +0300 Subject: [PATCH 1/2] use "export" macro to export interesting defines to binding --- lv_conf_template.h | 6 ++++++ src/lv_core/lv_style.h | 2 ++ src/lv_misc/lv_area.h | 3 +++ src/lv_misc/lv_log.h | 15 ++++++++------- src/lv_objx/lv_bar.h | 5 +++++ src/lv_objx/lv_btnm.h | 2 ++ src/lv_objx/lv_chart.h | 3 +++ src/lv_objx/lv_label.h | 4 ++++ src/lv_objx/lv_ta.h | 2 ++ 9 files changed, 35 insertions(+), 7 deletions(-) diff --git a/lv_conf_template.h b/lv_conf_template.h index f1f06fe07..d5944c4ec 100644 --- a/lv_conf_template.h +++ b/lv_conf_template.h @@ -98,6 +98,12 @@ typedef int16_t lv_coord_t; # define LV_MEM_CUSTOM_GET_SIZE your_mem_get_size /*Wrapper to lv_mem_get_size*/ #endif /* LV_ENABLE_GC */ +/* Export integer constant to binding. + * This macro is used with constants in the form of LV_ that + * should also appear on lvgl binding API such as Micropython + */ +#define LV_EXPORT_CONST_INT(int_value) + /*======================= Input device settings *=======================*/ diff --git a/src/lv_core/lv_style.h b/src/lv_core/lv_style.h index 0055529de..a334a4a5e 100644 --- a/src/lv_core/lv_style.h +++ b/src/lv_core/lv_style.h @@ -25,6 +25,8 @@ extern "C" { #define LV_RADIUS_CIRCLE (LV_COORD_MAX) /**< A very big radius to always draw as circle*/ #define LV_STYLE_DEGUG_SENTINEL_VALUE 0x12345678 +LV_EXPORT_CONST_INT(LV_RADIUS_CIRCLE); + /********************** * TYPEDEFS **********************/ diff --git a/src/lv_misc/lv_area.h b/src/lv_misc/lv_area.h index 30b62cbec..149df2302 100644 --- a/src/lv_misc/lv_area.h +++ b/src/lv_misc/lv_area.h @@ -29,6 +29,9 @@ extern "C" { #define LV_COORD_MAX ((lv_coord_t)((uint32_t)((uint32_t)1 << (8 * sizeof(lv_coord_t) - 1)) - 1000)) #define LV_COORD_MIN (-LV_COORD_MAX) +LV_EXPORT_CONST_INT(LV_COORD_MAX); +LV_EXPORT_CONST_INT(LV_COORD_MIN); + /********************** * TYPEDEFS **********************/ diff --git a/src/lv_misc/lv_log.h b/src/lv_misc/lv_log.h index 6a6c2d2a4..d85bcde43 100644 --- a/src/lv_misc/lv_log.h +++ b/src/lv_misc/lv_log.h @@ -26,13 +26,14 @@ extern "C" { /*Possible log level. For compatibility declare it independently from `LV_USE_LOG`*/ -#define LV_LOG_LEVEL_TRACE 0 /**< A lot of logs to give detailed information*/ -#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_NONE 4 /**< Do not log anything*/ -#define _LV_LOG_LEVEL_NUM 5 /**< Number of log levels */ - +enum { + LV_LOG_LEVEL_TRACE = 0, /**< A lot of logs to give detailed information*/ + LV_LOG_LEVEL_INFO = 1, /**< Log important events*/ + LV_LOG_LEVEL_WARN = 2, /**< Log if something unwanted happened but didn't caused problem*/ + LV_LOG_LEVEL_ERROR = 3, /**< Only critical issue, when the system may fail*/ + LV_LOG_LEVEL_NONE = 4, /**< Do not log anything*/ + _LV_LOG_LEVEL_NUM = 5 /**< Number of log levels */ +}; typedef int8_t lv_log_level_t; #if LV_USE_LOG diff --git a/src/lv_objx/lv_bar.h b/src/lv_objx/lv_bar.h index 14c558e7a..9ffdbdd62 100644 --- a/src/lv_objx/lv_bar.h +++ b/src/lv_objx/lv_bar.h @@ -43,6 +43,11 @@ extern "C" { /** log2(LV_BAR_ANIM_STATE_END) used to normalize data*/ #define LV_BAR_ANIM_STATE_NORM 8 +LV_EXPORT_CONST_INT(LV_BAR_ANIM_STATE_START); +LV_EXPORT_CONST_INT(LV_BAR_ANIM_STATE_END); +LV_EXPORT_CONST_INT(LV_BAR_ANIM_STATE_INV); +LV_EXPORT_CONST_INT(LV_BAR_ANIM_STATE_NORM); + /********************** * TYPEDEFS **********************/ diff --git a/src/lv_objx/lv_btnm.h b/src/lv_objx/lv_btnm.h index bedcdf436..44bc4efbb 100644 --- a/src/lv_objx/lv_btnm.h +++ b/src/lv_objx/lv_btnm.h @@ -31,6 +31,8 @@ extern "C" { #define LV_BTNM_WIDTH_MASK 0x0007 #define LV_BTNM_BTN_NONE 0xFFFF +LV_EXPORT_CONST_INT(LV_BTNM_BTN_NONE); + /********************** * TYPEDEFS **********************/ diff --git a/src/lv_objx/lv_chart.h b/src/lv_objx/lv_chart.h index dd2c9be8b..55fb92999 100644 --- a/src/lv_objx/lv_chart.h +++ b/src/lv_objx/lv_chart.h @@ -34,6 +34,9 @@ extern "C" { /**Automatically calculate the tick length*/ #define LV_CHART_TICK_LENGTH_AUTO 255 +LV_EXPORT_CONST_INT(LV_CHART_POINT_DEF); +LV_EXPORT_CONST_INT(LV_CHART_TICK_LENGTH_AUTO); + /********************** * TYPEDEFS **********************/ diff --git a/src/lv_objx/lv_label.h b/src/lv_objx/lv_label.h index 2804ef700..2de59cdf0 100644 --- a/src/lv_objx/lv_label.h +++ b/src/lv_objx/lv_label.h @@ -35,6 +35,10 @@ extern "C" { #define LV_LABEL_POS_LAST 0xFFFF #define LV_LABEL_TEXT_SEL_OFF 0xFFFF +LV_EXPORT_CONST_INT(LV_LABEL_DOT_NUM); +LV_EXPORT_CONST_INT(LV_LABEL_POS_LAST); +LV_EXPORT_CONST_INT(LV_LABEL_TEXT_SEL_OFF); + /********************** * TYPEDEFS **********************/ diff --git a/src/lv_objx/lv_ta.h b/src/lv_objx/lv_ta.h index 4d3a4a4e3..ec2854e49 100644 --- a/src/lv_objx/lv_ta.h +++ b/src/lv_objx/lv_ta.h @@ -39,6 +39,8 @@ extern "C" { *********************/ #define LV_TA_CURSOR_LAST (0x7FFF) /*Put the cursor after the last character*/ +LV_EXPORT_CONST_INT(LV_TA_CURSOR_LAST); + /********************** * TYPEDEFS **********************/ From 02755339bc2090a3b647da78fe89c543e969c08c Mon Sep 17 00:00:00 2001 From: Amir Gonnen Date: Fri, 4 Oct 2019 12:26:33 +0300 Subject: [PATCH 2/2] Move LV_EXPORT_CONST_INT to compiler settings section --- lv_conf_template.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lv_conf_template.h b/lv_conf_template.h index d5944c4ec..14424ba35 100644 --- a/lv_conf_template.h +++ b/lv_conf_template.h @@ -98,12 +98,6 @@ typedef int16_t lv_coord_t; # define LV_MEM_CUSTOM_GET_SIZE your_mem_get_size /*Wrapper to lv_mem_get_size*/ #endif /* LV_ENABLE_GC */ -/* Export integer constant to binding. - * This macro is used with constants in the form of LV_ that - * should also appear on lvgl binding API such as Micropython - */ -#define LV_EXPORT_CONST_INT(int_value) - /*======================= Input device settings *=======================*/ @@ -202,6 +196,12 @@ typedef void * lv_img_decoder_user_data_t; * font's bitmaps */ #define LV_ATTRIBUTE_LARGE_CONST +/* Export integer constant to binding. + * This macro is used with constants in the form of LV_ that + * should also appear on lvgl binding API such as Micropython + */ +#define LV_EXPORT_CONST_INT(int_value) + /*=================== * HAL settings *==================*/