micropython: Update all types to use the new type definition.

This commit is contained in:
iabdalkader 2023-05-06 11:32:02 +02:00
parent b2ef6e7b9f
commit 9cc17743e6
10 changed files with 226 additions and 198 deletions

View File

View File

@ -83,10 +83,11 @@ STATIC const mp_rom_map_elem_t py_clock_locals_dict_table[] = {
}; };
STATIC MP_DEFINE_CONST_DICT(py_clock_locals_dict, py_clock_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(py_clock_locals_dict, py_clock_locals_dict_table);
const mp_obj_type_t py_clock_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, py_clock_type,
.name = MP_QSTR_Clock, MP_QSTR_Clock,
.print = py_clock_print, MP_TYPE_FLAG_NONE,
.make_new = py_clock_make_new, print, py_clock_print,
.locals_dict = (mp_obj_t)&py_clock_locals_dict, make_new, py_clock_make_new,
}; locals_dict, &py_clock_locals_dict
);

View File

@ -134,14 +134,15 @@ static const mp_map_elem_t locals_dict_table[] = {
{ MP_OBJ_NEW_QSTR(MP_QSTR_close), (mp_obj_t)&py_gif_close_obj }, { MP_OBJ_NEW_QSTR(MP_QSTR_close), (mp_obj_t)&py_gif_close_obj },
{ NULL, NULL }, { NULL, NULL },
}; };
STATIC MP_DEFINE_CONST_DICT(locals_dict, locals_dict_table); STATIC MP_DEFINE_CONST_DICT(py_gif_locals_dict, locals_dict_table);
static const mp_obj_type_t py_gif_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, py_gif_type,
.name = MP_QSTR_Gif, MP_QSTR_Gif,
.print = py_gif_print, MP_TYPE_FLAG_NONE,
.locals_dict = (mp_obj_t)&locals_dict, print, py_gif_print,
}; locals_dict, &py_gif_locals_dict
);
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_gif_open_obj, 1, py_gif_open); STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_gif_open_obj, 1, py_gif_open);
static const mp_map_elem_t globals_dict_table[] = { static const mp_map_elem_t globals_dict_table[] = {

View File

@ -63,12 +63,12 @@ static void py_cascade_print(const mp_print_t *print, mp_obj_t self_in, mp_print
self->_cobj.n_features, self->_cobj.n_rectangles); self->_cobj.n_features, self->_cobj.n_rectangles);
} }
static const mp_obj_type_t py_cascade_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, py_cascade_type,
.name = MP_QSTR_Cascade, MP_QSTR_Cascade,
.print = py_cascade_print, MP_TYPE_FLAG_NONE,
}; print, py_cascade_print
);
// Keypoints object /////////////////////////////////////////////////////////// // Keypoints object ///////////////////////////////////////////////////////////
#ifdef IMLIB_ENABLE_FIND_KEYPOINTS #ifdef IMLIB_ENABLE_FIND_KEYPOINTS
@ -114,13 +114,14 @@ static mp_obj_t py_kp_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value)
return MP_OBJ_NULL; // op not supported return MP_OBJ_NULL; // op not supported
} }
static const mp_obj_type_t py_kp_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, py_kp_type,
.name = MP_QSTR_kp_desc, MP_QSTR_kp_desc,
.print = py_kp_print, MP_TYPE_FLAG_NONE,
.subscr = py_kp_subscr, print, py_kp_print,
.unary_op = py_kp_unary_op, subscr, py_kp_subscr,
}; unary_op, py_kp_unary_op
);
py_kp_obj_t *py_kpts_obj(mp_obj_t kpts_obj) py_kp_obj_t *py_kpts_obj(mp_obj_t kpts_obj)
{ {
@ -144,12 +145,12 @@ static void py_lbp_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kin
mp_printf(print, "{}"); mp_printf(print, "{}");
} }
static const mp_obj_type_t py_lbp_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, py_lbp_type,
.name = MP_QSTR_lbp_desc, MP_QSTR_lbp_desc,
.print = py_lbp_print, MP_TYPE_FLAG_NONE,
}; print, py_lbp_print
);
#endif // IMLIB_ENABLE_FIND_LBP #endif // IMLIB_ENABLE_FIND_LBP
// Keypoints Match Object ///////////////////////////////////////////////////// // Keypoints Match Object /////////////////////////////////////////////////////
@ -244,13 +245,14 @@ STATIC const mp_rom_map_elem_t py_kptmatch_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(py_kptmatch_locals_dict, py_kptmatch_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(py_kptmatch_locals_dict, py_kptmatch_locals_dict_table);
static const mp_obj_type_t py_kptmatch_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, py_kptmatch_type,
.name = MP_QSTR_kptmatch, MP_QSTR_kptmatch,
.print = py_kptmatch_print, MP_TYPE_FLAG_NONE,
.subscr = py_kptmatch_subscr, print, py_kptmatch_print,
.locals_dict = (mp_obj_t) &py_kptmatch_locals_dict subscr, py_kptmatch_subscr,
}; locals_dict, &py_kptmatch_locals_dict
);
#endif //IMLIB_ENABLE_DESCRIPTOR && IMLIB_ENABLE_FIND_KEYPOINTS #endif //IMLIB_ENABLE_DESCRIPTOR && IMLIB_ENABLE_FIND_KEYPOINTS
@ -2967,13 +2969,14 @@ STATIC const mp_rom_map_elem_t py_similarity_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(py_similarity_locals_dict, py_similarity_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(py_similarity_locals_dict, py_similarity_locals_dict_table);
static const mp_obj_type_t py_similarity_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, py_similarity_type,
.name = MP_QSTR_similarity, MP_QSTR_similarity,
.print = py_similarity_print, MP_TYPE_FLAG_NONE,
.subscr = py_similarity_subscr, print, py_similarity_print,
.locals_dict = (mp_obj_t) &py_similarity_locals_dict subscr, py_similarity_subscr,
}; locals_dict, &py_similarity_locals_dict
);
static mp_obj_t py_image_get_similarity(mp_obj_t img_obj, mp_obj_t other_obj) static mp_obj_t py_image_get_similarity(mp_obj_t img_obj, mp_obj_t other_obj)
{ {
@ -3226,13 +3229,14 @@ STATIC const mp_rom_map_elem_t py_statistics_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(py_statistics_locals_dict, py_statistics_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(py_statistics_locals_dict, py_statistics_locals_dict_table);
static const mp_obj_type_t py_statistics_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, py_statistics_type,
.name = MP_QSTR_statistics, MP_QSTR_statistics,
.print = py_statistics_print, MP_TYPE_FLAG_NONE,
.subscr = py_statistics_subscr, print, py_statistics_print,
.locals_dict = (mp_obj_t) &py_statistics_locals_dict subscr, py_statistics_subscr,
}; locals_dict, &py_statistics_locals_dict
);
// Percentile Object // // Percentile Object //
#define py_percentile_obj_size 3 #define py_percentile_obj_size 3
@ -3311,13 +3315,14 @@ STATIC const mp_rom_map_elem_t py_percentile_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(py_percentile_locals_dict, py_percentile_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(py_percentile_locals_dict, py_percentile_locals_dict_table);
static const mp_obj_type_t py_percentile_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, py_percentile_type,
.name = MP_QSTR_percentile, MP_QSTR_percentile,
.print = py_percentile_print, MP_TYPE_FLAG_NONE,
.subscr = py_percentile_subscr, print, py_percentile_print,
.locals_dict = (mp_obj_t) &py_percentile_locals_dict subscr, py_percentile_subscr,
}; locals_dict, &py_percentile_locals_dict
);
// Threshold Object // // Threshold Object //
#define py_threshold_obj_size 3 #define py_threshold_obj_size 3
@ -3396,13 +3401,14 @@ STATIC const mp_rom_map_elem_t py_threshold_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(py_threshold_locals_dict, py_threshold_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(py_threshold_locals_dict, py_threshold_locals_dict_table);
static const mp_obj_type_t py_threshold_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, py_threshold_type,
.name = MP_QSTR_threshold, MP_QSTR_threshold,
.print = py_threshold_print, MP_TYPE_FLAG_NONE,
.subscr = py_threshold_subscr, print, py_threshold_print,
.locals_dict = (mp_obj_t) &py_threshold_locals_dict subscr, py_threshold_subscr,
}; locals_dict, &py_threshold_locals_dict
);
// Histogram Object // // Histogram Object //
#define py_histogram_obj_size 3 #define py_histogram_obj_size 3
@ -3629,13 +3635,14 @@ STATIC const mp_rom_map_elem_t py_histogram_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(py_histogram_locals_dict, py_histogram_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(py_histogram_locals_dict, py_histogram_locals_dict_table);
static const mp_obj_type_t py_histogram_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, py_histogram_type,
.name = MP_QSTR_histogram, MP_QSTR_histogram,
.print = py_histogram_print, MP_TYPE_FLAG_NONE,
.subscr = py_histogram_subscr, print, py_histogram_print,
.locals_dict = (mp_obj_t) &py_histogram_locals_dict subscr, py_histogram_subscr,
}; locals_dict, &py_histogram_locals_dict
);
static mp_obj_t py_image_get_histogram(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) static mp_obj_t py_image_get_histogram(uint n_args, const mp_obj_t *args, mp_map_t *kw_args)
{ {
@ -3942,13 +3949,14 @@ STATIC const mp_rom_map_elem_t py_line_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(py_line_locals_dict, py_line_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(py_line_locals_dict, py_line_locals_dict_table);
static const mp_obj_type_t py_line_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, py_line_type,
.name = MP_QSTR_line, MP_QSTR_line,
.print = py_line_print, MP_TYPE_FLAG_NONE,
.subscr = py_line_subscr, print, py_line_print,
.locals_dict = (mp_obj_t) &py_line_locals_dict subscr, py_line_subscr,
}; locals_dict, &py_line_locals_dict
);
static mp_obj_t py_image_get_regression(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) static mp_obj_t py_image_get_regression(uint n_args, const mp_obj_t *args, mp_map_t *kw_args)
{ {
@ -4402,13 +4410,14 @@ STATIC const mp_rom_map_elem_t py_blob_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(py_blob_locals_dict, py_blob_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(py_blob_locals_dict, py_blob_locals_dict_table);
static const mp_obj_type_t py_blob_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, py_blob_type,
.name = MP_QSTR_blob, MP_QSTR_blob,
.print = py_blob_print, MP_TYPE_FLAG_NONE,
.subscr = py_blob_subscr, print, py_blob_print,
.locals_dict = (mp_obj_t) &py_blob_locals_dict subscr, py_blob_subscr,
}; locals_dict, &py_blob_locals_dict
);
static bool py_image_find_blobs_threshold_cb(void *fun_obj, find_blobs_list_lnk_data_t *blob) static bool py_image_find_blobs_threshold_cb(void *fun_obj, find_blobs_list_lnk_data_t *blob)
{ {
@ -4801,13 +4810,14 @@ STATIC const mp_rom_map_elem_t py_circle_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(py_circle_locals_dict, py_circle_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(py_circle_locals_dict, py_circle_locals_dict_table);
static const mp_obj_type_t py_circle_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, py_circle_type,
.name = MP_QSTR_circle, MP_QSTR_circle,
.print = py_circle_print, MP_TYPE_FLAG_NONE,
.subscr = py_circle_subscr, print, py_circle_print,
.locals_dict = (mp_obj_t) &py_circle_locals_dict subscr, py_circle_subscr,
}; locals_dict, &py_circle_locals_dict
);
static mp_obj_t py_image_find_circles(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) static mp_obj_t py_image_find_circles(uint n_args, const mp_obj_t *args, mp_map_t *kw_args)
{ {
@ -4936,13 +4946,14 @@ STATIC const mp_rom_map_elem_t py_rect_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(py_rect_locals_dict, py_rect_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(py_rect_locals_dict, py_rect_locals_dict_table);
static const mp_obj_type_t py_rect_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, py_rect_type,
.name = MP_QSTR_rect, MP_QSTR_rect,
.print = py_rect_print, MP_TYPE_FLAG_NONE,
.subscr = py_rect_subscr, print, py_rect_print,
.locals_dict = (mp_obj_t) &py_rect_locals_dict subscr, py_rect_subscr,
}; locals_dict, &py_rect_locals_dict
);
static mp_obj_t py_image_find_rects(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) static mp_obj_t py_image_find_rects(uint n_args, const mp_obj_t *args, mp_map_t *kw_args)
{ {
@ -5102,13 +5113,14 @@ STATIC const mp_rom_map_elem_t py_qrcode_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(py_qrcode_locals_dict, py_qrcode_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(py_qrcode_locals_dict, py_qrcode_locals_dict_table);
static const mp_obj_type_t py_qrcode_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, py_qrcode_type,
.name = MP_QSTR_qrcode, MP_QSTR_qrcode,
.print = py_qrcode_print, MP_TYPE_FLAG_NONE,
.subscr = py_qrcode_subscr, print, py_qrcode_print,
.locals_dict = (mp_obj_t) &py_qrcode_locals_dict subscr, py_qrcode_subscr,
}; locals_dict, &py_qrcode_locals_dict
);
static mp_obj_t py_image_find_qrcodes(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) static mp_obj_t py_image_find_qrcodes(uint n_args, const mp_obj_t *args, mp_map_t *kw_args)
{ {
@ -5310,13 +5322,14 @@ STATIC const mp_rom_map_elem_t py_apriltag_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(py_apriltag_locals_dict, py_apriltag_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(py_apriltag_locals_dict, py_apriltag_locals_dict_table);
static const mp_obj_type_t py_apriltag_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, py_apriltag_type,
.name = MP_QSTR_apriltag, MP_QSTR_apriltag,
.print = py_apriltag_print, MP_TYPE_FLAG_NONE,
.subscr = py_apriltag_subscr, print, py_apriltag_print,
.locals_dict = (mp_obj_t) &py_apriltag_locals_dict subscr, py_apriltag_subscr,
}; locals_dict, &py_apriltag_locals_dict
);
static mp_obj_t py_image_find_apriltags(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) static mp_obj_t py_image_find_apriltags(uint n_args, const mp_obj_t *args, mp_map_t *kw_args)
{ {
@ -5491,13 +5504,14 @@ STATIC const mp_rom_map_elem_t py_datamatrix_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(py_datamatrix_locals_dict, py_datamatrix_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(py_datamatrix_locals_dict, py_datamatrix_locals_dict_table);
static const mp_obj_type_t py_datamatrix_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, py_datamatrix_type,
.name = MP_QSTR_datamatrix, MP_QSTR_datamatrix,
.print = py_datamatrix_print, MP_TYPE_FLAG_NONE,
.subscr = py_datamatrix_subscr, print, py_datamatrix_print,
.locals_dict = (mp_obj_t) &py_datamatrix_locals_dict subscr, py_datamatrix_subscr,
}; locals_dict, &py_datamatrix_locals_dict
);
static mp_obj_t py_image_find_datamatrices(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) static mp_obj_t py_image_find_datamatrices(uint n_args, const mp_obj_t *args, mp_map_t *kw_args)
{ {
@ -5641,13 +5655,14 @@ STATIC const mp_rom_map_elem_t py_barcode_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(py_barcode_locals_dict, py_barcode_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(py_barcode_locals_dict, py_barcode_locals_dict_table);
static const mp_obj_type_t py_barcode_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, py_barcode_type,
.name = MP_QSTR_barcode, MP_QSTR_barcode,
.print = py_barcode_print, MP_TYPE_FLAG_NONE,
.subscr = py_barcode_subscr, print, py_barcode_print,
.locals_dict = (mp_obj_t) &py_barcode_locals_dict subscr, py_barcode_subscr,
}; locals_dict, &py_barcode_locals_dict
);
static mp_obj_t py_image_find_barcodes(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) static mp_obj_t py_image_find_barcodes(uint n_args, const mp_obj_t *args, mp_map_t *kw_args)
{ {
@ -5757,13 +5772,14 @@ STATIC const mp_rom_map_elem_t py_displacement_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(py_displacement_locals_dict, py_displacement_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(py_displacement_locals_dict, py_displacement_locals_dict_table);
static const mp_obj_type_t py_displacement_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, py_displacement_type,
.name = MP_QSTR_displacement, MP_QSTR_displacement,
.print = py_displacement_print, MP_TYPE_FLAG_NONE,
.subscr = py_displacement_subscr, print, py_displacement_print,
.locals_dict = (mp_obj_t) &py_displacement_locals_dict subscr, py_displacement_subscr,
}; locals_dict, &py_displacement_locals_dict
);
static mp_obj_t py_image_find_displacement(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) static mp_obj_t py_image_find_displacement(uint n_args, const mp_obj_t *args, mp_map_t *kw_args)
{ {
@ -6400,18 +6416,19 @@ static const mp_rom_map_elem_t locals_dict_table[] = {
#endif #endif
}; };
STATIC MP_DEFINE_CONST_DICT(locals_dict, locals_dict_table); STATIC MP_DEFINE_CONST_DICT(py_image_locals_dict, locals_dict_table);
static const mp_obj_type_t py_image_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, py_image_type,
.name = MP_QSTR_Image, MP_QSTR_Image,
.print = py_image_print, MP_TYPE_FLAG_ITER_IS_GETITER,
.buffer_p = { .get_buffer = py_image_get_buffer }, print, py_image_print,
.subscr = py_image_subscr, buffer, py_image_get_buffer,
.getiter = py_image_getiter, subscr, py_image_subscr,
.unary_op = py_image_unary_op, iter, py_image_getiter,
.locals_dict = (mp_obj_t) &locals_dict unary_op, py_image_unary_op,
}; locals_dict, &py_image_locals_dict
);
mp_obj_t py_image_binary_to_grayscale(mp_obj_t arg) mp_obj_t py_image_binary_to_grayscale(mp_obj_t arg)
{ {

View File

@ -637,12 +637,12 @@ STATIC const mp_rom_map_elem_t py_imageio_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(py_imageio_locals_dict, py_imageio_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(py_imageio_locals_dict, py_imageio_locals_dict_table);
const mp_obj_type_t py_imageio_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, py_imageio_type,
.name = MP_QSTR_ImageIO, MP_QSTR_ImageIO,
.print = py_imageio_print, MP_TYPE_FLAG_NONE,
.make_new = py_imageio_make_new, print, py_imageio_print,
.locals_dict = (mp_obj_dict_t *) &py_imageio_locals_dict, make_new, py_imageio_make_new,
}; locals_dict, &py_imageio_locals_dict
);
#endif // IMLIB_ENABLE_IMAGE_IO #endif // IMLIB_ENABLE_IMAGE_IO

View File

@ -24,7 +24,7 @@
#include "framebuffer.h" #include "framebuffer.h"
#include "omv_boardconfig.h" #include "omv_boardconfig.h"
STATIC const mp_obj_type_t py_mjpeg_type; static const mp_obj_type_t py_mjpeg_type;
typedef struct py_mjpeg_obj { typedef struct py_mjpeg_obj {
mp_obj_base_t base; mp_obj_base_t base;
@ -177,12 +177,13 @@ STATIC const mp_rom_map_elem_t py_mjpeg_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(py_mjpeg_locals_dict, py_mjpeg_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(py_mjpeg_locals_dict, py_mjpeg_locals_dict_table);
STATIC const mp_obj_type_t py_mjpeg_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, py_mjpeg_type,
.name = MP_QSTR_Mjpeg, MP_QSTR_Mjpeg,
.print = py_mjpeg_print, MP_TYPE_FLAG_NONE,
.locals_dict = (mp_obj_dict_t *) &py_mjpeg_locals_dict, print, py_mjpeg_print,
}; locals_dict, &py_mjpeg_locals_dict
);
STATIC const mp_rom_map_elem_t globals_dict_table[] = { STATIC const mp_rom_map_elem_t globals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_mjpeg) }, { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_mjpeg) },

View File

@ -139,13 +139,14 @@ STATIC const mp_rom_map_elem_t py_tf_classification_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(py_tf_classification_locals_dict, py_tf_classification_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(py_tf_classification_locals_dict, py_tf_classification_locals_dict_table);
static const mp_obj_type_t py_tf_classification_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, py_tf_classification_type,
.name = MP_QSTR_tf_classification, MP_QSTR_tf_classification,
.print = py_tf_classification_print, MP_TYPE_FLAG_NONE,
.subscr = py_tf_classification_subscr, print, py_tf_classification_print,
.locals_dict = (mp_obj_t) &py_tf_classification_locals_dict subscr, py_tf_classification_subscr,
}; locals_dict, &py_tf_classification_locals_dict
);
static const mp_obj_type_t py_tf_model_type; static const mp_obj_type_t py_tf_model_type;
@ -842,14 +843,15 @@ STATIC const mp_rom_map_elem_t locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_regression), MP_ROM_PTR(&py_tf_regression_obj) } { MP_ROM_QSTR(MP_QSTR_regression), MP_ROM_PTR(&py_tf_regression_obj) }
}; };
STATIC MP_DEFINE_CONST_DICT(locals_dict, locals_dict_table); STATIC MP_DEFINE_CONST_DICT(py_tf_locals_dict, locals_dict_table);
STATIC const mp_obj_type_t py_tf_model_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, py_tf_model_type,
.name = MP_QSTR_tf_model, MP_QSTR_tf_model,
.print = py_tf_model_print, MP_TYPE_FLAG_NONE,
.locals_dict = (mp_obj_t) &locals_dict print, py_tf_model_print,
}; locals_dict, &py_tf_locals_dict
);
#endif // IMLIB_ENABLE_TF #endif // IMLIB_ENABLE_TF

View File

@ -266,13 +266,14 @@ STATIC const mp_rom_map_elem_t py_micro_speech_locals_dict_table[] = {
}; };
STATIC MP_DEFINE_CONST_DICT(py_micro_speech_locals_dict, py_micro_speech_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(py_micro_speech_locals_dict, py_micro_speech_locals_dict_table);
static const mp_obj_type_t py_micro_speech_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, py_micro_speech_type,
.name = MP_QSTR_MicroSpeech, MP_QSTR_MicroSpeech,
.print = py_micro_speech_print, MP_TYPE_FLAG_NONE,
.make_new = py_micro_speech_make_new, print, py_micro_speech_print,
.locals_dict = (mp_obj_dict_t*)&py_micro_speech_locals_dict, make_new, py_micro_speech_make_new,
}; locals_dict, &py_micro_speech_locals_dict
);
STATIC const mp_rom_map_elem_t module_globals_table[] = { STATIC const mp_rom_map_elem_t module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_micro_speech) }, { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_micro_speech) },

