@@ -244,26 +244,16 @@ typedef long mp_off_t;
244
244
// These CIRCUITPY_xxx values should all be defined in the *.mk files as being on or off.
245
245
// So if any are not defined in *.mk, they'll throw an error here.
246
246
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
-
254
247
#if CIRCUITPY_BOARD
255
248
#define BOARD_I2C (defined(DEFAULT_I2C_BUS_SDA) && defined(DEFAULT_I2C_BUS_SCL))
256
249
#define BOARD_SPI (defined(DEFAULT_SPI_BUS_SCK) && defined(DEFAULT_SPI_BUS_MISO) && defined(DEFAULT_SPI_BUS_MOSI))
257
250
#define BOARD_UART (defined(DEFAULT_UART_BUS_RX) && defined(DEFAULT_UART_BUS_TX))
258
-
259
251
// I2C and SPI are always allocated off the heap.
260
-
261
252
#if BOARD_UART
262
253
#define BOARD_UART_ROOT_POINTER mp_obj_t shared_uart_bus;
263
254
#else
264
255
#define BOARD_UART_ROOT_POINTER
265
256
#endif
266
-
267
257
#else
268
258
#define BOARD_UART_ROOT_POINTER
269
259
#endif
@@ -276,23 +266,6 @@ typedef long mp_off_t;
276
266
#define CIRCUITPY_DISPLAY_LIMIT (0)
277
267
#endif
278
268
279
- #if CIRCUITPY_ERRNO
280
- #define MICROPY_PY_UERRNO (1)
281
- // Uses about 80 bytes.
282
- #define MICROPY_PY_UERRNO_ERRORCODE (1)
283
- #define ERRNO_MODULE { MP_ROM_QSTR(MP_QSTR_errno), MP_ROM_PTR(&mp_module_uerrno) },
284
- #else
285
- #define ERRNO_MODULE
286
- #
287
- #endif
288
-
289
- #if CIRCUITPY_ESPIDF
290
- extern const struct _mp_obj_module_t espidf_module ;
291
- #define ESPIDF_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_espidf),(mp_obj_t)&espidf_module },
292
- #else
293
- #define ESPIDF_MODULE
294
- #endif
295
-
296
269
#if CIRCUITPY_GAMEPADSHIFT
297
270
// Scan gamepad every 32ms
298
271
#define CIRCUITPY_GAMEPAD_TICKS 0x1f
@@ -301,18 +274,6 @@ extern const struct _mp_obj_module_t espidf_module;
301
274
#define GAMEPAD_ROOT_POINTERS
302
275
#endif
303
276
304
- #if CIRCUITPY_JSON
305
- #define MICROPY_PY_UJSON (1)
306
- #define MICROPY_PY_IO (1)
307
- #define JSON_MODULE { MP_ROM_QSTR(MP_QSTR_json), MP_ROM_PTR(&mp_module_ujson) },
308
- #else
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
313
- #define JSON_MODULE
314
- #endif
315
-
316
277
#if CIRCUITPY_KEYPAD
317
278
#define KEYPAD_ROOT_POINTERS mp_obj_t keypad_scanners_linked_list;
318
279
#else
@@ -331,83 +292,51 @@ extern const struct _mp_obj_module_t espidf_module;
331
292
extern const struct _mp_obj_module_t nvm_module ;
332
293
#endif
333
294
334
- #if CIRCUITPY_OS
335
- extern const struct _mp_obj_module_t os_module ;
336
- #define OS_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_os), (mp_obj_t)&os_module },
337
- #define OS_MODULE_ALT_NAME { MP_OBJ_NEW_QSTR(MP_QSTR__os), (mp_obj_t)&os_module },
338
- #else
339
- #define OS_MODULE
340
- #define OS_MODULE_ALT_NAME
341
- #endif
295
+ // Following modules are implemented in either extmod or py directory.
342
296
343
- #if CIRCUITPY_RE
344
- #define MICROPY_PY_URE (1)
345
- #define RE_MODULE { MP_ROM_QSTR(MP_QSTR_re), MP_ROM_PTR(&mp_module_ure) },
346
- #else
347
- #define RE_MODULE
348
- #endif
297
+ #define MICROPY_PY_UBINASCII CIRCUITPY_BINASCII
349
298
350
- #if CIRCUITPY_RP2PIO
351
- extern const struct _mp_obj_module_t rp2pio_module ;
352
- #define RP2PIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_rp2pio),(mp_obj_t)&rp2pio_module },
353
- #else
354
- #define RP2PIO_MODULE
355
- #endif
299
+ #define MICROPY_PY_UERRNO CIRCUITPY_ERRNO
300
+ // Uses about 80 bytes.
301
+ #define MICROPY_PY_UERRNO_ERRORCODE CIRCUITPY_ERRNO
356
302
357
- #if CIRCUITPY_SAMD
358
- extern const struct _mp_obj_module_t samd_module ;
359
- #define SAMD_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_samd),(mp_obj_t)&samd_module },
360
- #else
361
- #define SAMD_MODULE
362
- #endif
303
+ #define MICROPY_PY_URE CIRCUITPY_RE
363
304
364
- #if CIRCUITPY_TIME
365
- extern const struct _mp_obj_module_t time_module ;
366
- #define TIME_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_time), (mp_obj_t)&time_module },
367
- #define TIME_MODULE_ALT_NAME { MP_OBJ_NEW_QSTR(MP_QSTR__time), (mp_obj_t)&time_module },
305
+ #if CIRCUITPY_JSON
306
+ #define MICROPY_PY_UJSON (1)
307
+ #define MICROPY_PY_IO (1)
368
308
#else
369
- #define TIME_MODULE
370
- #define TIME_MODULE_ALT_NAME
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
371
313
#endif
372
314
373
- #if defined( CIRCUITPY_ULAB ) && CIRCUITPY_ULAB
315
+ #if CIRCUITPY_ULAB
374
316
// ulab requires reverse special methods
375
317
#if defined(MICROPY_PY_REVERSE_SPECIAL_METHODS ) && !MICROPY_PY_REVERSE_SPECIAL_METHODS
376
318
#error "ulab requires MICROPY_PY_REVERSE_SPECIAL_METHODS"
377
319
#endif
378
- #define ULAB_MODULE \
379
- { MP_ROM_QSTR(MP_QSTR_ulab), MP_ROM_PTR(&ulab_user_cmodule) },
380
- #else
381
- #define ULAB_MODULE
382
320
#endif
383
321
384
322
// Define certain native modules with weak links so they can be replaced with Python
385
323
// implementations. This list may grow over time.
386
- #define MICROPY_PORT_BUILTIN_MODULE_WEAK_LINKS \
387
- OS_MODULE \
388
- TIME_MODULE \
324
+
325
+ #define MICROPY_PORT_BUILTIN_MODULE_WEAK_LINKS
389
326
390
327
// Native modules that are weak links can be accessed directly
391
328
// by prepending their name with an underscore. This list should correspond to
392
329
// MICROPY_PORT_BUILTIN_MODULE_WEAK_LINKS, assuming you want the native modules
393
330
// to be accessible when overriden.
394
- #define MICROPY_PORT_BUILTIN_MODULE_ALT_NAMES \
395
- OS_MODULE_ALT_NAME \
396
- TIME_MODULE_ALT_NAME \
331
+
332
+ #define MICROPY_PORT_BUILTIN_MODULE_ALT_NAMES
397
333
398
334
// This is an inclusive list that should correspond to the CIRCUITPY_XXX list above,
399
335
// including dependencies.
400
336
// Some of these definitions will be blank depending on what is turned on and off.
401
337
// Some are omitted because they're in MICROPY_PORT_BUILTIN_MODULE_WEAK_LINKS above.
402
338
403
- #define MICROPY_PORT_BUILTIN_MODULES_STRONG_LINKS \
404
- BINASCII_MODULE \
405
- ERRNO_MODULE \
406
- ESPIDF_MODULE \
407
- JSON_MODULE \
408
- RE_MODULE \
409
- RP2PIO_MODULE \
410
- SAMD_MODULE \
339
+ #define MICROPY_PORT_BUILTIN_MODULES_STRONG_LINKS
411
340
412
341
// The following modules are defined in their respective __init__.c file in the
413
342
// shared-bindings directory using MP_REGISTER_MODULE.
0 commit comments