Content-Length: 402202 | pFad | http://github.com/adafruit/circuitpython/commit/17af5cd492e926c2d3a2c06b6519242bf8f3885c

6A Use MP_REGISTER_MODULE with displayio, terminalio, and fontio · adafruit/circuitpython@17af5cd · GitHub
Skip to content

Commit 17af5cd

Browse files
committed
Use MP_REGISTER_MODULE with displayio, terminalio, and fontio
Convert from using MICROPY_PORT_BUILTIN_MODULES_STRONG_LINKS to using MP_REGISTER_MODULE for displayio, terminalio, and fontio modules. Related to #5183.
1 parent da320c3 commit 17af5cd

File tree

4 files changed

+11
-17
lines changed

4 files changed

+11
-17
lines changed

Diff for: py/circuitpy_mpconfig.h

+5-17
Original file line numberDiff line numberDiff line change
@@ -412,27 +412,18 @@ extern const struct _mp_obj_module_t digitalio_module;
412412
#define DIGITALIO_MODULE
413413
#endif
414414

415+
// CIRCUITPY_DISPLAYIO uses MP_REGISTER_MODULE
416+
// CIRCUITPY_TERMINALIO uses MP_REGISTER_MODULE
417+
// CIRCUITPY_FONTIO uses MP_REGISTER_MODULE
418+
415419
#if CIRCUITPY_DISPLAYIO
416-
extern const struct _mp_obj_module_t displayio_module;
417-
extern const struct _mp_obj_module_t fontio_module;
418-
extern const struct _mp_obj_module_t terminalio_module;
419-
#define DISPLAYIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_displayio), (mp_obj_t)&displayio_module },
420420
#ifndef CIRCUITPY_DISPLAY_LIMIT
421421
#define CIRCUITPY_DISPLAY_LIMIT (1)
422422
#endif
423423
#else
424-
#define DISPLAYIO_MODULE
425424
#define CIRCUITPY_DISPLAY_LIMIT (0)
426425
#endif
427426

428-
#if CIRCUITPY_DISPLAYIO && CIRCUITPY_TERMINALIO
429-
#define FONTIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_fontio), (mp_obj_t)&fontio_module },
430-
#define TERMINALIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_terminalio), (mp_obj_t)&terminalio_module },
431-
#else
432-
#define FONTIO_MODULE
433-
#define TERMINALIO_MODULE
434-
#endif
435-
436427
#if CIRCUITPY_DUALBANK
437428
extern const struct _mp_obj_module_t dualbank_module;
438429
#define DUALBANK_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_dualbank), (mp_obj_t)&dualbank_module },
@@ -886,7 +877,7 @@ extern const struct _mp_obj_module_t msgpack_module;
886877
TIME_MODULE_ALT_NAME \
887878

888879
// This is an inclusive list that should correspond to the CIRCUITPY_XXX list above,
889-
// including dependencies such as TERMINALIO depending on DISPLAYIO (shown by indentation).
880+
// including dependencies (shown by indentation).
890881
// Some of these definitions will be blank depending on what is turned on and off.
891882
// Some are omitted because they're in MICROPY_PORT_BUILTIN_MODULE_WEAK_LINKS above.
892883
#define MICROPY_PORT_BUILTIN_MODULES_STRONG_LINKS \
@@ -912,10 +903,7 @@ extern const struct _mp_obj_module_t msgpack_module;
912903
CANIO_MODULE \
913904
COUNTIO_MODULE \
914905
DIGITALIO_MODULE \
915-
DISPLAYIO_MODULE \
916906
DUALBANK_MODULE \
917-
FONTIO_MODULE \
918-
TERMINALIO_MODULE \
919907
VECTORIO_MODULE \
920908
ERRNO_MODULE \
921909
ESPIDF_MODULE \

Diff for: shared-bindings/displayio/__init__.c

+2
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,5 @@ const mp_obj_module_t displayio_module = {
136136
.base = { &mp_type_module },
137137
.globals = (mp_obj_dict_t *)&displayio_module_globals,
138138
};
139+
140+
MP_REGISTER_MODULE(MP_QSTR_displayio, displayio_module, CIRCUITPY_DISPLAYIO);

Diff for: shared-bindings/fontio/__init__.c

+2
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,5 @@ const mp_obj_module_t fontio_module = {
4848
.base = { &mp_type_module },
4949
.globals = (mp_obj_dict_t *)&fontio_module_globals,
5050
};
51+
52+
MP_REGISTER_MODULE(MP_QSTR_fontio, fontio_module, CIRCUITPY_DISPLAYIO && CIRCUITPY_TERMINALIO);

Diff for: shared-bindings/terminalio/__init__.c

+2
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,5 @@ const mp_obj_module_t terminalio_module = {
5656
.base = { &mp_type_module },
5757
.globals = (mp_obj_dict_t *)&terminalio_module_globals,
5858
};
59+
60+
MP_REGISTER_MODULE(MP_QSTR_terminalio, terminalio_module, CIRCUITPY_DISPLAYIO && CIRCUITPY_TERMINALIO);

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/adafruit/circuitpython/commit/17af5cd492e926c2d3a2c06b6519242bf8f3885c

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy