stm32: 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 17:18:35 +10:00
parent bb794f05b7
commit 0a92469c10
4 changed files with 16 additions and 31 deletions

View File

@ -265,3 +265,5 @@ const mp_obj_module_t pyb_module = {
.base = { &mp_type_module },
.globals = (mp_obj_dict_t *)&pyb_module_globals,
};
MP_REGISTER_MODULE(MP_QSTR_pyb, pyb_module, MICROPY_PY_PYB);

View File

@ -60,4 +60,6 @@ const mp_obj_module_t stm_module = {
.globals = (mp_obj_dict_t *)&stm_module_globals,
};
MP_REGISTER_MODULE(MP_QSTR_stm, stm_module, MICROPY_PY_STM);
#endif // MICROPY_PY_STM

View File

@ -153,3 +153,5 @@ const mp_obj_module_t mp_module_utime = {
.base = { &mp_type_module },
.globals = (mp_obj_dict_t *)&time_module_globals,
};
MP_REGISTER_MODULE(MP_QSTR_utime, mp_module_utime, MICROPY_PY_UTIME);

View File

@ -172,30 +172,20 @@
#define MICROPY_PORT_BUILTINS \
{ MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mp_builtin_open_obj) },
// extra built in modules to add to the list of known ones
extern const struct _mp_obj_module_t pyb_module;
extern const struct _mp_obj_module_t stm_module;
extern const struct _mp_obj_module_t mp_module_ubinascii;
extern const struct _mp_obj_module_t mp_module_ure;
extern const struct _mp_obj_module_t mp_module_uzlib;
extern const struct _mp_obj_module_t mp_module_ujson;
extern const struct _mp_obj_module_t mp_module_uheapq;
extern const struct _mp_obj_module_t mp_module_uhashlib;
extern const struct _mp_obj_module_t mp_module_utime;
extern const struct _mp_obj_module_t mp_module_usocket;
extern const struct _mp_obj_module_t mp_module_network;
extern const struct _mp_obj_module_t mp_module_onewire;
#if MICROPY_PY_PYB
#define PYB_BUILTIN_MODULE { MP_ROM_QSTR(MP_QSTR_pyb), MP_ROM_PTR(&pyb_module) },
extern const struct _mp_obj_module_t pyb_module;
#define PYB_BUILTIN_MODULE_CONSTANTS \
{ MP_ROM_QSTR(MP_QSTR_pyb), MP_ROM_PTR(&pyb_module) },
#else
#define PYB_BUILTIN_MODULE
#define PYB_BUILTIN_MODULE_CONSTANTS
#endif
#if MICROPY_PY_STM
#define STM_BUILTIN_MODULE { MP_ROM_QSTR(MP_QSTR_stm), MP_ROM_PTR(&stm_module) },
extern const struct _mp_obj_module_t stm_module;
#define STM_BUILTIN_MODULE_CONSTANTS \
{ MP_ROM_QSTR(MP_QSTR_stm), MP_ROM_PTR(&stm_module) },
#else
#define STM_BUILTIN_MODULE
#define STM_BUILTIN_MODULE_CONSTANTS
#endif
#if MICROPY_PY_MACHINE
@ -206,12 +196,6 @@ extern const struct _mp_obj_module_t mp_module_onewire;
#define MACHINE_BUILTIN_MODULE_CONSTANTS
#endif
#if MICROPY_PY_UTIME
#define UTIME_BUILTIN_MODULE { MP_ROM_QSTR(MP_QSTR_utime), MP_ROM_PTR(&mp_module_utime) },
#else
#define UTIME_BUILTIN_MODULE
#endif
#if defined(MICROPY_HW_ETH_MDC)
extern const struct _mp_obj_type_t network_lan_type;
#define MICROPY_HW_NIC_ETH { MP_ROM_QSTR(MP_QSTR_LAN), MP_ROM_PTR(&network_lan_type) },
@ -244,16 +228,11 @@ extern const struct _mod_network_nic_type_t mod_network_nic_type_cc3k;
#define MICROPY_HW_NIC_CC3K
#endif
#define MICROPY_PORT_BUILTIN_MODULES \
PYB_BUILTIN_MODULE \
STM_BUILTIN_MODULE \
UTIME_BUILTIN_MODULE \
// extra constants
#define MICROPY_PORT_CONSTANTS \
MACHINE_BUILTIN_MODULE_CONSTANTS \
PYB_BUILTIN_MODULE \
STM_BUILTIN_MODULE \
PYB_BUILTIN_MODULE_CONSTANTS \
STM_BUILTIN_MODULE_CONSTANTS \
#ifndef MICROPY_BOARD_NETWORK_INTERFACES
#define MICROPY_BOARD_NETWORK_INTERFACES