mirror of https://github.com/arendst/Tasmota.git
Merge pull request #12544 from s-hadinger/lvgl_ctypes
LVGL ctypes implemented
This commit is contained in:
commit
ee15b58877
|
@ -0,0 +1,276 @@
|
|||
/********************************************************************
|
||||
* Tasmota LVGL ctypes mapping
|
||||
*******************************************************************/
|
||||
#include "be_constobj.h"
|
||||
|
||||
#ifdef USE_LVGL
|
||||
|
||||
#include "lvgl.h"
|
||||
|
||||
|
||||
// binary search within an array of sorted strings
|
||||
// the first 4 bytes are a pointer to a string
|
||||
// returns 0..total_elements-1 or -1 if not found
|
||||
|
||||
int32_t bin_search_ctypes(const char * needle, const void * table, size_t elt_size, size_t total_elements) {
|
||||
int32_t low = 0;
|
||||
int32_t high = total_elements - 1;
|
||||
int32_t mid = (low + high) / 2;
|
||||
// start a dissect
|
||||
while (low <= high) {
|
||||
const char * elt = *(const char **) ( ((uint8_t*)table) + mid * elt_size );
|
||||
int32_t comp = strcmp(needle, elt);
|
||||
if (comp < 0) {
|
||||
high = mid - 1;
|
||||
} else if (comp > 0) {
|
||||
low = mid + 1;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
mid = (low + high) / 2;
|
||||
}
|
||||
if (low <= high) {
|
||||
return mid;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
enum {
|
||||
|
||||
ctypes_i32 = 14,
|
||||
ctypes_i16 = 12,
|
||||
ctypes_i8 = 11,
|
||||
ctypes_u32 = 4,
|
||||
ctypes_u16 = 2,
|
||||
ctypes_u8 = 1,
|
||||
|
||||
// big endian
|
||||
ctypes_be_i32 = -14,
|
||||
ctypes_be_i16 = -12,
|
||||
ctypes_be_i8 = -11,
|
||||
ctypes_be_u32 = -4,
|
||||
ctypes_be_u16 = -2,
|
||||
ctypes_be_u8 = -1,
|
||||
|
||||
ctypes_bf = 0, //bif-field
|
||||
};
|
||||
|
||||
typedef struct be_ctypes_structure_item_t {
|
||||
const char * name;
|
||||
uint16_t offset_bytes;
|
||||
uint8_t offset_bits : 3;
|
||||
uint8_t len_bits : 5;
|
||||
int8_t type;
|
||||
} be_ctypes_structure_item_t;
|
||||
|
||||
typedef struct be_ctypes_structure_t {
|
||||
uint16_t size_bytes; /* size in bytes */
|
||||
uint16_t size_elt; /* number of elements */
|
||||
const be_ctypes_structure_item_t * items;
|
||||
} be_ctypes_structure_t;
|
||||
|
||||
typedef struct be_ctypes_class_t {
|
||||
const char * name;
|
||||
const be_ctypes_structure_t * definitions;
|
||||
} be_ctypes_class_t;
|
||||
|
||||
typedef struct be_ctypes_classes_t {
|
||||
uint16_t size;
|
||||
const be_ctypes_class_t * classes;
|
||||
} be_ctypes_classes_t;
|
||||
|
||||
// const be_ctypes_class_t * g_ctypes_classes = NULL;
|
||||
|
||||
// extern void berry_log_C(const char * berry_buf, ...);
|
||||
int be_ctypes_init(bvm *vm) {
|
||||
// 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);
|
||||
be_pop(vm, 1);
|
||||
// berry_log_C("be_ctypes_init> be_ctypes_class = %p", be_ctypes_classes);
|
||||
const char * class_name = be_classname(vm, 1);
|
||||
// berry_log_C("be_ctypes_init> class_name = %s", class_name);
|
||||
|
||||
// call super(self, bytes)
|
||||
be_getglobal(vm, "super"); // push super function
|
||||
be_pushvalue(vm, 1); // push self instance
|
||||
be_getglobal(vm, "bytes"); // push bytes class
|
||||
be_call(vm, 2);
|
||||
be_pop(vm, 2);
|
||||
// berry_log_C("be_ctypes_init> super found %p", be_toint(vm, -1));
|
||||
|
||||
// call bytes.init(self)
|
||||
be_getmember(vm, -1, "init");
|
||||
be_pushvalue(vm, -2);
|
||||
be_call(vm, 1);
|
||||
be_pop(vm, 3);
|
||||
// berry_log_C("be_ctypes_init> init called");
|
||||
|
||||
// look for class definition
|
||||
int32_t class_idx = bin_search_ctypes(class_name, &be_ctypes_classes->classes[0], sizeof(be_ctypes_class_t), be_ctypes_classes->size);
|
||||
if (class_idx >= 0) {
|
||||
// found
|
||||
const be_ctypes_structure_t * definitions = be_ctypes_classes->classes[class_idx].definitions;
|
||||
// store definition in '.def'
|
||||
// berry_log_C("Found definitions = %p", definitions);
|
||||
be_pushcomptr(vm, (void*) definitions);
|
||||
be_setmember(vm, 1, ".def");
|
||||
be_pop(vm, 1);
|
||||
|
||||
// call self.resize(definitions->size_bytes)
|
||||
be_getmember(vm, 1, "resize");
|
||||
be_pushvalue(vm, 1);
|
||||
be_pushint(vm, definitions->size_bytes);
|
||||
be_call(vm, 2);
|
||||
be_pop(vm, 3);
|
||||
}
|
||||
|
||||
be_return(vm);
|
||||
}
|
||||
|
||||
int be_ctypes_member(bvm *vm) {
|
||||
int argc = be_top(vm);
|
||||
be_getmember(vm, 1, ".def");
|
||||
const be_ctypes_structure_t *definitions;
|
||||
definitions = (const be_ctypes_structure_t *) be_tocomptr(vm, -1);
|
||||
be_pop(vm, 1);
|
||||
const char *name = be_tostring(vm, 2);
|
||||
|
||||
// look for member
|
||||
int32_t member_idx = bin_search_ctypes(name, &definitions->items[0], sizeof(be_ctypes_structure_item_t), definitions->size_elt);
|
||||
if (member_idx >= 0) {
|
||||
const be_ctypes_structure_item_t *member = &definitions->items[member_idx];
|
||||
// berry_log_C("member found bytes=%i, bits=%i, len_bits=%i, type=%i", member->offset_bytes, member->offset_bits, member->len_bits, member->type);
|
||||
|
||||
// dispatch according to types
|
||||
if (ctypes_bf == member->type) {
|
||||
// bitfield
|
||||
be_getmember(vm, 1, "getbits");
|
||||
be_pushvalue(vm, 1); // self
|
||||
be_pushint(vm, member->offset_bytes * 8 + member->offset_bits);
|
||||
be_pushint(vm, member->len_bits);
|
||||
be_call(vm, 3);
|
||||
be_pop(vm, 3);
|
||||
be_return(vm);
|
||||
} else {
|
||||
// general int support
|
||||
int size = member->type; // eventually 1/2/4, positive if little endian, negative if big endian
|
||||
int sign = false; // signed int
|
||||
if (size >= ctypes_i8) {
|
||||
size -= ctypes_i8 - 1;
|
||||
sign = true;
|
||||
}
|
||||
if (size <= ctypes_be_i8) {
|
||||
size += ctypes_be_i8 - 1;
|
||||
sign = true;
|
||||
}
|
||||
// get
|
||||
be_getmember(vm, 1, sign ? "geti" : "get"); // self.get or self.geti
|
||||
be_pushvalue(vm, 1); // push self
|
||||
be_pushint(vm, member->offset_bytes);
|
||||
be_pushint(vm, size);
|
||||
be_call(vm, 3);
|
||||
be_pop(vm, 3);
|
||||
be_return(vm);
|
||||
}
|
||||
}
|
||||
|
||||
be_return_nil(vm);
|
||||
}
|
||||
|
||||
// setmember takes 3 arguments:
|
||||
// 1: self (subclass of bytes())
|
||||
// 2: name of member
|
||||
// 3: value
|
||||
int be_ctypes_setmember(bvm *vm) {
|
||||
int argc = be_top(vm);
|
||||
be_getmember(vm, 1, ".def");
|
||||
const be_ctypes_structure_t *definitions;
|
||||
definitions = (const be_ctypes_structure_t *) be_tocomptr(vm, -1);
|
||||
be_pop(vm, 1);
|
||||
const char *name = be_tostring(vm, 2);
|
||||
|
||||
// look for member
|
||||
int32_t member_idx = bin_search_ctypes(name, &definitions->items[0], sizeof(be_ctypes_structure_item_t), definitions->size_elt);
|
||||
if (member_idx >= 0) {
|
||||
const be_ctypes_structure_item_t *member = &definitions->items[member_idx];
|
||||
// berry_log_C("member found bytes=%i, bits=%i, len_bits=%i, type=%i", member->offset_bytes, member->offset_bits, member->len_bits, member->type);
|
||||
|
||||
// dispatch according to types
|
||||
if (ctypes_bf == member->type) {
|
||||
// bitfield
|
||||
be_getmember(vm, 1, "setbits");
|
||||
be_pushvalue(vm, 1); // self
|
||||
be_pushint(vm, member->offset_bytes * 8 + member->offset_bits);
|
||||
be_pushint(vm, member->len_bits);
|
||||
be_pushvalue(vm, 3); // val
|
||||
be_call(vm, 4);
|
||||
be_pop(vm, 5);
|
||||
be_return_nil(vm);
|
||||
} else {
|
||||
// general int support
|
||||
int size = member->type; // eventually 1/2/4, positive if little endian, negative if big endian
|
||||
int sign = false; // signed int
|
||||
if (size >= ctypes_i8) {
|
||||
size -= ctypes_i8 - 1;
|
||||
sign = true;
|
||||
}
|
||||
if (size <= ctypes_be_i8) {
|
||||
size += ctypes_be_i8 - 1;
|
||||
sign = true;
|
||||
}
|
||||
// set
|
||||
be_getmember(vm, 1, sign ? "seti" : "set"); // self.get or self.geti
|
||||
be_pushvalue(vm, 1); // push self
|
||||
be_pushint(vm, member->offset_bytes);
|
||||
be_pushvalue(vm, 3); // val
|
||||
be_pushint(vm, size);
|
||||
be_call(vm, 4);
|
||||
be_pop(vm, 5);
|
||||
be_return_nil(vm);
|
||||
}
|
||||
}
|
||||
|
||||
be_return_nil(vm);
|
||||
}
|
||||
|
||||
BE_EXPORT_VARIABLE extern const bclass be_class_bytes;
|
||||
|
||||
#if BE_USE_PRECOMPILED_OBJECT
|
||||
#include "../generate/be_fixed_be_class_lv_ctypes.h"
|
||||
#endif
|
||||
|
||||
void be_load_lvgl_ctypes_lib(bvm *vm) {
|
||||
#if !BE_USE_PRECOMPILED_OBJECT
|
||||
static const bnfuncinfo members[] = {
|
||||
{ ".def", NULL }, // pointer to definition
|
||||
{ "init", be_ctypes_init },
|
||||
{ "member", be_ctypes_member },
|
||||
{ "setmember", be_ctypes_setmember },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
be_regclass(vm, "ctypes_bytes", members);
|
||||
|
||||
be_getglobal(vm, "ctypes_bytes");
|
||||
be_getglobal(vm, "bytes");
|
||||
be_setsuper(vm, -2);
|
||||
be_pop(vm, 2);
|
||||
#else
|
||||
be_pushntvclass(vm, &be_class_lv_ctypes);
|
||||
be_setglobal(vm, "ctypes_bytes");
|
||||
be_pop(vm, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* @const_object_info_begin
|
||||
class be_class_lv_ctypes (scope: global, name: ctypes_bytes, super: be_class_bytes) {
|
||||
.def, var
|
||||
init, func(be_ctypes_init)
|
||||
member, func(be_ctypes_member)
|
||||
setmember, func(be_ctypes_setmember)
|
||||
}
|
||||
@const_object_info_end */
|
||||
|
||||
#endif // USE_LVGL
|
|
@ -0,0 +1,507 @@
|
|||
/********************************************************************
|
||||
* Tasmota LVGL ctypes mapping
|
||||
*******************************************************************/
|
||||
#include "be_constobj.h"
|
||||
|
||||
#ifdef USE_LVGL
|
||||
|
||||
#include "lvgl.h"
|
||||
|
||||
enum {
|
||||
|
||||
ctypes_i32 = 14,
|
||||
ctypes_i16 = 12,
|
||||
ctypes_i8 = 11,
|
||||
ctypes_u32 = 4,
|
||||
ctypes_u16 = 2,
|
||||
ctypes_u8 = 1,
|
||||
|
||||
// big endian
|
||||
ctypes_be_i32 = -14,
|
||||
ctypes_be_i16 = -12,
|
||||
ctypes_be_i8 = -11,
|
||||
ctypes_be_u32 = -4,
|
||||
ctypes_be_u16 = -2,
|
||||
ctypes_be_u8 = -1,
|
||||
|
||||
ctypes_bf = 0, //bif-field
|
||||
};
|
||||
|
||||
typedef struct be_ctypes_structure_item_t {
|
||||
const char * name;
|
||||
uint16_t offset_bytes;
|
||||
uint8_t offset_bits : 3;
|
||||
uint8_t len_bits : 5;
|
||||
int8_t type;
|
||||
} be_ctypes_structure_item_t;
|
||||
|
||||
typedef struct be_ctypes_structure_t {
|
||||
uint16_t size_bytes; /* size in bytes */
|
||||
uint16_t size_elt; /* number of elements */
|
||||
const be_ctypes_structure_item_t * items;
|
||||
} be_ctypes_structure_t;
|
||||
|
||||
typedef struct be_ctypes_class_t {
|
||||
const char * name;
|
||||
const be_ctypes_structure_t * definitions;
|
||||
} be_ctypes_class_t;
|
||||
|
||||
typedef struct be_ctypes_classes_t {
|
||||
uint16_t size;
|
||||
const be_ctypes_class_t * classes;
|
||||
} be_ctypes_classes_t;
|
||||
|
||||
// extern const be_ctypes_class_t *g_ctypes_classes;
|
||||
|
||||
|
||||
BE_EXPORT_VARIABLE extern const bclass be_class_lv_ctypes;
|
||||
|
||||
|
||||
|
||||
// const be_ctypes_structure_t be_lv_area_t = {
|
||||
// 4,
|
||||
// (const be_ctypes_structure_item_t[4]) {
|
||||
// { "x1", 0, 16, ctypes_int },
|
||||
// { "x2", 32, 16, ctypes_int },
|
||||
// { "y1", 16, 16, ctypes_int },
|
||||
// { "y2", 48, 16, ctypes_int },
|
||||
// // }};
|
||||
|
||||
// #if BE_USE_PRECOMPILED_OBJECT
|
||||
// #include "../generate/be_fixed_be_class_lv_area_t.h"
|
||||
// #endif
|
||||
|
||||
// void be_load_lvgl_lv_area_t_lib(bvm *vm) {
|
||||
// #if !BE_USE_PRECOMPILED_OBJECT
|
||||
// static const bnfuncinfo members[] = {
|
||||
// { NULL, NULL }
|
||||
// };
|
||||
// be_regclass(vm, "lv_area_t", members);
|
||||
|
||||
// be_getglobal(vm, "lv_area_t");
|
||||
// be_getglobal(vm, "lv_ctypes");
|
||||
// be_setsuper(vm, -2);
|
||||
// be_pop(vm, 2);
|
||||
// #else
|
||||
// be_pushntvclass(vm, &be_class_lv_area_t);
|
||||
// be_setglobal(vm, "lv_area_t");
|
||||
// be_pop(vm, 1);
|
||||
// #endif
|
||||
// }
|
||||
|
||||
void ctypes_register_class(bvm *vm, const bclass * ctypes_class, const be_ctypes_structure_t * definitions) {
|
||||
be_pushntvclass(vm, ctypes_class);
|
||||
be_setglobal(vm, str(ctypes_class->name));
|
||||
be_pop(vm, 1);
|
||||
}
|
||||
|
||||
/********************************************************************
|
||||
* Generated code, don't edit
|
||||
*******************************************************************/
|
||||
const be_ctypes_structure_t be_lv_point_t = {
|
||||
4, /* size in bytes */
|
||||
2, /* number of elements */
|
||||
(const be_ctypes_structure_item_t[2]) {
|
||||
{ "x", 0, 0, 0, 12 },
|
||||
{ "y", 2, 0, 0, 12 },
|
||||
}};
|
||||
|
||||
const be_ctypes_structure_t be_lv_area_t = {
|
||||
8, /* size in bytes */
|
||||
4, /* number of elements */
|
||||
(const be_ctypes_structure_item_t[4]) {
|
||||
{ "x1", 0, 0, 0, 12 },
|
||||
{ "x2", 4, 0, 0, 12 },
|
||||
{ "y1", 2, 0, 0, 12 },
|
||||
{ "y2", 6, 0, 0, 12 },
|
||||
}};
|
||||
|
||||
const be_ctypes_structure_t be_lv_draw_rect_dsc_t = {
|
||||
77, /* size in bytes */
|
||||
43, /* number of elements */
|
||||
(const be_ctypes_structure_item_t[43]) {
|
||||
{ "bg_blend_mode", 12, 0, 0, 1 },
|
||||
{ "bg_color", 2, 0, 0, 2 },
|
||||
{ "bg_grad_color", 4, 0, 0, 2 },
|
||||
{ "bg_grad_color_stop", 9, 0, 0, 12 },
|
||||
{ "bg_grad_dir", 6, 0, 0, 1 },
|
||||
{ "bg_main_color_stop", 7, 0, 0, 12 },
|
||||
{ "bg_opa", 11, 0, 0, 1 },
|
||||
{ "border_blend_mode", 20, 0, 0, 1 },
|
||||
{ "border_color", 13, 0, 0, 2 },
|
||||
{ "border_opa", 19, 0, 0, 1 },
|
||||
{ "border_post", 21, 0, 1, 0 },
|
||||
{ "border_side", 17, 0, 0, 12 },
|
||||
{ "border_width", 15, 0, 0, 12 },
|
||||
{ "outline_blend_mode", 29, 0, 0, 1 },
|
||||
{ "outline_color", 22, 0, 0, 2 },
|
||||
{ "outline_opa", 28, 0, 0, 1 },
|
||||
{ "outline_pad", 26, 0, 0, 12 },
|
||||
{ "outline_width", 24, 0, 0, 12 },
|
||||
{ "pattern_blend_mode", 55, 0, 0, 1 },
|
||||
{ "pattern_font", 46, 0, 0, 4 },
|
||||
{ "pattern_image", 42, 0, 0, 4 },
|
||||
{ "pattern_opa", 52, 0, 0, 1 },
|
||||
{ "pattern_recolor", 50, 0, 0, 2 },
|
||||
{ "pattern_recolor_opa", 53, 0, 0, 1 },
|
||||
{ "pattern_repeat", 54, 0, 1, 0 },
|
||||
{ "radius", 0, 0, 0, 12 },
|
||||
{ "shadow_blend_mode", 41, 0, 0, 1 },
|
||||
{ "shadow_color", 30, 0, 0, 2 },
|
||||
{ "shadow_ofs_x", 34, 0, 0, 12 },
|
||||
{ "shadow_ofs_y", 36, 0, 0, 12 },
|
||||
{ "shadow_opa", 40, 0, 0, 1 },
|
||||
{ "shadow_spread", 38, 0, 0, 12 },
|
||||
{ "shadow_width", 32, 0, 0, 12 },
|
||||
{ "value_align", 75, 0, 0, 1 },
|
||||
{ "value_blend_mode", 76, 0, 0, 1 },
|
||||
{ "value_color", 65, 0, 0, 2 },
|
||||
{ "value_font", 60, 0, 0, 4 },
|
||||
{ "value_letter_space", 71, 0, 0, 12 },
|
||||
{ "value_line_space", 73, 0, 0, 12 },
|
||||
{ "value_ofs_x", 67, 0, 0, 12 },
|
||||
{ "value_ofs_y", 69, 0, 0, 12 },
|
||||
{ "value_opa", 64, 0, 0, 1 },
|
||||
{ "value_str", 56, 0, 0, 4 },
|
||||
}};
|
||||
|
||||
const be_ctypes_structure_t be_lv_draw_line_dsc_t = {
|
||||
10, /* size in bytes */
|
||||
9, /* number of elements */
|
||||
(const be_ctypes_structure_item_t[9]) {
|
||||
{ "blend_mode", 9, 0, 2, 0 },
|
||||
{ "color", 0, 0, 0, 2 },
|
||||
{ "dash_gap", 6, 0, 0, 12 },
|
||||
{ "dash_width", 4, 0, 0, 12 },
|
||||
{ "opa", 8, 0, 0, 1 },
|
||||
{ "raw_end", 9, 4, 1, 0 },
|
||||
{ "round_end", 9, 3, 1, 0 },
|
||||
{ "round_start", 9, 2, 1, 0 },
|
||||
{ "width", 2, 0, 0, 12 },
|
||||
}};
|
||||
|
||||
const be_ctypes_structure_t be_lv_draw_img_dsc_t = {
|
||||
14, /* size in bytes */
|
||||
9, /* number of elements */
|
||||
(const be_ctypes_structure_item_t[9]) {
|
||||
{ "angle", 1, 0, 0, 2 },
|
||||
{ "antialias", 13, 0, 1, 0 },
|
||||
{ "blend_mode", 12, 0, 0, 1 },
|
||||
{ "opa", 0, 0, 0, 1 },
|
||||
{ "pivot_x", 3, 0, 0, 12 },
|
||||
{ "pivot_y", 5, 0, 0, 12 },
|
||||
{ "recolor", 10, 0, 0, 2 },
|
||||
{ "recolor_opa", 9, 0, 0, 1 },
|
||||
{ "zoom", 7, 0, 0, 2 },
|
||||
}};
|
||||
|
||||
const be_ctypes_structure_t be_lv_draw_label_dsc_t = {
|
||||
31, /* size in bytes */
|
||||
15, /* number of elements */
|
||||
(const be_ctypes_structure_item_t[15]) {
|
||||
{ "bidi_dir", 27, 0, 0, 1 },
|
||||
{ "blend_mode", 30, 0, 0, 1 },
|
||||
{ "color", 0, 0, 0, 2 },
|
||||
{ "decor", 29, 0, 0, 1 },
|
||||
{ "flag", 28, 0, 0, 1 },
|
||||
{ "font", 6, 0, 0, 4 },
|
||||
{ "letter_space", 13, 0, 0, 12 },
|
||||
{ "line_space", 11, 0, 0, 12 },
|
||||
{ "ofs_x", 23, 0, 0, 12 },
|
||||
{ "ofs_y", 25, 0, 0, 12 },
|
||||
{ "opa", 10, 0, 0, 1 },
|
||||
{ "sel_bg_color", 4, 0, 0, 2 },
|
||||
{ "sel_color", 2, 0, 0, 2 },
|
||||
{ "sel_end", 19, 0, 0, 4 },
|
||||
{ "sel_start", 15, 0, 0, 4 },
|
||||
}};
|
||||
|
||||
const be_ctypes_structure_t be_lv_draw_mask_common_dsc_t = {
|
||||
5, /* size in bytes */
|
||||
2, /* number of elements */
|
||||
(const be_ctypes_structure_item_t[2]) {
|
||||
{ "cb", 0, 0, 0, 4 },
|
||||
{ "type", 4, 0, 0, 1 },
|
||||
}};
|
||||
|
||||
const be_ctypes_structure_t be_lv_draw_mask_line_param_cfg_t = {
|
||||
9, /* size in bytes */
|
||||
5, /* number of elements */
|
||||
(const be_ctypes_structure_item_t[5]) {
|
||||
{ "p1_x", 0, 0, 0, 12 },
|
||||
{ "p1_y", 2, 0, 0, 12 },
|
||||
{ "p2_x", 4, 0, 0, 12 },
|
||||
{ "p2_y", 6, 0, 0, 12 },
|
||||
{ "side", 8, 0, 2, 0 },
|
||||
}};
|
||||
|
||||
const be_ctypes_structure_t be_lv_draw_mask_line_param_t = {
|
||||
35, /* size in bytes */
|
||||
15, /* number of elements */
|
||||
(const be_ctypes_structure_item_t[15]) {
|
||||
{ "cfg_p1_x", 5, 0, 0, 12 },
|
||||
{ "cfg_p1_y", 7, 0, 0, 12 },
|
||||
{ "cfg_p2_x", 9, 0, 0, 12 },
|
||||
{ "cfg_p2_y", 11, 0, 0, 12 },
|
||||
{ "cfg_side", 13, 0, 2, 0 },
|
||||
{ "dsc_cb", 0, 0, 0, 4 },
|
||||
{ "dsc_type", 4, 0, 0, 1 },
|
||||
{ "flat", 34, 0, 1, 0 },
|
||||
{ "inv", 34, 1, 1, 0 },
|
||||
{ "origo_x", 14, 0, 0, 12 },
|
||||
{ "origo_y", 16, 0, 0, 12 },
|
||||
{ "spx", 30, 0, 0, 14 },
|
||||
{ "steep", 26, 0, 0, 14 },
|
||||
{ "xy_steep", 18, 0, 0, 14 },
|
||||
{ "yx_steep", 22, 0, 0, 14 },
|
||||
}};
|
||||
|
||||
const be_ctypes_structure_t be_lv_draw_mask_angle_param_cfg_t = {
|
||||
8, /* size in bytes */
|
||||
4, /* number of elements */
|
||||
(const be_ctypes_structure_item_t[4]) {
|
||||
{ "end_angle", 6, 0, 0, 12 },
|
||||
{ "start_angle", 4, 0, 0, 12 },
|
||||
{ "vertex_p_x", 0, 0, 0, 12 },
|
||||
{ "vertex_p_y", 2, 0, 0, 12 },
|
||||
}};
|
||||
|
||||
const be_ctypes_structure_t be_lv_draw_mask_angle_param_t = {
|
||||
85, /* size in bytes */
|
||||
37, /* number of elements */
|
||||
(const be_ctypes_structure_item_t[37]) {
|
||||
{ "cfg_end_angle", 11, 0, 0, 12 },
|
||||
{ "cfg_start_angle", 9, 0, 0, 12 },
|
||||
{ "cfg_vertex_p_x", 5, 0, 0, 12 },
|
||||
{ "cfg_vertex_p_y", 7, 0, 0, 12 },
|
||||
{ "delta_deg", 83, 0, 0, 2 },
|
||||
{ "dsc_cb", 0, 0, 0, 4 },
|
||||
{ "dsc_type", 4, 0, 0, 1 },
|
||||
{ "end_line_cfg_p1_x", 53, 0, 0, 12 },
|
||||
{ "end_line_cfg_p1_y", 55, 0, 0, 12 },
|
||||
{ "end_line_cfg_p2_x", 57, 0, 0, 12 },
|
||||
{ "end_line_cfg_p2_y", 59, 0, 0, 12 },
|
||||
{ "end_line_cfg_side", 61, 0, 2, 0 },
|
||||
{ "end_line_dsc_cb", 48, 0, 0, 4 },
|
||||
{ "end_line_dsc_type", 52, 0, 0, 1 },
|
||||
{ "end_line_flat", 82, 0, 1, 0 },
|
||||
{ "end_line_inv", 82, 1, 1, 0 },
|
||||
{ "end_line_origo_x", 62, 0, 0, 12 },
|
||||
{ "end_line_origo_y", 64, 0, 0, 12 },
|
||||
{ "end_line_spx", 78, 0, 0, 14 },
|
||||
{ "end_line_steep", 74, 0, 0, 14 },
|
||||
{ "end_line_xy_steep", 66, 0, 0, 14 },
|
||||
{ "end_line_yx_steep", 70, 0, 0, 14 },
|
||||
{ "start_line_cfg_p1_x", 18, 0, 0, 12 },
|
||||
{ "start_line_cfg_p1_y", 20, 0, 0, 12 },
|
||||
{ "start_line_cfg_p2_x", 22, 0, 0, 12 },
|
||||
{ "start_line_cfg_p2_y", 24, 0, 0, 12 },
|
||||
{ "start_line_cfg_side", 26, 0, 2, 0 },
|
||||
{ "start_line_dsc_cb", 13, 0, 0, 4 },
|
||||
{ "start_line_dsc_type", 17, 0, 0, 1 },
|
||||
{ "start_line_flat", 47, 0, 1, 0 },
|
||||
{ "start_line_inv", 47, 1, 1, 0 },
|
||||
{ "start_line_origo_x", 27, 0, 0, 12 },
|
||||
{ "start_line_origo_y", 29, 0, 0, 12 },
|
||||
{ "start_line_spx", 43, 0, 0, 14 },
|
||||
{ "start_line_steep", 39, 0, 0, 14 },
|
||||
{ "start_line_xy_steep", 31, 0, 0, 14 },
|
||||
{ "start_line_yx_steep", 35, 0, 0, 14 },
|
||||
}};
|
||||
|
||||
const be_ctypes_structure_t be_lv_draw_mask_radius_param_cfg_t = {
|
||||
11, /* size in bytes */
|
||||
6, /* number of elements */
|
||||
(const be_ctypes_structure_item_t[6]) {
|
||||
{ "outer", 10, 0, 1, 0 },
|
||||
{ "radius", 8, 0, 0, 12 },
|
||||
{ "rect_x1", 0, 0, 0, 12 },
|
||||
{ "rect_x2", 4, 0, 0, 12 },
|
||||
{ "rect_y1", 2, 0, 0, 12 },
|
||||
{ "rect_y2", 6, 0, 0, 12 },
|
||||
}};
|
||||
|
||||
const be_ctypes_structure_t be_lv_sqrt_res_t = {
|
||||
4, /* size in bytes */
|
||||
2, /* number of elements */
|
||||
(const be_ctypes_structure_item_t[2]) {
|
||||
{ "f", 2, 0, 0, 2 },
|
||||
{ "i", 0, 0, 0, 2 },
|
||||
}};
|
||||
|
||||
const be_ctypes_structure_t be_lv_draw_mask_radius_param_t = {
|
||||
24, /* size in bytes */
|
||||
11, /* number of elements */
|
||||
(const be_ctypes_structure_item_t[11]) {
|
||||
{ "cfg_outer", 15, 0, 1, 0 },
|
||||
{ "cfg_radius", 13, 0, 0, 12 },
|
||||
{ "cfg_rect_x1", 5, 0, 0, 12 },
|
||||
{ "cfg_rect_x2", 9, 0, 0, 12 },
|
||||
{ "cfg_rect_y1", 7, 0, 0, 12 },
|
||||
{ "cfg_rect_y2", 11, 0, 0, 12 },
|
||||
{ "dsc_cb", 0, 0, 0, 4 },
|
||||
{ "dsc_type", 4, 0, 0, 1 },
|
||||
{ "y_prev", 16, 0, 0, 14 },
|
||||
{ "y_prev_x_f", 22, 0, 0, 2 },
|
||||
{ "y_prev_x_i", 20, 0, 0, 2 },
|
||||
}};
|
||||
|
||||
const be_ctypes_structure_t be_lv_draw_mask_fade_param_cfg_t = {
|
||||
14, /* size in bytes */
|
||||
8, /* number of elements */
|
||||
(const be_ctypes_structure_item_t[8]) {
|
||||
{ "coords_x1", 0, 0, 0, 12 },
|
||||
{ "coords_x2", 4, 0, 0, 12 },
|
||||
{ "coords_y1", 2, 0, 0, 12 },
|
||||
{ "coords_y2", 6, 0, 0, 12 },
|
||||
{ "opa_bottom", 13, 0, 0, 1 },
|
||||
{ "opa_top", 12, 0, 0, 1 },
|
||||
{ "y_bottom", 10, 0, 0, 12 },
|
||||
{ "y_top", 8, 0, 0, 12 },
|
||||
}};
|
||||
|
||||
const be_ctypes_structure_t be_lv_draw_mask_fade_param_t = {
|
||||
19, /* size in bytes */
|
||||
10, /* number of elements */
|
||||
(const be_ctypes_structure_item_t[10]) {
|
||||
{ "cfg_coords_x1", 5, 0, 0, 12 },
|
||||
{ "cfg_coords_x2", 9, 0, 0, 12 },
|
||||
{ "cfg_coords_y1", 7, 0, 0, 12 },
|
||||
{ "cfg_coords_y2", 11, 0, 0, 12 },
|
||||
{ "cfg_opa_bottom", 18, 0, 0, 1 },
|
||||
{ "cfg_opa_top", 17, 0, 0, 1 },
|
||||
{ "cfg_y_bottom", 15, 0, 0, 12 },
|
||||
{ "cfg_y_top", 13, 0, 0, 12 },
|
||||
{ "dsc_cb", 0, 0, 0, 4 },
|
||||
{ "dsc_type", 4, 0, 0, 1 },
|
||||
}};
|
||||
|
||||
const be_ctypes_structure_t be_lv_draw_mask_map_param_cfg_t = {
|
||||
12, /* size in bytes */
|
||||
5, /* number of elements */
|
||||
(const be_ctypes_structure_item_t[5]) {
|
||||
{ "coords_x1", 0, 0, 0, 12 },
|
||||
{ "coords_x2", 4, 0, 0, 12 },
|
||||
{ "coords_y1", 2, 0, 0, 12 },
|
||||
{ "coords_y2", 6, 0, 0, 12 },
|
||||
{ "map", 8, 0, 0, 4 },
|
||||
}};
|
||||
|
||||
const be_ctypes_structure_t be_lv_draw_mask_map_param_t = {
|
||||
17, /* size in bytes */
|
||||
7, /* number of elements */
|
||||
(const be_ctypes_structure_item_t[7]) {
|
||||
{ "cfg_coords_x1", 5, 0, 0, 12 },
|
||||
{ "cfg_coords_x2", 9, 0, 0, 12 },
|
||||
{ "cfg_coords_y1", 7, 0, 0, 12 },
|
||||
{ "cfg_coords_y2", 11, 0, 0, 12 },
|
||||
{ "cfg_map", 13, 0, 0, 4 },
|
||||
{ "dsc_cb", 0, 0, 0, 4 },
|
||||
{ "dsc_type", 4, 0, 0, 1 },
|
||||
}};
|
||||
|
||||
const be_ctypes_structure_t be_lv_draw_mask_saved_t = {
|
||||
8, /* size in bytes */
|
||||
2, /* number of elements */
|
||||
(const be_ctypes_structure_item_t[2]) {
|
||||
{ "custom_id", 4, 0, 0, 4 },
|
||||
{ "param", 0, 0, 0, 4 },
|
||||
}};
|
||||
|
||||
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 },
|
||||
}};
|
||||
|
||||
/* @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)
|
||||
}
|
||||
@const_object_info_end */
|
||||
|
||||
void be_load_ctypes_definitions_lib(bvm *vm) {
|
||||
be_pushcomptr(vm, (void*) be_ctypes_classes);
|
||||
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);
|
||||
}
|
||||
|
||||
/*******************************************************************/
|
||||
|
||||
|
||||
#endif // USE_LVGL
|
|
@ -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_ctypes_lib(bvm *vm);
|
||||
extern void be_load_ctypes_definitions_lib(bvm *vm);
|
||||
#endif// USE_LVGL
|
||||
|
||||
/* this code loads the native class definitions */
|
||||
|
@ -126,6 +128,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_ctypes_lib(vm);
|
||||
be_load_ctypes_definitions_lib(vm);
|
||||
#endif // USE_LVGL
|
||||
}
|
||||
#endif
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,33 +1,34 @@
|
|||
#include "be_constobj.h"
|
||||
|
||||
static be_define_const_map_slots(be_class_bytes_map) {
|
||||
{ be_const_key(opt_add, -1), be_const_func(m_merge) },
|
||||
{ be_const_key(set, -1), be_const_func(m_set) },
|
||||
{ be_const_key(opt_connect, -1), be_const_func(m_connect) },
|
||||
{ be_const_key(tostring, 2), be_const_func(m_tostring) },
|
||||
{ be_const_key(size, -1), be_const_func(m_size) },
|
||||
{ be_const_key(get, -1), be_const_func(m_getu) },
|
||||
{ be_const_key(asstring, -1), be_const_func(m_asstring) },
|
||||
{ be_const_key(fromstring, -1), be_const_func(m_fromstring) },
|
||||
{ be_const_key(_buffer, -1), be_const_func(m_buffer) },
|
||||
{ be_const_key(resize, 10), be_const_func(m_resize) },
|
||||
{ be_const_key(asstring, 11), be_const_func(m_asstring) },
|
||||
{ be_const_key(init, -1), be_const_func(m_init) },
|
||||
{ be_const_key(item, 12), be_const_func(m_item) },
|
||||
{ be_const_key(getbits, -1), be_const_closure(getbits_closure) },
|
||||
{ be_const_key(add, -1), be_const_func(m_add) },
|
||||
{ be_const_key(setbits, -1), be_const_closure(setbits_closure) },
|
||||
{ be_const_key(copy, 7), be_const_func(m_copy) },
|
||||
{ be_const_key(dot_p, -1), be_const_int(0) },
|
||||
{ be_const_key(geti, -1), be_const_func(m_geti) },
|
||||
{ be_const_key(resize, -1), be_const_func(m_resize) },
|
||||
{ be_const_key(seti, -1), be_const_func(m_set) },
|
||||
{ be_const_key(setitem, -1), be_const_func(m_setitem) },
|
||||
{ be_const_key(opt_neq, 15), be_const_func(m_nequal) },
|
||||
{ be_const_key(clear, -1), be_const_func(m_clear) },
|
||||
{ be_const_key(item, 18), be_const_func(m_item) },
|
||||
{ be_const_key(dot_p, 3), be_const_int(0) },
|
||||
{ be_const_key(geti, -1), be_const_func(m_geti) },
|
||||
{ be_const_key(opt_connect, -1), be_const_func(m_connect) },
|
||||
{ be_const_key(tostring, -1), be_const_func(m_tostring) },
|
||||
{ be_const_key(size, -1), be_const_func(m_size) },
|
||||
{ be_const_key(getbits, -1), be_const_closure(getbits_closure) },
|
||||
{ be_const_key(fromstring, -1), be_const_func(m_fromstring) },
|
||||
{ be_const_key(opt_add, -1), be_const_func(m_merge) },
|
||||
{ be_const_key(_buffer, 2), be_const_func(m_buffer) },
|
||||
{ be_const_key(copy, 8), be_const_func(m_copy) },
|
||||
{ be_const_key(get, -1), be_const_func(m_getu) },
|
||||
{ be_const_key(set, -1), be_const_func(m_set) },
|
||||
{ be_const_key(opt_eq, -1), be_const_func(m_equal) },
|
||||
{ be_const_key(opt_neq, -1), be_const_func(m_nequal) },
|
||||
{ be_const_key(clear, 16), be_const_func(m_clear) },
|
||||
{ be_const_key(setbits, -1), be_const_closure(setbits_closure) },
|
||||
{ be_const_key(add, -1), be_const_func(m_add) },
|
||||
};
|
||||
|
||||
static be_define_const_map(
|
||||
be_class_bytes_map,
|
||||
22
|
||||
23
|
||||
);
|
||||
|
||||
BE_EXPORT_VARIABLE be_define_const_class(
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
#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) },
|
||||
};
|
||||
|
||||
static be_define_const_map(
|
||||
be_class_ctypes_classes_map,
|
||||
19
|
||||
);
|
||||
|
||||
BE_EXPORT_VARIABLE be_define_const_class(
|
||||
be_class_ctypes_classes,
|
||||
0,
|
||||
NULL,
|
||||
be_class_ctypes_classes
|
||||
);
|
|
@ -0,0 +1,20 @@
|
|||
#include "be_constobj.h"
|
||||
|
||||
static be_define_const_map_slots(be_class_lv_ctypes_map) {
|
||||
{ be_const_key(dot_def, -1), be_const_int(0) },
|
||||
{ be_const_key(setmember, -1), be_const_func(be_ctypes_setmember) },
|
||||
{ be_const_key(init, -1), be_const_func(be_ctypes_init) },
|
||||
{ be_const_key(member, 2), be_const_func(be_ctypes_member) },
|
||||
};
|
||||
|
||||
static be_define_const_map(
|
||||
be_class_lv_ctypes_map,
|
||||
4
|
||||
);
|
||||
|
||||
BE_EXPORT_VARIABLE be_define_const_class(
|
||||
be_class_lv_ctypes,
|
||||
1,
|
||||
(bclass *)&be_class_bytes,
|
||||
ctypes_bytes
|
||||
);
|
|
@ -763,7 +763,6 @@ class Bytes : bytes
|
|||
#- Reads a bit-field in a `bytes()` object
|
||||
#-
|
||||
#- Input:
|
||||
#- offset_bytes (int): byte offset in the bytes() object
|
||||
#- offset_bits (int): bit number to start reading from (0 = LSB)
|
||||
#- len_bits (int): how many bits to read
|
||||
#- Output:
|
||||
|
@ -801,11 +800,9 @@ class Bytes : bytes
|
|||
#- Writes a bit-field in a `bytes()` object
|
||||
#-
|
||||
#- Input:
|
||||
#- offset_bytes (int): byte offset in the bytes() object
|
||||
#- offset_bits (int): bit number to start writing to (0 = LSB)
|
||||
#- len_bits (int): how many bits to write
|
||||
#- Output:
|
||||
#- bytes() object modified (by reference)
|
||||
#- val (int): value to set
|
||||
#-------------------------------------------------------------#
|
||||
def setbits(offset_bits, len_bits, val)
|
||||
if len_bits < 0 || len_bits > 32 raise "value_error", "length in bits must be between 0 and 32" end
|
||||
|
@ -966,6 +963,7 @@ void be_load_byteslib(bvm *vm)
|
|||
{ "get", m_getu },
|
||||
{ "geti", m_geti },
|
||||
{ "set", m_set },
|
||||
{ "seti", m_set }, // setters for signed and unsigned are identical
|
||||
{ "item", m_item },
|
||||
{ "setitem", m_setitem },
|
||||
{ "size", m_size },
|
||||
|
@ -998,6 +996,7 @@ class be_class_bytes (scope: global, name: bytes) {
|
|||
get, func(m_getu)
|
||||
geti, func(m_geti)
|
||||
set, func(m_set)
|
||||
seti, func(m_set)
|
||||
item, func(m_item)
|
||||
setitem, func(m_setitem)
|
||||
size, func(m_size)
|
||||
|
|
|
@ -83,11 +83,20 @@ const bmap _name = { \
|
|||
const bclass _name = { \
|
||||
be_const_header(BE_CLASS), \
|
||||
.nvar = _nvar, \
|
||||
.super = _super, \
|
||||
.super = (bclass*)_super, \
|
||||
.members = (bmap*)&_name##_map, \
|
||||
.name = (bstring*)&be_const_str_##_name_ \
|
||||
}
|
||||
|
||||
#define be_define_const_empty_class(_name, _super, _name_) \
|
||||
const bclass _name = { \
|
||||
be_const_header(BE_CLASS), \
|
||||
.nvar = 0, \
|
||||
.super = (bclass*)_super, \
|
||||
.members = NULL, \
|
||||
.name = (bstring*)&be_const_str_##_name_ \
|
||||
}
|
||||
|
||||
#define be_define_const_module(_name, _name_) \
|
||||
const bmodule _name = { \
|
||||
be_const_header(BE_MODULE), \
|
||||
|
@ -166,7 +175,13 @@ const bmap _name( \
|
|||
|
||||
#define be_define_const_class(_name, _nvar, _super, _name_) \
|
||||
const bclass _name( \
|
||||
_nvar, _super, (bmap*)&_name##_map, \
|
||||
_nvar, (bclass*)_super, (bmap*)&_name##_map, \
|
||||
(bstring*)&be_const_str_##_name_ \
|
||||
)
|
||||
|
||||
#define be_define_const_empty_class(_name, _super, _name_) \
|
||||
const bclass _name( \
|
||||
0, (bclass*)_super, NULL, \
|
||||
(bstring*)&be_const_str_##_name_ \
|
||||
)
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ ctypes.be_u32 = -4
|
|||
ctypes.be_u16 = -2
|
||||
ctypes.be_u8 = -1
|
||||
|
||||
ctypes.bf_x = 0 # generic bitfield
|
||||
# bitfields (always unsigned)
|
||||
ctypes.bf_0 = 100 # serves as base
|
||||
ctypes.bf_1 = 101
|
||||
|
@ -157,14 +158,56 @@ ctypes.print_types = def ()
|
|||
print(" ctypes_str = 3,")
|
||||
print("};")
|
||||
print()
|
||||
print("typedef struct be_ctypes_structure_t {")
|
||||
print("typedef struct be_ctypes_structure_item_t {")
|
||||
print(" const char * name;")
|
||||
print(" uint16_t offset_bits;")
|
||||
print(" uint16_t len_bits : 13;")
|
||||
print(" uint16_t type : 3;")
|
||||
print("} be_ctypes_structure_item_t;")
|
||||
print()
|
||||
print("typedef struct be_ctypes_structure_t {")
|
||||
print(" uint16_t size_bytes; /* size in bytes */")
|
||||
print(" uint16_t size_elt; /* number of elements */")
|
||||
print(" const be_ctypes_structure_item_t * items;")
|
||||
print("} be_ctypes_structure_t;")
|
||||
print()
|
||||
end
|
||||
|
||||
global_classes = [] # track the list of all classes and
|
||||
ctypes.print_classes = def ()
|
||||
ctypes.sort(global_classes)
|
||||
|
||||
print("const be_ctypes_classes_t be_ctypes_classes[] = {")
|
||||
print(string.format(" %i,", size(global_classes)))
|
||||
print(string.format(" (const be_ctypes_class_t[%i]) {", size(global_classes)))
|
||||
|
||||
for elt:global_classes
|
||||
print(string.format(" { \"%s\", &be_%s },", elt, elt))
|
||||
end
|
||||
|
||||
print("}};")
|
||||
print()
|
||||
print("/* @const_object_info_begin")
|
||||
print("class be_class_ctypes_classes (scope: global) {")
|
||||
for elt:global_classes
|
||||
print(string.format(" %s, int(0)", elt))
|
||||
end
|
||||
print("}")
|
||||
print("@const_object_info_end */")
|
||||
print()
|
||||
|
||||
print("void be_load_ctypes_definitions_lib(bvm *vm) {")
|
||||
print(" be_pushcomptr(vm, (void*) be_ctypes_classes);")
|
||||
print(" be_setglobal(vm, \".ctypes_classes\");")
|
||||
print(" be_pop(vm, 1);")
|
||||
print()
|
||||
for elt:global_classes
|
||||
print(string.format(" static be_define_const_empty_class(be_class_%s, &be_class_lv_ctypes, %s);", elt, elt))
|
||||
print(string.format(" ctypes_register_class(vm, &be_class_%s, &be_%s);", elt, elt))
|
||||
end
|
||||
print("}")
|
||||
|
||||
end
|
||||
|
||||
#-------------------------------------------------------------
|
||||
#- 'ctypes.structure' class
|
||||
|
@ -203,23 +246,29 @@ class structure
|
|||
self.parse_line(map_line)
|
||||
end
|
||||
|
||||
# clear any outstanding bitfield
|
||||
self.align(1)
|
||||
self.size_bytes = self.cur_offset
|
||||
|
||||
if name != nil
|
||||
print(string.format("const be_ctypes_structure_t be_%s[%d] = {", name, size(self.mapping)))
|
||||
print(string.format("const be_ctypes_structure_t be_%s = {", name))
|
||||
print(string.format(" %i, /* size in bytes */", self.size_bytes))
|
||||
print(string.format(" %i, /* number of elements */", size(self.mapping)))
|
||||
print(string.format(" (const be_ctypes_structure_item_t[%i]) {", size(self.mapping)))
|
||||
# list keys for future binary search
|
||||
var names = []
|
||||
for n:self.mapping.keys() names.push(n) end # convert to list
|
||||
ctypes.sort(names)
|
||||
for n:names
|
||||
var args = self.mapping[n]
|
||||
print(string.format(" { \"%s\", %i, %i, %s },", n, args[0], args[1], args[2]))
|
||||
print(string.format(" { \"%s\", %i, %i, %i, %i },", n, args[0], args[1], args[2], args[3]))
|
||||
end
|
||||
print("};")
|
||||
print("}};")
|
||||
print()
|
||||
end
|
||||
|
||||
# clear any outstanding bitfield
|
||||
self.align(1)
|
||||
self.size_bytes = self.cur_offset
|
||||
# retain class definition
|
||||
global_classes.push(name)
|
||||
end
|
||||
end
|
||||
|
||||
def size()
|
||||
|
@ -277,10 +326,10 @@ class structure
|
|||
|
||||
var offset = self.cur_offset # var for closure
|
||||
|
||||
# inlcude nested
|
||||
# include nested
|
||||
for subname:type_obj.mapping.keys()
|
||||
var val = type_obj.mapping[subname]
|
||||
self.mapping[name+"_"+subname] = [val[0] + (offset << 3), val[1], val[2]]
|
||||
self.mapping[name+"_"+subname] = [val[0] + offset, val[1], val[2], val[3]]
|
||||
end
|
||||
# self.mapping[name] = [offset << 3, sub_size << 3]
|
||||
|
||||
|
@ -290,17 +339,17 @@ class structure
|
|||
self.cur_offset += sub_size
|
||||
end
|
||||
|
||||
def get_int_closure(name, size_in_bytes_le_be) # can be 1/2/4
|
||||
def get_int_closure(name, type) # can be 1/2/4
|
||||
#- abs size -#
|
||||
var size_in_bytes = size_in_bytes_le_be < 0 ? - size_in_bytes_le_be : size_in_bytes_le_be
|
||||
var size_in_bytes = type < 0 ? - type : type
|
||||
var signed = size_in_bytes > 10
|
||||
size_in_bytes_le_be = size_in_bytes_le_be % 10 # remove sign marker
|
||||
var size_in_bytes_le_be = type % 10 # remove sign marker
|
||||
size_in_bytes = size_in_bytes % 10 # remove sign marker
|
||||
|
||||
self.align(size_in_bytes) # force alignment
|
||||
var offset = self.cur_offset # prepare variable for capture in closure
|
||||
|
||||
self.mapping[name] = [offset << 3, size_in_bytes_le_be << 3, signed ? "ctypes_int" : "ctypes_uint"]
|
||||
self.mapping[name] = [offset, 0, 0, type]
|
||||
|
||||
#- add closures -#
|
||||
if signed
|
||||
|
@ -317,7 +366,7 @@ class structure
|
|||
def get_bitfield_closure(name, size_in_bits) # can be 1..32
|
||||
var cur_offset = self.cur_offset # prepare variable for capture in closure
|
||||
var bit_offset = self.bit_offset
|
||||
self.mapping[name] = [bit_offset + (cur_offset << 3), size_in_bits, "ctypes_uint"]
|
||||
self.mapping[name] = [cur_offset, bit_offset, size_in_bits, 0]
|
||||
self.get_closures[name] = def (b, p) return ctypes.get_bits(b, cur_offset + p, bit_offset, size_in_bits) end
|
||||
self.set_closures[name] = def (b, p, v) return ctypes.set_bits(b, cur_offset+ p, bit_offset, size_in_bits, v) end
|
||||
|
||||
|
@ -446,9 +495,9 @@ return ctypes
|
|||
# > bb.e
|
||||
# key_error: e
|
||||
# stack traceback:
|
||||
# <native>: in native function
|
||||
# stdin:11: in function `member`
|
||||
# stdin:1: in function `main`
|
||||
# <native>: in native function
|
||||
# stdin:11: in function `member`
|
||||
# stdin:1: in function `main`
|
||||
|
||||
|
||||
# > bb['a']
|
||||
|
|
|
@ -43,11 +43,11 @@ lv_area_t = [
|
|||
]
|
||||
lv_area_t = ctypes.structure(lv_area_t, "lv_area_t")
|
||||
|
||||
test_t = [
|
||||
[lv_area_t, "a"],
|
||||
[lv_area_t, "b"]
|
||||
]
|
||||
test_t = ctypes.structure(test_t, "test_t")
|
||||
# test_t = [
|
||||
# [lv_area_t, "a"],
|
||||
# [lv_area_t, "b"]
|
||||
# ]
|
||||
# test_t = ctypes.structure(test_t, "test_t")
|
||||
|
||||
lv_draw_rect_dsc_t = [
|
||||
[lv_style_int_t, "radius"],
|
||||
|
@ -275,6 +275,8 @@ lv_draw_mask_saved_t = [
|
|||
]
|
||||
lv_draw_mask_saved_t = ctypes.structure(lv_draw_mask_saved_t, "lv_draw_mask_saved_t")
|
||||
|
||||
#
|
||||
ctypes.print_classes()
|
||||
|
||||
# Ex:
|
||||
# bb = ctypes.buffer(test_t, bytes("0101020203030404FFFFFEFEFCFC8080"))
|
||||
|
|
|
@ -176,6 +176,7 @@ extern "C" {
|
|||
// the first 4 bytes are a pointer to a string
|
||||
// returns 0..total_elements-1 or -1 if not found
|
||||
extern "C" {
|
||||
int32_t bin_search(const char * needle, const void * table, size_t elt_size, size_t total_elements);
|
||||
int32_t bin_search(const char * needle, const void * table, size_t elt_size, size_t total_elements) {
|
||||
int32_t low = 0;
|
||||
int32_t high = total_elements - 1;
|
||||
|
|
|
@ -1,318 +0,0 @@
|
|||
/*
|
||||
xdrv_52_3_berry_native.ino - Berry scripting language, native fucnctions
|
||||
|
||||
Copyright (C) 2021 Stephan Hadinger, Berry language by Guan Wenliang https://github.com/Skiars/berry
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef USE_BERRY
|
||||
#ifdef USE_LVGL
|
||||
|
||||
#include <berry.h>
|
||||
#include "lvgl.h"
|
||||
#include "be_lvgl.h"
|
||||
|
||||
// Berry easy logging
|
||||
extern "C" {
|
||||
extern void berry_log_C(const char * berry_buf, ...);
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************
|
||||
* Generated code, don't edit
|
||||
*******************************************************************/
|
||||
enum {
|
||||
ctypes_ptr = 0,
|
||||
ctypes_uint = 1,
|
||||
ctypes_int = 2,
|
||||
ctypes_str = 3,
|
||||
};
|
||||
|
||||
typedef struct be_ctypes_structure_t {
|
||||
const char * name;
|
||||
uint16_t offset_bits;
|
||||
uint16_t len_bits : 13;
|
||||
uint16_t type : 3;
|
||||
} be_ctypes_structure_t;
|
||||
const be_ctypes_structure_t be_lv_point_t[2] = {
|
||||
{ "x", 0, 16, ctypes_int },
|
||||
{ "y", 16, 16, ctypes_int },
|
||||
};
|
||||
|
||||
const be_ctypes_structure_t be_lv_area_t[4] = {
|
||||
{ "x1", 0, 16, ctypes_int },
|
||||
{ "x2", 32, 16, ctypes_int },
|
||||
{ "y1", 16, 16, ctypes_int },
|
||||
{ "y2", 48, 16, ctypes_int },
|
||||
};
|
||||
|
||||
const be_ctypes_structure_t be_test_t[8] = {
|
||||
{ "a_x1", 0, 16, ctypes_int },
|
||||
{ "a_x2", 32, 16, ctypes_int },
|
||||
{ "a_y1", 16, 16, ctypes_int },
|
||||
{ "a_y2", 48, 16, ctypes_int },
|
||||
{ "b_x1", 64, 16, ctypes_int },
|
||||
{ "b_x2", 96, 16, ctypes_int },
|
||||
{ "b_y1", 80, 16, ctypes_int },
|
||||
{ "b_y2", 112, 16, ctypes_int },
|
||||
};
|
||||
|
||||
const be_ctypes_structure_t be_lv_draw_rect_dsc_t[43] = {
|
||||
{ "bg_blend_mode", 96, 8, ctypes_uint },
|
||||
{ "bg_color", 16, 16, ctypes_uint },
|
||||
{ "bg_grad_color", 32, 16, ctypes_uint },
|
||||
{ "bg_grad_color_stop", 72, 16, ctypes_int },
|
||||
{ "bg_grad_dir", 48, 8, ctypes_uint },
|
||||
{ "bg_main_color_stop", 56, 16, ctypes_int },
|
||||
{ "bg_opa", 88, 8, ctypes_uint },
|
||||
{ "border_blend_mode", 160, 8, ctypes_uint },
|
||||
{ "border_color", 104, 16, ctypes_uint },
|
||||
{ "border_opa", 152, 8, ctypes_uint },
|
||||
{ "border_post", 168, 1, ctypes_uint },
|
||||
{ "border_side", 136, 16, ctypes_int },
|
||||
{ "border_width", 120, 16, ctypes_int },
|
||||
{ "outline_blend_mode", 232, 8, ctypes_uint },
|
||||
{ "outline_color", 176, 16, ctypes_uint },
|
||||
{ "outline_opa", 224, 8, ctypes_uint },
|
||||
{ "outline_pad", 208, 16, ctypes_int },
|
||||
{ "outline_width", 192, 16, ctypes_int },
|
||||
{ "pattern_blend_mode", 440, 8, ctypes_uint },
|
||||
{ "pattern_font", 368, 32, ctypes_uint },
|
||||
{ "pattern_image", 336, 32, ctypes_uint },
|
||||
{ "pattern_opa", 416, 8, ctypes_uint },
|
||||
{ "pattern_recolor", 400, 16, ctypes_uint },
|
||||
{ "pattern_recolor_opa", 424, 8, ctypes_uint },
|
||||
{ "pattern_repeat", 432, 1, ctypes_uint },
|
||||
{ "radius", 0, 16, ctypes_int },
|
||||
{ "shadow_blend_mode", 328, 8, ctypes_uint },
|
||||
{ "shadow_color", 240, 16, ctypes_uint },
|
||||
{ "shadow_ofs_x", 272, 16, ctypes_int },
|
||||
{ "shadow_ofs_y", 288, 16, ctypes_int },
|
||||
{ "shadow_opa", 320, 8, ctypes_uint },
|
||||
{ "shadow_spread", 304, 16, ctypes_int },
|
||||
{ "shadow_width", 256, 16, ctypes_int },
|
||||
{ "value_align", 600, 8, ctypes_uint },
|
||||
{ "value_blend_mode", 608, 8, ctypes_uint },
|
||||
{ "value_color", 520, 16, ctypes_uint },
|
||||
{ "value_font", 480, 32, ctypes_uint },
|
||||
{ "value_letter_space", 568, 16, ctypes_int },
|
||||
{ "value_line_space", 584, 16, ctypes_int },
|
||||
{ "value_ofs_x", 536, 16, ctypes_int },
|
||||
{ "value_ofs_y", 552, 16, ctypes_int },
|
||||
{ "value_opa", 512, 8, ctypes_uint },
|
||||
{ "value_str", 448, 32, ctypes_uint },
|
||||
};
|
||||
|
||||
const be_ctypes_structure_t be_lv_draw_line_dsc_t[9] = {
|
||||
{ "blend_mode", 72, 2, ctypes_uint },
|
||||
{ "color", 0, 16, ctypes_uint },
|
||||
{ "dash_gap", 48, 16, ctypes_int },
|
||||
{ "dash_width", 32, 16, ctypes_int },
|
||||
{ "opa", 64, 8, ctypes_uint },
|
||||
{ "raw_end", 76, 1, ctypes_uint },
|
||||
{ "round_end", 75, 1, ctypes_uint },
|
||||
{ "round_start", 74, 1, ctypes_uint },
|
||||
{ "width", 16, 16, ctypes_int },
|
||||
};
|
||||
|
||||
const be_ctypes_structure_t be_lv_draw_img_dsc_t[9] = {
|
||||
{ "angle", 8, 16, ctypes_uint },
|
||||
{ "antialias", 104, 1, ctypes_uint },
|
||||
{ "blend_mode", 96, 8, ctypes_uint },
|
||||
{ "opa", 0, 8, ctypes_uint },
|
||||
{ "pivot_x", 24, 16, ctypes_int },
|
||||
{ "pivot_y", 40, 16, ctypes_int },
|
||||
{ "recolor", 80, 16, ctypes_uint },
|
||||
{ "recolor_opa", 72, 8, ctypes_uint },
|
||||
{ "zoom", 56, 16, ctypes_uint },
|
||||
};
|
||||
|
||||
const be_ctypes_structure_t be_lv_draw_label_dsc_t[15] = {
|
||||
{ "bidi_dir", 216, 8, ctypes_uint },
|
||||
{ "blend_mode", 240, 8, ctypes_uint },
|
||||
{ "color", 0, 16, ctypes_uint },
|
||||
{ "decor", 232, 8, ctypes_uint },
|
||||
{ "flag", 224, 8, ctypes_uint },
|
||||
{ "font", 48, 32, ctypes_uint },
|
||||
{ "letter_space", 104, 16, ctypes_int },
|
||||
{ "line_space", 88, 16, ctypes_int },
|
||||
{ "ofs_x", 184, 16, ctypes_int },
|
||||
{ "ofs_y", 200, 16, ctypes_int },
|
||||
{ "opa", 80, 8, ctypes_uint },
|
||||
{ "sel_bg_color", 32, 16, ctypes_uint },
|
||||
{ "sel_color", 16, 16, ctypes_uint },
|
||||
{ "sel_end", 152, 32, ctypes_uint },
|
||||
{ "sel_start", 120, 32, ctypes_uint },
|
||||
};
|
||||
|
||||
const be_ctypes_structure_t be_lv_draw_mask_common_dsc_t[2] = {
|
||||
{ "cb", 0, 32, ctypes_uint },
|
||||
{ "type", 32, 8, ctypes_uint },
|
||||
};
|
||||
|
||||
const be_ctypes_structure_t be_lv_draw_mask_line_param_cfg_t[5] = {
|
||||
{ "p1_x", 0, 16, ctypes_int },
|
||||
{ "p1_y", 16, 16, ctypes_int },
|
||||
{ "p2_x", 32, 16, ctypes_int },
|
||||
{ "p2_y", 48, 16, ctypes_int },
|
||||
{ "side", 64, 2, ctypes_uint },
|
||||
};
|
||||
|
||||
const be_ctypes_structure_t be_lv_draw_mask_line_param_t[15] = {
|
||||
{ "cfg_p1_x", 40, 16, ctypes_int },
|
||||
{ "cfg_p1_y", 56, 16, ctypes_int },
|
||||
{ "cfg_p2_x", 72, 16, ctypes_int },
|
||||
{ "cfg_p2_y", 88, 16, ctypes_int },
|
||||
{ "cfg_side", 104, 2, ctypes_uint },
|
||||
{ "dsc_cb", 0, 32, ctypes_uint },
|
||||
{ "dsc_type", 32, 8, ctypes_uint },
|
||||
{ "flat", 272, 1, ctypes_uint },
|
||||
{ "inv", 273, 1, ctypes_uint },
|
||||
{ "origo_x", 112, 16, ctypes_int },
|
||||
{ "origo_y", 128, 16, ctypes_int },
|
||||
{ "spx", 240, 32, ctypes_int },
|
||||
{ "steep", 208, 32, ctypes_int },
|
||||
{ "xy_steep", 144, 32, ctypes_int },
|
||||
{ "yx_steep", 176, 32, ctypes_int },
|
||||
};
|
||||
|
||||
const be_ctypes_structure_t be_lv_draw_mask_angle_param_cfg_t[4] = {
|
||||
{ "end_angle", 48, 16, ctypes_int },
|
||||
{ "start_angle", 32, 16, ctypes_int },
|
||||
{ "vertex_p_x", 0, 16, ctypes_int },
|
||||
{ "vertex_p_y", 16, 16, ctypes_int },
|
||||
};
|
||||
|
||||
const be_ctypes_structure_t be_lv_draw_mask_angle_param_t[37] = {
|
||||
{ "cfg_end_angle", 88, 16, ctypes_int },
|
||||
{ "cfg_start_angle", 72, 16, ctypes_int },
|
||||
{ "cfg_vertex_p_x", 40, 16, ctypes_int },
|
||||
{ "cfg_vertex_p_y", 56, 16, ctypes_int },
|
||||
{ "delta_deg", 664, 16, ctypes_uint },
|
||||
{ "dsc_cb", 0, 32, ctypes_uint },
|
||||
{ "dsc_type", 32, 8, ctypes_uint },
|
||||
{ "end_line_cfg_p1_x", 424, 16, ctypes_int },
|
||||
{ "end_line_cfg_p1_y", 440, 16, ctypes_int },
|
||||
{ "end_line_cfg_p2_x", 456, 16, ctypes_int },
|
||||
{ "end_line_cfg_p2_y", 472, 16, ctypes_int },
|
||||
{ "end_line_cfg_side", 488, 2, ctypes_uint },
|
||||
{ "end_line_dsc_cb", 384, 32, ctypes_uint },
|
||||
{ "end_line_dsc_type", 416, 8, ctypes_uint },
|
||||
{ "end_line_flat", 656, 1, ctypes_uint },
|
||||
{ "end_line_inv", 657, 1, ctypes_uint },
|
||||
{ "end_line_origo_x", 496, 16, ctypes_int },
|
||||
{ "end_line_origo_y", 512, 16, ctypes_int },
|
||||
{ "end_line_spx", 624, 32, ctypes_int },
|
||||
{ "end_line_steep", 592, 32, ctypes_int },
|
||||
{ "end_line_xy_steep", 528, 32, ctypes_int },
|
||||
{ "end_line_yx_steep", 560, 32, ctypes_int },
|
||||
{ "start_line_cfg_p1_x", 144, 16, ctypes_int },
|
||||
{ "start_line_cfg_p1_y", 160, 16, ctypes_int },
|
||||
{ "start_line_cfg_p2_x", 176, 16, ctypes_int },
|
||||
{ "start_line_cfg_p2_y", 192, 16, ctypes_int },
|
||||
{ "start_line_cfg_side", 208, 2, ctypes_uint },
|
||||
{ "start_line_dsc_cb", 104, 32, ctypes_uint },
|
||||
{ "start_line_dsc_type", 136, 8, ctypes_uint },
|
||||
{ "start_line_flat", 376, 1, ctypes_uint },
|
||||
{ "start_line_inv", 377, 1, ctypes_uint },
|
||||
{ "start_line_origo_x", 216, 16, ctypes_int },
|
||||
{ "start_line_origo_y", 232, 16, ctypes_int },
|
||||
{ "start_line_spx", 344, 32, ctypes_int },
|
||||
{ "start_line_steep", 312, 32, ctypes_int },
|
||||
{ "start_line_xy_steep", 248, 32, ctypes_int },
|
||||
{ "start_line_yx_steep", 280, 32, ctypes_int },
|
||||
};
|
||||
|
||||
const be_ctypes_structure_t be_lv_draw_mask_radius_param_cfg_t[6] = {
|
||||
{ "outer", 80, 1, ctypes_uint },
|
||||
{ "radius", 64, 16, ctypes_int },
|
||||
{ "rect_x1", 0, 16, ctypes_int },
|
||||
{ "rect_x2", 32, 16, ctypes_int },
|
||||
{ "rect_y1", 16, 16, ctypes_int },
|
||||
{ "rect_y2", 48, 16, ctypes_int },
|
||||
};
|
||||
|
||||
const be_ctypes_structure_t be_lv_sqrt_res_t[2] = {
|
||||
{ "f", 16, 16, ctypes_uint },
|
||||
{ "i", 0, 16, ctypes_uint },
|
||||
};
|
||||
|
||||
const be_ctypes_structure_t be_lv_draw_mask_radius_param_t[11] = {
|
||||
{ "cfg_outer", 120, 1, ctypes_uint },
|
||||
{ "cfg_radius", 104, 16, ctypes_int },
|
||||
{ "cfg_rect_x1", 40, 16, ctypes_int },
|
||||
{ "cfg_rect_x2", 72, 16, ctypes_int },
|
||||
{ "cfg_rect_y1", 56, 16, ctypes_int },
|
||||
{ "cfg_rect_y2", 88, 16, ctypes_int },
|
||||
{ "dsc_cb", 0, 32, ctypes_uint },
|
||||
{ "dsc_type", 32, 8, ctypes_uint },
|
||||
{ "y_prev", 128, 32, ctypes_int },
|
||||
{ "y_prev_x_f", 176, 16, ctypes_uint },
|
||||
{ "y_prev_x_i", 160, 16, ctypes_uint },
|
||||
};
|
||||
|
||||
const be_ctypes_structure_t be_lv_draw_mask_fade_param_cfg_t[8] = {
|
||||
{ "coords_x1", 0, 16, ctypes_int },
|
||||
{ "coords_x2", 32, 16, ctypes_int },
|
||||
{ "coords_y1", 16, 16, ctypes_int },
|
||||
{ "coords_y2", 48, 16, ctypes_int },
|
||||
{ "opa_bottom", 104, 8, ctypes_uint },
|
||||
{ "opa_top", 96, 8, ctypes_uint },
|
||||
{ "y_bottom", 80, 16, ctypes_int },
|
||||
{ "y_top", 64, 16, ctypes_int },
|
||||
};
|
||||
|
||||
const be_ctypes_structure_t be_lv_draw_mask_fade_param_t[10] = {
|
||||
{ "cfg_coords_x1", 40, 16, ctypes_int },
|
||||
{ "cfg_coords_x2", 72, 16, ctypes_int },
|
||||
{ "cfg_coords_y1", 56, 16, ctypes_int },
|
||||
{ "cfg_coords_y2", 88, 16, ctypes_int },
|
||||
{ "cfg_opa_bottom", 144, 8, ctypes_uint },
|
||||
{ "cfg_opa_top", 136, 8, ctypes_uint },
|
||||
{ "cfg_y_bottom", 120, 16, ctypes_int },
|
||||
{ "cfg_y_top", 104, 16, ctypes_int },
|
||||
{ "dsc_cb", 0, 32, ctypes_uint },
|
||||
{ "dsc_type", 32, 8, ctypes_uint },
|
||||
};
|
||||
|
||||
const be_ctypes_structure_t be_lv_draw_mask_map_param_cfg_t[5] = {
|
||||
{ "coords_x1", 0, 16, ctypes_int },
|
||||
{ "coords_x2", 32, 16, ctypes_int },
|
||||
{ "coords_y1", 16, 16, ctypes_int },
|
||||
{ "coords_y2", 48, 16, ctypes_int },
|
||||
{ "map", 64, 32, ctypes_uint },
|
||||
};
|
||||
|
||||
const be_ctypes_structure_t be_lv_draw_mask_map_param_t[7] = {
|
||||
{ "cfg_coords_x1", 40, 16, ctypes_int },
|
||||
{ "cfg_coords_x2", 72, 16, ctypes_int },
|
||||
{ "cfg_coords_y1", 56, 16, ctypes_int },
|
||||
{ "cfg_coords_y2", 88, 16, ctypes_int },
|
||||
{ "cfg_map", 104, 32, ctypes_uint },
|
||||
{ "dsc_cb", 0, 32, ctypes_uint },
|
||||
{ "dsc_type", 32, 8, ctypes_uint },
|
||||
};
|
||||
|
||||
const be_ctypes_structure_t be_lv_draw_mask_saved_t[2] = {
|
||||
{ "custom_id", 32, 32, ctypes_uint },
|
||||
{ "param", 0, 32, ctypes_uint },
|
||||
};
|
||||
|
||||
/********************************************************************/
|
||||
|
||||
#endif // USE_LVGL
|
||||
|
||||
#endif // USE_BERRY
|
Loading…
Reference in New Issue