diff --git a/README.md b/README.md index f57469ed..a47c64e2 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,17 @@ +***IMPORTANT READ ME FIRST*** + +* DO NOT use any information from the official binding and try to use that when compiling this binding it is not going to work +* DO NOT add any submodule initilization commands when cloning the repo or any any point after the repo has been cloned. + To clone and build this is how it's done. + ``` + git clone https://github.com/lvgl-micropython/lvgl_micropython + cd lvgl_micropython + python3 make.py esp32 ...... + ``` +* If you want to update to the current master then delete your local copy and clone it again from scratch. + + + # LVGL binding for Micropython ______________________________ diff --git a/ext_mod/lcd_bus/esp32_src/rgb_bus_rotation.c b/ext_mod/lcd_bus/esp32_src/rgb_bus_rotation.c index 97608e81..40e2db26 100644 --- a/ext_mod/lcd_bus/esp32_src/rgb_bus_rotation.c +++ b/ext_mod/lcd_bus/esp32_src/rgb_bus_rotation.c @@ -116,20 +116,34 @@ #define RGB_BUS_ROTATION_270 (3) - __attribute__((always_inline)) static inline void rotate0(uint8_t *src, uint8_t *dst, uint32_t x_start, uint32_t y_start, uint32_t x_end, uint32_t y_end, uint32_t dst_width, uint32_t dst_height, uint8_t bytes_per_pixel); - __attribute__((always_inline)) static inline void rotate_8bpp(uint8_t *src, uint8_t *dst, uint32_t x_start, uint32_t y_start, uint32_t x_end, uint32_t y_end, uint32_t dst_width, uint32_t dst_height, uint8_t rotate); - __attribute__((always_inline)) static inline void rotate_16bpp(uint16_t *src, uint16_t *dst, uint32_t x_start, uint32_t y_start, uint32_t x_end, uint32_t y_end, uint32_t dst_width, uint32_t dst_height, uint8_t rotate); - __attribute__((always_inline)) static inline void rotate_24bpp(uint8_t *src, uint8_t *dst, uint32_t x_start, uint32_t y_start, uint32_t x_end, uint32_t y_end, uint32_t dst_width, uint32_t dst_height, uint8_t rotate); - __attribute__((always_inline)) static inline void rotate_32bpp(uint32_t *src, uint32_t *dst, uint32_t x_start, uint32_t y_start, uint32_t x_end, uint32_t y_end, uint32_t dst_width, uint32_t dst_height, uint8_t rotate); + static void rotate0(uint8_t *src, uint8_t *dst, uint32_t x_start, uint32_t y_start, + uint32_t x_end, uint32_t y_end, uint32_t dst_width, uint32_t dst_height, + uint8_t bytes_per_pixel); + static void rotate_8bpp(uint8_t *src, uint8_t *dst, uint32_t x_start, uint32_t y_start, + uint32_t x_end, uint32_t y_end, uint32_t dst_width, uint32_t dst_height, + uint8_t rotate); - static void copy_pixels( - void *dst, void *src, uint32_t x_start, uint32_t y_start, - uint32_t x_end, uint32_t y_end, uint32_t dst_width, uint32_t dst_height, - uint32_t bytes_per_pixel, uint8_t rotate); + static void rotate_16bpp(uint16_t *src, uint16_t *dst, uint32_t x_start, uint32_t y_start, + uint32_t x_end, uint32_t y_end, uint32_t dst_width, uint32_t dst_height, + uint8_t rotate); + static void rotate_24bpp(uint8_t *src, uint8_t *dst, uint32_t x_start, uint32_t y_start, + uint32_t x_end, uint32_t y_end, uint32_t dst_width, uint32_t dst_height, + uint8_t rotate); - static bool rgb_bus_trans_done_cb(esp_lcd_panel_handle_t panel, const esp_lcd_rgb_panel_event_data_t *edata, void *user_ctx) + static void rotate_32bpp(uint32_t *src, uint32_t *dst, uint32_t x_start, uint32_t y_start, + uint32_t x_end, uint32_t y_end, uint32_t dst_width, uint32_t dst_height, + uint8_t rotate); + + + static void copy_pixels(void *dst, void *src, uint32_t x_start, uint32_t y_start, + uint32_t x_end, uint32_t y_end, uint32_t dst_width, uint32_t dst_height, + uint32_t bytes_per_pixel, uint8_t rotate); + + + static bool rgb_bus_trans_done_cb(esp_lcd_panel_handle_t panel, + const esp_lcd_rgb_panel_event_data_t *edata, void *user_ctx) { LCD_UNUSED(edata); mp_lcd_rgb_bus_obj_t *self = (mp_lcd_rgb_bus_obj_t *)user_ctx; @@ -294,19 +308,19 @@ __attribute__((always_inline)) - static inline void copy_8bpp(uint8_t *to, const uint8_t *from) + static inline void copy_8bpp(uint8_t *from, uint8_t *to) { *to++ = *from++; } __attribute__((always_inline)) - static inline void copy_16bpp(uint16_t *to, const uint16_t *from) + static inline void copy_16bpp(uint16_t *from, uint16_t *to) { *to++ = *from++; } __attribute__((always_inline)) - static inline void copy_24bpp(uint8_t *to, const uint8_t *from) + static inline void copy_24bpp(uint8_t *from, uint8_t *to) { *to++ = *from++; *to++ = *from++; @@ -314,7 +328,7 @@ } __attribute__((always_inline)) - static inline void copy_32bpp(uint32_t *to, const uint32_t *from) + static inline void copy_32bpp(uint32_t *from, uint32_t *to) { *to++ = *from++; } @@ -354,7 +368,9 @@ } - void rotate0(uint8_t *src, uint8_t *dst, uint32_t x_start, uint32_t y_start, uint32_t x_end, uint32_t y_end, uint32_t dst_width, uint32_t dst_height, uint8_t bytes_per_pixel) + void rotate0(uint8_t *src, uint8_t *dst, uint32_t x_start, uint32_t y_start, + uint32_t x_end, uint32_t y_end, uint32_t dst_width, + uint32_t dst_height, uint8_t bytes_per_pixel) { dst += ((y_start * dst_width + x_start) * bytes_per_pixel); @@ -372,10 +388,12 @@ } } - void rotate_8bpp(uint8_t *src, uint8_t *dst, uint32_t x_start, uint32_t y_start, uint32_t x_end, uint32_t y_end, uint32_t dst_width, uint32_t dst_height, uint8_t rotate) + void rotate_8bpp(uint8_t *src, uint8_t *dst, uint32_t x_start, uint32_t y_start, + uint32_t x_end, uint32_t y_end, uint32_t dst_width, uint32_t dst_height, + uint8_t rotate) { - uint32_t j; uint32_t i; + uint32_t j; uint32_t src_bytes_per_line = x_end - x_start + 1; uint32_t offset = y_start * src_bytes_per_line + x_start; @@ -384,9 +402,9 @@ case RGB_BUS_ROTATION_90: for (uint32_t y = y_start; y < y_end; y++) { for (uint32_t x = x_start; x < x_end; x++) { - j = y * src_bytes_per_line + x - offset; - i = (dst_height - 1 - x) * dst_width + y; - copy_8bpp(dst + i, src + j); + i = y * src_bytes_per_line + x - offset; + j = (dst_height - 1 - x) * dst_width + y; + copy_8bpp(src + i, dst + j); } } break; @@ -400,7 +418,7 @@ for (uint32_t y = y_start; y < y_end; y++) { i = (dst_height - 1 - y) * dst_width + (dst_width - 1 - x_start); for (uint32_t x = x_start; x < x_end; x++) { - copy_8bpp(dst + i, src); + copy_8bpp(src, dst + i); src++; i--; } @@ -411,9 +429,9 @@ case RGB_BUS_ROTATION_270: for (uint32_t y = y_start; y < y_end; y++) { for (uint32_t x = x_start; x < x_end; x++) { - j = y * src_bytes_per_line + x - offset; - i = x * dst_width + dst_width - 1 - y; - copy_8bpp(dst + i, src + j); + i = y * src_bytes_per_line + x - offset; + j = x * dst_width + dst_width - 1 - y; + copy_8bpp(src + i, dst + j); } } break; @@ -429,10 +447,12 @@ } - void rotate_16bpp(uint16_t *src, uint16_t *dst, uint32_t x_start, uint32_t y_start, uint32_t x_end, uint32_t y_end, uint32_t dst_width, uint32_t dst_height, uint8_t rotate) + void rotate_16bpp(uint16_t *src, uint16_t *dst, uint32_t x_start, uint32_t y_start, + uint32_t x_end, uint32_t y_end, uint32_t dst_width, uint32_t dst_height, + uint8_t rotate) { - uint32_t j; uint32_t i; + uint32_t j; uint32_t src_bytes_per_line = x_end - x_start + 1; uint32_t offset = y_start * src_bytes_per_line + x_start; @@ -441,9 +461,9 @@ case RGB_BUS_ROTATION_90: for (uint32_t y = y_start; y < y_end; y++) { for (uint32_t x = x_start; x < x_end; x++) { - j = y * src_bytes_per_line + x - offset; - i = (dst_height - 1 - x) * dst_width + y; - copy_16bpp(dst + i, src + j); + i = y * src_bytes_per_line + x - offset; + j = (dst_height - 1 - x) * dst_width + y; + copy_16bpp(src + i, dst + j); } } break; @@ -457,7 +477,7 @@ for (uint32_t y = y_start; y < y_end; y++) { i = (dst_height - 1 - y) * dst_width + (dst_width - 1 - x_start); for (uint32_t x = x_start; x < x_end; x++) { - copy_16bpp(dst + i, src); + copy_16bpp(src, dst + i); src++; i--; } @@ -468,9 +488,9 @@ case RGB_BUS_ROTATION_270: for (uint32_t y = y_start; y < y_end; y++) { for (uint32_t x = x_start; x < x_end; x++) { - j = y * src_bytes_per_line + x - offset; - i = (x * dst_width + dst_width - 1 - y); - copy_16bpp(dst + i, src + j); + i = y * src_bytes_per_line + x - offset; + j = (x * dst_width + dst_width - 1 - y); + copy_16bpp(src + i, dst + j); } } break; @@ -485,10 +505,12 @@ } - void rotate_24bpp(uint8_t *src, uint8_t *dst, uint32_t x_start, uint32_t y_start, uint32_t x_end, uint32_t y_end, uint32_t dst_width, uint32_t dst_height, uint8_t rotate) + void rotate_24bpp(uint8_t *src, uint8_t *dst, uint32_t x_start, uint32_t y_start, + uint32_t x_end, uint32_t y_end, uint32_t dst_width, uint32_t dst_height, + uint8_t rotate) { - uint32_t j; uint32_t i; + uint32_t j; uint32_t src_bytes_per_line = (x_end - x_start + 1) * 3; uint32_t offset = y_start * src_bytes_per_line + x_start * 3; @@ -498,9 +520,9 @@ case RGB_BUS_ROTATION_90: for (uint32_t y = y_start; y < y_end; y++) { for (uint32_t x = x_start; x < x_end; x++) { - j = y * src_bytes_per_line + x * 3 - offset; - i = ((dst_height - 1 - x) * dst_width + y) * 3; - copy_24bpp(dst + i, src + j); + i = y * src_bytes_per_line + x * 3 - offset; + j = ((dst_height - 1 - x) * dst_width + y) * 3; + copy_24bpp(src + i, dst + j); } } break; @@ -514,7 +536,7 @@ for (int y = y_start; y < y_end; y++) { i = ((dst_height - 1 - y) * dst_width + (dst_width - 1 - x_start)) * 3; for (size_t x = x_start; x < x_end; x++) { - copy_24bpp(dst + i, src); + copy_24bpp(src, dst + i); src += 3; i -= 3; } @@ -525,9 +547,9 @@ case RGB_BUS_ROTATION_270: for (uint32_t y = y_start; y < y_end; y++) { for (uint32_t x = x_start; x < x_end; x++) { - j = y * src_bytes_per_line + x * 3 - offset; - i = (x * dst_width + dst_width - 1 - y) * 3; - copy_24bpp(dst + i, src + j); + i = y * src_bytes_per_line + x * 3 - offset; + j = (x * dst_width + dst_width - 1 - y) * 3; + copy_24bpp(src + i, dst + j); } } break; @@ -542,10 +564,12 @@ } - void rotate_32bpp(uint32_t *src, uint32_t *dst, uint32_t x_start, uint32_t y_start, uint32_t x_end, uint32_t y_end, uint32_t dst_width, uint32_t dst_height, uint8_t rotate) + void rotate_32bpp(uint32_t *src, uint32_t *dst, uint32_t x_start, uint32_t y_start, + uint32_t x_end, uint32_t y_end, uint32_t dst_width, uint32_t dst_height, + uint8_t rotate) { - uint32_t j; uint32_t i; + uint32_t j; uint32_t src_bytes_per_line = x_end - x_start + 1; uint32_t offset = y_start * src_bytes_per_line + x_start; @@ -554,9 +578,9 @@ case RGB_BUS_ROTATION_90: for (uint32_t y = y_start; y < y_end; y++) { for (uint32_t x = x_start; x < x_end; x++) { - j = y * src_bytes_per_line + x - offset; - i = (dst_height - 1 - x) * dst_width + y; - copy_32bpp(dst + i, src + j); + i = y * src_bytes_per_line + x - offset; + j = (dst_height - 1 - x) * dst_width + y; + copy_32bpp(src + i, dst + j); } } break; @@ -570,7 +594,7 @@ for (uint32_t y = y_start; y < y_end; y++) { i = (dst_height - 1 - y) * dst_width + (dst_width - 1 - x_start); for (uint32_t x = x_start; x < x_end; x++) { - copy_32bpp(dst + i, src); + copy_32bpp(src, dst + i); src++; i--; } @@ -581,9 +605,9 @@ case RGB_BUS_ROTATION_270: for (uint32_t y = y_start; y < y_end; y++) { for (uint32_t x = x_start; x < x_end; x++) { - j = y * src_bytes_per_line + x - offset; - i = x * dst_width + dst_width - 1 - y; - copy_32bpp(dst + i, src + j); + i = y * src_bytes_per_line + x - offset; + j = x * dst_width + dst_width - 1 - y; + copy_32bpp(src + i, dst + j); } } break; diff --git a/gen/python_api_gen_mpy.py b/gen/python_api_gen_mpy.py index ca9a4e94..5c57ef39 100644 --- a/gen/python_api_gen_mpy.py +++ b/gen/python_api_gen_mpy.py @@ -3730,6 +3730,7 @@ def _iter_metadata(d, indent=0): if args.metadata: + metadata = collections.OrderedDict() metadata['objects'] = {obj_name: obj_metadata[obj_name] for obj_name in obj_names} metadata['functions'] = {simplify_identifier(f.name): func_metadata[f.name] for f in module_funcs} @@ -3746,9 +3747,16 @@ def _iter_metadata(d, indent=0): with open(args.metadata, 'w') as metadata_file: json.dump(metadata, metadata_file, indent=4) + build_path = os.path.split(args.metadata)[0] + + api_json_path = os.path.join(build_path, 'lvgl_api.json') + + with open(api_json_path, 'w') as metadata_file: + json.dump(lvgl_json, metadata_file, indent=4) + import stub_gen - stub_gen.run(args.metadata) + stub_gen.run(args.metadata, api_json_path) stdout.close() diff --git a/gen/stub_gen.py b/gen/stub_gen.py index 74d33bec..6da737d9 100644 --- a/gen/stub_gen.py +++ b/gen/stub_gen.py @@ -449,7 +449,8 @@ class mem_pool_t(object): ''' -def run(json_path): +def run(json_path, lvgl_api_json_path): + with open(json_path, 'r') as f: data = f.read()