Skip to content

Commit b3ca6fd

Browse files
authored
Merge pull request #6995 from dhalbert/missing-support-matrix-modules
add missing native modules to support matrix
2 parents 9292af5 + ed87579 commit b3ca6fd

File tree

9 files changed

+66
-42
lines changed

9 files changed

+66
-42
lines changed

docs/design_guide.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ following structure:
309309
310310
param_type
311311
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
312-
The type of the parameter. This could be among other `int`, `float`, `str` `bool`, etc.
312+
The type of the parameter. This could be, among others, ``int``, ``float``, ``str``, ``bool``, etc.
313313
To document an object in the CircuitPython domain, you need to include a ``~`` before the
314314
definition as shown in the following example:
315315

docs/library/builtins.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
:mod:`builtins` -- builtin functions and exceptions
22
===================================================
33

4+
.. module:: builtins
5+
:synopsis: builtin Python functions
6+
47
All builtin functions and exceptions are described here. They are also
5-
available via ``builtins`` module.
8+
available via the ``builtins`` module.
69

710
For more information about built-ins, see the following CPython documentation:
811

docs/library/collections.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Classes
2828

2929
- The optional *flags* can be 1 to check for overflow when adding items.
3030

31-
As well as supporting `bool` and `len`, deque objects have the following
31+
As well as supporting ``bool`` and ``len``, deque objects have the following
3232
methods:
3333

3434
.. method:: deque.append(x)

docs/library/micropython.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ Functions
7676
.. function:: heap_locked()
7777

7878
Lock or unlock the heap. When locked no memory allocation can occur and a
79-
`MemoryError` will be raised if any heap allocation is attempted.
79+
``MemoryError`` will be raised if any heap allocation is attempted.
8080
`heap_locked()` returns a true value if the heap is currently locked.
8181

8282
These functions can be nested, ie `heap_lock()` can be called multiple times

docs/shared_bindings_matrix.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,23 @@
5656
}
5757

5858
ADDITIONAL_MODULES = {
59-
"fontio": "CIRCUITPY_DISPLAYIO",
60-
"terminalio": "CIRCUITPY_DISPLAYIO",
59+
"_asyncio": "MICROPY_PY_UASYNCIO",
6160
"adafruit_bus_device": "CIRCUITPY_BUSDEVICE",
6261
"adafruit_pixelbuf": "CIRCUITPY_PIXELBUF",
62+
"array": "CIRCUITPY_ARRAY",
63+
# always available, so depend on something that's always 1.
64+
"builtins": "CIRCUITPY",
65+
"collections": "CIRCUITPY_COLLECTIONS",
66+
"fontio": "CIRCUITPY_DISPLAYIO",
67+
"io": "CIRCUITPY_IO",
68+
"select": "MICROPY_PY_USELECT_SELECT",
69+
"terminalio": "CIRCUITPY_DISPLAYIO",
70+
"sys": "CIRCUITPY_SYS",
6371
"usb": "CIRCUITPY_USB_HOST",
6472
}
6573

74+
MODULES_NOT_IN_SHARED_BINDINGS = ["_asyncio", "array", "binascii", "builtins", "collections", "errno", "json", "re", "select", "sys", "ulab"]
75+
6676
FROZEN_EXCLUDES = ["examples", "docs", "tests", "utils", "conf.py", "setup.py"]
6777
"""Files and dirs at the root of a frozen directory that should be ignored.
6878
This is the same list as in the preprocess_frozen_modules script."""
@@ -82,7 +92,7 @@ def get_shared_bindings():
8292
""" Get a list of modules in shared-bindings based on folder names.
8393
"""
8494
shared_bindings_dir = get_circuitpython_root_dir() / "shared-bindings"
85-
return [item.name for item in shared_bindings_dir.iterdir()] + ["binascii", "errno", "json", "re", "ulab"]
95+
return [item.name for item in shared_bindings_dir.iterdir()] + MODULES_NOT_IN_SHARED_BINDINGS
8696

8797

8898
def get_board_mapping():

py/circuitpy_mpconfig.h

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@
3535
#include <stdatomic.h>
3636

3737
// This is CircuitPython.
38-
#define CIRCUITPY 1
38+
// Always 1: defined in circuitpy_mpconfig.mk
39+
// #define CIRCUITPY (1)
3940

4041
// REPR_C encodes qstrs, 31-bit ints, and 30-bit floats in a single 32-bit word.
4142
#ifndef MICROPY_OBJ_REPR
@@ -91,7 +92,7 @@ extern void common_hal_mcu_enable_interrupts(void);
9192
#define MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE (CIRCUITPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE)
9293
#define MICROPY_PERSISTENT_CODE_LOAD (1)
9394

94-
#define MICROPY_PY_ARRAY (1)
95+
#define MICROPY_PY_ARRAY (CIRCUITPY_ARRAY)
9596
#define MICROPY_PY_ARRAY_SLICE_ASSIGN (1)
9697
#define MICROPY_PY_ATTRTUPLE (1)
9798

@@ -113,21 +114,30 @@ extern void common_hal_mcu_enable_interrupts(void);
113114
#define MICROPY_PY_BUILTINS_STR_UNICODE (1)
114115

115116
#define MICROPY_PY_CMATH (0)
116-
#define MICROPY_PY_COLLECTIONS (1)
117+
#define MICROPY_PY_COLLECTIONS (CIRCUITPY_COLLECTIONS)
117118
#define MICROPY_PY_DESCRIPTORS (1)
118119
#define MICROPY_PY_IO_FILEIO (1)
119120
#define MICROPY_PY_GC (1)
120121
// Supplanted by shared-bindings/math
122+
#define MICROPY_PY_IO (CIRCUITPY_IO)
121123
#define MICROPY_PY_MATH (0)
122124
#define MICROPY_PY_MICROPYTHON_MEM_INFO (0)
123125
// Supplanted by shared-bindings/struct
124126
#define MICROPY_PY_STRUCT (0)
125-
#define MICROPY_PY_SYS (1)
127+
#define MICROPY_PY_SYS (CIRCUITPY_SYS)
126128
#define MICROPY_PY_SYS_MAXSIZE (1)
127129
#define MICROPY_PY_SYS_STDFILES (1)
130+
// In extmod
131+
#define MICROPY_PY_UBINASCII (CIRCUITPY_BINASCII)
132+
#define MICROPY_PY_UERRNO (CIRCUITPY_ERRNO)
133+
// Uses about 80 bytes.
134+
#define MICROPY_PY_UERRNO_ERRORCODE (CIRCUITPY_ERRNO)
128135
// Supplanted by shared-bindings/random
129136
#define MICROPY_PY_URANDOM (0)
130137
#define MICROPY_PY_URANDOM_EXTRA_FUNCS (0)
138+
// In extmod
139+
#define MICROPY_PY_UJSON (CIRCUITPY_JSON)
140+
#define MICROPY_PY_URE (CIRCUITPY_RE)
131141
#define MICROPY_PY___FILE__ (1)
132142

133143
#define MICROPY_QSTR_BYTES_IN_HASH (1)
@@ -349,26 +359,6 @@ typedef long mp_off_t;
349359
extern const struct _mp_obj_module_t nvm_module;
350360
#endif
351361

352-
// Following modules are implemented in either extmod or py directory.
353-
354-
#define MICROPY_PY_UBINASCII CIRCUITPY_BINASCII
355-
356-
#define MICROPY_PY_UERRNO CIRCUITPY_ERRNO
357-
// Uses about 80 bytes.
358-
#define MICROPY_PY_UERRNO_ERRORCODE CIRCUITPY_ERRNO
359-
360-
#define MICROPY_PY_URE CIRCUITPY_RE
361-
362-
#if CIRCUITPY_JSON
363-
#define MICROPY_PY_UJSON (1)
364-
#define MICROPY_PY_IO (1)
365-
#else
366-
#ifndef MICROPY_PY_IO
367-
// We don't need MICROPY_PY_IO unless someone else wants it.
368-
#define MICROPY_PY_IO (0)
369-
#endif
370-
#endif
371-
372362
#ifndef ULAB_SUPPORTS_COMPLEX
373363
#define ULAB_SUPPORTS_COMPLEX (0)
374364
#endif

py/circuitpy_mpconfig.mk

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626
# Boards default to all modules enabled (with exceptions)
2727
# Manually disable by overriding in #mpconfigboard.mk
2828

29+
# Always on. Present here to help generate documentation module support matrix for "builtins".
30+
CIRCUITPY = 1
31+
CFLAGS += -DCIRCUITPY=$(CIRCUITPY)
32+
2933
# Smaller builds can be forced for resource constrained chips (typically SAMD21s
3034
# without external flash) by setting CIRCUITPY_FULL_BUILD=0. Avoid using this
3135
# for merely incomplete ports, as it changes settings in other files.
@@ -68,6 +72,9 @@ CFLAGS += -DCIRCUITPY_ANALOGBUFIO=$(CIRCUITPY_ANALOGBUFIO)
6872
CIRCUITPY_ANALOGIO ?= 1
6973
CFLAGS += -DCIRCUITPY_ANALOGIO=$(CIRCUITPY_ANALOGIO)
7074

75+
CIRCUITPY_ARRAY ?= 1
76+
CFLAGS += -DCIRCUITPY_ARRAY=$(CIRCUITPY_ARRAY)
77+
7178
CIRCUITPY_ATEXIT ?= $(CIRCUITPY_FULL_BUILD)
7279
CFLAGS += -DCIRCUITPY_ATEXIT=$(CIRCUITPY_ATEXIT)
7380

@@ -159,20 +166,17 @@ CFLAGS += -DCIRCUITPY_CAMERA=$(CIRCUITPY_CAMERA)
159166
CIRCUITPY_CANIO ?= 0
160167
CFLAGS += -DCIRCUITPY_CANIO=$(CIRCUITPY_CANIO)
161168

162-
CIRCUITPY_CYW43 ?= 0
163-
CFLAGS += -DCIRCUITPY_CYW43=$(CIRCUITPY_CYW43)
164-
165-
CIRCUITPY_DIGITALIO ?= 1
166-
CFLAGS += -DCIRCUITPY_DIGITALIO=$(CIRCUITPY_DIGITALIO)
169+
CIRCUITPY_COLLECTIONS ?= 1
170+
CFLAGS += -DCIRCUITPY_COLLECTIONS=$(CIRCUITPY_COLLECTIONS)
167171

168172
CIRCUITPY_COMPUTED_GOTO_SAVE_SPACE ?= 0
169173
CFLAGS += -DCIRCUITPY_COMPUTED_GOTO_SAVE_SPACE=$(CIRCUITPY_COMPUTED_GOTO_SAVE_SPACE)
170174

171-
CIRCUITPY_OPT_LOAD_ATTR_FAST_PATH ?= 1
172-
CFLAGS += -DCIRCUITPY_OPT_LOAD_ATTR_FAST_PATH=$(CIRCUITPY_OPT_LOAD_ATTR_FAST_PATH)
175+
CIRCUITPY_CYW43 ?= 0
176+
CFLAGS += -DCIRCUITPY_CYW43=$(CIRCUITPY_CYW43)
173177

174-
CIRCUITPY_OPT_MAP_LOOKUP_CACHE ?= $(CIRCUITPY_FULL_BUILD)
175-
CFLAGS += -DCIRCUITPY_OPT_MAP_LOOKUP_CACHE=$(CIRCUITPY_OPT_MAP_LOOKUP_CACHE)
178+
CIRCUITPY_DIGITALIO ?= 1
179+
CFLAGS += -DCIRCUITPY_DIGITALIO=$(CIRCUITPY_DIGITALIO)
176180

177181
CIRCUITPY_COUNTIO ?= $(CIRCUITPY_FULL_BUILD)
178182
CFLAGS += -DCIRCUITPY_COUNTIO=$(CIRCUITPY_COUNTIO)
@@ -257,6 +261,10 @@ CFLAGS += -DCIRCUITPY_I2CTARGET=$(CIRCUITPY_I2CTARGET)
257261
CIRCUITPY_IMAGECAPTURE ?= 0
258262
CFLAGS += -DCIRCUITPY_IMAGECAPTURE=$(CIRCUITPY_IMAGECAPTURE)
259263

264+
# io - needed by JSON support
265+
CIRCUITPY_IO ?= $(CIRCUITPY_JSON)
266+
CFLAGS += -DCIRCUITPY_IO=$(CIRCUITPY_IO)
267+
260268
CIRCUITPY_IPADDRESS ?= $(CIRCUITPY_WIFI)
261269
CFLAGS += -DCIRCUITPY_IPADDRESS=$(CIRCUITPY_IPADDRESS)
262270

@@ -293,6 +301,12 @@ CFLAGS += -DCIRCUITPY_NVM=$(CIRCUITPY_NVM)
293301
CIRCUITPY_ONEWIREIO ?= $(CIRCUITPY_BUSIO)
294302
CFLAGS += -DCIRCUITPY_ONEWIREIO=$(CIRCUITPY_ONEWIREIO)
295303

304+
CIRCUITPY_OPT_LOAD_ATTR_FAST_PATH ?= 1
305+
CFLAGS += -DCIRCUITPY_OPT_LOAD_ATTR_FAST_PATH=$(CIRCUITPY_OPT_LOAD_ATTR_FAST_PATH)
306+
307+
CIRCUITPY_OPT_MAP_LOOKUP_CACHE ?= $(CIRCUITPY_FULL_BUILD)
308+
CFLAGS += -DCIRCUITPY_OPT_MAP_LOOKUP_CACHE=$(CIRCUITPY_OPT_MAP_LOOKUP_CACHE)
309+
296310
CIRCUITPY_OS ?= 1
297311
CFLAGS += -DCIRCUITPY_OS=$(CIRCUITPY_OS)
298312

@@ -374,7 +388,6 @@ CFLAGS += -DCIRCUITPY_SOCKETPOOL=$(CIRCUITPY_SOCKETPOOL)
374388
CIRCUITPY_SSL ?= $(CIRCUITPY_WIFI)
375389
CFLAGS += -DCIRCUITPY_SSL=$(CIRCUITPY_SSL)
376390

377-
# Currently always off.
378391
CIRCUITPY_STAGE ?= 0
379392
CFLAGS += -DCIRCUITPY_STAGE=$(CIRCUITPY_STAGE)
380393

@@ -393,6 +406,9 @@ CFLAGS += -DCIRCUITPY_SUPERVISOR=$(CIRCUITPY_SUPERVISOR)
393406
CIRCUITPY_SYNTHIO ?= $(CIRCUITPY_AUDIOCORE)
394407
CFLAGS += -DCIRCUITPY_SYNTHIO=$(CIRCUITPY_SYNTHIO)
395408

409+
CIRCUITPY_SYS ?= 1
410+
CFLAGS += -DCIRCUITPY_SYS=$(CIRCUITPY_SYS)
411+
396412
CIRCUITPY_TERMINALIO ?= $(CIRCUITPY_DISPLAYIO)
397413
CFLAGS += -DCIRCUITPY_TERMINALIO=$(CIRCUITPY_TERMINALIO)
398414

shared-bindings/analogio/AnalogIn.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ MP_PROPERTY_GETTER(analogio_analogin_value_obj,
117117

118118
//| reference_voltage: float
119119
//| """The maximum voltage measurable (also known as the reference voltage) as a
120-
//| `float` in Volts. Note the ADC value may not scale to the actual voltage linearly
120+
//| ``float`` in Volts. Note the ADC value may not scale to the actual voltage linearly
121121
//| at ends of the analog range."""
122122
//|
123123
STATIC mp_obj_t analogio_analogin_obj_get_reference_voltage(mp_obj_t self_in) {

shared-bindings/support_matrix.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ Module Support Matrix - Which Modules Are Available on Which Boards
66
The following table lists the available built-in modules for each CircuitPython
77
capable board, as well as each :term:`frozen module` included on it.
88

9+
You can filter this list by typing one or more module names or partial names into the search box.
10+
Only those boards that provide those modules will be listed.
11+
To exclude boards that provide a module, type a "-" in front of the module name.
12+
You can also type a regular expression as a filter.
13+
914
.. raw:: html
1015

1116
<p id="support-matrix-filter-block"><input placeholder="Filter the boards by available modules" id="support-matrix-filter" type="text"/><span id="support-matrix-filter-num">(all)</span></p>

0 commit comments

Comments
 (0)