From 62f00a43d51e76ee64c0b127eec07f22c1dee5e9 Mon Sep 17 00:00:00 2001 From: Jim Mussared Date: Wed, 20 Apr 2022 21:17:46 +1000 Subject: [PATCH] rp2: Make port-specific modules use MP_REGISTER_MODULE. Signed-off-by: Jim Mussared --- ports/rp2/modrp2.c | 2 ++ ports/rp2/modutime.c | 2 ++ ports/rp2/mpconfigport.h | 7 ------- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/ports/rp2/modrp2.c b/ports/rp2/modrp2.c index 15c61911d3..9c5223587a 100644 --- a/ports/rp2/modrp2.c +++ b/ports/rp2/modrp2.c @@ -42,3 +42,5 @@ const mp_obj_module_t mp_module_rp2 = { .base = { &mp_type_module }, .globals = (mp_obj_dict_t *)&rp2_module_globals, }; + +MP_REGISTER_MODULE(MP_QSTR__rp2, mp_module_rp2, 1); diff --git a/ports/rp2/modutime.c b/ports/rp2/modutime.c index a586073101..b73eacf87e 100644 --- a/ports/rp2/modutime.c +++ b/ports/rp2/modutime.c @@ -125,3 +125,5 @@ const mp_obj_module_t mp_module_utime = { .base = { &mp_type_module }, .globals = (mp_obj_dict_t *)&mp_module_time_globals, }; + +MP_REGISTER_MODULE(MP_QSTR_utime, mp_module_utime, 1); diff --git a/ports/rp2/mpconfigport.h b/ports/rp2/mpconfigport.h index 6c7a1e60e1..704247dfbe 100644 --- a/ports/rp2/mpconfigport.h +++ b/ports/rp2/mpconfigport.h @@ -134,9 +134,6 @@ #define MICROPY_PORT_BUILTINS \ { MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mp_builtin_open_obj) }, -extern const struct _mp_obj_module_t mp_module_rp2; -extern const struct _mp_obj_module_t mp_module_utime; - #if MICROPY_PY_NETWORK #define NETWORK_ROOT_POINTERS mp_obj_list_t mod_network_nic_list; #else @@ -171,10 +168,6 @@ extern const struct _mod_network_nic_type_t mod_network_nic_type_nina; #define MICROPY_PORT_ROOT_POINTER_NINAW10 #endif -#define MICROPY_PORT_BUILTIN_MODULES \ - { MP_OBJ_NEW_QSTR(MP_QSTR__rp2), (mp_obj_t)&mp_module_rp2 }, \ - { MP_ROM_QSTR(MP_QSTR_utime), MP_ROM_PTR(&mp_module_utime) }, \ - #ifndef MICROPY_BOARD_NETWORK_INTERFACES #define MICROPY_BOARD_NETWORK_INTERFACES #endif