Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add missing native modules to support matrix #6995

Merged
merged 1 commit into from
Oct 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/design_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ following structure:

param_type
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The type of the parameter. This could be among other `int`, `float`, `str` `bool`, etc.
The type of the parameter. This could be, among others, ``int``, ``float``, ``str``, ``bool``, etc.
To document an object in the CircuitPython domain, you need to include a ``~`` before the
definition as shown in the following example:

Expand Down
5 changes: 4 additions & 1 deletion docs/library/builtins.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
:mod:`builtins` -- builtin functions and exceptions
===================================================

.. module:: builtins
:synopsis: builtin Python functions

All builtin functions and exceptions are described here. They are also
available via ``builtins`` module.
available via the ``builtins`` module.

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

Expand Down
2 changes: 1 addition & 1 deletion docs/library/collections.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Classes

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

As well as supporting `bool` and `len`, deque objects have the following
As well as supporting ``bool`` and ``len``, deque objects have the following
methods:

.. method:: deque.append(x)
Expand Down
2 changes: 1 addition & 1 deletion docs/library/micropython.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Functions
.. function:: heap_locked()

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

These functions can be nested, ie `heap_lock()` can be called multiple times
Expand Down
16 changes: 13 additions & 3 deletions docs/shared_bindings_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,23 @@
}

ADDITIONAL_MODULES = {
"fontio": "CIRCUITPY_DISPLAYIO",
"terminalio": "CIRCUITPY_DISPLAYIO",
"_asyncio": "MICROPY_PY_UASYNCIO",
"adafruit_bus_device": "CIRCUITPY_BUSDEVICE",
"adafruit_pixelbuf": "CIRCUITPY_PIXELBUF",
"array": "CIRCUITPY_ARRAY",
# always available, so depend on something that's always 1.
"builtins": "CIRCUITPY",
"collections": "CIRCUITPY_COLLECTIONS",
"fontio": "CIRCUITPY_DISPLAYIO",
"io": "CIRCUITPY_IO",
"select": "MICROPY_PY_USELECT_SELECT",
"terminalio": "CIRCUITPY_DISPLAYIO",
"sys": "CIRCUITPY_SYS",
"usb": "CIRCUITPY_USB_HOST",
}

MODULES_NOT_IN_SHARED_BINDINGS = ["_asyncio", "array", "binascii", "builtins", "collections", "errno", "json", "re", "select", "sys", "ulab"]

FROZEN_EXCLUDES = ["examples", "docs", "tests", "utils", "conf.py", "setup.py"]
"""Files and dirs at the root of a frozen directory that should be ignored.
This is the same list as in the preprocess_frozen_modules script."""
Expand All @@ -82,7 +92,7 @@ def get_shared_bindings():
""" Get a list of modules in shared-bindings based on folder names.
"""
shared_bindings_dir = get_circuitpython_root_dir() / "shared-bindings"
return [item.name for item in shared_bindings_dir.iterdir()] + ["binascii", "errno", "json", "re", "ulab"]
return [item.name for item in shared_bindings_dir.iterdir()] + MODULES_NOT_IN_SHARED_BINDINGS


def get_board_mapping():
Expand Down
38 changes: 14 additions & 24 deletions py/circuitpy_mpconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
#include <stdatomic.h>

// This is CircuitPython.
#define CIRCUITPY 1
// Always 1: defined in circuitpy_mpconfig.mk
// #define CIRCUITPY (1)

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

#define MICROPY_PY_ARRAY (1)
#define MICROPY_PY_ARRAY (CIRCUITPY_ARRAY)
#define MICROPY_PY_ARRAY_SLICE_ASSIGN (1)
#define MICROPY_PY_ATTRTUPLE (1)

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

#define MICROPY_PY_CMATH (0)
#define MICROPY_PY_COLLECTIONS (1)
#define MICROPY_PY_COLLECTIONS (CIRCUITPY_COLLECTIONS)
#define MICROPY_PY_DESCRIPTORS (1)
#define MICROPY_PY_IO_FILEIO (1)
#define MICROPY_PY_GC (1)
// Supplanted by shared-bindings/math
#define MICROPY_PY_IO (CIRCUITPY_IO)
#define MICROPY_PY_MATH (0)
#define MICROPY_PY_MICROPYTHON_MEM_INFO (0)
// Supplanted by shared-bindings/struct
#define MICROPY_PY_STRUCT (0)
#define MICROPY_PY_SYS (1)
#define MICROPY_PY_SYS (CIRCUITPY_SYS)
#define MICROPY_PY_SYS_MAXSIZE (1)
#define MICROPY_PY_SYS_STDFILES (1)
// In extmod
#define MICROPY_PY_UBINASCII (CIRCUITPY_BINASCII)
#define MICROPY_PY_UERRNO (CIRCUITPY_ERRNO)
// Uses about 80 bytes.
#define MICROPY_PY_UERRNO_ERRORCODE (CIRCUITPY_ERRNO)
// Supplanted by shared-bindings/random
#define MICROPY_PY_URANDOM (0)
#define MICROPY_PY_URANDOM_EXTRA_FUNCS (0)
// In extmod
#define MICROPY_PY_UJSON (CIRCUITPY_JSON)
#define MICROPY_PY_URE (CIRCUITPY_RE)
#define MICROPY_PY___FILE__ (1)

