From 674b7aff992ba51e757f2a217bd258e632b28b29 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sun, 2 Mar 2025 15:56:44 -0600 Subject: [PATCH 1/5] Add typing shorthand for display-related types .. and use it to give a better type hint for supervisor.runtime.display. --- shared-bindings/displayio/__init__.c | 17 +++++++++++++++++ shared-bindings/supervisor/Runtime.c | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/shared-bindings/displayio/__init__.c b/shared-bindings/displayio/__init__.c index 39d8af37f2592..c71ee0ec19ef8 100644 --- a/shared-bindings/displayio/__init__.c +++ b/shared-bindings/displayio/__init__.c @@ -45,6 +45,23 @@ //| """ //| +//| AnyDisplayBus: fourwire.FourWire | i2cdisplaybus.I2cDisplayBus +//| """Type-checking shorthand for any kind of display bus. Not actually defined in CircuitPython.""" +//| +//| AnyFramebuffer: ( +//| rgbmatrix.RGBMatrix +//| | is31fl3741.FrameBuffer +//| | sharpdisplay.SharpMemoryFramebuffer +//| | videocore.Framebuffer +//| | picodvi.Framebuffer +//| | aurora_epaper.AuroraMemoryFramebuffer +//| ) +//| """Type-checking shorthand for any kind of framebuffer. Not actually defined in CircuitPython.""" +//| +//| AnyDisplay: ( +//| busdisplay.BusDisplay | epaperdisplay.EPaperDisplay | framebufferio.FrameBufferDisplay +//| ) +//| """Type-checking shorthand for any kind of display. Not actually defined in CircuitPython.""" //| CIRCUITPYTHON_TERMINAL: Group //| """The `displayio.Group` that is the displayed serial terminal (REPL).""" //| diff --git a/shared-bindings/supervisor/Runtime.c b/shared-bindings/supervisor/Runtime.c index fd97cc65cd19b..fbd6cdb138c94 100644 --- a/shared-bindings/supervisor/Runtime.c +++ b/shared-bindings/supervisor/Runtime.c @@ -208,7 +208,7 @@ MP_PROPERTY_GETSET(supervisor_runtime_rgb_status_brightness_obj, (mp_obj_t)&supervisor_runtime_set_rgb_status_brightness_obj); #if CIRCUITPY_DISPLAYIO -//| display: Any +//| display: displayio.AnyDisplay | None //| """The primary configured displayio display, if any. //| //| If the board has a display that is hard coded, or that was explicitly set From bf84e135c0c96a2f96b7a00ad302848f9e4817d2 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sun, 2 Mar 2025 15:58:57 -0600 Subject: [PATCH 2/5] fix a typo --- shared-bindings/supervisor/Runtime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/supervisor/Runtime.c b/shared-bindings/supervisor/Runtime.c index fbd6cdb138c94..7b497639939f0 100644 --- a/shared-bindings/supervisor/Runtime.c +++ b/shared-bindings/supervisor/Runtime.c @@ -213,7 +213,7 @@ MP_PROPERTY_GETSET(supervisor_runtime_rgb_status_brightness_obj, //| //| If the board has a display that is hard coded, or that was explicitly set //| in boot.py or code.py (including a previous run of code.py), it is -//| available here until it is released with ``displayio.releasee_displays()``. +//| available here until it is released with ``displayio.release_displays()``. //| //| The display can be of any supported display type, such as `busdisplay.BusDisplay`. //| From 270e92f5d5ce268729709160b8c00e3e267c17e4 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sun, 2 Mar 2025 16:29:39 -0600 Subject: [PATCH 3/5] ensure all port bindings are included --- Makefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 47f39703704ba..1cd02ef715a5b 100644 --- a/Makefile +++ b/Makefile @@ -265,9 +265,8 @@ stubs: @mkdir circuitpython-stubs @$(PYTHON) tools/extract_pyi.py shared-bindings/ $(STUBDIR) @$(PYTHON) tools/extract_pyi.py extmod/ulab/code/ $(STUBDIR)/ulab - @$(PYTHON) tools/extract_pyi.py ports/atmel-samd/bindings $(STUBDIR) - @$(PYTHON) tools/extract_pyi.py ports/espressif/bindings $(STUBDIR) - @$(PYTHON) tools/extract_pyi.py ports/raspberrypi/bindings $(STUBDIR) + @for d in ports/*/bindings; do \ + $(PYTHON) tools/extract_pyi.py "$$d" $(STUBDIR); done @sed -e "s,__version__,`python -msetuptools_scm`," < setup.py-stubs > circuitpython-stubs/setup.py @cp README.rst-stubs circuitpython-stubs/README.rst @cp MANIFEST.in-stubs circuitpython-stubs/MANIFEST.in From 2136c92ec2a6431975b0890496843fefaec23099 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sun, 2 Mar 2025 16:29:58 -0600 Subject: [PATCH 4/5] fix some names --- shared-bindings/displayio/__init__.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/shared-bindings/displayio/__init__.c b/shared-bindings/displayio/__init__.c index c71ee0ec19ef8..136f380f3d33d 100644 --- a/shared-bindings/displayio/__init__.c +++ b/shared-bindings/displayio/__init__.c @@ -45,12 +45,12 @@ //| """ //| -//| AnyDisplayBus: fourwire.FourWire | i2cdisplaybus.I2cDisplayBus +//| AnyDisplayBus = fourwire.FourWire | i2cdisplaybus.I2CDisplayBus | is31fl3741.IS31FL3741 //| """Type-checking shorthand for any kind of display bus. Not actually defined in CircuitPython.""" //| -//| AnyFramebuffer: ( +//| AnyFramebuffer = ( //| rgbmatrix.RGBMatrix -//| | is31fl3741.FrameBuffer +//| | is31fl3741.IS31FL3741_FrameBuffer //| | sharpdisplay.SharpMemoryFramebuffer //| | videocore.Framebuffer //| | picodvi.Framebuffer @@ -58,8 +58,8 @@ //| ) //| """Type-checking shorthand for any kind of framebuffer. Not actually defined in CircuitPython.""" //| -//| AnyDisplay: ( -//| busdisplay.BusDisplay | epaperdisplay.EPaperDisplay | framebufferio.FrameBufferDisplay +//| AnyDisplay = ( +//| busdisplay.BusDisplay | epaperdisplay.EPaperDisplay | framebufferio.FramebufferDisplay //| ) //| """Type-checking shorthand for any kind of display. Not actually defined in CircuitPython.""" //| CIRCUITPYTHON_TERMINAL: Group From c61895ea0c81281e5840c7acd854382ab3b0ac6b Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sun, 2 Mar 2025 16:37:32 -0600 Subject: [PATCH 5/5] locally, doxygen said this was ambiguous. --- ports/zephyr-cp/bindings/zephyr_serial/UART.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/zephyr-cp/bindings/zephyr_serial/UART.c b/ports/zephyr-cp/bindings/zephyr_serial/UART.c index 1d7d9fa842777..dbb643645f5b9 100644 --- a/ports/zephyr-cp/bindings/zephyr_serial/UART.c +++ b/ports/zephyr-cp/bindings/zephyr_serial/UART.c @@ -24,7 +24,7 @@ //| class UART: //| """A bidirectional serial protocol. Already initialized for Zephyr defined -//| busses in `board`. +//| busses in :py:mod:`board`. //| //| .. raw:: html //|