Skip to content

Commit abb7ea4

Browse files
committed
Updated LVGL defs from 8.x to LVGL 9.x
1 parent 58113f2 commit abb7ea4

File tree

2 files changed

+19
-16
lines changed

2 files changed

+19
-16
lines changed

gen/lvgl_api_gen_mpy.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ def get_path(name: str, p: str) -> str:
239239
if args.board == 'win':
240240
sdl2_include, _ = get_sdl2()
241241
cpp_args.append(f'-I"{sdl2_include}"')
242-
242+
243243
elif sys.platform.startswith('darwin'):
244244
cpp_args = ['-std=c11']
245245
cpp_path = 'clang'
@@ -583,8 +583,8 @@ def is_struct(type):
583583
gen = c_generator.CGenerator()
584584

585585
ast = pycparser.parse_file(
586-
args.input[0],
587-
use_cpp=True,
586+
args.input[0],
587+
use_cpp=True,
588588
cpp_path=cpp_path,
589589
cpp_args=cpp_args
590590
)
@@ -711,7 +711,7 @@ def my_excepthook(exc_type, exc_value, tb):
711711
# # check if it's found in `structs_without_typedef`. It actually has the typedef. Replace type with it.
712712
# if typedef.type.name in structs_without_typedef:
713713
# typedef.type = structs_without_typedef[struct_name]
714-
#
714+
#
715715
# structs = collections.OrderedDict((typedef.declname, typedef.type) for typedef in struct_typedefs if typedef.declname and typedef.type.decls) # and not lv_base_obj_pattern.match(typedef.declname))
716716
structs.update(structs_without_typedef) # This is for struct without typedef
717717
explicit_structs = collections.OrderedDict((typedef.type.name, typedef.declname) for typedef in struct_typedefs if typedef.type.name) # and not lv_base_obj_pattern.match(typedef.type.name))
@@ -1161,6 +1161,9 @@ def register_int_ptr_type(convertor, *types):
11611161
# Emit Header
11621162
#
11631163

1164+
if 'src/core/lv_global.h' not in args.input:
1165+
args.input.append('src/core/lv_global.h')
1166+
11641167
print ("""
11651168
/*
11661169
* Auto-Generated file, DO NOT EDIT!
@@ -1236,7 +1239,7 @@ def register_int_ptr_type(convertor, *types):
12361239
#define GENMPY_UNUSED
12371240
#endif // __GNUC__
12381241
#endif // GENMPY_UNUSED
1239-
1242+
12401243
// Custom function mp object
12411244
12421245
typedef mp_obj_t (*mp_fun_ptr_var_t)(size_t n, const mp_obj_t *, void *ptr);
@@ -1398,9 +1401,9 @@ def register_int_ptr_type(convertor, *types):
13981401
13991402
static void mp_lv_delete_cb(lv_event_t * e)
14001403
{
1401-
LV_OBJ_T *lv_obj = e->current_target;
1402-
if (lv_obj){
1403-
mp_lv_obj_t *self = lv_obj->user_data;
1404+
lv_obj_t *obj = (lv_obj_t *)lv_event_get_current_target(e);
1405+
if (obj){
1406+
mp_lv_obj_t *self = lv_obj_get_user_data(obj);
14041407
if (self) {
14051408
self->lv_obj = NULL;
14061409
}
@@ -1410,7 +1413,7 @@ def register_int_ptr_type(convertor, *types):
14101413
static inline mp_obj_t lv_to_mp(LV_OBJ_T *lv_obj)
14111414
{
14121415
if (lv_obj == NULL) return mp_const_none;
1413-
mp_lv_obj_t *self = (mp_lv_obj_t*)lv_obj->user_data;
1416+
mp_lv_obj_t *self = (mp_lv_obj_t*)lv_obj_get_user_data(lv_obj);
14141417
if (!self)
14151418
{
14161419
// Create the MP object
@@ -1421,7 +1424,7 @@ def register_int_ptr_type(convertor, *types):
14211424
};
14221425
14231426
// Register the Python object in user_data
1424-
lv_obj->user_data = self;
1427+
lv_obj_set_user_data(lv_obj, self);
14251428
14261429
// Register a "Delete" event callback
14271430
lv_obj_add_event_cb(lv_obj, mp_lv_delete_cb, LV_EVENT_DELETE, NULL);
@@ -3603,7 +3606,7 @@ def _iter_metadata(d, indent=0):
36033606

36043607
import stub_gen
36053608

3606-
stub_gen.run(args.metadata)
3609+
stub_gen.run(args.metadata, '')
36073610

36083611
stdout.close()
36093612

gen/python_api_gen_mpy.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1513,9 +1513,9 @@ def register_int_ptr_type(convertor, *types):
15131513
15141514
static void mp_lv_delete_cb(lv_event_t * e)
15151515
{
1516-
LV_OBJ_T *lv_obj = e->current_target;
1517-
if (lv_obj){
1518-
mp_lv_obj_t *self = lv_obj->user_data;
1516+
lv_obj_t *obj = (lv_obj_t *)lv_event_get_current_target(e);
1517+
if (obj){
1518+
mp_lv_obj_t *self = lv_obj_get_user_data(obj);
15191519
if (self) {
15201520
self->lv_obj = NULL;
15211521
}
@@ -1525,7 +1525,7 @@ def register_int_ptr_type(convertor, *types):
15251525
static mp_obj_t lv_to_mp(LV_OBJ_T *lv_obj)
15261526
{
15271527
if (lv_obj == NULL) return mp_const_none;
1528-
mp_lv_obj_t *self = (mp_lv_obj_t*)lv_obj->user_data;
1528+
mp_lv_obj_t *self = (mp_lv_obj_t*)lv_obj_get_user_data(lv_obj);
15291529
if (!self)
15301530
{
15311531
// Find the object type
@@ -1548,7 +1548,7 @@ def register_int_ptr_type(convertor, *types):
15481548
};
15491549
15501550
// Register the Python object in user_data
1551-
lv_obj->user_data = self;
1551+
lv_obj_set_user_data(lv_obj, self);
15521552
15531553
// Register a "Delete" event callback
15541554
lv_obj_add_event_cb(lv_obj, mp_lv_delete_cb, LV_EVENT_DELETE, NULL);

0 commit comments

Comments
 (0)