#define MICROPY_QSTR_BYTES_IN_HASH (1)
Expand Down Expand Up @@ -349,26 +359,6 @@ typedef long mp_off_t;
extern const struct _mp_obj_module_t nvm_module;
#endif

// Following modules are implemented in either extmod or py directory.

#define MICROPY_PY_UBINASCII CIRCUITPY_BINASCII

#define MICROPY_PY_UERRNO CIRCUITPY_ERRNO
// Uses about 80 bytes.
#define MICROPY_PY_UERRNO_ERRORCODE CIRCUITPY_ERRNO

#define MICROPY_PY_URE CIRCUITPY_RE

#if CIRCUITPY_JSON
#define MICROPY_PY_UJSON (1)
#define MICROPY_PY_IO (1)
#else
#ifndef MICROPY_PY_IO
// We don't need MICROPY_PY_IO unless someone else wants it.
#define MICROPY_PY_IO (0)
#endif
#endif

#ifndef ULAB_SUPPORTS_COMPLEX
#define ULAB_SUPPORTS_COMPLEX (0)
#endif
Expand Down
36 changes: 26 additions & 10 deletions py/circuitpy_mpconfig.mk
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
# Boards default to all modules enabled (with exceptions)
# Manually disable by overriding in #mpconfigboard.mk

# Always on. Present here to help generate documentation module support matrix for "builtins".
CIRCUITPY = 1
CFLAGS += -DCIRCUITPY=$(CIRCUITPY)

# Smaller builds can be forced for resource constrained chips (typically SAMD21s
# without external flash) by setting CIRCUITPY_FULL_BUILD=0. Avoid using this
# for merely incomplete ports, as it changes settings in other files.
Expand Down Expand Up @@ -68,6 +72,9 @@ CFLAGS += -DCIRCUITPY_ANALOGBUFIO=$(CIRCUITPY_ANALOGBUFIO)
CIRCUITPY_ANALOGIO ?= 1
CFLAGS += -DCIRCUITPY_ANALOGIO=$(CIRCUITPY_ANALOGIO)

CIRCUITPY_ARRAY ?= 1
CFLAGS += -DCIRCUITPY_ARRAY=$(CIRCUITPY_ARRAY)

CIRCUITPY_ATEXIT ?= $(CIRCUITPY_FULL_BUILD)
CFLAGS += -DCIRCUITPY_ATEXIT=$(CIRCUITPY_ATEXIT)

Expand Down Expand Up @@ -159,20 +166,17 @@ CFLAGS += -DCIRCUITPY_CAMERA=$(CIRCUITPY_CAMERA)
CIRCUITPY_CANIO ?= 0
CFLAGS += -DCIRCUITPY_CANIO=$(CIRCUITPY_CANIO)

CIRCUITPY_CYW43 ?= 0
CFLAGS += -DCIRCUITPY_CYW43=$(CIRCUITPY_CYW43)

CIRCUITPY_DIGITALIO ?= 1
CFLAGS += -DCIRCUITPY_DIGITALIO=$(CIRCUITPY_DIGITALIO)
CIRCUITPY_COLLECTIONS ?= 1
CFLAGS += -DCIRCUITPY_COLLECTIONS=$(CIRCUITPY_COLLECTIONS)

CIRCUITPY_COMPUTED_GOTO_SAVE_SPACE ?= 0
CFLAGS += -DCIRCUITPY_COMPUTED_GOTO_SAVE_SPACE=$(CIRCUITPY_COMPUTED_GOTO_SAVE_SPACE)

CIRCUITPY_OPT_LOAD_ATTR_FAST_PATH ?= 1
CFLAGS += -DCIRCUITPY_OPT_LOAD_ATTR_FAST_PATH=$(CIRCUITPY_OPT_LOAD_ATTR_FAST_PATH)
CIRCUITPY_CYW43 ?= 0
CFLAGS += -DCIRCUITPY_CYW43=$(CIRCUITPY_CYW43)

