zephyr: Make port-specific modules use MP_REGISTER_MODULE.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This commit is contained in:
Jim Mussared 2022-04-20 21:27:10 +10:00
parent 63431a5536
commit ec2fe5d6ca
5 changed files with 8 additions and 35 deletions

View File

@ -472,4 +472,6 @@ const mp_obj_module_t mp_module_usocket = {
.globals = (mp_obj_dict_t *)&mp_module_usocket_globals,
};
MP_REGISTER_MODULE(MP_QSTR_usocket, mp_module_usocket, MICROPY_PY_USOCKET);
#endif // MICROPY_PY_USOCKET

View File

@ -64,4 +64,6 @@ const mp_obj_module_t mp_module_time = {
.globals = (mp_obj_dict_t *)&mp_module_time_globals,
};
MP_REGISTER_MODULE(MP_QSTR_utime, mp_module_time, MICROPY_PY_UTIME);
#endif // MICROPY_PY_UTIME

View File

@ -89,4 +89,6 @@ const mp_obj_module_t mp_module_zephyr = {
.globals = (mp_obj_dict_t *)&mp_module_time_globals,
};
MP_REGISTER_MODULE(MP_QSTR_zephyr, mp_module_zephyr, MICROPY_PY_ZEPHYR);
#endif // MICROPY_PY_ZEPHYR

View File

@ -142,4 +142,6 @@ const mp_obj_module_t mp_module_zsensor = {
.globals = (mp_obj_dict_t *)&mp_module_zsensor_globals,
};
MP_REGISTER_MODULE(MP_QSTR_zsensor, mp_module_zsensor, MICROPY_PY_ZSENSOR);
#endif // MICROPY_PY_UHASHLIB

View File

@ -138,41 +138,6 @@ typedef long mp_off_t;
void *machine_pin_irq_list; /* Linked list of pin irq objects */ \
struct _mp_bluetooth_zephyr_root_pointers_t *bluetooth_zephyr_root_pointers;
extern const struct _mp_obj_module_t mp_module_time;
extern const struct _mp_obj_module_t mp_module_usocket;
extern const struct _mp_obj_module_t mp_module_zephyr;
extern const struct _mp_obj_module_t mp_module_zsensor;
#if MICROPY_PY_USOCKET
#define MICROPY_PY_USOCKET_DEF { MP_ROM_QSTR(MP_QSTR_usocket), MP_ROM_PTR(&mp_module_usocket) },
#else
#define MICROPY_PY_USOCKET_DEF
#endif
#if MICROPY_PY_UTIME
#define MICROPY_PY_UTIME_DEF { MP_ROM_QSTR(MP_QSTR_utime), MP_ROM_PTR(&mp_module_time) },
#else
#define MICROPY_PY_UTIME_DEF
#endif
#if MICROPY_PY_ZEPHYR
#define MICROPY_PY_ZEPHYR_DEF { MP_ROM_QSTR(MP_QSTR_zephyr), MP_ROM_PTR(&mp_module_zephyr) },
#else
#define MICROPY_PY_ZEPHYR_DEF
#endif
#if MICROPY_PY_ZSENSOR
#define MICROPY_PY_ZSENSOR_DEF { MP_ROM_QSTR(MP_QSTR_zsensor), MP_ROM_PTR(&mp_module_zsensor) },
#else
#define MICROPY_PY_ZSENSOR_DEF
#endif
#define MICROPY_PORT_BUILTIN_MODULES \
MICROPY_PY_USOCKET_DEF \
MICROPY_PY_UTIME_DEF \
MICROPY_PY_ZEPHYR_DEF \
MICROPY_PY_ZSENSOR_DEF \
// extra built in names to add to the global namespace
#define MICROPY_PORT_BUILTINS \
{ MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mp_builtin_open_obj) },