@@ -244,13 +244,6 @@ typedef long mp_off_t;
244244// These CIRCUITPY_xxx values should all be defined in the *.mk files as being on or off.
245245// So if any are not defined in *.mk, they'll throw an error here.
246246
247- #if CIRCUITPY_BINASCII
248- #define MICROPY_PY_UBINASCII CIRCUITPY_BINASCII
249- #define BINASCII_MODULE { MP_ROM_QSTR(MP_QSTR_binascii), MP_ROM_PTR(&mp_module_ubinascii) },
250- #else
251- #define BINASCII_MODULE
252- #endif
253-
254247#if CIRCUITPY_BOARD
255248#define BOARD_I2C (defined(DEFAULT_I2C_BUS_SDA) && defined(DEFAULT_I2C_BUS_SCL))
256249#define BOARD_SPI (defined(DEFAULT_SPI_BUS_SCK) && defined(DEFAULT_SPI_BUS_MISO) && defined(DEFAULT_SPI_BUS_MOSI))
@@ -273,15 +266,6 @@ typedef long mp_off_t;
273266#define CIRCUITPY_DISPLAY_LIMIT (0)
274267#endif
275268
276- #if CIRCUITPY_ERRNO
277- #define MICROPY_PY_UERRNO (1)
278- // Uses about 80 bytes.
279- #define MICROPY_PY_UERRNO_ERRORCODE (1)
280- #define ERRNO_MODULE { MP_ROM_QSTR(MP_QSTR_errno), MP_ROM_PTR(&mp_module_uerrno) },
281- #else
282- #define ERRNO_MODULE
283- #endif
284-
285269#if CIRCUITPY_GAMEPADSHIFT
286270// Scan gamepad every 32ms
287271#define CIRCUITPY_GAMEPAD_TICKS 0x1f
@@ -290,18 +274,6 @@ typedef long mp_off_t;
290274#define GAMEPAD_ROOT_POINTERS
291275#endif
292276
293- #if CIRCUITPY_JSON
294- #define MICROPY_PY_UJSON (1)
295- #define MICROPY_PY_IO (1)
296- #define JSON_MODULE { MP_ROM_QSTR(MP_QSTR_json), MP_ROM_PTR(&mp_module_ujson) },
297- #else
298- #ifndef MICROPY_PY_IO
299- // We don't need MICROPY_PY_IO unless someone else wants it.
300- #define MICROPY_PY_IO (0)
301- #endif
302- #define JSON_MODULE
303- #endif
304-
305277#if CIRCUITPY_KEYPAD
306278#define KEYPAD_ROOT_POINTERS mp_obj_t keypad_scanners_linked_list;
307279#else
@@ -320,22 +292,31 @@ typedef long mp_off_t;
320292extern const struct _mp_obj_module_t nvm_module ;
321293#endif
322294
323- #if CIRCUITPY_RE
324- #define MICROPY_PY_URE (1)
325- #define RE_MODULE { MP_ROM_QSTR(MP_QSTR_re), MP_ROM_PTR(&mp_module_ure) },
295+ // Following modules are implemented in either extmod or py directory.
296+
297+ #define MICROPY_PY_UBINASCII CIRCUITPY_BINASCII
298+
299+ #define MICROPY_PY_UERRNO CIRCUITPY_ERRNO
300+ // Uses about 80 bytes.
301+ #define MICROPY_PY_UERRNO_ERRORCODE CIRCUITPY_ERRNO
302+
303+ #define MICROPY_PY_URE CIRCUITPY_RE
304+
305+ #if CIRCUITPY_JSON
306+ #define MICROPY_PY_UJSON (1)
307+ #define MICROPY_PY_IO (1)
326308#else
327- #define RE_MODULE
309+ #ifndef MICROPY_PY_IO
310+ // We don't need MICROPY_PY_IO unless someone else wants it.
311+ #define MICROPY_PY_IO (0)
312+ #endif
328313#endif
329314
330- #if defined( CIRCUITPY_ULAB ) && CIRCUITPY_ULAB
315+ #if CIRCUITPY_ULAB
331316// ulab requires reverse special methods
332317#if defined(MICROPY_PY_REVERSE_SPECIAL_METHODS ) && !MICROPY_PY_REVERSE_SPECIAL_METHODS
333318#error "ulab requires MICROPY_PY_REVERSE_SPECIAL_METHODS"
334319#endif
335- #define ULAB_MODULE \
336- { MP_ROM_QSTR(MP_QSTR_ulab), MP_ROM_PTR(&ulab_user_cmodule) },
337- #else
338- #define ULAB_MODULE
339320#endif
340321
341322// Define certain native modules with weak links so they can be replaced with Python
@@ -355,11 +336,7 @@ extern const struct _mp_obj_module_t nvm_module;
355336// Some of these definitions will be blank depending on what is turned on and off.
356337// Some are omitted because they're in MICROPY_PORT_BUILTIN_MODULE_WEAK_LINKS above.
357338
358- #define MICROPY_PORT_BUILTIN_MODULES_STRONG_LINKS \
359- BINASCII_MODULE \
360- ERRNO_MODULE \
361- JSON_MODULE \
362- RE_MODULE \
339+ #define MICROPY_PORT_BUILTIN_MODULES_STRONG_LINKS
363340
364341// The following modules are defined in their respective __init__.c file in the
365342// shared-bindings directory using MP_REGISTER_MODULE.
0 commit comments