CIRCUITPY_OPT_MAP_LOOKUP_CACHE ?= $(CIRCUITPY_FULL_BUILD)
CFLAGS += -DCIRCUITPY_OPT_MAP_LOOKUP_CACHE=$(CIRCUITPY_OPT_MAP_LOOKUP_CACHE)
CIRCUITPY_DIGITALIO ?= 1
CFLAGS += -DCIRCUITPY_DIGITALIO=$(CIRCUITPY_DIGITALIO)

CIRCUITPY_COUNTIO ?= $(CIRCUITPY_FULL_BUILD)
CFLAGS += -DCIRCUITPY_COUNTIO=$(CIRCUITPY_COUNTIO)
Expand Down Expand Up @@ -257,6 +261,10 @@ CFLAGS += -DCIRCUITPY_I2CTARGET=$(CIRCUITPY_I2CTARGET)
CIRCUITPY_IMAGECAPTURE ?= 0
CFLAGS += -DCIRCUITPY_IMAGECAPTURE=$(CIRCUITPY_IMAGECAPTURE)

# io - needed by JSON support
CIRCUITPY_IO ?= $(CIRCUITPY_JSON)
CFLAGS += -DCIRCUITPY_IO=$(CIRCUITPY_IO)

CIRCUITPY_IPADDRESS ?= $(CIRCUITPY_WIFI)
CFLAGS += -DCIRCUITPY_IPADDRESS=$(CIRCUITPY_IPADDRESS)

Expand Down Expand Up @@ -293,6 +301,12 @@ CFLAGS += -DCIRCUITPY_NVM=$(CIRCUITPY_NVM)
CIRCUITPY_ONEWIREIO ?= $(CIRCUITPY_BUSIO)
CFLAGS += -DCIRCUITPY_ONEWIREIO=$(CIRCUITPY_ONEWIREIO)

CIRCUITPY_OPT_LOAD_ATTR_FAST_PATH ?= 1
CFLAGS += -DCIRCUITPY_OPT_LOAD_ATTR_FAST_PATH=$(CIRCUITPY_OPT_LOAD_ATTR_FAST_PATH)

CIRCUITPY_OPT_MAP_LOOKUP_CACHE ?= $(CIRCUITPY_FULL_BUILD)
CFLAGS += -DCIRCUITPY_OPT_MAP_LOOKUP_CACHE=$(CIRCUITPY_OPT_MAP_LOOKUP_CACHE)

CIRCUITPY_OS ?= 1
CFLAGS += -DCIRCUITPY_OS=$(CIRCUITPY_OS)

Expand Down Expand Up @@ -374,7 +388,6 @@ CFLAGS += -DCIRCUITPY_SOCKETPOOL=$(CIRCUITPY_SOCKETPOOL)
CIRCUITPY_SSL ?= $(CIRCUITPY_WIFI)
CFLAGS += -DCIRCUITPY_SSL=$(CIRCUITPY_SSL)

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

Expand All @@ -393,6 +406,9 @@ CFLAGS += -DCIRCUITPY_SUPERVISOR=$(CIRCUITPY_SUPERVISOR)
CIRCUITPY_SYNTHIO ?= $(CIRCUITPY_AUDIOCORE)
CFLAGS += -DCIRCUITPY_SYNTHIO=$(CIRCUITPY_SYNTHIO)

CIRCUITPY_SYS ?= 1
CFLAGS += -DCIRCUITPY_SYS=$(CIRCUITPY_SYS)

CIRCUITPY_TERMINALIO ?= $(CIRCUITPY_DISPLAYIO)
CFLAGS += -DCIRCUITPY_TERMINALIO=$(CIRCUITPY_TERMINALIO)

Expand Down
2 changes: 1 addition & 1 deletion shared-bindings/analogio/AnalogIn.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ MP_PROPERTY_GETTER(analogio_analogin_value_obj,

//| reference_voltage: float
//| """The maximum voltage measurable (also known as the reference voltage) as a
//| `float` in Volts. Note the ADC value may not scale to the actual voltage linearly
//| ``float`` in Volts. Note the ADC value may not scale to the actual voltage linearly
//| at ends of the analog range."""
//|
STATIC mp_obj_t analogio_analogin_obj_get_reference_voltage(mp_obj_t self_in) {
Expand Down
5 changes: 5 additions & 0 deletions shared-bindings/support_matrix.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ Module Support Matrix - Which Modules Are Available on Which Boards
The following table lists the available built-in modules for each CircuitPython
capable board, as well as each :term:`frozen module` included on it.

You can filter this list by typing one or more module names or partial names into the search box.
Only those boards that provide those modules will be listed.
To exclude boards that provide a module, type a "-" in front of the module name.
You can also type a regular expression as a filter.

.. raw:: html

<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>
Expand Down