Merge pull request #15440 from s-hadinger/lv_qrcode_improv

LVGL improved qrcode integration as actual class
This commit is contained in:
s-hadinger 2022-04-23 19:03:33 +02:00 committed by GitHub
commit 4c113c1da6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 45 additions and 4 deletions

View File

@ -583,6 +583,14 @@ const be_ntv_func_def_t lv_indev_func[] = {
{ "wait_release", { (const void*) &lv_indev_wait_release, "", "(lv.lv_indev)" } },
};
/* `lv_qrcode` methods */
#ifdef BE_LV_WIDGET_QRCODE
const be_ntv_func_def_t lv_qrcode_func[] = {
{ "delete", { (const void*) &lv_qrcode_delete, "", "(lv.lv_obj)" } },
{ "update", { (const void*) &lv_qrcode_update, "i", "(lv.lv_obj).i" } },
};
#endif // BE_LV_WIDGET_QRCODE
/* `lv_chart` methods */
#ifdef BE_LV_WIDGET_CHART
const be_ntv_func_def_t lv_chart_func[] = {
@ -1030,6 +1038,7 @@ extern const bclass be_class_lv_line;
extern const bclass be_class_lv_meter;
extern const bclass be_class_lv_msgbox;
extern const bclass be_class_lv_obj;
extern const bclass be_class_lv_qrcode;
extern const bclass be_class_lv_roller;
extern const bclass be_class_lv_slider;
extern const bclass be_class_lv_spinbox;
@ -1099,6 +1108,9 @@ const be_ntv_class_def_t lv_classes[] = {
{ "lv_msgbox", &be_class_lv_msgbox, lv_msgbox_func, sizeof(lv_msgbox_func) / sizeof(lv_msgbox_func[0]) },
#endif // BE_LV_WIDGET_MSGBOX
{ "lv_obj", &be_class_lv_obj, lv_obj_func, sizeof(lv_obj_func) / sizeof(lv_obj_func[0]) },
#ifdef BE_LV_WIDGET_QRCODE
{ "lv_qrcode", &be_class_lv_qrcode, lv_qrcode_func, sizeof(lv_qrcode_func) / sizeof(lv_qrcode_func[0]) },
#endif // BE_LV_WIDGET_QRCODE
#ifdef BE_LV_WIDGET_ROLLER
{ "lv_roller", &be_class_lv_roller, lv_roller_func, sizeof(lv_roller_func) / sizeof(lv_roller_func[0]) },
#endif // BE_LV_WIDGET_ROLLER
@ -1140,6 +1152,10 @@ const size_t lv_classes_size = sizeof(lv_classes) / sizeof(lv_classes[0]);
/* `lv_group` methods */
int be_ntv_lv_group_init(bvm *vm) { return be_call_c_func(vm, (void*) &lv_group_create, "+_p", ""); }
/* `lv_indev` methods */
/* `lv_qrcode` methods */
#ifdef BE_LV_WIDGET_QRCODE
int be_ntv_lv_qrcode_init(bvm *vm) { return be_call_c_func(vm, (void*) &lv_qrcode_create, "+_p", "(lv.lv_obj)i(lv.lv_color)(lv.lv_color)"); }
#endif // BE_LV_WIDGET_QRCODE
/* `lv_chart` methods */
#ifdef BE_LV_WIDGET_CHART
int be_ntv_lv_chart_init(bvm *vm) { return be_call_c_func(vm, (void*) &lv_chart_create, "+_p", "(lv.lv_obj)"); }

View File

@ -141,9 +141,6 @@ const be_ntv_func_def_t lv_func[] = {
{ "palette_lighten", { (const void*) &lv_palette_lighten, "lv.lv_color", "ii" } },
{ "palette_main", { (const void*) &lv_palette_main, "lv.lv_color", "i" } },
{ "pct", { (const void*) &lv_pct, "i", "i" } },
{ "qrcode_create", { (const void*) &lv_qrcode_create, "lv.lv_obj", "(lv.lv_obj)i(lv.lv_color)(lv.lv_color)" } },
{ "qrcode_delete", { (const void*) &lv_qrcode_delete, "", "(lv.lv_obj)" } },
{ "qrcode_update", { (const void*) &lv_qrcode_update, "i", "(lv.lv_obj).i" } },
{ "rand", { (const void*) &lv_rand, "i", "ii" } },
{ "refr_now", { (const void*) &lv_refr_now, "", "(lv.lv_disp)" } },
{ "refr_obj", { (const void*) &lv_refr_obj, "", "(lv.lv_draw_ctx)(lv.lv_obj)" } },

View File

@ -585,6 +585,11 @@ extern int lvbe_indev_get_vect(bvm *vm);
extern int lvbe_indev_wait_release(bvm *vm);
extern int lvbe_indev_search_obj(bvm *vm);
/* `lv_qrcode` external functions definitions */
extern int lvbe_qrcode_create(bvm *vm);
extern int lvbe_qrcode_update(bvm *vm);
extern int lvbe_qrcode_delete(bvm *vm);
/* `lv_chart` external functions definitions */
extern int lvbe_chart_create(bvm *vm);
extern int lvbe_chart_set_type(bvm *vm);
@ -948,6 +953,7 @@ extern int be_ntv_lv_disp_init(bvm *vm);
extern int be_ntv_lv_obj_init(bvm *vm);
extern int be_ntv_lv_group_init(bvm *vm);
extern int be_ntv_lv_indev_init(bvm *vm);
extern int be_ntv_lv_qrcode_init(bvm *vm);
extern int be_ntv_lv_chart_init(bvm *vm);
extern int be_ntv_lv_colorwheel_init(bvm *vm);
extern int be_ntv_lv_imgbtn_init(bvm *vm);
@ -996,6 +1002,7 @@ extern const bclass be_class_lv_line;
extern const bclass be_class_lv_meter;
extern const bclass be_class_lv_msgbox;
extern const bclass be_class_lv_obj;
extern const bclass be_class_lv_qrcode;
extern const bclass be_class_lv_roller;
extern const bclass be_class_lv_slider;
extern const bclass be_class_lv_spinbox;
@ -1193,6 +1200,22 @@ be_local_class(lv_img,
);
/*******************************************************************/
/********************************************************************
** Solidified class: lv_qrcode
********************************************************************/
extern const bclass be_class_lv_obj;
be_local_class(lv_qrcode,
0,
&be_class_lv_obj,
be_nested_map(2,
( (struct bmapnode*) &(const bmapnode[]) {
{ be_const_key(_class, -1), be_const_comptr(&lv_qrcode_class) },
{ be_const_key(init, -1), be_const_func(be_ntv_lv_qrcode_init) },
})),
(be_str_literal("lv_qrcode"))
);
/*******************************************************************/
/********************************************************************
** Solidified class: lv_chart
********************************************************************/

View File

@ -188,8 +188,11 @@ lv_widgets = ['arc', 'bar', 'btn', 'btnmatrix', 'canvas', 'checkbox',
'dropdown', 'img', 'label', 'line', 'roller', 'slider',
'switch', 'table', 'textarea' ]
# extra widgets
lv_widgets = lv_widgets + [ 'chart', 'colorwheel', 'imgbtn', 'led', 'meter', 'msgbox', 'spinbox', 'spinner' ]
# add qrcode
lv_widgets = lv_widgets + [ 'qrcode' ]
lv_prefix = ['obj', 'group', 'style', 'indev', 'disp', 'timer', 'anim'] + lv_widgets
# define here widget inheritance because it's hard to deduce from source

View File

@ -1081,6 +1081,8 @@
#define BE_LV_WIDGET_SPINBOX
#define BE_LV_WIDGET_SPINNER
#define BE_LV_WIDGET_QRCODE
#endif // ESP32
/*********************************************************************************************\