LVGL add all callbacks (#12636)

* LVGL add all callbacks

* LVGL allow nil argument for init()

* Final touch
This commit is contained in:
s-hadinger 2021-07-12 22:53:31 +02:00 committed by GitHub
parent 580da43a88
commit 76a0635491
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 2490 additions and 1915 deletions

View File

@ -27,24 +27,47 @@ extern int lv0_screenshot(bvm *vm);
static int lv_get_hor_res(void) {
return lv_disp_get_hor_res(lv_disp_get_default());
}
static int lv_get_ver_res(bvm *vm) {
static int lv_get_ver_res(void) {
return lv_disp_get_ver_res(lv_disp_get_default());
}
/* `lv` methods */
const lvbe_call_c_t lv_func[] = {
// resolution
{ "draw_arc", (void*) &lv_draw_arc, "", "iiiii(lv_area)(lv_draw_line_dsc)" },
{ "draw_img", (void*) &lv_draw_img, "", "(lv_area)(lv_area).(lv_draw_img_dsc)" },
{ "draw_img_dsc_init", (void*) &lv_draw_img_dsc_init, "", "(lv_draw_img_dsc)" },
{ "draw_label", (void*) &lv_draw_label, "", "(lv_area)(lv_area)(lv_draw_label_dsc)s(lv_draw_label_hint)" },
{ "draw_label_dsc_init", (void*) &lv_draw_label_dsc_init, "", "(lv_draw_label_dsc)" },
{ "draw_line", (void*) &lv_draw_line, "", "(lv_point)(lv_point)(lv_area)(lv_draw_line_dsc)" },
{ "draw_line_dsc_init", (void*) &lv_draw_line_dsc_init, "", "(lv_draw_line_dsc)" },
{ "draw_mask_add", (void*) &lv_draw_mask_add, "i", ".." },
{ "draw_mask_angle_init", (void*) &lv_draw_mask_angle_init, "", "(lv_draw_mask_angle_param)iiii" },
{ "draw_mask_fade_init", (void*) &lv_draw_mask_fade_init, "", "(lv_draw_mask_fade_param)(lv_area)iiii" },
{ "draw_mask_get_cnt", (void*) &lv_draw_mask_get_cnt, "i", "" },
{ "draw_mask_line_angle_init", (void*) &lv_draw_mask_line_angle_init, "", "(lv_draw_mask_line_param)iii(lv_draw_mask_line_side)" },
{ "draw_mask_line_points_init", (void*) &lv_draw_mask_line_points_init, "", "(lv_draw_mask_line_param)iiii(lv_draw_mask_line_side)" },
{ "draw_mask_map_init", (void*) &lv_draw_mask_map_init, "", "(lv_draw_mask_map_param)(lv_area)(lv_opa)" },
{ "draw_mask_radius_init", (void*) &lv_draw_mask_radius_init, "", "(lv_draw_mask_radius_param)(lv_area)ib" },
{ "draw_mask_remove_custom", (void*) &lv_draw_mask_remove_custom, ".", "." },
{ "draw_mask_remove_id", (void*) &lv_draw_mask_remove_id, ".", "i" },
{ "draw_polygon", (void*) &lv_draw_polygon, "", "ii(lv_area)(lv_draw_rect_dsc)" },
{ "draw_px", (void*) &lv_draw_px, "", "(lv_point)(lv_area)(lv_style)" },
{ "draw_rect", (void*) &lv_draw_rect, "", "(lv_area)(lv_area)(lv_draw_rect_dsc)" },
{ "draw_triangle", (void*) &lv_draw_triangle, "", "i(lv_area)(lv_draw_rect_dsc)" },
{ "event_get_data", (void*) &lv_event_get_data, ".", "" },
{ "event_send", (void*) &lv_event_send, "i", "(lv_obj)i." },
{ "event_send_refresh", (void*) &lv_event_send_refresh, "i", "(lv_obj)" },
{ "event_send_refresh_recursive", (void*) &lv_event_send_refresh_recursive, "", "(lv_obj)" },
{ "get_hor_res", (void*) &lv_get_hor_res, "i", "" },
{ "get_ver_res", (void*) &lv_get_ver_res, "i", "" },
// layers
{ "layer_sys", (void*) &lv_layer_sys, "lv_obj", "" },
{ "layer_top", (void*) &lv_layer_top, "lv_obj", "" },
// screens
{ "scr_act", (void*) &lv_scr_act, "lv_obj", "" },
{ "scr_load", (void*) &lv_scr_load, "", "(lv_obj)" },
{ "scr_load_anim", (void*) &lv_scr_load_anim, "", "(lv_obj)iiib" },
{ "scr_load_anim", (void*) &lv_scr_load_anim, "", "(lv_obj)(lv_scr_load_anim)iib" },
{ "signal_send", (void*) &lv_signal_send, "i", "(lv_obj)i." },
};
const size_t lv_func_size = sizeof(lv_func) / sizeof(lv_func[0]);
@ -160,6 +183,19 @@ const be_constint_t lv0_constants[] = {
{ "DRAG_DIR_HOR", LV_DRAG_DIR_HOR },
{ "DRAG_DIR_ONE", LV_DRAG_DIR_ONE },
{ "DRAG_DIR_VER", LV_DRAG_DIR_VER },
{ "DRAW_MASK_LINE_SIDE_BOTTOM", LV_DRAW_MASK_LINE_SIDE_BOTTOM },
{ "DRAW_MASK_LINE_SIDE_LEFT", LV_DRAW_MASK_LINE_SIDE_LEFT },
{ "DRAW_MASK_LINE_SIDE_RIGHT", LV_DRAW_MASK_LINE_SIDE_RIGHT },
{ "DRAW_MASK_LINE_SIDE_TOP", LV_DRAW_MASK_LINE_SIDE_TOP },
{ "DRAW_MASK_RES_CHANGED", LV_DRAW_MASK_RES_CHANGED },
{ "DRAW_MASK_RES_FULL_COVER", LV_DRAW_MASK_RES_FULL_COVER },
{ "DRAW_MASK_RES_TRANSP", LV_DRAW_MASK_RES_TRANSP },
{ "DRAW_MASK_RES_UNKNOWN", LV_DRAW_MASK_RES_UNKNOWN },
{ "DRAW_MASK_TYPE_ANGLE", LV_DRAW_MASK_TYPE_ANGLE },
{ "DRAW_MASK_TYPE_FADE", LV_DRAW_MASK_TYPE_FADE },
{ "DRAW_MASK_TYPE_LINE", LV_DRAW_MASK_TYPE_LINE },
{ "DRAW_MASK_TYPE_MAP", LV_DRAW_MASK_TYPE_MAP },
{ "DRAW_MASK_TYPE_RADIUS", LV_DRAW_MASK_TYPE_RADIUS },
{ "DROPDOWN_DIR_DOWN", LV_DROPDOWN_DIR_DOWN },
{ "DROPDOWN_DIR_LEFT", LV_DROPDOWN_DIR_LEFT },
{ "DROPDOWN_DIR_RIGHT", LV_DROPDOWN_DIR_RIGHT },
@ -496,11 +532,7 @@ const be_constint_t lv0_constants[] = {
};
const size_t lv0_constants_size = sizeof(lv0_constants)/sizeof(lv0_constants[0]);
#if !BE_USE_PRECOMPILED_OBJECT
//#if 1 // TODO we will do pre-compiled later
be_native_module_attr_table(lvgl) {
// Symbols
@ -582,8 +614,6 @@ be_native_module_attr_table(lvgl) {
be_native_module_function("load_freetype_font", lv0_load_freetype_font),
be_native_module_function("screenshot", lv0_screenshot),
};
be_define_native_module(lvgl, NULL);
@ -729,9 +759,6 @@ module lvgl (scope: global) {
load_freetype_font, func(lv0_load_freetype_font)
screenshot, func(lv0_screenshot)
}
@const_object_info_end */
#include "../generate/be_fixed_lvgl.h"

View File

@ -0,0 +1,216 @@
/********************************************************************
* Tasmota LVGL callbacks
*
*******************************************************************/
#include "be_constobj.h"
extern int lv0_init(bvm *vm);
extern int lvx_tostring(bvm *vm);
extern int be_call_c_func(bvm *vm, void * func, const char * return_type, const char * arg_type);
int lv_cb_call_any(bvm *vm, const char * return_type, const char * arg_type) {
int argc = be_top(vm);
// get pointer to callback
be_getmember(vm, 1, ".p");
void * cb = be_tocomptr(vm, -1);
be_pop(vm, 1);
// remove first argument which is the instance `self`
for (int i=1; i<argc; i++) {
be_moveto(vm, i+1, i);
}
be_pop(vm, 1);
// call callback
return be_call_c_func(vm, cb, return_type, arg_type);
}
int lv_cb_call(bvm *vm) {
return lv_cb_call_any(vm, "i", NULL);
}
// 'lv_group_focus_cb'
// typedef void (*lv_group_focus_cb_t)(struct _lv_group_t *);
int lv_group_focus_cb_call(bvm *vm) {
return lv_cb_call_any(vm, "", "(lv_group)");
}
// 'lv_event_cb'
// typedef void (*lv_event_cb_t)(struct _lv_obj_t * obj, lv_event_t event);
int lv_event_cb_call(bvm *vm) {
return lv_cb_call_any(vm, "", "(lv_obj)");
}
// 'lv_signal_cb'
// typedef lv_res_t (*lv_signal_cb_t)(struct _lv_obj_t * obj, lv_signal_t sign, void * param);
int lv_signal_cb_call(bvm *vm) {
return lv_cb_call_any(vm, "i", "(lv_obj)i.");
}
// 'lv_design_cb'
// typedef lv_design_res_t (*lv_design_cb_t)(struct _lv_obj_t * obj, const lv_area_t * clip_area, lv_design_mode_t mode);
int lv_design_cb_call(bvm *vm) {
return lv_cb_call_any(vm, "i", "(lv_obj)(lv_area)i");
}
// 'lv_gauge_format_cb'
// typedef void (*lv_gauge_format_cb_t)(lv_obj_t * gauge, char * buf, int bufsize, int32_t value);
int lv_gauge_format_cb_call(bvm *vm) {
return lv_cb_call_any(vm, "", "(lv_obj).ii");
}
#if BE_USE_PRECOMPILED_OBJECT
#include "../generate/be_fixed_be_lvgl_cb.h"
#endif
void be_load_lvgl_cb_lib(bvm *vm) {
#if !BE_USE_PRECOMPILED_OBJECT
static const bnfuncinfo members[] = {
{ ".p", NULL },
{ "init", lv0_init },
{ "tostring", lvx_tostring },
{ "()", lv_cb_call },
// { NULL, (bntvfunc) BE_CLOSURE }, /* mark section for berry closures */
// { "get_tasmota", (bntvfunc) &get_tasmota_closure },
// { "add_cmd", (bntvfunc) &add_cmd_closure },
{ NULL, NULL }
};
be_regclass(vm, "lv_cb", members);
#else
be_pushntvclass(vm, &be_lvgl_cb);
be_setglobal(vm, "lv_cb");
be_pop(vm, 1);
#endif
}
/* @const_object_info_begin
class be_lvgl_cb (scope: global, name: lv_cb) {
.p, var
init, func(lv0_init)
tostring, func(lvx_tostring)
call, func(lv_cb_call)
}
@const_object_info_end */
// instanciate all callbacks as sub-classes
// 'lv_group_focus_cb'
// 'lv_event_cb'
// 'lv_signal_cb'
// 'lv_design_cb'
// 'lv_gauge_format_cb'
//
#if BE_USE_PRECOMPILED_OBJECT
#include "../generate/be_fixed_be_lv_group_focus_cb.h"
#include "../generate/be_fixed_be_lv_event_cb.h"
#include "../generate/be_fixed_be_lv_signal_cb.h"
#include "../generate/be_fixed_be_lv_design_cb.h"
#include "../generate/be_fixed_be_lv_gauge_format_cb.h"
#endif
void be_load_lvgl_cb_all_lib(bvm *vm) {
#if !BE_USE_PRECOMPILED_OBJECT
static const bnfuncinfo members_lv_group_focus_cb[] = {
{ "()", lv_group_focus_cb_call },
{ NULL, NULL }
};
be_regclass(vm, "lv_group_focus_cb", members);
be_getglobal(vm, "lv_group_focus_cb");
be_getglobal(vm, "lv_cb");
be_setsuper(vm, -2);
be_pop(vm, 2);
#else
be_pushntvclass(vm, &be_lv_group_focus_cb);
be_setglobal(vm, "lv_group_focus_cb");
be_pop(vm, 1);
#endif
#if !BE_USE_PRECOMPILED_OBJECT
static const bnfuncinfo members_lv_event_cb[] = {
{ "()", lv_event_cb_call },
{ NULL, NULL }
};
be_regclass(vm, "lv_event_cb", members);
be_getglobal(vm, "lv_event_cb");
be_getglobal(vm, "lv_cb");
be_setsuper(vm, -2);
be_pop(vm, 2);
#else
be_pushntvclass(vm, &be_lv_event_cb);
be_setglobal(vm, "lv_event_cb");
be_pop(vm, 1);
#endif
#if !BE_USE_PRECOMPILED_OBJECT
static const bnfuncinfo members_lv_signal_cb[] = {
{ "()", lv_signal_cb_call },
{ NULL, NULL }
};
be_regclass(vm, "lv_signal_cb", members);
be_getglobal(vm, "lv_signal_cb");
be_getglobal(vm, "lv_cb");
be_setsuper(vm, -2);
be_pop(vm, 2);
#else
be_pushntvclass(vm, &be_lv_signal_cb);
be_setglobal(vm, "lv_signal_cb");
be_pop(vm, 1);
#endif
#if !BE_USE_PRECOMPILED_OBJECT
static const bnfuncinfo members_lv_design_cb[] = {
{ "()", lv_design_cb_call },
{ NULL, NULL }
};
be_regclass(vm, "lv_design_cb", members);
be_getglobal(vm, "lv_design_cb");
be_getglobal(vm, "lv_cb");
be_setsuper(vm, -2);
be_pop(vm, 2);
#else
be_pushntvclass(vm, &be_lv_design_cb);
be_setglobal(vm, "lv_design_cb");
be_pop(vm, 1);
#endif
#if !BE_USE_PRECOMPILED_OBJECT
static const bnfuncinfo members_lv_gauge_format_cb[] = {
{ "()", lv_gauge_format_cb_call },
{ NULL, NULL }
};
be_regclass(vm, "lv_gauge_format_cb", members);
be_getglobal(vm, "lv_gauge_format_cb");
be_getglobal(vm, "lv_cb");
be_setsuper(vm, -2);
be_pop(vm, 2);
#else
be_pushntvclass(vm, &be_lv_gauge_format_cb);
be_setglobal(vm, "lv_gauge_format_cb");
be_pop(vm, 1);
#endif
}
/* @const_object_info_begin
class be_lv_group_focus_cb (scope: global, name: lv_group_focus_cb, super: be_lvgl_cb) {
call, func(lv_group_focus_cb_call)
}
class be_lv_event_cb (scope: global, name: lv_event_cb, super: be_lvgl_cb) {
call, func(lv_event_cb_call)
}
class be_lv_signal_cb (scope: global, name: lv_signal_cb, super: be_lvgl_cb) {
call, func(lv_signal_cb_call)
}
class be_lv_design_cb (scope: global, name: lv_design_cb, super: be_lvgl_cb) {
call, func(lv_design_cb_call)
}
class be_lv_gauge_format_cb (scope: global, name: lv_gauge_format_cb, super: be_lvgl_cb) {
call, func(lv_gauge_format_cb_call)
}
@const_object_info_end */

View File

@ -83,8 +83,19 @@ typedef struct be_ctypes_classes_t {
// const be_ctypes_class_t * g_ctypes_classes = NULL;
// extern void berry_log_C(const char * berry_buf, ...);
//
// Constructor for ctypes structure
//
// If no arg: allocate a bytes() structure of the right size, filled with zeroes
// Arg1 is instance self
// If arg 2 is int (and not null): copy the data to the bytes structure
int be_ctypes_init(bvm *vm) {
int argc = be_top(vm);
void * src_data = NULL;
if (argc > 1 && (be_isint(vm, 2) || be_iscomptr(vm,2))) {
src_data = (void*) be_toint(vm, 2);
}
// get global array of classes from global variable '.ctypes_classes'
be_getglobal(vm, ".ctypes_classes");
const be_ctypes_classes_t * be_ctypes_classes = (const be_ctypes_classes_t *) be_tocomptr(vm, -1);
@ -125,6 +136,18 @@ int be_ctypes_init(bvm *vm) {
be_pushint(vm, definitions->size_bytes);
be_call(vm, 2);
be_pop(vm, 3);
// if src_data then copy source data to the new structure
if (src_data) {
// call self._buffer()
be_getmember(vm, 1, "_buffer");
be_pushvalue(vm, 1);
be_call(vm, 1); // call with 1 parameter
void * dst_data = be_tocomptr(vm, -2);
be_pop(vm, 2);
// copy data
memmove(dst_data, src_data, definitions->size_bytes);
}
}
be_return(vm);

View File

@ -98,7 +98,7 @@ void ctypes_register_class(bvm *vm, const bclass * ctypes_class, const be_ctypes
/********************************************************************
* Generated code, don't edit
*******************************************************************/
const be_ctypes_structure_t be_lv_point_t = {
const be_ctypes_structure_t be_lv_point = {
4, /* size in bytes */
2, /* number of elements */
(const be_ctypes_structure_item_t[2]) {
@ -106,7 +106,7 @@ const be_ctypes_structure_t be_lv_point_t = {
{ "y", 2, 0, 0, 12 },
}};
const be_ctypes_structure_t be_lv_area_t = {
const be_ctypes_structure_t be_lv_area = {
8, /* size in bytes */
4, /* number of elements */
(const be_ctypes_structure_item_t[4]) {
@ -116,7 +116,7 @@ const be_ctypes_structure_t be_lv_area_t = {
{ "y2", 6, 0, 0, 12 },
}};
const be_ctypes_structure_t be_lv_draw_rect_dsc_t = {
const be_ctypes_structure_t be_lv_draw_rect_dsc = {
77, /* size in bytes */
43, /* number of elements */
(const be_ctypes_structure_item_t[43]) {
@ -165,7 +165,7 @@ const be_ctypes_structure_t be_lv_draw_rect_dsc_t = {
{ "value_str", 56, 0, 0, 4 },
}};
const be_ctypes_structure_t be_lv_draw_line_dsc_t = {
const be_ctypes_structure_t be_lv_draw_line_dsc = {
10, /* size in bytes */
9, /* number of elements */
(const be_ctypes_structure_item_t[9]) {
@ -180,7 +180,7 @@ const be_ctypes_structure_t be_lv_draw_line_dsc_t = {
{ "width", 2, 0, 0, 12 },
}};
const be_ctypes_structure_t be_lv_draw_img_dsc_t = {
const be_ctypes_structure_t be_lv_draw_img_dsc = {
14, /* size in bytes */
9, /* number of elements */
(const be_ctypes_structure_item_t[9]) {
@ -195,7 +195,7 @@ const be_ctypes_structure_t be_lv_draw_img_dsc_t = {
{ "zoom", 7, 0, 0, 2 },
}};
const be_ctypes_structure_t be_lv_draw_label_dsc_t = {
const be_ctypes_structure_t be_lv_draw_label_dsc = {
31, /* size in bytes */
15, /* number of elements */
(const be_ctypes_structure_item_t[15]) {
@ -216,7 +216,7 @@ const be_ctypes_structure_t be_lv_draw_label_dsc_t = {
{ "sel_start", 15, 0, 0, 4 },
}};
const be_ctypes_structure_t be_lv_draw_mask_common_dsc_t = {
const be_ctypes_structure_t be_lv_draw_mask_common_dsc = {
5, /* size in bytes */
2, /* number of elements */
(const be_ctypes_structure_item_t[2]) {
@ -224,7 +224,7 @@ const be_ctypes_structure_t be_lv_draw_mask_common_dsc_t = {
{ "type", 4, 0, 0, 1 },
}};
const be_ctypes_structure_t be_lv_draw_mask_line_param_cfg_t = {
const be_ctypes_structure_t be_lv_draw_mask_line_param_cfg = {
9, /* size in bytes */
5, /* number of elements */
(const be_ctypes_structure_item_t[5]) {
@ -235,7 +235,7 @@ const be_ctypes_structure_t be_lv_draw_mask_line_param_cfg_t = {
{ "side", 8, 0, 2, 0 },
}};
const be_ctypes_structure_t be_lv_draw_mask_line_param_t = {
const be_ctypes_structure_t be_lv_draw_mask_line_param = {
35, /* size in bytes */
15, /* number of elements */
(const be_ctypes_structure_item_t[15]) {
@ -256,7 +256,7 @@ const be_ctypes_structure_t be_lv_draw_mask_line_param_t = {
{ "yx_steep", 22, 0, 0, 14 },
}};
const be_ctypes_structure_t be_lv_draw_mask_angle_param_cfg_t = {
const be_ctypes_structure_t be_lv_draw_mask_angle_param_cfg = {
8, /* size in bytes */
4, /* number of elements */
(const be_ctypes_structure_item_t[4]) {
@ -266,7 +266,7 @@ const be_ctypes_structure_t be_lv_draw_mask_angle_param_cfg_t = {
{ "vertex_p_y", 2, 0, 0, 12 },
}};
const be_ctypes_structure_t be_lv_draw_mask_angle_param_t = {
const be_ctypes_structure_t be_lv_draw_mask_angle_param = {
85, /* size in bytes */
37, /* number of elements */
(const be_ctypes_structure_item_t[37]) {
@ -309,7 +309,7 @@ const be_ctypes_structure_t be_lv_draw_mask_angle_param_t = {
{ "start_line_yx_steep", 35, 0, 0, 14 },
}};
const be_ctypes_structure_t be_lv_draw_mask_radius_param_cfg_t = {
const be_ctypes_structure_t be_lv_draw_mask_radius_param_cfg = {
11, /* size in bytes */
6, /* number of elements */
(const be_ctypes_structure_item_t[6]) {
@ -321,7 +321,7 @@ const be_ctypes_structure_t be_lv_draw_mask_radius_param_cfg_t = {
{ "rect_y2", 6, 0, 0, 12 },
}};
const be_ctypes_structure_t be_lv_sqrt_res_t = {
const be_ctypes_structure_t be_lv_sqrt_res = {
4, /* size in bytes */
2, /* number of elements */
(const be_ctypes_structure_item_t[2]) {
@ -329,7 +329,7 @@ const be_ctypes_structure_t be_lv_sqrt_res_t = {
{ "i", 0, 0, 0, 2 },
}};
const be_ctypes_structure_t be_lv_draw_mask_radius_param_t = {
const be_ctypes_structure_t be_lv_draw_mask_radius_param = {
24, /* size in bytes */
11, /* number of elements */
(const be_ctypes_structure_item_t[11]) {
@ -346,7 +346,7 @@ const be_ctypes_structure_t be_lv_draw_mask_radius_param_t = {
{ "y_prev_x_i", 20, 0, 0, 2 },
}};
const be_ctypes_structure_t be_lv_draw_mask_fade_param_cfg_t = {
const be_ctypes_structure_t be_lv_draw_mask_fade_param_cfg = {
14, /* size in bytes */
8, /* number of elements */
(const be_ctypes_structure_item_t[8]) {
@ -360,7 +360,7 @@ const be_ctypes_structure_t be_lv_draw_mask_fade_param_cfg_t = {
{ "y_top", 8, 0, 0, 12 },
}};
const be_ctypes_structure_t be_lv_draw_mask_fade_param_t = {
const be_ctypes_structure_t be_lv_draw_mask_fade_param = {
19, /* size in bytes */
10, /* number of elements */
(const be_ctypes_structure_item_t[10]) {
@ -376,7 +376,7 @@ const be_ctypes_structure_t be_lv_draw_mask_fade_param_t = {
{ "dsc_type", 4, 0, 0, 1 },
}};
const be_ctypes_structure_t be_lv_draw_mask_map_param_cfg_t = {
const be_ctypes_structure_t be_lv_draw_mask_map_param_cfg = {
12, /* size in bytes */
5, /* number of elements */
(const be_ctypes_structure_item_t[5]) {
@ -387,7 +387,7 @@ const be_ctypes_structure_t be_lv_draw_mask_map_param_cfg_t = {
{ "map", 8, 0, 0, 4 },
}};
const be_ctypes_structure_t be_lv_draw_mask_map_param_t = {
const be_ctypes_structure_t be_lv_draw_mask_map_param = {
17, /* size in bytes */
7, /* number of elements */
(const be_ctypes_structure_item_t[7]) {
@ -400,7 +400,7 @@ const be_ctypes_structure_t be_lv_draw_mask_map_param_t = {
{ "dsc_type", 4, 0, 0, 1 },
}};
const be_ctypes_structure_t be_lv_draw_mask_saved_t = {
const be_ctypes_structure_t be_lv_draw_mask_saved = {
8, /* size in bytes */
2, /* number of elements */
(const be_ctypes_structure_item_t[2]) {
@ -411,48 +411,48 @@ const be_ctypes_structure_t be_lv_draw_mask_saved_t = {
const be_ctypes_classes_t be_ctypes_classes[] = {
19,
(const be_ctypes_class_t[19]) {
{ "lv_area_t", &be_lv_area_t },
{ "lv_draw_img_dsc_t", &be_lv_draw_img_dsc_t },
{ "lv_draw_label_dsc_t", &be_lv_draw_label_dsc_t },
{ "lv_draw_line_dsc_t", &be_lv_draw_line_dsc_t },
{ "lv_draw_mask_angle_param_cfg_t", &be_lv_draw_mask_angle_param_cfg_t },
{ "lv_draw_mask_angle_param_t", &be_lv_draw_mask_angle_param_t },
{ "lv_draw_mask_common_dsc_t", &be_lv_draw_mask_common_dsc_t },
{ "lv_draw_mask_fade_param_cfg_t", &be_lv_draw_mask_fade_param_cfg_t },
{ "lv_draw_mask_fade_param_t", &be_lv_draw_mask_fade_param_t },
{ "lv_draw_mask_line_param_cfg_t", &be_lv_draw_mask_line_param_cfg_t },
{ "lv_draw_mask_line_param_t", &be_lv_draw_mask_line_param_t },
{ "lv_draw_mask_map_param_cfg_t", &be_lv_draw_mask_map_param_cfg_t },
{ "lv_draw_mask_map_param_t", &be_lv_draw_mask_map_param_t },
{ "lv_draw_mask_radius_param_cfg_t", &be_lv_draw_mask_radius_param_cfg_t },
{ "lv_draw_mask_radius_param_t", &be_lv_draw_mask_radius_param_t },
{ "lv_draw_mask_saved_t", &be_lv_draw_mask_saved_t },
{ "lv_draw_rect_dsc_t", &be_lv_draw_rect_dsc_t },
{ "lv_point_t", &be_lv_point_t },
{ "lv_sqrt_res_t", &be_lv_sqrt_res_t },
{ "lv_area", &be_lv_area },
{ "lv_draw_img_dsc", &be_lv_draw_img_dsc },
{ "lv_draw_label_dsc", &be_lv_draw_label_dsc },
{ "lv_draw_line_dsc", &be_lv_draw_line_dsc },
{ "lv_draw_mask_angle_param", &be_lv_draw_mask_angle_param },
{ "lv_draw_mask_angle_param_cfg", &be_lv_draw_mask_angle_param_cfg },
{ "lv_draw_mask_common_dsc", &be_lv_draw_mask_common_dsc },
{ "lv_draw_mask_fade_param", &be_lv_draw_mask_fade_param },
{ "lv_draw_mask_fade_param_cfg", &be_lv_draw_mask_fade_param_cfg },
{ "lv_draw_mask_line_param", &be_lv_draw_mask_line_param },
{ "lv_draw_mask_line_param_cfg", &be_lv_draw_mask_line_param_cfg },
{ "lv_draw_mask_map_param", &be_lv_draw_mask_map_param },
{ "lv_draw_mask_map_param_cfg", &be_lv_draw_mask_map_param_cfg },
{ "lv_draw_mask_radius_param", &be_lv_draw_mask_radius_param },
{ "lv_draw_mask_radius_param_cfg", &be_lv_draw_mask_radius_param_cfg },
{ "lv_draw_mask_saved", &be_lv_draw_mask_saved },
{ "lv_draw_rect_dsc", &be_lv_draw_rect_dsc },
{ "lv_point", &be_lv_point },
{ "lv_sqrt_res", &be_lv_sqrt_res },
}};
/* @const_object_info_begin
class be_class_ctypes_classes (scope: global) {
lv_area_t, int(0)
lv_draw_img_dsc_t, int(0)
lv_draw_label_dsc_t, int(0)
lv_draw_line_dsc_t, int(0)
lv_draw_mask_angle_param_cfg_t, int(0)
lv_draw_mask_angle_param_t, int(0)
lv_draw_mask_common_dsc_t, int(0)
lv_draw_mask_fade_param_cfg_t, int(0)
lv_draw_mask_fade_param_t, int(0)
lv_draw_mask_line_param_cfg_t, int(0)
lv_draw_mask_line_param_t, int(0)
lv_draw_mask_map_param_cfg_t, int(0)
lv_draw_mask_map_param_t, int(0)
lv_draw_mask_radius_param_cfg_t, int(0)
lv_draw_mask_radius_param_t, int(0)
lv_draw_mask_saved_t, int(0)
lv_draw_rect_dsc_t, int(0)
lv_point_t, int(0)
lv_sqrt_res_t, int(0)
lv_area, int(0)
lv_draw_img_dsc, int(0)
lv_draw_label_dsc, int(0)
lv_draw_line_dsc, int(0)
lv_draw_mask_angle_param, int(0)
lv_draw_mask_angle_param_cfg, int(0)
lv_draw_mask_common_dsc, int(0)
lv_draw_mask_fade_param, int(0)
lv_draw_mask_fade_param_cfg, int(0)
lv_draw_mask_line_param, int(0)
lv_draw_mask_line_param_cfg, int(0)
lv_draw_mask_map_param, int(0)
lv_draw_mask_map_param_cfg, int(0)
lv_draw_mask_radius_param, int(0)
lv_draw_mask_radius_param_cfg, int(0)
lv_draw_mask_saved, int(0)
lv_draw_rect_dsc, int(0)
lv_point, int(0)
lv_sqrt_res, int(0)
}
@const_object_info_end */
@ -461,44 +461,44 @@ void be_load_ctypes_definitions_lib(bvm *vm) {
be_setglobal(vm, ".ctypes_classes");
be_pop(vm, 1);
static be_define_const_empty_class(be_class_lv_area_t, &be_class_lv_ctypes, lv_area_t);
ctypes_register_class(vm, &be_class_lv_area_t, &be_lv_area_t);
static be_define_const_empty_class(be_class_lv_draw_img_dsc_t, &be_class_lv_ctypes, lv_draw_img_dsc_t);
ctypes_register_class(vm, &be_class_lv_draw_img_dsc_t, &be_lv_draw_img_dsc_t);
static be_define_const_empty_class(be_class_lv_draw_label_dsc_t, &be_class_lv_ctypes, lv_draw_label_dsc_t);
ctypes_register_class(vm, &be_class_lv_draw_label_dsc_t, &be_lv_draw_label_dsc_t);
static be_define_const_empty_class(be_class_lv_draw_line_dsc_t, &be_class_lv_ctypes, lv_draw_line_dsc_t);
ctypes_register_class(vm, &be_class_lv_draw_line_dsc_t, &be_lv_draw_line_dsc_t);
static be_define_const_empty_class(be_class_lv_draw_mask_angle_param_cfg_t, &be_class_lv_ctypes, lv_draw_mask_angle_param_cfg_t);
ctypes_register_class(vm, &be_class_lv_draw_mask_angle_param_cfg_t, &be_lv_draw_mask_angle_param_cfg_t);
static be_define_const_empty_class(be_class_lv_draw_mask_angle_param_t, &be_class_lv_ctypes, lv_draw_mask_angle_param_t);
ctypes_register_class(vm, &be_class_lv_draw_mask_angle_param_t, &be_lv_draw_mask_angle_param_t);
static be_define_const_empty_class(be_class_lv_draw_mask_common_dsc_t, &be_class_lv_ctypes, lv_draw_mask_common_dsc_t);
ctypes_register_class(vm, &be_class_lv_draw_mask_common_dsc_t, &be_lv_draw_mask_common_dsc_t);
static be_define_const_empty_class(be_class_lv_draw_mask_fade_param_cfg_t, &be_class_lv_ctypes, lv_draw_mask_fade_param_cfg_t);
ctypes_register_class(vm, &be_class_lv_draw_mask_fade_param_cfg_t, &be_lv_draw_mask_fade_param_cfg_t);
static be_define_const_empty_class(be_class_lv_draw_mask_fade_param_t, &be_class_lv_ctypes, lv_draw_mask_fade_param_t);
ctypes_register_class(vm, &be_class_lv_draw_mask_fade_param_t, &be_lv_draw_mask_fade_param_t);
static be_define_const_empty_class(be_class_lv_draw_mask_line_param_cfg_t, &be_class_lv_ctypes, lv_draw_mask_line_param_cfg_t);
ctypes_register_class(vm, &be_class_lv_draw_mask_line_param_cfg_t, &be_lv_draw_mask_line_param_cfg_t);
static be_define_const_empty_class(be_class_lv_draw_mask_line_param_t, &be_class_lv_ctypes, lv_draw_mask_line_param_t);
ctypes_register_class(vm, &be_class_lv_draw_mask_line_param_t, &be_lv_draw_mask_line_param_t);
static be_define_const_empty_class(be_class_lv_draw_mask_map_param_cfg_t, &be_class_lv_ctypes, lv_draw_mask_map_param_cfg_t);
ctypes_register_class(vm, &be_class_lv_draw_mask_map_param_cfg_t, &be_lv_draw_mask_map_param_cfg_t);
static be_define_const_empty_class(be_class_lv_draw_mask_map_param_t, &be_class_lv_ctypes, lv_draw_mask_map_param_t);
ctypes_register_class(vm, &be_class_lv_draw_mask_map_param_t, &be_lv_draw_mask_map_param_t);
static be_define_const_empty_class(be_class_lv_draw_mask_radius_param_cfg_t, &be_class_lv_ctypes, lv_draw_mask_radius_param_cfg_t);
ctypes_register_class(vm, &be_class_lv_draw_mask_radius_param_cfg_t, &be_lv_draw_mask_radius_param_cfg_t);
static be_define_const_empty_class(be_class_lv_draw_mask_radius_param_t, &be_class_lv_ctypes, lv_draw_mask_radius_param_t);
ctypes_register_class(vm, &be_class_lv_draw_mask_radius_param_t, &be_lv_draw_mask_radius_param_t);
static be_define_const_empty_class(be_class_lv_draw_mask_saved_t, &be_class_lv_ctypes, lv_draw_mask_saved_t);
ctypes_register_class(vm, &be_class_lv_draw_mask_saved_t, &be_lv_draw_mask_saved_t);
static be_define_const_empty_class(be_class_lv_draw_rect_dsc_t, &be_class_lv_ctypes, lv_draw_rect_dsc_t);
ctypes_register_class(vm, &be_class_lv_draw_rect_dsc_t, &be_lv_draw_rect_dsc_t);
static be_define_const_empty_class(be_class_lv_point_t, &be_class_lv_ctypes, lv_point_t);
ctypes_register_class(vm, &be_class_lv_point_t, &be_lv_point_t);
static be_define_const_empty_class(be_class_lv_sqrt_res_t, &be_class_lv_ctypes, lv_sqrt_res_t);
ctypes_register_class(vm, &be_class_lv_sqrt_res_t, &be_lv_sqrt_res_t);
static be_define_const_empty_class(be_class_lv_area, &be_class_lv_ctypes, lv_area);
ctypes_register_class(vm, &be_class_lv_area, &be_lv_area);
static be_define_const_empty_class(be_class_lv_draw_img_dsc, &be_class_lv_ctypes, lv_draw_img_dsc);
ctypes_register_class(vm, &be_class_lv_draw_img_dsc, &be_lv_draw_img_dsc);
static be_define_const_empty_class(be_class_lv_draw_label_dsc, &be_class_lv_ctypes, lv_draw_label_dsc);
ctypes_register_class(vm, &be_class_lv_draw_label_dsc, &be_lv_draw_label_dsc);
static be_define_const_empty_class(be_class_lv_draw_line_dsc, &be_class_lv_ctypes, lv_draw_line_dsc);
ctypes_register_class(vm, &be_class_lv_draw_line_dsc, &be_lv_draw_line_dsc);
static be_define_const_empty_class(be_class_lv_draw_mask_angle_param, &be_class_lv_ctypes, lv_draw_mask_angle_param);
ctypes_register_class(vm, &be_class_lv_draw_mask_angle_param, &be_lv_draw_mask_angle_param);
static be_define_const_empty_class(be_class_lv_draw_mask_angle_param_cfg, &be_class_lv_ctypes, lv_draw_mask_angle_param_cfg);
ctypes_register_class(vm, &be_class_lv_draw_mask_angle_param_cfg, &be_lv_draw_mask_angle_param_cfg);
static be_define_const_empty_class(be_class_lv_draw_mask_common_dsc, &be_class_lv_ctypes, lv_draw_mask_common_dsc);
ctypes_register_class(vm, &be_class_lv_draw_mask_common_dsc, &be_lv_draw_mask_common_dsc);
static be_define_const_empty_class(be_class_lv_draw_mask_fade_param, &be_class_lv_ctypes, lv_draw_mask_fade_param);
ctypes_register_class(vm, &be_class_lv_draw_mask_fade_param, &be_lv_draw_mask_fade_param);
static be_define_const_empty_class(be_class_lv_draw_mask_fade_param_cfg, &be_class_lv_ctypes, lv_draw_mask_fade_param_cfg);
ctypes_register_class(vm, &be_class_lv_draw_mask_fade_param_cfg, &be_lv_draw_mask_fade_param_cfg);
static be_define_const_empty_class(be_class_lv_draw_mask_line_param, &be_class_lv_ctypes, lv_draw_mask_line_param);
ctypes_register_class(vm, &be_class_lv_draw_mask_line_param, &be_lv_draw_mask_line_param);
static be_define_const_empty_class(be_class_lv_draw_mask_line_param_cfg, &be_class_lv_ctypes, lv_draw_mask_line_param_cfg);
ctypes_register_class(vm, &be_class_lv_draw_mask_line_param_cfg, &be_lv_draw_mask_line_param_cfg);
static be_define_const_empty_class(be_class_lv_draw_mask_map_param, &be_class_lv_ctypes, lv_draw_mask_map_param);
ctypes_register_class(vm, &be_class_lv_draw_mask_map_param, &be_lv_draw_mask_map_param);
static be_define_const_empty_class(be_class_lv_draw_mask_map_param_cfg, &be_class_lv_ctypes, lv_draw_mask_map_param_cfg);
ctypes_register_class(vm, &be_class_lv_draw_mask_map_param_cfg, &be_lv_draw_mask_map_param_cfg);
static be_define_const_empty_class(be_class_lv_draw_mask_radius_param, &be_class_lv_ctypes, lv_draw_mask_radius_param);
ctypes_register_class(vm, &be_class_lv_draw_mask_radius_param, &be_lv_draw_mask_radius_param);
static be_define_const_empty_class(be_class_lv_draw_mask_radius_param_cfg, &be_class_lv_ctypes, lv_draw_mask_radius_param_cfg);
ctypes_register_class(vm, &be_class_lv_draw_mask_radius_param_cfg, &be_lv_draw_mask_radius_param_cfg);
static be_define_const_empty_class(be_class_lv_draw_mask_saved, &be_class_lv_ctypes, lv_draw_mask_saved);
ctypes_register_class(vm, &be_class_lv_draw_mask_saved, &be_lv_draw_mask_saved);
static be_define_const_empty_class(be_class_lv_draw_rect_dsc, &be_class_lv_ctypes, lv_draw_rect_dsc);
ctypes_register_class(vm, &be_class_lv_draw_rect_dsc, &be_lv_draw_rect_dsc);
static be_define_const_empty_class(be_class_lv_point, &be_class_lv_ctypes, lv_point);
ctypes_register_class(vm, &be_class_lv_point, &be_lv_point);
static be_define_const_empty_class(be_class_lv_sqrt_res, &be_class_lv_ctypes, lv_sqrt_res);
ctypes_register_class(vm, &be_class_lv_sqrt_res, &be_lv_sqrt_res);
}
/*******************************************************************/

View File

@ -47,6 +47,16 @@ extern int lvbe_img_get_angle(bvm *vm);
extern int lvbe_img_get_pivot(bvm *vm);
extern int lvbe_img_get_zoom(bvm *vm);
extern int lvbe_img_get_antialias(bvm *vm);
extern int lvbe_img_cf_get_px_size(bvm *vm);
extern int lvbe_img_cf_is_chroma_keyed(bvm *vm);
extern int lvbe_img_cf_has_alpha(bvm *vm);
extern int lvbe_img_buf_get_px_color(bvm *vm);
extern int lvbe_img_buf_get_px_alpha(bvm *vm);
extern int lvbe_img_buf_set_px_color(bvm *vm);
extern int lvbe_img_buf_set_px_alpha(bvm *vm);
extern int lvbe_img_buf_set_palette(bvm *vm);
extern int lvbe_img_buf_free(bvm *vm);
extern int lvbe_img_buf_get_img_size(bvm *vm);
/* `lv_style` external functions definitions */
extern int lvbe_style_copy(bvm *vm);
@ -167,6 +177,7 @@ extern int lvbe_group_set_editing(bvm *vm);
extern int lvbe_group_set_click_focus(bvm *vm);
extern int lvbe_group_set_wrap(bvm *vm);
extern int lvbe_group_get_focused(bvm *vm);
extern int lvbe_group_get_focus_cb(bvm *vm);
extern int lvbe_group_get_editing(bvm *vm);
extern int lvbe_group_get_click_focus(bvm *vm);
extern int lvbe_group_get_wrap(bvm *vm);
@ -280,6 +291,9 @@ extern int lvbe_obj_get_base_dir(bvm *vm);
extern int lvbe_obj_get_protect(bvm *vm);
extern int lvbe_obj_is_protected(bvm *vm);
extern int lvbe_obj_get_state(bvm *vm);
extern int lvbe_obj_get_signal_cb(bvm *vm);
extern int lvbe_obj_get_design_cb(bvm *vm);
extern int lvbe_obj_get_event_cb(bvm *vm);
extern int lvbe_obj_is_point_on_coords(bvm *vm);
extern int lvbe_obj_hittest(bvm *vm);
extern int lvbe_obj_get_ext_attr(bvm *vm);
@ -479,6 +493,7 @@ extern int lvbe_obj_get_style_scale_grad_color(bvm *vm);
extern int lvbe_obj_set_style_local_scale_grad_color(bvm *vm);
extern int lvbe_obj_get_style_scale_end_color(bvm *vm);
extern int lvbe_obj_set_style_local_scale_end_color(bvm *vm);
extern int lvbe_obj_signal_send(bvm *vm);
/* `lv_arc` external functions definitions */
extern int lvbe_arc_create(bvm *vm);
@ -1159,11 +1174,6 @@ void be_load_lv_style_lib(bvm *vm) {
{ NULL, NULL }
};
be_regclass(vm, "lv_style", members);
be_getglobal(vm, "lv_style");
be_getglobal(vm, "lv_obj");
be_setsuper(vm, -2);
be_pop(vm, 2);
#else
be_pushntvclass(vm, &be_class_lv_style);
be_setglobal(vm, "lv_style");
@ -1172,7 +1182,7 @@ void be_load_lv_style_lib(bvm *vm) {
};
/* @const_object_info_begin
class be_class_lv_style (scope: global, name: lv_style, super: be_class_lv_obj) {
class be_class_lv_style (scope: global, name: lv_style) {
.p, var
init, func(lvs_init)
tostring, func(lvs_tostring)
@ -1226,11 +1236,6 @@ void be_load_lv_indev_lib(bvm *vm) {
{ NULL, NULL }
};
be_regclass(vm, "lv_indev", members);
be_getglobal(vm, "lv_indev");
be_getglobal(vm, "lv_obj");
be_setsuper(vm, -2);
be_pop(vm, 2);
#else
be_pushntvclass(vm, &be_class_lv_indev);
be_setglobal(vm, "lv_indev");
@ -1239,7 +1244,7 @@ void be_load_lv_indev_lib(bvm *vm) {
};
/* @const_object_info_begin
class be_class_lv_indev (scope: global, name: lv_indev, super: be_class_lv_obj) {
class be_class_lv_indev (scope: global, name: lv_indev) {
.p, var
init, func(lv0_init)
tostring, func(lvx_tostring)

View File

@ -102,6 +102,8 @@ extern void be_load_md5_lib(bvm *vm);
extern void be_load_lvgl_color_lib(bvm *vm);
extern void be_load_lvgl_font_lib(bvm *vm);
extern void be_load_lv_all_lib(bvm *vm);
extern void be_load_lvgl_cb_lib(bvm *vm);
extern void be_load_lvgl_cb_all_lib(bvm *vm);
extern void be_load_lvgl_ctypes_lib(bvm *vm);
extern void be_load_ctypes_definitions_lib(bvm *vm);
#endif// USE_LVGL
@ -128,6 +130,8 @@ BERRY_API void be_load_custom_libs(bvm *vm)
be_load_lvgl_font_lib(vm);
be_load_lv_all_lib(vm);
be_load_lvgl_cb_lib(vm);
be_load_lvgl_cb_all_lib(vm);
be_load_lvgl_ctypes_lib(vm);
be_load_ctypes_definitions_lib(vm);
#endif // USE_LVGL

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,25 +1,25 @@
#include "be_constobj.h"
static be_define_const_map_slots(be_class_ctypes_classes_map) {
{ be_const_key(lv_draw_mask_line_param_cfg_t, 1), be_const_int(0) },
{ be_const_key(lv_draw_mask_radius_param_t, 8), be_const_int(0) },
{ be_const_key(lv_draw_mask_radius_param_cfg_t, 12), be_const_int(0) },
{ be_const_key(lv_draw_mask_saved_t, -1), be_const_int(0) },
{ be_const_key(lv_draw_mask_line_param_t, 9), be_const_int(0) },
{ be_const_key(lv_area_t, -1), be_const_int(0) },
{ be_const_key(lv_draw_mask_map_param_cfg_t, -1), be_const_int(0) },
{ be_const_key(lv_draw_mask_map_param_t, -1), be_const_int(0) },
{ be_const_key(lv_draw_line_dsc_t, -1), be_const_int(0) },
{ be_const_key(lv_draw_label_dsc_t, -1), be_const_int(0) },
{ be_const_key(lv_draw_mask_common_dsc_t, 2), be_const_int(0) },
{ be_const_key(lv_draw_rect_dsc_t, -1), be_const_int(0) },
{ be_const_key(lv_draw_mask_fade_param_cfg_t, -1), be_const_int(0) },
{ be_const_key(lv_sqrt_res_t, 7), be_const_int(0) },
{ be_const_key(lv_point_t, -1), be_const_int(0) },
{ be_const_key(lv_draw_mask_angle_param_cfg_t, -1), be_const_int(0) },
{ be_const_key(lv_draw_mask_fade_param_t, -1), be_const_int(0) },
{ be_const_key(lv_draw_mask_angle_param_t, 15), be_const_int(0) },
{ be_const_key(lv_draw_img_dsc_t, -1), be_const_int(0) },
{ be_const_key(lv_draw_mask_radius_param_cfg, -1), be_const_int(0) },
{ be_const_key(lv_draw_img_dsc, 14), be_const_int(0) },
{ be_const_key(lv_draw_mask_radius_param, -1), be_const_int(0) },
{ be_const_key(lv_point, 4), be_const_int(0) },
{ be_const_key(lv_draw_mask_fade_param_cfg, 5), be_const_int(0) },
{ be_const_key(lv_draw_mask_map_param, -1), be_const_int(0) },
{ be_const_key(lv_draw_label_dsc, -1), be_const_int(0) },
{ be_const_key(lv_area, 17), be_const_int(0) },
{ be_const_key(lv_draw_mask_angle_param_cfg, 3), be_const_int(0) },
{ be_const_key(lv_draw_mask_line_param_cfg, -1), be_const_int(0) },
{ be_const_key(lv_draw_mask_saved, 12), be_const_int(0) },
{ be_const_key(lv_draw_mask_map_param_cfg, -1), be_const_int(0) },
{ be_const_key(lv_draw_rect_dsc, -1), be_const_int(0) },
{ be_const_key(lv_draw_mask_angle_param, -1), be_const_int(0) },
{ be_const_key(lv_draw_line_dsc, 15), be_const_int(0) },
{ be_const_key(lv_draw_mask_common_dsc, -1), be_const_int(0) },
{ be_const_key(lv_draw_mask_line_param, -1), be_const_int(0) },
{ be_const_key(lv_sqrt_res, -1), be_const_int(0) },
{ be_const_key(lv_draw_mask_fade_param, 13), be_const_int(0) },
};
static be_define_const_map(

View File

@ -0,0 +1,20 @@
#include "be_constobj.h"
static be_define_const_map_slots(be_class_lv_draw_line_map) {
{ be_const_key(init, 2), be_const_func(lvbe_draw_line_create) },
{ be_const_key(tostring, -1), be_const_func(lvx_tostring) },
{ be_const_key(dot_p, -1), be_const_int(0) },
{ be_const_key(member, 0), be_const_func(lvx_member) },
};
static be_define_const_map(
be_class_lv_draw_line_map,
4
);
BE_EXPORT_VARIABLE be_define_const_class(
be_class_lv_draw_line,
1,
NULL,
lv_draw_line
);

View File

@ -15,6 +15,6 @@ static be_define_const_map(
BE_EXPORT_VARIABLE be_define_const_class(
be_class_lv_indev,
1,
(bclass *)&be_class_lv_obj,
NULL,
lv_indev
);

View File

@ -15,6 +15,6 @@ static be_define_const_map(
BE_EXPORT_VARIABLE be_define_const_class(
be_class_lv_style,
1,
(bclass *)&be_class_lv_obj,
NULL,
lv_style
);

View File

@ -0,0 +1,17 @@
#include "be_constobj.h"
static be_define_const_map_slots(be_lv_design_cb_map) {
{ be_const_key(call, -1), be_const_func(lv_design_cb_call) },
};
static be_define_const_map(
be_lv_design_cb_map,
1
);
BE_EXPORT_VARIABLE be_define_const_class(
be_lv_design_cb,
0,
(bclass *)&be_lvgl_cb,
lv_design_cb
);

View File

@ -0,0 +1,17 @@
#include "be_constobj.h"
static be_define_const_map_slots(be_lv_event_cb_map) {
{ be_const_key(call, -1), be_const_func(lv_event_cb_call) },
};
static be_define_const_map(
be_lv_event_cb_map,
1
);
BE_EXPORT_VARIABLE be_define_const_class(
be_lv_event_cb,
0,
(bclass *)&be_lvgl_cb,
lv_event_cb
);

View File

@ -0,0 +1,17 @@
#include "be_constobj.h"
static be_define_const_map_slots(be_lv_gauge_format_cb_map) {
{ be_const_key(call, -1), be_const_func(lv_gauge_format_cb_call) },
};
static be_define_const_map(
be_lv_gauge_format_cb_map,
1
);
BE_EXPORT_VARIABLE be_define_const_class(
be_lv_gauge_format_cb,
0,
(bclass *)&be_lvgl_cb,
lv_gauge_format_cb
);

View File

@ -0,0 +1,17 @@
#include "be_constobj.h"
static be_define_const_map_slots(be_lv_group_focus_cb_map) {
{ be_const_key(call, -1), be_const_func(lv_group_focus_cb_call) },
};
static be_define_const_map(
be_lv_group_focus_cb_map,
1
);
BE_EXPORT_VARIABLE be_define_const_class(
be_lv_group_focus_cb,
0,
(bclass *)&be_lvgl_cb,
lv_group_focus_cb
);

View File

@ -0,0 +1,17 @@
#include "be_constobj.h"
static be_define_const_map_slots(be_lv_signal_cb_map) {
{ be_const_key(call, -1), be_const_func(lv_signal_cb_call) },
};
static be_define_const_map(
be_lv_signal_cb_map,
1
);
BE_EXPORT_VARIABLE be_define_const_class(
be_lv_signal_cb,
0,
(bclass *)&be_lvgl_cb,
lv_signal_cb
);

View File

@ -0,0 +1,20 @@
#include "be_constobj.h"
static be_define_const_map_slots(be_lvgl_cb_map) {
{ be_const_key(dot_p, -1), be_const_int(0) },
{ be_const_key(tostring, 2), be_const_func(lvx_tostring) },
{ be_const_key(call, -1), be_const_func(lv_cb_call) },
{ be_const_key(init, 0), be_const_func(lv0_init) },
};
static be_define_const_map(
be_lvgl_cb_map,
4
);
BE_EXPORT_VARIABLE be_define_const_class(
be_lvgl_cb,
1,
NULL,
lv_cb
);

View File

@ -10,17 +10,17 @@ import ctypes
ctypes.print_types()
lv_style_int_t = ctypes.i16
lv_color_t = ctypes.u16 # depends on colors
lv_grad_dir_t = ctypes.u8
lv_opa_t = ctypes.u8
lv_blend_mode_t = ctypes.u8
lv_align_t = ctypes.u8
lv_coord_t = ctypes.i16
lv_bidi_dir_t = ctypes.u8
lv_txt_flag_t = ctypes.u8
lv_text_decor_t = ctypes.u8
lv_font_t = ctypes.u32
lv_style_int = ctypes.i16
lv_color = ctypes.u16 # depends on colors
lv_grad_dir = ctypes.u8
lv_opa = ctypes.u8
lv_blend_mode = ctypes.u8
lv_align = ctypes.u8
lv_coord = ctypes.i16
lv_bidi_dir = ctypes.u8
lv_txt_flag = ctypes.u8
lv_text_decor = ctypes.u8
lv_font = ctypes.u32
uint8_t_1 = ctypes.bf_1
uint8_t_2 = ctypes.bf_2
uint8_t = ctypes.u8
@ -29,158 +29,158 @@ uint32_t = ctypes.u32
int32_t = ctypes.i32
ptr = ctypes.u32
lv_point_t = [
[lv_coord_t, "x"],
[lv_coord_t, "y"],
lv_point = [
[lv_coord, "x"],
[lv_coord, "y"],
]
lv_point_t = ctypes.structure(lv_point_t, "lv_point_t")
lv_point = ctypes.structure(lv_point, "lv_point")
lv_area_t = [
[lv_coord_t, "x1"],
[lv_coord_t, "y1"],
[lv_coord_t, "x2"],
[lv_coord_t, "y2"],
lv_area = [
[lv_coord, "x1"],
[lv_coord, "y1"],
[lv_coord, "x2"],
[lv_coord, "y2"],
]
lv_area_t = ctypes.structure(lv_area_t, "lv_area_t")
lv_area = ctypes.structure(lv_area, "lv_area")
# test_t = [
# [lv_area_t, "a"],
# [lv_area_t, "b"]
# [lv_area, "a"],
# [lv_area, "b"]
# ]
# test_t = ctypes.structure(test_t, "test_t")
lv_draw_rect_dsc_t = [
[lv_style_int_t, "radius"],
lv_draw_rect_dsc = [
[lv_style_int, "radius"],
#/*Background*/
[lv_color_t, "bg_color"],
[lv_color_t, "bg_grad_color"],
[lv_grad_dir_t, "bg_grad_dir"],
[lv_style_int_t, "bg_main_color_stop"],
[lv_style_int_t, "bg_grad_color_stop"],
[lv_opa_t, "bg_opa"],
[lv_blend_mode_t, "bg_blend_mode"],
[lv_color, "bg_color"],
[lv_color, "bg_grad_color"],
[lv_grad_dir, "bg_grad_dir"],
[lv_style_int, "bg_main_color_stop"],
[lv_style_int, "bg_grad_color_stop"],
[lv_opa, "bg_opa"],
[lv_blend_mode, "bg_blend_mode"],
#/*Border*/
[lv_color_t, "border_color"],
[lv_style_int_t, "border_width"],
[lv_style_int_t, "border_side"],
[lv_opa_t, "border_opa"],
[lv_blend_mode_t, "border_blend_mode"],
[lv_color, "border_color"],
[lv_style_int, "border_width"],
[lv_style_int, "border_side"],
[lv_opa, "border_opa"],
[lv_blend_mode, "border_blend_mode"],
[uint8_t_1, "border_post"],
#/*Outline*/
[lv_color_t, "outline_color"],
[lv_style_int_t, "outline_width"],
[lv_style_int_t, "outline_pad"],
[lv_opa_t, "outline_opa"],
[lv_blend_mode_t, "outline_blend_mode"],
[lv_color, "outline_color"],
[lv_style_int, "outline_width"],
[lv_style_int, "outline_pad"],
[lv_opa, "outline_opa"],
[lv_blend_mode, "outline_blend_mode"],
#/*Shadow*/
[lv_color_t, "shadow_color"],
[lv_style_int_t, "shadow_width"],
[lv_style_int_t, "shadow_ofs_x"],
[lv_style_int_t, "shadow_ofs_y"],
[lv_style_int_t, "shadow_spread"],
[lv_opa_t, "shadow_opa"],
[lv_blend_mode_t, "shadow_blend_mode"],
[lv_color, "shadow_color"],
[lv_style_int, "shadow_width"],
[lv_style_int, "shadow_ofs_x"],
[lv_style_int, "shadow_ofs_y"],
[lv_style_int, "shadow_spread"],
[lv_opa, "shadow_opa"],
[lv_blend_mode, "shadow_blend_mode"],
#/*Pattern*/
[ptr, "pattern_image"],
[ptr, "pattern_font"],
[lv_color_t, "pattern_recolor"],
[lv_opa_t, "pattern_opa"],
[lv_opa_t, "pattern_recolor_opa"],
[lv_color, "pattern_recolor"],
[lv_opa, "pattern_opa"],
[lv_opa, "pattern_recolor_opa"],
[uint8_t_1, "pattern_repeat"],
[lv_blend_mode_t, "pattern_blend_mode"],
[lv_blend_mode, "pattern_blend_mode"],
#/*Value*/
[ptr, "value_str"],
[ptr, "value_font"],
[lv_opa_t, "value_opa"],
[lv_color_t, "value_color"],
[lv_style_int_t, "value_ofs_x"],
[lv_style_int_t, "value_ofs_y"],
[lv_style_int_t, "value_letter_space"],
[lv_style_int_t, "value_line_space"],
[lv_align_t, "value_align"],
[lv_blend_mode_t, "value_blend_mode"],
[lv_opa, "value_opa"],
[lv_color, "value_color"],
[lv_style_int, "value_ofs_x"],
[lv_style_int, "value_ofs_y"],
[lv_style_int, "value_letter_space"],
[lv_style_int, "value_line_space"],
[lv_align, "value_align"],
[lv_blend_mode, "value_blend_mode"],
]
lv_draw_rect_dsc_t = ctypes.structure(lv_draw_rect_dsc_t, "lv_draw_rect_dsc_t")
lv_draw_rect_dsc = ctypes.structure(lv_draw_rect_dsc, "lv_draw_rect_dsc")
lv_draw_line_dsc_t = [
[lv_color_t, "color"],
[lv_style_int_t, "width"],
[lv_style_int_t, "dash_width"],
[lv_style_int_t, "dash_gap"],
[lv_opa_t, "opa"],
lv_draw_line_dsc = [
[lv_color, "color"],
[lv_style_int, "width"],
[lv_style_int, "dash_width"],
[lv_style_int, "dash_gap"],
[lv_opa, "opa"],
[uint8_t_2, "blend_mode"],
[uint8_t_1, "round_start"],
[uint8_t_1, "round_end"],
[uint8_t_1, "raw_end"],
]
lv_draw_line_dsc_t = ctypes.structure(lv_draw_line_dsc_t, "lv_draw_line_dsc_t")
lv_draw_line_dsc = ctypes.structure(lv_draw_line_dsc, "lv_draw_line_dsc")
lv_draw_img_dsc_t = [
[lv_opa_t, "opa"],
lv_draw_img_dsc = [
[lv_opa, "opa"],
[uint16_t, "angle"],
[lv_point_t, "pivot"],
[lv_point, "pivot"],
[uint16_t, "zoom"],
[lv_opa_t, "recolor_opa"],
[lv_color_t, "recolor"],
[lv_blend_mode_t, "blend_mode"],
[lv_opa, "recolor_opa"],
[lv_color, "recolor"],
[lv_blend_mode, "blend_mode"],
[uint8_t_1, "antialias"],
]
lv_draw_img_dsc_t = ctypes.structure(lv_draw_img_dsc_t, "lv_draw_img_dsc_t")
lv_draw_img_dsc = ctypes.structure(lv_draw_img_dsc, "lv_draw_img_dsc")
lv_draw_label_dsc_t = [
[lv_color_t, "color"],
[lv_color_t, "sel_color"],
[lv_color_t, "sel_bg_color"],
[lv_font_t, "font"],
[lv_opa_t, "opa"],
[lv_style_int_t, "line_space"],
[lv_style_int_t, "letter_space"],
lv_draw_label_dsc = [
[lv_color, "color"],
[lv_color, "sel_color"],
[lv_color, "sel_bg_color"],
[lv_font, "font"],
[lv_opa, "opa"],
[lv_style_int, "line_space"],
[lv_style_int, "letter_space"],
[uint32_t, "sel_start"],
[uint32_t, "sel_end"],
[lv_coord_t, "ofs_x"],
[lv_coord_t, "ofs_y"],
[lv_bidi_dir_t, "bidi_dir"],
[lv_txt_flag_t, "flag"],
[lv_text_decor_t, "decor"],
[lv_blend_mode_t, "blend_mode"],
[lv_coord, "ofs_x"],
[lv_coord, "ofs_y"],
[lv_bidi_dir, "bidi_dir"],
[lv_txt_flag, "flag"],
[lv_text_decor, "decor"],
[lv_blend_mode, "blend_mode"],
]
lv_draw_label_dsc_t = ctypes.structure(lv_draw_label_dsc_t, "lv_draw_label_dsc_t")
lv_draw_label_dsc = ctypes.structure(lv_draw_label_dsc, "lv_draw_label_dsc")
#- --------- lv_mask --------- -#
lv_draw_mask_xcb_t = ptr # callback
lv_draw_mask_type_t = ctypes.u8
lv_draw_mask_line_side_t = ctypes.u8
lv_draw_mask_xcb = ptr # callback
lv_draw_mask_type = ctypes.u8
lv_draw_mask_line_side = ctypes.u8
lv_draw_mask_common_dsc_t = [
[lv_draw_mask_xcb_t, "cb"],
[lv_draw_mask_type_t, "type"],
lv_draw_mask_common_dsc = [
[lv_draw_mask_xcb, "cb"],
[lv_draw_mask_type, "type"],
]
lv_draw_mask_common_dsc_t = ctypes.structure(lv_draw_mask_common_dsc_t, "lv_draw_mask_common_dsc_t")
lv_draw_mask_common_dsc = ctypes.structure(lv_draw_mask_common_dsc, "lv_draw_mask_common_dsc")
lv_draw_mask_line_param_cfg_t = [
lv_draw_mask_line_param_cfg = [
#/*First point */
[lv_point_t, "p1"],
[lv_point, "p1"],
#/*Second point*/
[lv_point_t, "p2"],
[lv_point, "p2"],
#/*Which side to keep?*/
[uint8_t_2, "side"],
]
lv_draw_mask_line_param_cfg_t = ctypes.structure(lv_draw_mask_line_param_cfg_t, "lv_draw_mask_line_param_cfg_t")
lv_draw_mask_line_param_cfg = ctypes.structure(lv_draw_mask_line_param_cfg, "lv_draw_mask_line_param_cfg")
lv_draw_mask_line_param_t = [
lv_draw_mask_line_param = [
#/*The first element must be the common descriptor*/
[lv_draw_mask_common_dsc_t, "dsc"],
[lv_draw_mask_line_param_cfg_t, "cfg"],
[lv_draw_mask_common_dsc, "dsc"],
[lv_draw_mask_line_param_cfg, "cfg"],
#/*A point of the line*/
[lv_point_t, "origo"],
[lv_point, "origo"],
#/* X / (1024*Y) steepness (X is 0..1023 range). What is the change of X in 1024 Y?*/
[int32_t, "xy_steep"],
#/* Y / (1024*X) steepness (Y is 0..1023 range). What is the change of Y in 1024 X?*/
@ -195,85 +195,85 @@ lv_draw_mask_line_param_t = [
# * It is used to select left/right/top/bottom*/
[uint8_t_1, "inv"],
]
lv_draw_mask_line_param_t = ctypes.structure(lv_draw_mask_line_param_t, "lv_draw_mask_line_param_t")
lv_draw_mask_line_param = ctypes.structure(lv_draw_mask_line_param, "lv_draw_mask_line_param")
lv_draw_mask_angle_param_cfg_t = [
[lv_point_t, "vertex_p"],
[lv_coord_t, "start_angle"],
[lv_coord_t, "end_angle"],
lv_draw_mask_angle_param_cfg = [
[lv_point, "vertex_p"],
[lv_coord, "start_angle"],
[lv_coord, "end_angle"],
]
lv_draw_mask_angle_param_cfg_t = ctypes.structure(lv_draw_mask_angle_param_cfg_t, "lv_draw_mask_angle_param_cfg_t")
lv_draw_mask_angle_param_cfg = ctypes.structure(lv_draw_mask_angle_param_cfg, "lv_draw_mask_angle_param_cfg")
lv_draw_mask_angle_param_t = [
lv_draw_mask_angle_param = [
#/*The first element must be the common descriptor*/
[lv_draw_mask_common_dsc_t, "dsc"],
[lv_draw_mask_angle_param_cfg_t, "cfg"],
[lv_draw_mask_common_dsc, "dsc"],
[lv_draw_mask_angle_param_cfg, "cfg"],
[lv_draw_mask_line_param_t, "start_line"],
[lv_draw_mask_line_param_t, "end_line"],
[lv_draw_mask_line_param, "start_line"],
[lv_draw_mask_line_param, "end_line"],
[uint16_t, "delta_deg"],
]
lv_draw_mask_angle_param_t = ctypes.structure(lv_draw_mask_angle_param_t, "lv_draw_mask_angle_param_t")
lv_draw_mask_angle_param = ctypes.structure(lv_draw_mask_angle_param, "lv_draw_mask_angle_param")
lv_draw_mask_radius_param_cfg_t = [
[lv_area_t, "rect"],
[lv_coord_t, "radius"],
lv_draw_mask_radius_param_cfg = [
[lv_area, "rect"],
[lv_coord, "radius"],
[uint8_t_1, "outer"],
]
lv_draw_mask_radius_param_cfg_t = ctypes.structure(lv_draw_mask_radius_param_cfg_t, "lv_draw_mask_radius_param_cfg_t")
lv_draw_mask_radius_param_cfg = ctypes.structure(lv_draw_mask_radius_param_cfg, "lv_draw_mask_radius_param_cfg")
lv_sqrt_res_t = [
lv_sqrt_res = [
[uint16_t, "i"],
[uint16_t, "f"],
]
lv_sqrt_res_t = ctypes.structure(lv_sqrt_res_t, "lv_sqrt_res_t")
lv_sqrt_res = ctypes.structure(lv_sqrt_res, "lv_sqrt_res")
lv_draw_mask_radius_param_t = [
lv_draw_mask_radius_param = [
#/*The first element must be the common descriptor*/
[lv_draw_mask_common_dsc_t, "dsc"],
[lv_draw_mask_radius_param_cfg_t, "cfg"],
[lv_draw_mask_common_dsc, "dsc"],
[lv_draw_mask_radius_param_cfg, "cfg"],
[int32_t, "y_prev"],
[lv_sqrt_res_t, "y_prev_x"],
[lv_sqrt_res, "y_prev_x"],
]
lv_draw_mask_radius_param_t = ctypes.structure(lv_draw_mask_radius_param_t, "lv_draw_mask_radius_param_t")
lv_draw_mask_radius_param = ctypes.structure(lv_draw_mask_radius_param, "lv_draw_mask_radius_param")
lv_draw_mask_fade_param_cfg_t = [
[lv_area_t, "coords"],
[lv_coord_t, "y_top"],
[lv_coord_t, "y_bottom"],
[lv_opa_t, "opa_top"],
[lv_opa_t, "opa_bottom"],
lv_draw_mask_fade_param_cfg = [
[lv_area, "coords"],
[lv_coord, "y_top"],
[lv_coord, "y_bottom"],
[lv_opa, "opa_top"],
[lv_opa, "opa_bottom"],
]
lv_draw_mask_fade_param_cfg_t = ctypes.structure(lv_draw_mask_fade_param_cfg_t, "lv_draw_mask_fade_param_cfg_t")
lv_draw_mask_fade_param_cfg = ctypes.structure(lv_draw_mask_fade_param_cfg, "lv_draw_mask_fade_param_cfg")
lv_draw_mask_fade_param_t = [
lv_draw_mask_fade_param = [
# /*The first element must be the common descriptor*/
[lv_draw_mask_common_dsc_t, "dsc"],
[lv_draw_mask_fade_param_cfg_t, "cfg"],
[lv_draw_mask_common_dsc, "dsc"],
[lv_draw_mask_fade_param_cfg, "cfg"],
]
lv_draw_mask_fade_param_t = ctypes.structure(lv_draw_mask_fade_param_t, "lv_draw_mask_fade_param_t")
lv_draw_mask_fade_param = ctypes.structure(lv_draw_mask_fade_param, "lv_draw_mask_fade_param")
lv_draw_mask_map_param_cfg_t = [
[lv_area_t, "coords"],
lv_draw_mask_map_param_cfg = [
[lv_area, "coords"],
[ptr, "map"],
]
lv_draw_mask_map_param_cfg_t = ctypes.structure(lv_draw_mask_map_param_cfg_t, "lv_draw_mask_map_param_cfg_t")
lv_draw_mask_map_param_cfg = ctypes.structure(lv_draw_mask_map_param_cfg, "lv_draw_mask_map_param_cfg")
lv_draw_mask_map_param_t = [
lv_draw_mask_map_param = [
#/*The first element must be the common descriptor*/
[lv_draw_mask_common_dsc_t, "dsc"],
[lv_draw_mask_map_param_cfg_t, "cfg"],
[lv_draw_mask_common_dsc, "dsc"],
[lv_draw_mask_map_param_cfg, "cfg"],
]
lv_draw_mask_map_param_t = ctypes.structure(lv_draw_mask_map_param_t, "lv_draw_mask_map_param_t")
lv_draw_mask_map_param = ctypes.structure(lv_draw_mask_map_param, "lv_draw_mask_map_param")
lv_draw_mask_saved_t = [
lv_draw_mask_saved = [
[ptr, "param"],
[ptr, "custom_id"],
]
lv_draw_mask_saved_t = ctypes.structure(lv_draw_mask_saved_t, "lv_draw_mask_saved_t")
lv_draw_mask_saved = ctypes.structure(lv_draw_mask_saved, "lv_draw_mask_saved")
#
ctypes.print_classes()
@ -286,7 +286,7 @@ ctypes.print_classes()
#- Ex
bb=ctypes.buffer(lv_draw_line_dsc_t)
bb=ctypes.buffer(lv_draw_line_dsc)
bb.color
bb.blend_mode
@ -302,12 +302,12 @@ bb.raw_end = 1
bb.blend_mode=0
- bytes('FFFF0000000000000010')
lv_draw_line_dsc_t = [
[lv_color_t, "color"],
[lv_style_int_t, "width"],
[lv_style_int_t, "dash_width"],
[lv_style_int_t, "dash_gap"],
[lv_opa_t, "opa"],
lv_draw_line_dsc = [
[lv_color, "color"],
[lv_style_int, "width"],
[lv_style_int, "dash_width"],
[lv_style_int, "dash_gap"],
[lv_opa, "opa"],
[uint8_t_2, "blend_mode"],
[uint8_t_1, "round_start"],
[uint8_t_1, "round_end"],

View File

@ -12,6 +12,16 @@ extern "C" {
/* `lv_img` methods */
#if BE_LV_WIDGET_IMG
const lvbe_call_c_t lv_img_func[] = {
{ "buf_free", (void*) &lv_img_buf_free, "", "(lv_img_dsc)" },
{ "buf_get_img_size", (void*) &lv_img_buf_get_img_size, "i", "ii(lv_img_cf)" },
{ "buf_get_px_alpha", (void*) &lv_img_buf_get_px_alpha, "i", "(lv_img_dsc)ii" },
{ "buf_get_px_color", (void*) &lv_img_buf_get_px_color, "lv_color", "(lv_img_dsc)ii(lv_color)" },
{ "buf_set_palette", (void*) &lv_img_buf_set_palette, "", "(lv_img_dsc)i(lv_color)" },
{ "buf_set_px_alpha", (void*) &lv_img_buf_set_px_alpha, "", "(lv_img_dsc)iii" },
{ "buf_set_px_color", (void*) &lv_img_buf_set_px_color, "", "(lv_img_dsc)ii(lv_color)" },
{ "cf_get_px_size", (void*) &lv_img_cf_get_px_size, "i", "(lv_img_cf)" },
{ "cf_has_alpha", (void*) &lv_img_cf_has_alpha, "b", "(lv_img_cf)" },
{ "cf_is_chroma_keyed", (void*) &lv_img_cf_is_chroma_keyed, "b", "(lv_img_cf)" },
{ "create", (void*) &lv_img_create, "+lv_img", "(lv_obj)(lv_obj)" },
{ "get_angle", (void*) &lv_img_get_angle, "i", "(lv_obj)" },
{ "get_antialias", (void*) &lv_img_get_antialias, "b", "(lv_obj)" },
@ -149,6 +159,7 @@ const lvbe_call_c_t lv_group_func[] = {
{ "focus_prev", (void*) &lv_group_focus_prev, "", "(lv_group)" },
{ "get_click_focus", (void*) &lv_group_get_click_focus, "b", "(lv_group)" },
{ "get_editing", (void*) &lv_group_get_editing, "b", "(lv_group)" },
{ "get_focus_cb", (void*) &lv_group_get_focus_cb, "lv_group_focus_cb", "(lv_group)" },
{ "get_focused", (void*) &lv_group_get_focused, "lv_obj", "(lv_group)" },
{ "get_wrap", (void*) &lv_group_get_wrap, "b", "(lv_group)" },
{ "remove_all_objs", (void*) &lv_group_remove_all_objs, "", "(lv_group)" },
@ -203,11 +214,13 @@ const lvbe_call_c_t lv_obj_func[] = {
{ "get_child_back", (void*) &lv_obj_get_child_back, "lv_obj", "(lv_obj)(lv_obj)" },
{ "get_click", (void*) &lv_obj_get_click, "b", "(lv_obj)" },
{ "get_coords", (void*) &lv_obj_get_coords, "", "(lv_obj)(lv_area)" },
{ "get_design_cb", (void*) &lv_obj_get_design_cb, "lv_design_cb", "(lv_obj)" },
{ "get_drag", (void*) &lv_obj_get_drag, "b", "(lv_obj)" },
{ "get_drag_dir", (void*) &lv_obj_get_drag_dir, "i", "(lv_obj)" },
{ "get_drag_parent", (void*) &lv_obj_get_drag_parent, "b", "(lv_obj)" },
{ "get_drag_throw", (void*) &lv_obj_get_drag_throw, "b", "(lv_obj)" },
{ "get_draw_rect_ext_pad_size", (void*) &lv_obj_get_draw_rect_ext_pad_size, "i", "(lv_obj)i" },
{ "get_event_cb", (void*) &lv_obj_get_event_cb, "lv_event_cb", "(lv_obj)" },
{ "get_ext_attr", (void*) &lv_obj_get_ext_attr, ".", "(lv_obj)" },
{ "get_ext_click_pad_bottom", (void*) &lv_obj_get_ext_click_pad_bottom, "i", "(lv_obj)" },
{ "get_ext_click_pad_left", (void*) &lv_obj_get_ext_click_pad_left, "i", "(lv_obj)" },
@ -229,6 +242,7 @@ const lvbe_call_c_t lv_obj_func[] = {
{ "get_parent_event", (void*) &lv_obj_get_parent_event, "b", "(lv_obj)" },
{ "get_protect", (void*) &lv_obj_get_protect, "i", "(lv_obj)" },
{ "get_screen", (void*) &lv_obj_get_screen, "lv_obj", "(lv_obj)" },
{ "get_signal_cb", (void*) &lv_obj_get_signal_cb, "lv_signal_cb", "(lv_obj)" },
{ "get_state", (void*) &lv_obj_get_state, "i", "(lv_obj)i" },
{ "get_style_bg_blend_mode", (void*) &lv_obj_get_style_bg_blend_mode, "i", "(lv_obj)i" },
{ "get_style_bg_color", (void*) &lv_obj_get_style_bg_color, "lv_color", "(lv_obj)i" },
@ -472,6 +486,7 @@ const lvbe_call_c_t lv_obj_func[] = {
{ "set_width_margin", (void*) &lv_obj_set_width_margin, "", "(lv_obj)i" },
{ "set_x", (void*) &lv_obj_set_x, "", "(lv_obj)i" },
{ "set_y", (void*) &lv_obj_set_y, "", "(lv_obj)i" },
{ "signal_send", (void*) &lv_obj_signal_send, "i", "(lv_obj)i." },
};
/* `lv_arc` methods */
@ -772,7 +787,7 @@ const lvbe_call_c_t lv_imgbtn_func[] = {
#if BE_LV_WIDGET_KEYBOARD
const lvbe_call_c_t lv_keyboard_func[] = {
{ "create", (void*) &lv_keyboard_create, "+lv_keyboard", "(lv_obj)(lv_obj)" },
{ "def_event_cb", (void*) &lv_keyboard_def_event_cb, "", "(lv_obj)(lv_event)" },
{ "def_event_cb", (void*) &lv_keyboard_def_event_cb, "", "(lv_obj)i" },
{ "get_cursor_manage", (void*) &lv_keyboard_get_cursor_manage, "b", "(lv_obj)" },
{ "get_mode", (void*) &lv_keyboard_get_mode, "i", "(lv_obj)" },
{ "get_textarea", (void*) &lv_keyboard_get_textarea, "lv_obj", "(lv_obj)" },
@ -1159,7 +1174,7 @@ const lvbe_call_c_t lv_win_func[] = {
{ "add_btn_left", (void*) &lv_win_add_btn_left, "lv_obj", "(lv_obj)." },
{ "add_btn_right", (void*) &lv_win_add_btn_right, "lv_obj", "(lv_obj)." },
{ "clean", (void*) &lv_win_clean, "", "(lv_obj)" },
{ "close_event_cb", (void*) &lv_win_close_event_cb, "", "(lv_obj)(lv_event)" },
{ "close_event_cb", (void*) &lv_win_close_event_cb, "", "(lv_obj)i" },
{ "create", (void*) &lv_win_create, "+lv_win", "(lv_obj)(lv_obj)" },
{ "focus", (void*) &lv_win_focus, "", "(lv_obj)(lv_obj)(lv_anim_enable)" },
{ "get_anim_time", (void*) &lv_win_get_anim_time, "i", "(lv_obj)" },

View File

@ -314,11 +314,10 @@ extern "C" {
* Optional argument:
* - return_type: the C function return value is int32_t and is converted to the
* relevant Berry object depending on this char:
* '0' (default): nil, no value
* '' (default): nil, no value
* 'i' be_int
* 'b' be_boot
* 's' be_str
* 'o' instance of `lv_obj` (needs to be improved)
*
* - arg_type: optionally check the types of input arguments, or throw an error
* string of argument types, '+' marks optional arguments
@ -326,6 +325,7 @@ extern "C" {
* 'i' be_int
* 'b' be_bool
* 's' be_string
* 'c' C callback
* 'lv_obj' be_instance of type or subtype
* '0'..'5' callback
*
@ -394,6 +394,8 @@ int32_t be_convert_single_elt(bvm *vm, int32_t idx, const char * arg_type = null
int32_t ret = 0;
char provided_type = 0;
idx = be_absindex(vm, idx); // make sure we have an absolute index
// berry_log_C(">> 0 idx=%i arg_type=%s", idx, arg_type ? arg_type : "NULL");
if (arg_type == nullptr) { arg_type = "."; } // if no type provided, replace with wildchar
size_t arg_type_len = strlen(arg_type);
@ -453,7 +455,7 @@ int32_t be_convert_single_elt(bvm *vm, int32_t idx, const char * arg_type = null
if (be_isint(vm, idx)) { ret = be_toint(vm, idx); provided_type = 'i'; }
else if (be_isbool(vm, idx)) { ret = be_tobool(vm, idx); provided_type = 'b'; }
else if (be_isstring(vm, idx)) { ret = (int32_t) be_tostring(vm, idx); provided_type = 's'; }
else if (be_iscomptr(vm, idx)) { ret = (int32_t) be_tocomptr(vm, idx); provided_type = 'i'; }
else if (be_iscomptr(vm, idx)) { ret = (int32_t) be_tocomptr(vm, idx); provided_type = 'c'; }
// check if simple type was a match
if (provided_type) {
@ -470,34 +472,45 @@ int32_t be_convert_single_elt(bvm *vm, int32_t idx, const char * arg_type = null
// non-simple type
if (be_isinstance(vm, idx)) {
be_getmember(vm, idx, ".p");
int32_t ret = be_convert_single_elt(vm, -1, nullptr); // recurse
be_pop(vm, 1);
if (arg_type_len > 1) {
// Check type
be_classof(vm, idx);
bool class_found = be_getglobal(vm, arg_type);
// Stack: class_of_idx, class_of_target (or nil)
if (class_found) {
if (!be_isderived(vm, -2)) {
berry_log_P("Unexpected class type '%s', expected '%s'", be_classname(vm, idx), arg_type);
}
} else {
berry_log_P("Unable to find class '%s' (%d)", arg_type, arg_type_len);
}
// check if the instance is a subclass of `bytes()``
be_getbuiltin(vm, "bytes"); // add "list" class
if (be_isderived(vm, idx)) {
be_pop(vm, 1);
be_getmember(vm, idx, "_buffer");
be_pushvalue(vm, idx);
be_call(vm, 1);
int32_t ret = (int32_t) be_tocomptr(vm, -2);
be_pop(vm, 2);
} else if (arg_type[0] != '.') {
berry_log_P("Unexpected instance type '%s', expected '%s'", be_classname(vm, idx), arg_type);
}
return ret;
} else {
be_pop(vm, 1);
be_getmember(vm, idx, ".p");
int32_t ret = be_convert_single_elt(vm, -1, nullptr); // recurse
be_pop(vm, 1);
return ret;
if (arg_type_len > 1) {
// Check type
be_classof(vm, idx);
bool class_found = be_getglobal(vm, arg_type);
// Stack: class_of_idx, class_of_target (or nil)
if (class_found) {
if (!be_isderived(vm, -2)) {
berry_log_P("Unexpected class type '%s', expected '%s'", be_classname(vm, idx), arg_type);
}
} else {
berry_log_P("Unable to find class '%s' (%d)", arg_type, arg_type_len);
}
be_pop(vm, 2);
} else if (arg_type[0] != '.') {
berry_log_P("Unexpected instance type '%s', expected '%s'", be_classname(vm, idx), arg_type);
}
return ret;
}
} else {
be_raise(vm, kTypeError, nullptr);
}
//
return ret;
}

View File

@ -230,7 +230,7 @@ void be_check_arg_type(bvm *vm, int32_t argc, const char * arg_type, int32_t p[5
void be_check_arg_type(bvm *vm, int32_t argc, const char * arg_type, int32_t p[5]) {
bool arg_type_check = (arg_type != nullptr); // is type checking activated
int32_t arg_idx = 0; // position in arg_type string
char type_short_name[16];
char type_short_name[32];
for (uint32_t i = 0; i < argc; i++) {
type_short_name[0] = 0; // clear string
@ -293,15 +293,15 @@ extern "C" {
if (argc > 1) {
obj1 = (lv_obj_t*) be_convert_single_elt(vm, 2);
}
if (argc > 2) {
if (argc > 2 && !be_isnil(vm, 3)) {
obj2 = (lv_obj_t*) be_convert_single_elt(vm, 3);
}
// AddLog(LOG_LEVEL_INFO, "argc %d obj1 %p obj2 %p", argc, obj1, obj2);
fn_any_callable f = (fn_any_callable) func;
// AddLog(LOG_LEVEL_INFO, ">> be_call_c_func(%p) - %p,%p,%p,%p,%p", f, p[0], p[1], p[2], p[3], p[4]);
lv_obj_t * obj;
if ((int32_t)obj1 == -1) { // special semantics of first ptr is -1, then just encapsulate
obj = obj2;
if ((int32_t)obj2 == -1) { // special semantics if second ptr is -1, then just encapsulate
obj = obj1;
} else { // otherwise call the LVGL creator
obj = (lv_obj_t*) (*f)((int32_t)obj1, (int32_t)obj2, 0, 0, 0);
}
@ -338,36 +338,33 @@ extern "C" {
// look for class descriptor
int32_t class_idx = bin_search(class_name, &lv_classes[0].name, sizeof(lv_classes[0]), lv_classes_size);
if (class_idx < 0) {
// class not found, abort
// berry_log_C("lvx_member class not found");
be_return_nil(vm);
}
const lvbe_call_c_t * methods_calls = lv_classes[class_idx].func_table;
size_t methods_size = lv_classes[class_idx].size;
if (class_idx >= 0) {
const lvbe_call_c_t * methods_calls = lv_classes[class_idx].func_table;
size_t methods_size = lv_classes[class_idx].size;
int32_t method_idx = bin_search(method_name, methods_calls, sizeof(lvbe_call_c_t), methods_size);
if (method_idx >= 0) {
// method found
const lvbe_call_c_t * method = &methods_calls[method_idx];
// berry_log_C("lvx_member method found func=%p return_type=%s arg_type=%s", method->func, method->return_type, method->arg_type);
// push native closure
be_pushntvclosure(vm, &lvx_call_c, 3); // 3 upvals
int32_t method_idx = bin_search(method_name, methods_calls, sizeof(lvbe_call_c_t), methods_size);
if (method_idx >= 0) {
// method found
const lvbe_call_c_t * method = &methods_calls[method_idx];
// berry_log_C("lvx_member method found func=%p return_type=%s arg_type=%s", method->func, method->return_type, method->arg_type);
// push native closure
be_pushntvclosure(vm, &lvx_call_c, 3); // 3 upvals
be_pushcomptr(vm, method->func);
be_setupval(vm, -2, 0);
be_pop(vm, 1);
be_pushcomptr(vm, method->func);
be_setupval(vm, -2, 0);
be_pop(vm, 1);
be_pushstring(vm, method->return_type);
be_setupval(vm, -2, 1);
be_pop(vm, 1);
be_pushstring(vm, method->return_type);
be_setupval(vm, -2, 1);
be_pop(vm, 1);
be_pushstring(vm, method->arg_type);
be_setupval(vm, -2, 2);
be_pop(vm, 1);
be_pushstring(vm, method->arg_type);
be_setupval(vm, -2, 2);
be_pop(vm, 1);
// all good
be_return(vm);
// all good
be_return(vm);
}
}
// get super if any, or nil if none
@ -393,7 +390,7 @@ extern "C" {
fn_any_callable f = (fn_any_callable) func;
be_check_arg_type(vm, argc, arg_type, p);
// AddLog(LOG_LEVEL_INFO, ">> be_call_c_func(%p) - %p,%p,%p,%p,%p - %s", f, p[0], p[1], p[2], p[3], p[4], return_type);
// berry_log_C(">> be_call_c_func(%p) - %p,%p,%p,%p,%p - %s", f, p[0], p[1], p[2], p[3], p[4], return_type ? return_type : "NULL");
int32_t ret = (*f)(p[0], p[1], p[2], p[3], p[4]);
// AddLog(LOG_LEVEL_INFO, ">> be_call_c_func, ret = %p", ret);
if ((return_type == nullptr) || (strlen(return_type) == 0)) { be_return_nil(vm); } // does not return
@ -403,14 +400,15 @@ extern "C" {
case 'i': be_pushint(vm, ret); break;
case 'b': be_pushbool(vm, ret); break;
case 's': be_pushstring(vm, (const char*) ret); break;
case 'c': be_pushint(vm, ret); break; // TODO missing 'c' general callback type
default: be_raise(vm, "internal_error", "Unsupported return type"); break;
}
be_return(vm);
} else { // class name
// AddLog(LOG_LEVEL_INFO, ">> be_call_c_func, create_obj", ret);
be_getglobal(vm, return_type); // stack = class
be_pushcomptr(vm, (void*) -1); // stack = class, -1
be_pushcomptr(vm, (void*) ret); // stack = class, -1, ptr
be_pushcomptr(vm, (void*) ret); // stack = class, ptr
be_pushcomptr(vm, (void*) -1); // stack = class, ptr, -1
be_call(vm, 2); // instanciate with 2 arguments, stack = instance, -1, ptr
be_pop(vm, 2); // stack = instance
be_return(vm);
@ -949,7 +947,7 @@ extern "C" {
int lvx_tostring(bvm *vm) {
lv_obj_t * obj = (lv_obj_t*) lv_get_arg(vm, 1);
const char * classname = be_classname(vm, 1);
char s[32];
char s[48];
snprintf(s, sizeof(s), "<instance: %s(0x%08X)>", classname, obj);
be_pushnstring(vm, s, strlen(s)); /* make escape string from buffer */
be_return(vm);
@ -1007,6 +1005,19 @@ extern "C" {
}
}
// ======================================================================
// Patch for ill-named functions
// ======================================================================
extern "C" {
// lv_signal_send should be renamed lv_obj_signal_send
// lv_res_t lv_signal_send(lv_obj_t * obj, lv_signal_t signal, void * param);
lv_res_t lv_obj_signal_send(lv_obj_t * obj, lv_signal_t signal, void * param) {
return lv_signal_send(obj, signal, param);
}
}
#include "lvgl_berry/be_lv_c_mapping.h"
#else // USE_LVGL

View File

@ -96,12 +96,26 @@ const char berry_prog[] =
// "end "
// "lv = lvgl() "
"import lvgl as lv "
// 'lv_group_focus_cb', 'lv_event_cb', 'lv_signal_cb', 'lv_design_cb', 'lv_gauge_format_cb'
"_lvgl_cb = [ {}, {}, {}, {}, {}, {} ] "
"_lvgl_cb_obj = [ {}, {}, {}, {}, {}, {} ] "
"def _lvgl_cb_dispatch(idx, obj, v1, v2, v3, v4) "
// "import string print(string.format('>>> idx=%i obj=0x%08X v1=%i', idx, obj, v1)) "
"var func = _lvgl_cb[idx].find(obj) "
"var inst = _lvgl_cb_obj[idx].find(obj) "
// convert arguments to ctypes if needed
// typedef void (*lv_group_focus_cb_t)(struct _lv_group_t *);
// typedef void (*lv_event_cb_t)(struct _lv_obj_t * obj, lv_event_t event);
// typedef lv_res_t (*lv_signal_cb_t)(struct _lv_obj_t * obj, lv_signal_t sign, void * param);
// typedef lv_design_res_t (*lv_design_cb_t)(struct _lv_obj_t * obj, const lv_area_t * clip_area, lv_design_mode_t mode);
// typedef void (*lv_gauge_format_cb_t)(lv_obj_t * gauge, char * buf, int bufsize, int32_t value);
"if idx == 3 "
// lv_signal_cb - arg2 is lv_area
"v1 = lv_area(v1) "
"end "
"if func != nil "
"return func(inst, v1, v2, v3, v4) "
"end "

View File

@ -75,9 +75,14 @@ return_types = {
"lv_border_side_t": "i",
"lv_align_t": "i",
"lv_keyboard_mode_t": "i",
# "lv_group_focus_cb_t": "i",
"lv_indev_type_t": "i",
"lv_event_t": "i",
"lv_signal_t": "i",
# "lv_signal_cb_t": "c",
# "lv_design_cb_t": "c",
# "lv_event_cb_t": "c",
# "lv_group_focus_cb_t": "c",
"lv_obj_t *": "lv_obj",
"lv_color_t": "lv_color",
@ -85,19 +90,27 @@ return_types = {
"lv_group_t *": "lv_group",
#"lv_disp_t*": "lv_disp",
#"lv_style_list_t*": "",
# callbacks
"lv_group_focus_cb_t": "lv_group_focus_cb",
"lv_event_cb_t": "lv_event_cb",
"lv_signal_cb_t": "lv_signal_cb",
"lv_design_cb_t": "lv_design_cb",
"lv_gauge_format_cb_t": "lv_gauge_format_cb",
}
lv = {}
lvs = [] # special case for case for lv_style
lv0 = [] # function in lvlg module
lv_module = []
lv_cb_types = [] # list of callback types that will need each a separate C callback, later sorted by first argument
lv_cb_types = ['lv_group_focus_cb', 'lv_event_cb', 'lv_signal_cb', 'lv_design_cb', 'lv_gauge_format_cb']
# list of callback types that will need each a separate C callback
lv_widgets = ['arc', 'bar', 'btn', 'btnmatrix', 'calendar', 'canvas', 'chart', 'checkbox',
'cont', 'cpicker', 'dropdown', 'gauge', 'img', 'imgbtn', 'keyboard', 'label', 'led', 'line',
'linemeter', 'list', 'msgbox', 'objmask', 'templ', 'page', 'roller', 'slider', 'spinbox',
'spinner', 'switch', 'table', 'tabview', 'textarea', 'tileview', 'win']
lv_prefix = ['obj', 'group', 'style', 'indev'] + lv_widgets
lv_prefix = ['obj', 'group', 'style', 'indev', ] + lv_widgets
def try_int(s):
try:
@ -115,6 +128,7 @@ def c_convert_ret_type(c_ret):
with open(lv_widgets_file) as f:
for l_raw in f:
l_raw = re.sub('//.*$', '', l_raw) # remove trailing comments
l_raw = re.sub('LV_ATTRIBUTE_FAST_MEM ', '', l_raw) # remove LV_ATTRIBUTE_FAST_MEM marker
l_raw = re.sub('\s+', ' ', l_raw) # replace any multi-space with a single space
l_raw = l_raw.strip(" \t\n\r") # remove leading or trailing spaces
l_raw = re.sub('static ', '', l_raw)
@ -128,12 +142,16 @@ with open(lv_widgets_file) as f:
ret_type = g.group(1) # return type of the function
# Ex: ret_type -> 'void'
if ret_type not in return_types:
ret_type_without_t = re.sub(r"_t$", "", ret_type)
if ret_type in return_types:
# convert return type
c_ret = c_convert_ret_type(ret_type)
elif ret_type_without_t in lv_cb_types:
c_ret = "c" # general callback, if not already captured by explicit type
else:
print(f" // Skipping unsupported return type: {ret_type}")
continue
# convert return type
c_ret = c_convert_ret_type(ret_type)
# convert arguments
c_args = ""
@ -155,7 +173,7 @@ with open(lv_widgets_file) as f:
ga_type = re.sub(r"_t$", "", ga_type)
# if the type is a single letter, we just add it
if len(ga_type) == 1:
if len(ga_type) == 1 and ga_type != 'c': # callbacks are different
c_args += ga_type
else:
if ga_type.endswith("_cb"):
@ -175,22 +193,25 @@ with open(lv_widgets_file) as f:
c_func_name = ""
if func_name == "lv_style_init":
continue # no need for init as it would collied with native init (and called behind the scene anyways)
found = False
for subtype in lv_prefix:
if func_name == "lv_style_init": continue # no need for init as it would collied with native init (and called behind the scene anyways)
if func_name.startswith("lv_" + subtype + "_"):
be_name = re.sub("^lv_" + subtype + "_", '', func_name)
c_func_name = "lvbe_" + subtype + "_" + be_name
if subtype not in lv: lv[subtype] = [] # add entry
# special case if the function is create, we change the return type to macth the class
# if be_name == 'create':
# c_ret = "lv_" + subtype
# lv0.append( [ c_func_name, c_ret, c_args, func_name, subtype ] ) # also add to lvgl
lv[subtype].append( [ c_func_name, c_ret, c_args, func_name, be_name ] )
found = True
break
if found: continue
# not found, we treat it as lv top level function
be_name = re.sub("^lv_", '', func_name)
lv0.append( [ func_name, c_ret, c_args, func_name, be_name ] )
# print(lv0[-1])
print("| callback types"+str(lv_cb_types))
@ -444,7 +465,7 @@ for subtype, flv in lv.items():
print(f" {{ NULL, NULL }}")
print(f" }};")
print(f" be_regclass(vm, \"lv_{subtype}\", members);")
if subtype != "obj" and subtype != "group": # lv_obj and lv_group do not inherit from lv_obj
if subtype in lv_widgets: # only for subclasses of lv_obj
print()
print(f" be_getglobal(vm, \"lv_{subtype}\");")
print(f" be_getglobal(vm, \"lv_obj\");")
@ -460,7 +481,7 @@ for subtype, flv in lv.items():
print(f"}};")
print()
print(f"/* @const_object_info_begin")
if subtype != "obj" and subtype != "group": # lv_obj and lv_group do not inherit from lv_obj
if subtype in lv_widgets: # only for subclasses of lv_obj
print(f"class be_class_lv_{subtype} (scope: global, name: lv_{subtype}, super: be_class_lv_obj) {{")
else:
print(f"class be_class_lv_{subtype} (scope: global, name: lv_{subtype}) {{")
@ -524,24 +545,43 @@ extern int lv0_screenshot(bvm *vm);
static int lv_get_hor_res(void) {
return lv_disp_get_hor_res(lv_disp_get_default());
}
static int lv_get_ver_res(bvm *vm) {
static int lv_get_ver_res(void) {
return lv_disp_get_ver_res(lv_disp_get_default());
}
/* `lv` methods */
const lvbe_call_c_t lv_func[] = {
// resolution
{ "get_hor_res", (void*) &lv_get_hor_res, "i", "" },
{ "get_ver_res", (void*) &lv_get_ver_res, "i", "" },
""")
// layers
{ "layer_sys", (void*) &lv_layer_sys, "lv_obj", "" },
{ "layer_top", (void*) &lv_layer_top, "lv_obj", "" },
func_out = {} # used to sort output
for f in lv0:
c_func_name = f[0]
c_ret_type = f[1]
c_argc = f[2]
if c_argc is not None: c_argc = "\"" + c_argc + "\""
orig_func_name = f[3]
be_name = f[4]
func_out[be_name] = f" {{ \"{be_name}\", (void*) &{orig_func_name}, \"{c_ret_type}\", { c_argc if c_argc else 'nullptr'} }},"
// screens
{ "scr_act", (void*) &lv_scr_act, "lv_obj", "" },
{ "scr_load", (void*) &lv_scr_load, "", "(lv_obj)" },
{ "scr_load_anim", (void*) &lv_scr_load_anim, "", "(lv_obj)iiib" },
for be_name in sorted(func_out):
print(func_out[be_name])
# // resolution
# { "get_hor_res", (void*) &lv_get_hor_res, "i", "" },
# { "get_ver_res", (void*) &lv_get_ver_res, "i", "" },
# // layers
# { "layer_sys", (void*) &lv_layer_sys, "lv_obj", "" },
# { "layer_top", (void*) &lv_layer_top, "lv_obj", "" },
# // screens
# { "scr_act", (void*) &lv_scr_act, "lv_obj", "" },
# { "scr_load", (void*) &lv_scr_load, "", "(lv_obj)" },
# { "scr_load_anim", (void*) &lv_scr_load_anim, "", "(lv_obj)iiib" },
print("""
};
const size_t lv_func_size = sizeof(lv_func) / sizeof(lv_func[0]);
@ -574,17 +614,7 @@ print("""
};
const size_t lv0_constants_size = sizeof(lv0_constants)/sizeof(lv0_constants[0]);
""")
for f in lv0:
c_func_name = f[0]
print(f"extern int {c_func_name}(bvm *vm);")
print("""
#if !BE_USE_PRECOMPILED_OBJECT
//#if 1 // TODO we will do pre-compiled later
be_native_module_attr_table(lvgl) {
// Symbols
@ -686,15 +716,6 @@ print("""
be_native_module_function("load_freetype_font", lv0_load_freetype_font),
be_native_module_function("screenshot", lv0_screenshot),
""")
for f in lv0:
c_func_name = f[0]
be_name = f[4]
print(f" be_native_module_function(\"{be_name}\", {c_func_name}),")
print("""
};
be_define_native_module(lvgl, NULL);
@ -849,16 +870,6 @@ print("""
load_freetype_font, func(lv0_load_freetype_font)
screenshot, func(lv0_screenshot)
""")
for f in lv0:
c_func_name = f[0]
be_name = f[4]
print(f" {be_name}, func({c_func_name})")
print("""
}
@const_object_info_end */
#include "../generate/be_fixed_lvgl.h"

View File

@ -618,3 +618,18 @@ TEXTAREA_CURSOR_LAST
// };
LV_DRAW_MASK_RES_TRANSP
LV_DRAW_MASK_RES_FULL_COVER
LV_DRAW_MASK_RES_CHANGED
LV_DRAW_MASK_RES_UNKNOWN
LV_DRAW_MASK_TYPE_LINE
LV_DRAW_MASK_TYPE_ANGLE
LV_DRAW_MASK_TYPE_RADIUS
LV_DRAW_MASK_TYPE_FADE
LV_DRAW_MASK_TYPE_MAP
LV_DRAW_MASK_LINE_SIDE_LEFT
LV_DRAW_MASK_LINE_SIDE_RIGHT
LV_DRAW_MASK_LINE_SIDE_TOP
LV_DRAW_MASK_LINE_SIDE_BOTTOM

View File

@ -158,7 +158,6 @@ void lv_event_send_refresh_recursive(lv_obj_t * obj);
// lv_res_t lv_event_send_func(lv_event_cb_t event_xcb, lv_obj_t * obj, lv_event_t event, const void * data);
const void * lv_event_get_data(void);
void lv_obj_set_signal_cb(lv_obj_t * obj, lv_signal_cb_t signal_cb);
lv_res_t lv_signal_send(lv_obj_t * obj, lv_signal_t signal, void * param);
void lv_obj_set_design_cb(lv_obj_t * obj, lv_design_cb_t design_cb);
void * lv_obj_allocate_ext_attr(lv_obj_t * obj, uint16_t ext_size);
void lv_obj_refresh_ext_draw_pad(lv_obj_t * obj);
@ -1163,3 +1162,82 @@ void lv_win_focus(lv_obj_t * win, lv_obj_t * obj, lv_anim_enable_t anim_en);
static inline void lv_win_scroll_hor(lv_obj_t * win, lv_coord_t dist)
static inline void lv_win_scroll_ver(lv_obj_t * win, lv_coord_t dist)
// ======================================================================
// Patch
// ======================================================================
// lv_signal_send should be renamed lv_obj_signal_send
// lv_res_t lv_signal_send(lv_obj_t * obj, lv_signal_t signal, void * param);
lv_res_t lv_obj_signal_send(lv_obj_t * obj, lv_signal_t signal, void * param);
// ======================================================================
// LV top level functions
// ======================================================================
// resolution
lv_coord_t lv_get_hor_res(void);
lv_coord_t lv_get_ver_res(void);
// layers
static inline lv_obj_t * lv_layer_sys(void);
static inline lv_obj_t * lv_layer_top(void);
// screens
static inline lv_obj_t * lv_scr_act(void);
static inline void lv_scr_load(lv_obj_t * scr);
void lv_scr_load_anim(lv_obj_t * scr, lv_scr_load_anim_t anim_type, uint32_t time, uint32_t delay, bool auto_del);
lv_res_t lv_signal_send(lv_obj_t * obj, lv_signal_t signal, void * param);
// ======================================================================
// LV DRAW
// ======================================================================
void lv_draw_arc(lv_coord_t center_x, lv_coord_t center_y, uint16_t radius, uint16_t start_angle, uint16_t end_angle, const lv_area_t * clip_area, const lv_draw_line_dsc_t * dsc);
LV_ATTRIBUTE_FAST_MEM void _lv_blend_fill(const lv_area_t * clip_area, const lv_area_t * fill_area, lv_color_t color, lv_opa_t * mask, lv_draw_mask_res_t mask_res, lv_opa_t opa, lv_blend_mode_t mode);
LV_ATTRIBUTE_FAST_MEM void _lv_blend_map(const lv_area_t * clip_area, const lv_area_t * map_area, const lv_color_t * map_buf, lv_opa_t * mask, lv_draw_mask_res_t mask_res, lv_opa_t opa, lv_blend_mode_t mode);
void lv_draw_img_dsc_init(lv_draw_img_dsc_t * dsc);
void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask, const void * src, const lv_draw_img_dsc_t * dsc);
lv_img_src_t lv_img_src_get_type(const void * src);
uint8_t lv_img_cf_get_px_size(lv_img_cf_t cf);
bool lv_img_cf_is_chroma_keyed(lv_img_cf_t cf);
bool lv_img_cf_has_alpha(lv_img_cf_t cf);
LV_ATTRIBUTE_FAST_MEM void lv_draw_label_dsc_init(lv_draw_label_dsc_t * dsc);
LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, const lv_draw_label_dsc_t * dsc, const char * txt, lv_draw_label_hint_t * hint);
LV_ATTRIBUTE_FAST_MEM void lv_draw_line(const lv_point_t * point1, const lv_point_t * point2, const lv_area_t * clip, const lv_draw_line_dsc_t * dsc);
LV_ATTRIBUTE_FAST_MEM void lv_draw_line_dsc_init(lv_draw_line_dsc_t * dsc);
int16_t lv_draw_mask_add(void * param, void * custom_id);
LV_ATTRIBUTE_FAST_MEM lv_draw_mask_res_t lv_draw_mask_apply(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len);
void * lv_draw_mask_remove_id(int16_t id);
void * lv_draw_mask_remove_custom(void * custom_id);
LV_ATTRIBUTE_FAST_MEM uint8_t lv_draw_mask_get_cnt(void);
void lv_draw_mask_line_points_init(lv_draw_mask_line_param_t * param, lv_coord_t p1x, lv_coord_t p1y, lv_coord_t p2x, lv_coord_t p2y, lv_draw_mask_line_side_t side);
void lv_draw_mask_line_angle_init(lv_draw_mask_line_param_t * param, lv_coord_t p1x, lv_coord_t py, int16_t angle, lv_draw_mask_line_side_t side);
void lv_draw_mask_angle_init(lv_draw_mask_angle_param_t * param, lv_coord_t vertex_x, lv_coord_t vertex_y, lv_coord_t start_angle, lv_coord_t end_angle);
void lv_draw_mask_radius_init(lv_draw_mask_radius_param_t * param, const lv_area_t * rect, lv_coord_t radius, bool inv);
void lv_draw_mask_fade_init(lv_draw_mask_fade_param_t * param, const lv_area_t * coords, lv_opa_t opa_top, lv_coord_t y_top, lv_opa_t opa_bottom, lv_coord_t y_bottom);
void lv_draw_mask_map_init(lv_draw_mask_map_param_t * param, const lv_area_t * coords, const lv_opa_t * map);
void lv_draw_rect(const lv_area_t * coords, const lv_area_t * mask, const lv_draw_rect_dsc_t * dsc);
void lv_draw_px(const lv_point_t * point, const lv_area_t * clip_area, const lv_style_t * style);
void lv_draw_triangle(const lv_point_t points[], const lv_area_t * clip, const lv_draw_rect_dsc_t * draw_dsc);
void lv_draw_polygon(const lv_point_t points[], uint16_t point_cnt, const lv_area_t * mask, const lv_draw_rect_dsc_t * draw_dsc);
lv_img_dsc_t * lv_img_buf_alloc(lv_coord_t w, lv_coord_t h, lv_img_cf_t cf);
lv_color_t lv_img_buf_get_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_color_t color);
lv_opa_t lv_img_buf_get_px_alpha(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y);
void lv_img_buf_set_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_color_t c);
void lv_img_buf_set_px_alpha(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_opa_t opa);
void lv_img_buf_set_palette(lv_img_dsc_t * dsc, uint8_t id, lv_color_t c);
void lv_img_buf_free(lv_img_dsc_t * dsc);
uint32_t lv_img_buf_get_img_size(lv_coord_t w, lv_coord_t h, lv_img_cf_t cf);
// void lv_img_cache_set_size(uint16_t new_slot_num);
// void lv_img_cache_invalidate_src(const void * src);