diff --git a/docs/rstjinja.py b/docs/rstjinja.py index 7ab92a9793..7d5fff5c6c 100644 --- a/docs/rstjinja.py +++ b/docs/rstjinja.py @@ -1,6 +1,13 @@ # Derived from code on Eric Holscher's blog, found at: # https://www.ericholscher.com/blog/2016/jul/25/integrating-jinja-rst-sphinx/ +import re + +def render_with_jinja(docname, source): + if re.search('^\s*.. jinja$', source[0], re.M): + return True + return False + def rstjinja(app, docname, source): """ Render our pages as a jinja template for fancy templating goodness. @@ -9,12 +16,12 @@ def rstjinja(app, docname, source): if app.builder.format not in ("html", "latex"): return - # we only want our one jinja template to run through this func - if "shared-bindings/support_matrix" not in docname: + # we only want specific files to run through this func + if not render_with_jinja(docname, source): return src = rendered = source[0] - print(docname) + print(f"rendering {docname} as jinja templates") if app.builder.format == "html": rendered = app.builder.templates.render_string( diff --git a/docs/shared_bindings_matrix.py b/docs/shared_bindings_matrix.py index 92def05fbf..e89b47c871 100644 --- a/docs/shared_bindings_matrix.py +++ b/docs/shared_bindings_matrix.py @@ -69,28 +69,23 @@ ADDITIONAL_MODULES = { "array": "CIRCUITPY_ARRAY", # always available, so depend on something that's always 1. "builtins": "CIRCUITPY", + "builtins.pow3": "CIRCUITPY_BUILTINS_POW3", + "busio.SPI": "CIRCUITPY_BUSIO_SPI", + "busio.UART": "CIRCUITPY_BUSIO_UART", "collections": "CIRCUITPY_COLLECTIONS", "fontio": "CIRCUITPY_DISPLAYIO", "io": "CIRCUITPY_IO", + "keypad.KeyMatrix": "CIRCUITPY_KEYPAD_KEYMATRIX", + "keypad.Keys": "CIRCUITPY_KEYPAD_KEYS", + "keypad.ShiftRegisterKeys": "CIRCUITPY_KEYPAD_SHIFTREGISTERKEYS", + "os.getenv": "CIRCUITPY_OS_GETENV", "select": "MICROPY_PY_USELECT_SELECT", - "terminalio": "CIRCUITPY_DISPLAYIO", "sys": "CIRCUITPY_SYS", + "terminalio": "CIRCUITPY_DISPLAYIO", "usb": "CIRCUITPY_USB_HOST", } -MODULES_NOT_IN_BINDINGS = [ - "_asyncio", - "array", - "binascii", - "builtins", - "collections", - "errno", - "json", - "re", - "select", - "sys", - "ulab", -] +MODULES_NOT_IN_BINDINGS = [ "binascii", "errno", "json", "re", "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. @@ -117,7 +112,7 @@ def get_bindings(): bindings_modules = [] for d in get_circuitpython_root_dir().glob("ports/*/bindings"): bindings_modules.extend(module.name for module in d.iterdir() if d.is_dir()) - return shared_bindings_modules + bindings_modules + MODULES_NOT_IN_BINDINGS + return shared_bindings_modules + bindings_modules + MODULES_NOT_IN_BINDINGS + list(ADDITIONAL_MODULES.keys()) def get_board_mapping(): diff --git a/lib/certificates/nina-fw b/lib/certificates/nina-fw index d73fe315cc..21205e4005 160000 --- a/lib/certificates/nina-fw +++ b/lib/certificates/nina-fw @@ -1 +1 @@ -Subproject commit d73fe315cc7f9148a0918490d3b75430c8444bf7 +Subproject commit 21205e400515a698266abaaea902bd1ea897bb5d diff --git a/lib/protomatter b/lib/protomatter index ecab2fa75e..ed2e701871 160000 --- a/lib/protomatter +++ b/lib/protomatter @@ -1 +1 @@ -Subproject commit ecab2fa75e9d7675785d2b87f29a22f027da8ce5 +Subproject commit ed2e7018718caebba2b7550517b556e7734357ef diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 1ca523bae2..e0e3149866 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -31,8 +31,8 @@ msgstr "" #: supervisor/shared/safe_mode.c msgid "" "\n" -"Please file an issue with your program at https://github.com/adafruit/" -"circuitpython/issues." +"Please file an issue with your program at github.com/adafruit/circuitpython/" +"issues." msgstr "" #: supervisor/shared/safe_mode.c @@ -393,10 +393,6 @@ msgstr "" msgid "'continue' outside loop" msgstr "" -#: py/objgenerator.c -msgid "'coroutine' object is not an iterator" -msgstr "" - #: py/compile.c msgid "'data' requires at least 2 arguments" msgstr "" @@ -664,11 +660,6 @@ msgstr "" msgid "Buffer is not a bytearray." msgstr "" -#: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c -#: shared-bindings/framebufferio/FramebufferDisplay.c -msgid "Buffer is too small" -msgstr "" - #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Buffer length %d too big. It must be less than %d" @@ -688,6 +679,12 @@ msgstr "" msgid "Buffer too short by %d bytes" msgstr "" +#: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-bindings/struct/__init__.c shared-module/struct/__init__.c +msgid "Buffer too small" +msgstr "" + #: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c msgid "Buffers must be same size" msgstr "" @@ -1030,10 +1027,6 @@ msgstr "" msgid "Failed to write internal flash." msgstr "" -#: supervisor/shared/safe_mode.c -msgid "Fault detected by hardware." -msgstr "" - #: py/moduerrno.c msgid "File exists" msgstr "" @@ -1109,6 +1102,10 @@ msgstr "" msgid "Half duplex SPI is not implemented" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Hard fault: memory access or instruction error." +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c #: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/busio/UART.c @@ -1755,6 +1752,10 @@ msgstr "" msgid "Polygon needs at least 3 points" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Power dipped. Make sure you are providing enough power." +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "Prefix buffer must be on the heap" msgstr "" @@ -1986,10 +1987,6 @@ msgstr "" msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "The power dipped. Make sure you are providing enough power." -msgstr "" - #: shared-module/audiomixer/MixerVoice.c msgid "The sample's bits_per_sample does not match the mixer's" msgstr "" @@ -2580,8 +2577,7 @@ msgstr "" msgid "buffer slices must be of equal length" msgstr "" -#: py/modstruct.c shared-bindings/struct/__init__.c -#: shared-module/struct/__init__.c +#: py/modstruct.c shared-module/struct/__init__.c msgid "buffer too small" msgstr "" @@ -3866,10 +3862,6 @@ msgstr "" msgid "pixel coordinates out of bounds" msgstr "" -#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c -msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter" -msgstr "" - #: extmod/vfs_posix_file.c msgid "poll on file not available on win32" msgstr "" @@ -4181,7 +4173,7 @@ msgstr "" msgid "type is not an acceptable base type" msgstr "" -#: py/objgenerator.c py/runtime.c +#: py/runtime.c msgid "type object '%q' has no attribute '%q'" msgstr "" diff --git a/ports/cxd56/common-hal/camera/Camera.c b/ports/cxd56/common-hal/camera/Camera.c index 606ad0f1e6..37b5f63d17 100644 --- a/ports/cxd56/common-hal/camera/Camera.c +++ b/ports/cxd56/common-hal/camera/Camera.c @@ -184,7 +184,7 @@ size_t common_hal_camera_take_picture(camera_obj_t *self, uint8_t *buffer, size_ mp_raise_ValueError(translate("Size not supported")); } if (!camera_check_buffer_length(width, height, format, len)) { - mp_raise_ValueError(translate("Buffer is too small")); + mp_raise_ValueError(translate("Buffer too small")); } if (!camera_check_format(format)) { mp_raise_ValueError(translate("Format not supported")); diff --git a/ports/raspberrypi/boards/adafruit_feather_rp2040_usb_host/mpconfigboard.h b/ports/raspberrypi/boards/adafruit_feather_rp2040_usb_host/mpconfigboard.h index fbf194ed8d..769f143971 100644 --- a/ports/raspberrypi/boards/adafruit_feather_rp2040_usb_host/mpconfigboard.h +++ b/ports/raspberrypi/boards/adafruit_feather_rp2040_usb_host/mpconfigboard.h @@ -2,6 +2,7 @@ #define MICROPY_HW_MCU_NAME "rp2040" #define MICROPY_HW_NEOPIXEL (&pin_GPIO21) +#define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO20) #define DEFAULT_I2C_BUS_SCL (&pin_GPIO3) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO2) diff --git a/ports/raspberrypi/supervisor/port.c b/ports/raspberrypi/supervisor/port.c index 9415d36aa6..5f18a4d2ed 100644 --- a/ports/raspberrypi/supervisor/port.c +++ b/ports/raspberrypi/supervisor/port.c @@ -252,14 +252,15 @@ uint32_t *port_heap_get_top(void) { return port_stack_get_top(); } +uint32_t __uninitialized_ram(saved_word); void port_set_saved_word(uint32_t value) { - // Store in a watchdog scratch register instead of RAM. 4-7 are used by the - // sdk. 0 is used by alarm. 1-3 are free. - watchdog_hw->scratch[1] = value; + // Store in RAM because the watchdog scratch registers don't survive + // resetting by pulling the RUN pin low. + saved_word = value; } uint32_t port_get_saved_word(void) { - return watchdog_hw->scratch[1]; + return saved_word; } static volatile bool ticks_enabled; diff --git a/shared-bindings/busio/SPI.c b/shared-bindings/busio/SPI.c index 9d843a7500..9ca4bc08e0 100644 --- a/shared-bindings/busio/SPI.c +++ b/shared-bindings/busio/SPI.c @@ -52,7 +52,22 @@ //| `!MOSI`, `!MISO`. Its up to the client to manage the appropriate //| select line, often abbreviated `!CS` or `!SS`. (This is common because //| multiple secondaries can share the `!clock`, `!MOSI` and `!MISO` lines -//| and therefore the hardware.)""" +//| and therefore the hardware.) +//| +//| .. raw:: html +//| +//|
+//| Available on these boards
+//|
+//| {% for board in support_matrix_reverse["busio.SPI"] %}
+//|
+//|
+//| Available on these boards
+//|
+//| {% for board in support_matrix_reverse["busio.UART"] %}
+//|
+//|
+//| Available on these boards
+//|
+//| {% for board in support_matrix_reverse["keypad.KeyMatrix"] %}
+//|
+//|
+//| Available on these boards
+//|
+//| {% for board in support_matrix_reverse["keypad.Keys"] %}
+//|
+//|
+//| Available on these boards
+//|
+//| {% for board in support_matrix_reverse["keypad.ShiftRegisterKeys"] %}
+//|
+//|
+//| Available on these boards
+//|
+//| {% for board in support_matrix_reverse["os.getenv"] %}
+//|
+//|
(all)
diff --git a/shared-bindings/vectorio/VectorShape.c b/shared-bindings/vectorio/VectorShape.c index 06a8355e2d..578749eb92 100644 --- a/shared-bindings/vectorio/VectorShape.c +++ b/shared-bindings/vectorio/VectorShape.c @@ -225,7 +225,7 @@ STATIC mp_obj_t vectorio_vector_shape_obj_set_pixel_shader(mp_obj_t wrapper_shap vectorio_vector_shape_t *self = MP_OBJ_TO_PTR(draw_protocol->draw_get_protocol_self(wrapper_shape)); if (!mp_obj_is_type(pixel_shader, &displayio_palette_type) && !mp_obj_is_type(pixel_shader, &displayio_colorconverter_type)) { - mp_raise_TypeError(translate("pixel_shader must be displayio.Palette or displayio.ColorConverter")); + mp_raise_TypeError_varg(translate("unsupported %q type"), MP_QSTR_pixel_shader); } common_hal_vectorio_vector_shape_set_pixel_shader(self, pixel_shader); diff --git a/shared-module/struct/__init__.c b/shared-module/struct/__init__.c index 11e122915c..5fc3d30f25 100644 --- a/shared-module/struct/__init__.c +++ b/shared-module/struct/__init__.c @@ -126,7 +126,7 @@ void shared_modules_struct_pack_into(mp_obj_t fmt_in, byte *p, byte *end_p, size const mp_uint_t total_sz = shared_modules_struct_calcsize(fmt_in); if (p + total_sz > end_p) { - mp_raise_RuntimeError(translate("buffer too small")); + mp_raise_RuntimeError(translate("Buffer too small")); } size_t i = 0; diff --git a/supervisor/shared/safe_mode.c b/supervisor/shared/safe_mode.c index 134952ca7f..6e1cc74084 100644 --- a/supervisor/shared/safe_mode.c +++ b/supervisor/shared/safe_mode.c @@ -154,7 +154,7 @@ void print_safe_mode_message(safe_mode_t reason) { switch (reason) { case SAFE_MODE_BROWNOUT: - message = translate("The power dipped. Make sure you are providing enough power."); + message = translate("Power dipped. Make sure you are providing enough power."); break; case SAFE_MODE_USER: #if defined(BOARD_USER_SAFE_MODE_ACTION) @@ -209,7 +209,7 @@ void print_safe_mode_message(safe_mode_t reason) { message = translate("Failed to write internal flash."); break; case SAFE_MODE_HARD_FAULT: - message = translate("Fault detected by hardware."); + message = translate("Hard fault: memory access or instruction error."); break; case SAFE_MODE_INTERRUPT_ERROR: message = translate("Interrupt error."); @@ -228,7 +228,7 @@ void print_safe_mode_message(safe_mode_t reason) { break; } serial_write_compressed(message); - serial_write_compressed(translate("\nPlease file an issue with your program at https://github.com/adafruit/circuitpython/issues.")); + serial_write_compressed(translate("\nPlease file an issue with your program at github.com/adafruit/circuitpython/issues.")); } // Always tell user how to get out of safe mode.