View File

@ -621,13 +621,7 @@ static const mp_rom_map_elem_t winc_locals_dict_table[] = {
static MP_DEFINE_CONST_DICT(winc_locals_dict, winc_locals_dict_table); static MP_DEFINE_CONST_DICT(winc_locals_dict, winc_locals_dict_table);
const mod_network_nic_type_t mod_network_nic_type_winc = { STATIC const mod_network_nic_protocol_t mod_network_nic_protocol_winc = {
.base = {
{ &mp_type_type },
.name = MP_QSTR_WINC,
.make_new = py_winc_make_new,
.locals_dict = (mp_obj_t)&winc_locals_dict,
},
.gethostbyname = py_winc_gethostbyname, .gethostbyname = py_winc_gethostbyname,
.socket = py_winc_socket_socket, .socket = py_winc_socket_socket,
.close = py_winc_socket_close, .close = py_winc_socket_close,
@ -643,4 +637,13 @@ const mod_network_nic_type_t mod_network_nic_type_winc = {
.settimeout = py_winc_socket_settimeout, .settimeout = py_winc_socket_settimeout,
.ioctl = py_winc_socket_ioctl, .ioctl = py_winc_socket_ioctl,
}; };
MP_DEFINE_CONST_OBJ_TYPE(
mod_network_nic_type_winc,
MP_QSTR_WINC,
MP_TYPE_FLAG_NONE,
make_new, py_winc_make_new,
locals_dict, &winc_locals_dict,
protocol, &mod_network_nic_protocol_winc
);
#endif // MICROPY_PY_WINC1500 #endif // MICROPY_PY_WINC1500

View File

@ -61,13 +61,15 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_net_predict_obj, 2, py_net_predict);
STATIC const mp_rom_map_elem_t locals_dict_table[] = { STATIC const mp_rom_map_elem_t locals_dict_table[] = {
{MP_ROM_QSTR(MP_QSTR_predict), MP_ROM_PTR(&py_net_predict_obj)}}; {MP_ROM_QSTR(MP_QSTR_predict), MP_ROM_PTR(&py_net_predict_obj)}};
STATIC MP_DEFINE_CONST_DICT(locals_dict, locals_dict_table); STATIC MP_DEFINE_CONST_DICT(py_net_locals_dict, locals_dict_table);
static const mp_obj_type_t py_st_net_type = {{&mp_type_type}, STATIC MP_DEFINE_CONST_OBJ_TYPE(
.name = MP_QSTR_Net, py_st_net_type,
.print = py_net_print, MP_QSTR_Net,
.locals_dict = MP_TYPE_FLAG_NONE,
(mp_obj_t)&locals_dict}; print, py_net_print,
locals_dict, &py_net_locals_dict
);
/* Function in charge of creating an instance of "ST NN" class and initializing /* Function in charge of creating an instance of "ST NN" class and initializing
* the NN named nn_name */ * the NN named nn_name */