Skip to content

Commit ec2fe5d

Browse files
committed
zephyr: Make port-specific modules use MP_REGISTER_MODULE.
Signed-off-by: Jim Mussared <[email protected]>
1 parent 63431a5 commit ec2fe5d

File tree

5 files changed

+8
-35
lines changed

5 files changed

+8
-35
lines changed

ports/zephyr/modusocket.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,4 +472,6 @@ const mp_obj_module_t mp_module_usocket = {
472472
.globals = (mp_obj_dict_t *)&mp_module_usocket_globals,
473473
};
474474

475+
MP_REGISTER_MODULE(MP_QSTR_usocket, mp_module_usocket, MICROPY_PY_USOCKET);
476+
475477
#endif // MICROPY_PY_USOCKET

ports/zephyr/modutime.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,6 @@ const mp_obj_module_t mp_module_time = {
6464
.globals = (mp_obj_dict_t *)&mp_module_time_globals,
6565
};
6666

67+
MP_REGISTER_MODULE(MP_QSTR_utime, mp_module_time, MICROPY_PY_UTIME);
68+
6769
#endif // MICROPY_PY_UTIME

ports/zephyr/modzephyr.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,6 @@ const mp_obj_module_t mp_module_zephyr = {
8989
.globals = (mp_obj_dict_t *)&mp_module_time_globals,
9090
};
9191

92+
MP_REGISTER_MODULE(MP_QSTR_zephyr, mp_module_zephyr, MICROPY_PY_ZEPHYR);
93+
9294
#endif // MICROPY_PY_ZEPHYR

ports/zephyr/modzsensor.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,4 +142,6 @@ const mp_obj_module_t mp_module_zsensor = {
142142
.globals = (mp_obj_dict_t *)&mp_module_zsensor_globals,
143143
};
144144

145+
MP_REGISTER_MODULE(MP_QSTR_zsensor, mp_module_zsensor, MICROPY_PY_ZSENSOR);
146+
145147
#endif // MICROPY_PY_UHASHLIB

ports/zephyr/mpconfigport.h

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -138,41 +138,6 @@ typedef long mp_off_t;
138138
void *machine_pin_irq_list; /* Linked list of pin irq objects */ \
139139
struct _mp_bluetooth_zephyr_root_pointers_t *bluetooth_zephyr_root_pointers;
140140

141-
extern const struct _mp_obj_module_t mp_module_time;
142-
extern const struct _mp_obj_module_t mp_module_usocket;
143-
extern const struct _mp_obj_module_t mp_module_zephyr;
144-
extern const struct _mp_obj_module_t mp_module_zsensor;
145-
146-
#if MICROPY_PY_USOCKET
147-
#define MICROPY_PY_USOCKET_DEF { MP_ROM_QSTR(MP_QSTR_usocket), MP_ROM_PTR(&mp_module_usocket) },
148-
#else
149-
#define MICROPY_PY_USOCKET_DEF
150-
#endif
151-
152-
#if MICROPY_PY_UTIME
153-
#define MICROPY_PY_UTIME_DEF { MP_ROM_QSTR(MP_QSTR_utime), MP_ROM_PTR(&mp_module_time) },
154-
#else
155-
#define MICROPY_PY_UTIME_DEF
156-
#endif
157-
158-
#if MICROPY_PY_ZEPHYR
159-
#define MICROPY_PY_ZEPHYR_DEF { MP_ROM_QSTR(MP_QSTR_zephyr), MP_ROM_PTR(&mp_module_zephyr) },
160-
#else
161-
#define MICROPY_PY_ZEPHYR_DEF
162-
#endif
163-
164-
#if MICROPY_PY_ZSENSOR
165-
#define MICROPY_PY_ZSENSOR_DEF { MP_ROM_QSTR(MP_QSTR_zsensor), MP_ROM_PTR(&mp_module_zsensor) },
166-
#else
167-
#define MICROPY_PY_ZSENSOR_DEF
168-
#endif
169-
170-
#define MICROPY_PORT_BUILTIN_MODULES \
171-
MICROPY_PY_USOCKET_DEF \
172-
MICROPY_PY_UTIME_DEF \
173-
MICROPY_PY_ZEPHYR_DEF \
174-
MICROPY_PY_ZSENSOR_DEF \
175-
176141
// extra built in names to add to the global namespace
177142
#define MICROPY_PORT_BUILTINS \
178143
{ MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mp_builtin_open_obj) },

0 commit comments

Comments
 (0)