Swap sphinx to autoapi and the inline stubs

This commit is contained in:
Scott Shawcroft 2020-05-12 17:15:28 -07:00
parent c534a872a2
commit 4e8de3c554
No known key found for this signature in database
GPG Key ID: 9349BC7E64B1921E
139 changed files with 337 additions and 1239 deletions

View File

@ -34,7 +34,7 @@ jobs:
run: | run: |
sudo apt-get install -y eatmydata sudo apt-get install -y eatmydata
sudo eatmydata apt-get install -y gettext librsvg2-bin mingw-w64 sudo eatmydata apt-get install -y gettext librsvg2-bin mingw-w64
pip install requests sh click setuptools cpp-coveralls "Sphinx<4" sphinx-rtd-theme recommonmark sphinxcontrib-svg2pdfconverter polib pyyaml pip install requests sh click setuptools cpp-coveralls "Sphinx<4" sphinx-rtd-theme recommonmark sphinx-autoapi sphinxcontrib-svg2pdfconverter polib pyyaml
- name: Versions - name: Versions
run: | run: |
gcc --version gcc --version

2
.gitignore vendored
View File

@ -14,6 +14,7 @@
############ ############
dist/ dist/
*.egg-info *.egg-info
.eggs
# Logs and Databases # Logs and Databases
###################### ######################
@ -51,6 +52,7 @@ _build
# Generated rst files # Generated rst files
###################### ######################
genrst/ genrst/
autoapi/
# ctags and similar # ctags and similar
################### ###################

View File

@ -69,7 +69,7 @@ clean:
rm -rf $(BUILDDIR)/* rm -rf $(BUILDDIR)/*
rm -rf $(STUBDIR) $(DISTDIR) *.egg-info rm -rf $(STUBDIR) $(DISTDIR) *.egg-info
html: html: stubs
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo @echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html." @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
@ -213,8 +213,10 @@ check-translate: locale/circuitpython.pot $(wildcard locale/*.po)
$(PYTHON) tools/check_translations.py $^ $(PYTHON) tools/check_translations.py $^
stubs: stubs:
mkdir -p circuitpython-stubs
python tools/extract_pyi.py shared-bindings/ $(STUBDIR) python tools/extract_pyi.py shared-bindings/ $(STUBDIR)
#python setup.py sdist python tools/extract_pyi.py ports/atmel-samd/bindings $(STUBDIR)
python setup.py sdist
update-frozen-libraries: update-frozen-libraries:
@echo "Updating all frozen libraries to latest tagged version." @echo "Updating all frozen libraries to latest tagged version."

14
conf.py
View File

@ -55,7 +55,6 @@ extensions = [
'sphinx.ext.todo', 'sphinx.ext.todo',
'sphinx.ext.coverage', 'sphinx.ext.coverage',
'rstjinja', 'rstjinja',
'c2rst',
'recommonmark', 'recommonmark',
] ]
@ -66,9 +65,17 @@ templates_path = ['templates']
source_suffix = { source_suffix = {
'.rst': 'restructuredtext', '.rst': 'restructuredtext',
'.md': 'markdown', '.md': 'markdown',
'.c': ''
} }
extensions.append('autoapi.extension')
autoapi_type = 'python'
# Uncomment this if debugging autoapi
# autoapi_keep_files = True
autoapi_dirs = ['circuitpython-stubs']
autoapi_add_toctree_entry = False
autoapi_options = ['members', 'undoc-members', 'private-members', 'show-inheritance', 'special-members', 'show-module-summary']
autoapi_template_dir = 'docs/autoapi/templates'
# The encoding of source files. # The encoding of source files.
#source_encoding = 'utf-8-sig' #source_encoding = 'utf-8-sig'
@ -78,7 +85,7 @@ source_suffix = {
# General information about the project. # General information about the project.
project = 'Adafruit CircuitPython' project = 'Adafruit CircuitPython'
copyright = '2014-2018, MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors)' copyright = '2014-2020, MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors)'
# These are overwritten on ReadTheDocs. # These are overwritten on ReadTheDocs.
# The version info for the project you're documenting, acts as replacement for # The version info for the project you're documenting, acts as replacement for
@ -105,6 +112,7 @@ exclude_patterns = ["**/build*",
".git", ".git",
".venv", ".venv",
".direnv", ".direnv",
"docs/autoapi",
"docs/README.md", "docs/README.md",
"drivers", "drivers",
"examples", "examples",

View File

@ -1,31 +0,0 @@
def c2rst(app, docname, source):
""" Pre-parse '.c' & '.h' files that contain rST source.
"""
# Make sure we're outputting HTML
if app.builder.format != 'html':
return
fname = app.env.doc2path(docname)
if (not fname.endswith(".c") and
not fname.endswith(".h")):
#print("skipping:", fname)
return
src = source[0]
stripped = []
for line in src.split("\n"):
line = line.strip()
if line == "//|":
stripped.append("")
elif line.startswith("//| "):
stripped.append(line[len("//| "):])
stripped = "\r\n".join(stripped)
rendered = app.builder.templates.render_string(
stripped, app.config.html_context
)
source[0] = rendered
def setup(app):
app.connect("source-read", c2rst)

View File

@ -21,4 +21,4 @@ Port Specific modules
--------------------- ---------------------
.. toctree:: .. toctree::
bindings/samd/__init__ ../../autoapi/samd/index

View File

@ -30,18 +30,12 @@
#include "py/objproperty.h" #include "py/objproperty.h"
#include "py/runtime.h" #include "py/runtime.h"
//| .. currentmodule:: samd //| import typing
//| class Clock:
//| """Identifies a clock on the microcontroller.
//| //|
//| :class:`Clock` --- Clock reference //| They are fixed by the hardware so they cannot be constructed on demand. Instead, use
//| ------------------------------------------ //| ``samd.clock`` to reference the desired clock."""
//|
//| Identifies a clock on the microcontroller.
//|
//| .. class:: Clock
//|
//| Identifies a clock on the microcontroller. They are fixed by the
//| hardware so they cannot be constructed on demand. Instead, use
//| `samd.clock` to reference the desired clock.
//| //|
STATIC void samd_clock_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { STATIC void samd_clock_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
@ -50,9 +44,8 @@ STATIC void samd_clock_print(const mp_print_t *print, mp_obj_t self_in, mp_print
mp_printf(print, "%q.%q.%q", MP_QSTR_samd, MP_QSTR_clock, self->name); mp_printf(print, "%q.%q.%q", MP_QSTR_samd, MP_QSTR_clock, self->name);
} }
//| .. attribute:: enabled //| enabled: bool = ...
//| //| """Is the clock enabled? (read-only)"""
//| Is the clock enabled? (read-only)
//| //|
STATIC mp_obj_t samd_clock_get_enabled(mp_obj_t self_in) { STATIC mp_obj_t samd_clock_get_enabled(mp_obj_t self_in) {
samd_clock_obj_t *self = MP_OBJ_TO_PTR(self_in); samd_clock_obj_t *self = MP_OBJ_TO_PTR(self_in);
@ -69,9 +62,8 @@ const mp_obj_property_t samd_clock_enabled_obj = {
}, },
}; };
//| .. attribute:: parent //| parent: typing.Union(Clock | None) = ...
//| //| """Clock parent. (read-only)"""
//| Clock parent. (read-only)
//| //|
STATIC mp_obj_t samd_clock_get_parent(mp_obj_t self_in) { STATIC mp_obj_t samd_clock_get_parent(mp_obj_t self_in) {
samd_clock_obj_t *self = MP_OBJ_TO_PTR(self_in); samd_clock_obj_t *self = MP_OBJ_TO_PTR(self_in);
@ -98,9 +90,8 @@ const mp_obj_property_t samd_clock_parent_obj = {
}, },
}; };
//| .. attribute:: frequency //| frequency: int = ...
//| //| """Clock frequency in Herz. (read-only)"""
//| Clock frequency. (read-only)
//| //|
STATIC mp_obj_t samd_clock_get_frequency(mp_obj_t self_in) { STATIC mp_obj_t samd_clock_get_frequency(mp_obj_t self_in) {
samd_clock_obj_t *self = MP_OBJ_TO_PTR(self_in); samd_clock_obj_t *self = MP_OBJ_TO_PTR(self_in);
@ -117,9 +108,8 @@ const mp_obj_property_t samd_clock_frequency_obj = {
}, },
}; };
//| .. attribute:: calibration //| calibration: int = ...
//| //| """Clock calibration. Not all clocks can be calibrated."""
//| Clock calibration. Not all clocks can be calibrated.
//| //|
STATIC mp_obj_t samd_clock_get_calibration(mp_obj_t self_in) { STATIC mp_obj_t samd_clock_get_calibration(mp_obj_t self_in) {
samd_clock_obj_t *self = MP_OBJ_TO_PTR(self_in); samd_clock_obj_t *self = MP_OBJ_TO_PTR(self_in);

View File

@ -30,29 +30,16 @@
#include "bindings/samd/Clock.h" #include "bindings/samd/Clock.h"
//| :mod:`samd` --- SAMD implementation settings //| """SAMD implementation settings"""
//| =================================================
//|
//| .. module:: samd
//| :synopsis: SAMD implementation settings
//| :platform: SAMD21
//|
//| Libraries
//|
//| .. toctree::
//| :maxdepth: 3
//|
//| Clock
//|
//| :mod:`samd.clock` --- samd clock names //| """:mod:`samd.clock` --- samd clock names
//| -------------------------------------------------------- //| --------------------------------------------------------
//| //|
//| .. module:: samd.clock //| .. module:: samd.clock
//| :synopsis: samd clock names //| :synopsis: samd clock names
//| :platform: SAMD21 //| :platform: SAMD21
//| //|
//| References to clocks as named by the microcontroller //| References to clocks as named by the microcontroller"""
//| //|
const mp_obj_module_t samd_clock_module = { const mp_obj_module_t samd_clock_module = {
.base = { &mp_type_module }, .base = { &mp_type_module },

View File

@ -5,18 +5,16 @@ from pathlib import Path
stub_root = Path("circuitpython-stubs") stub_root = Path("circuitpython-stubs")
stubs = [p.relative_to(stub_root).as_posix() for p in stub_root.glob("*.pyi")] stubs = [p.relative_to(stub_root).as_posix() for p in stub_root.glob("*.pyi")]
now = datetime.utcnow()
version = now.strftime("%Y.%m.%d")
setup( setup(
name="circuitpython-stubs", name="circuitpython-stubs",
description="PEP 561 type stubs for CircuitPython", description="PEP 561 type stubs for CircuitPython",
url="https://github.com/adafruit/circuitpython", url="https://github.com/adafruit/circuitpython",
maintainer="CircuitPythonistas", maintainer="CircuitPythonistas",
author_email="circuitpython@adafruit.com", author_email="circuitpython@adafruit.com",
version=version, use_scm_version=True,
license="MIT", license="MIT",
package_data={"circuitpython-stubs": stubs}, package_data={"circuitpython-stubs": stubs},
packages=["circuitpython-stubs"], packages=["circuitpython-stubs"],
setup_requires=["setuptools>=38.6.0"], setup_requires=["setuptools>=38.6.0",
"setuptools_scm"],
) )

View File

@ -48,10 +48,7 @@
#define WINDOW_DEFAULT (0.1f) #define WINDOW_DEFAULT (0.1f)
//| class Adapter: //| class Adapter:
//| """.. currentmodule:: _bleio //| """BLE adapter
//|
//| :class:`Adapter` --- BLE adapter
//| ----------------------------------------------------
//| //|
//| The Adapter manages the discovery and connection to other nearby Bluetooth Low Energy devices. //| The Adapter manages the discovery and connection to other nearby Bluetooth Low Energy devices.
//| This part of the Bluetooth Low Energy Specification is known as Generic Access Profile (GAP). //| This part of the Bluetooth Low Energy Specification is known as Generic Access Profile (GAP).

View File

@ -35,12 +35,7 @@
#include "shared-module/_bleio/Address.h" #include "shared-module/_bleio/Address.h"
//| class Address: //| class Address:
//| """.. currentmodule:: _bleio //| """Encapsulates the address of a BLE device."""
//|
//| :class:`Address` -- BLE address
//| =========================================================
//|
//| Encapsulates the address of a BLE device."""
//| //|
//| def __init__(self, address: buf, address_type: Any): //| def __init__(self, address: buf, address_type: Any):
@ -97,7 +92,7 @@ STATIC mp_obj_t bleio_address_make_new(const mp_obj_type_t *type, size_t n_args,
//| >>> _bleio.adapter.address //| >>> _bleio.adapter.address
//| <Address c8:1d:f5:ed:a8:35> //| <Address c8:1d:f5:ed:a8:35>
//| >>> _bleio.adapter.address.address_bytes //| >>> _bleio.adapter.address.address_bytes
//| b'5\xa8\xed\xf5\x1d\xc8'""" //| b'5\\xa8\\xed\\xf5\\x1d\\xc8'"""
//| //|
STATIC mp_obj_t bleio_address_get_address_bytes(mp_obj_t self_in) { STATIC mp_obj_t bleio_address_get_address_bytes(mp_obj_t self_in) {
bleio_address_obj_t *self = MP_OBJ_TO_PTR(self_in); bleio_address_obj_t *self = MP_OBJ_TO_PTR(self_in);

View File

@ -30,12 +30,8 @@
#include "shared-bindings/_bleio/UUID.h" #include "shared-bindings/_bleio/UUID.h"
//| class Attribute: //| class Attribute:
//| """.. currentmodule:: _bleio //| """Definitions associated with all BLE attributes: characteristics, descriptors, etc.
//| //|
//| :class:`Attribute` -- BLE Attribute
//| =========================================================
//|
//| Definitions associated with all BLE attributes: characteristics, descriptors, etc.
//| :py:class:`~_bleio.Attribute` is, notionally, a superclass of //| :py:class:`~_bleio.Attribute` is, notionally, a superclass of
//| :py:class:`~Characteristic` and :py:class:`~Descriptor`, //| :py:class:`~Characteristic` and :py:class:`~Descriptor`,
//| but is not defined as a Python superclass of those classes.""" //| but is not defined as a Python superclass of those classes."""

View File

@ -34,13 +34,8 @@
#include "shared-bindings/_bleio/UUID.h" #include "shared-bindings/_bleio/UUID.h"
//| class Characteristic: //| class Characteristic:
//| """.. currentmodule:: _bleio //| """Stores information about a BLE service characteristic and allows reading
//| //| and writing of the characteristic's value."""
//| :class:`Characteristic` -- BLE service characteristic
//| =========================================================
//|
//| Stores information about a BLE service characteristic and allows reading
//| and writing of the characteristic's value."""
//| //|
//| def __init__(self, ): //| def __init__(self, ):
//| """There is no regular constructor for a Characteristic. A new local Characteristic can be created //| """There is no regular constructor for a Characteristic. A new local Characteristic can be created

View File

@ -42,12 +42,7 @@ STATIC void raise_error_if_not_connected(bleio_characteristic_buffer_obj_t *self
} }
//| class CharacteristicBuffer: //| class CharacteristicBuffer:
//| """.. currentmodule:: _bleio //| """Accumulates a Characteristic's incoming values in a FIFO buffer."""
//|
//| :class:`CharacteristicBuffer` -- BLE Service incoming values buffer.
//| =====================================================================
//|
//| Accumulates a Characteristic's incoming values in a FIFO buffer."""
//| //|
//| def __init__(self, characteristic: Characteristic, *, timeout: int = 1, buffer_size: int = 64): //| def __init__(self, characteristic: Characteristic, *, timeout: int = 1, buffer_size: int = 64):
//| //|

View File

@ -43,12 +43,7 @@
#include "shared-bindings/_bleio/Service.h" #include "shared-bindings/_bleio/Service.h"
//| class Connection: //| class Connection:
//| """.. currentmodule:: _bleio //| """A BLE connection to another device. Used to discover and interact with services on the other
//|
//| :class:`Connection` -- A BLE connection
//| =========================================================
//|
//| A BLE connection to another device. Used to discover and interact with services on the other
//| device. //| device.
//| //|
//| Usage:: //| Usage::
@ -211,15 +206,14 @@ STATIC mp_obj_t bleio_connection_get_connection_interval(mp_obj_t self_in) {
} }
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_connection_get_connection_interval_obj, bleio_connection_get_connection_interval); STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_connection_get_connection_interval_obj, bleio_connection_get_connection_interval);
//| .. attribute:: max_packet_length //| attribute: Any = ...
//| //| """The maximum number of data bytes that can be sent in a single transmission,
//| The maximum number of data bytes that can be sent in a single transmission,
//| not including overhead bytes. //| not including overhead bytes.
//| //|
//| This is the maximum number of bytes that can be sent in a notification, //| This is the maximum number of bytes that can be sent in a notification,
//| which must be sent in a single packet. //| which must be sent in a single packet.
//| But for a regular characteristic read or write, may be sent in multiple packets, //| But for a regular characteristic read or write, may be sent in multiple packets,
//| so this limit does not apply. //| so this limit does not apply."""
//| //|
STATIC mp_obj_t bleio_connection_get_max_packet_length(mp_obj_t self_in) { STATIC mp_obj_t bleio_connection_get_max_packet_length(mp_obj_t self_in) {
bleio_connection_obj_t *self = MP_OBJ_TO_PTR(self_in); bleio_connection_obj_t *self = MP_OBJ_TO_PTR(self_in);

View File

@ -34,12 +34,8 @@
#include "shared-bindings/_bleio/UUID.h" #include "shared-bindings/_bleio/UUID.h"
//| class Descriptor: //| class Descriptor:
//| """.. currentmodule:: _bleio //| """Stores information about a BLE descriptor.
//| //|
//| :class:`Descriptor` -- BLE descriptor
//| =========================================================
//|
//| Stores information about a BLE descriptor.
//| Descriptors are attached to BLE characteristics and provide contextual //| Descriptors are attached to BLE characteristics and provide contextual
//| information about the characteristic.""" //| information about the characteristic."""
//| //|

View File

@ -36,12 +36,7 @@
#include "shared-bindings/util.h" #include "shared-bindings/util.h"
//| class PacketBuffer: //| class PacketBuffer:
//| """.. currentmodule:: _bleio //| """Accumulates a Characteristic's incoming packets in a FIFO buffer and facilitates packet aware
//|
//| :class:`PacketBuffer` -- Packet-oriented characteristic usage.
//| =====================================================================
//|
//| Accumulates a Characteristic's incoming packets in a FIFO buffer and facilitates packet aware
//| outgoing writes. A packet's size is either the characteristic length or the maximum transmission //| outgoing writes. A packet's size is either the characteristic length or the maximum transmission
//| unit (MTU) minus overhead, whichever is smaller. The MTU can change so check `incoming_packet_length` //| unit (MTU) minus overhead, whichever is smaller. The MTU can change so check `incoming_packet_length`
//| and `outgoing_packet_length` before creating a buffer to store data. //| and `outgoing_packet_length` before creating a buffer to store data.
@ -60,7 +55,7 @@
//| It may be a local Characteristic provided by a Peripheral Service, or a remote Characteristic //| It may be a local Characteristic provided by a Peripheral Service, or a remote Characteristic
//| in a remote Service that a Central has connected to. //| in a remote Service that a Central has connected to.
//| :param int buffer_size: Size of ring buffer (in packets of the Characteristic's maximum //| :param int buffer_size: Size of ring buffer (in packets of the Characteristic's maximum
//| length) that stores incoming packets coming from the peer. //| length) that stores incoming packets coming from the peer."""
//| ... //| ...
//| //|
STATIC mp_obj_t bleio_packet_buffer_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { STATIC mp_obj_t bleio_packet_buffer_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
@ -126,11 +121,11 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(bleio_packet_buffer_readinto_obj, bleio_packet_
//| """Writes all bytes from data into the same outgoing packet. The bytes from header are included //| """Writes all bytes from data into the same outgoing packet. The bytes from header are included
//| before data when the pending packet is currently empty. //| before data when the pending packet is currently empty.
//| //|
//| This does not block until the data is sent. It only blocks until the data is pending.""" //| This does not block until the data is sent. It only blocks until the data is pending.
//| ...
//| //|
//| :return: number of bytes written. May include header bytes when packet is empty. //| :return: number of bytes written. May include header bytes when packet is empty.
//| :rtype: int //| :rtype: int"""
//| ...
//| //|
// TODO: Add a kwarg `merge=False` to dictate whether subsequent writes are merged into a pending // TODO: Add a kwarg `merge=False` to dictate whether subsequent writes are merged into a pending
// one. // one.
@ -174,7 +169,7 @@ STATIC mp_obj_t bleio_packet_buffer_write(mp_uint_t n_args, const mp_obj_t *pos_
} }
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_packet_buffer_write_obj, 1, bleio_packet_buffer_write); STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_packet_buffer_write_obj, 1, bleio_packet_buffer_write);
//| def deinit(self, ) -> Any: //| def deinit(self) -> Any:
//| """Disable permanently.""" //| """Disable permanently."""
//| ... //| ...
STATIC mp_obj_t bleio_packet_buffer_deinit(mp_obj_t self_in) { STATIC mp_obj_t bleio_packet_buffer_deinit(mp_obj_t self_in) {
@ -184,7 +179,7 @@ STATIC mp_obj_t bleio_packet_buffer_deinit(mp_obj_t self_in) {
} }
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_packet_buffer_deinit_obj, bleio_packet_buffer_deinit); STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_packet_buffer_deinit_obj, bleio_packet_buffer_deinit);
//| packet_size: Any = ... //| packet_size: int = ...
//| """`packet_size` is the same as `incoming_packet_length`. //| """`packet_size` is the same as `incoming_packet_length`.
//| The name `packet_size` is deprecated and //| The name `packet_size` is deprecated and
//| will be removed in CircuitPython 6.0.0.""" //| will be removed in CircuitPython 6.0.0."""
@ -210,9 +205,8 @@ const mp_obj_property_t bleio_packet_buffer_incoming_packet_length_obj = {
(mp_obj_t)&mp_const_none_obj }, (mp_obj_t)&mp_const_none_obj },
}; };
//| .. attribute:: outgoing_packet_length //| outgoing_packet_length: int = ...
//| //| """Maximum length in bytes of a packet we are writing."""
//| Maximum length in bytes of a packet we are writing.
//| //|
STATIC mp_obj_t bleio_packet_buffer_get_outgoing_packet_length(mp_obj_t self_in) { STATIC mp_obj_t bleio_packet_buffer_get_outgoing_packet_length(mp_obj_t self_in) {
bleio_packet_buffer_obj_t *self = MP_OBJ_TO_PTR(self_in); bleio_packet_buffer_obj_t *self = MP_OBJ_TO_PTR(self_in);

View File

@ -36,12 +36,7 @@
#include "shared-module/_bleio/ScanEntry.h" #include "shared-module/_bleio/ScanEntry.h"
//| class ScanEntry: //| class ScanEntry:
//| """.. currentmodule:: _bleio //| """Encapsulates information about a device that was received during scanning. It can be
//|
//| :class:`ScanEntry` -- BLE scan data
//| =========================================================
//|
//| Encapsulates information about a device that was received during scanning. It can be
//| advertisement or scan response data. This object may only be created by a `_bleio.ScanResults`: //| advertisement or scan response data. This object may only be created by a `_bleio.ScanResults`:
//| it has no user-visible constructor.""" //| it has no user-visible constructor."""
//| //|
@ -68,7 +63,7 @@ STATIC mp_obj_t bleio_scanentry_matches(mp_uint_t n_args, const mp_obj_t *pos_ar
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
mp_buffer_info_t bufinfo; mp_buffer_info_t bufinfo;
mp_get_buffer_raise(args[ARG_prefixes].u_obj, &bufinfo, MP_BUFFER_READ); mp_get_buffer_raise(args[ARG_prefixes].u_obj, &bufinfo, MP_BUFFER_READ);
return mp_obj_new_bool(common_hal_bleio_scanentry_matches(self, bufinfo.buf, bufinfo.len, args[ARG_all].u_bool)); return mp_obj_new_bool(common_hal_bleio_scanentry_matches(self, bufinfo.buf, bufinfo.len, args[ARG_all].u_bool));

View File

@ -33,12 +33,7 @@
#include "shared-bindings/_bleio/ScanResults.h" #include "shared-bindings/_bleio/ScanResults.h"
//| class ScanResults: //| class ScanResults:
//| """.. currentmodule:: _bleio //| """Iterates over advertising data received while scanning. This object is always created
//|
//| :class:`ScanResults` -- An Iterator over BLE scanning results
//| ===============================================================
//|
//| Iterates over advertising data received while scanning. This object is always created
//| by a `_bleio.Adapter`: it has no user-visible constructor.""" //| by a `_bleio.Adapter`: it has no user-visible constructor."""
//| //|
STATIC mp_obj_t scanresults_iternext(mp_obj_t self_in) { STATIC mp_obj_t scanresults_iternext(mp_obj_t self_in) {

View File

@ -33,12 +33,7 @@
#include "shared-bindings/_bleio/UUID.h" #include "shared-bindings/_bleio/UUID.h"
//| class Service: //| class Service:
//| """.. currentmodule:: _bleio //| """Stores information about a BLE service and its characteristics."""
//|
//| :class:`Service` -- BLE GATT Service
//| =========================================================
//|
//| Stores information about a BLE service and its characteristics."""
//| //|
//| def __init__(self, uuid: UUID, *, secondary: bool = False): //| def __init__(self, uuid: UUID, *, secondary: bool = False):
//| """Create a new Service identified by the specified UUID. It can be accessed by all //| """Create a new Service identified by the specified UUID. It can be accessed by all

View File

@ -34,12 +34,7 @@
#include "shared-bindings/_bleio/UUID.h" #include "shared-bindings/_bleio/UUID.h"
//| class UUID: //| class UUID:
//| """.. currentmodule:: _bleio //| """A 16-bit or 128-bit UUID. Can be used for services, characteristics, descriptors and more."""
//|
//| :class:`UUID` -- BLE UUID
//| =========================================================
//|
//| A 16-bit or 128-bit UUID. Can be used for services, characteristics, descriptors and more."""
//| //|
//| def __init__(self, value: Any): //| def __init__(self, value: Any):
//| """Create a new UUID or UUID object encapsulating the uuid value. //| """Create a new UUID or UUID object encapsulating the uuid value.
@ -207,7 +202,7 @@ STATIC mp_obj_t bleio_uuid_pack_into(mp_uint_t n_args, const mp_obj_t *pos_args,
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
mp_buffer_info_t bufinfo; mp_buffer_info_t bufinfo;
mp_get_buffer_raise(args[ARG_buffer].u_obj, &bufinfo, MP_BUFFER_WRITE); mp_get_buffer_raise(args[ARG_buffer].u_obj, &bufinfo, MP_BUFFER_WRITE);

View File

@ -41,13 +41,7 @@
#include "shared-bindings/_bleio/Service.h" #include "shared-bindings/_bleio/Service.h"
#include "shared-bindings/_bleio/UUID.h" #include "shared-bindings/_bleio/UUID.h"
//| """:mod:`_bleio` --- Bluetooth Low Energy (BLE) communication //| """
//| ================================================================
//|
//| .. module:: _bleio
//| :synopsis: Bluetooth Low Energy functionality
//| :platform: nRF
//|
//| The `_bleio` module provides necessary low-level functionality for communicating //| The `_bleio` module provides necessary low-level functionality for communicating
//| using Bluetooth Low Energy (BLE). The '_' prefix indicates this module is meant //| using Bluetooth Low Energy (BLE). The '_' prefix indicates this module is meant
//| for internal use by libraries but not by the end user. Its API may change incompatibly //| for internal use by libraries but not by the end user. Its API may change incompatibly
@ -58,24 +52,6 @@
//| provides higher-level convenience functionality, including predefined beacons, clients, //| provides higher-level convenience functionality, including predefined beacons, clients,
//| servers. //| servers.
//| //|
//| Libraries
//|
//| .. toctree::
//| :maxdepth: 3
//|
//| Address
//| Adapter
//| Attribute
//| Characteristic
//| CharacteristicBuffer
//| Connection
//| Descriptor
//| PacketBuffer
//| ScanEntry
//| ScanResults
//| Service
//| UUID
//|
//| .. attribute:: adapter //| .. attribute:: adapter
//| //|
//| BLE Adapter used to manage device discovery and connections. //| BLE Adapter used to manage device discovery and connections.

View File

@ -34,28 +34,10 @@
#include "shared-module/_eve/__init__.h" #include "shared-module/_eve/__init__.h"
#include "shared-bindings/_eve/__init__.h" #include "shared-bindings/_eve/__init__.h"
//| """Low-level BridgeTek EVE bindings
//| """:mod:`_eve` --- low-level BridgeTek EVE bindings
//| ================================================
//|
//| .. module:: _eve
//| :synopsis: low-level BridgeTek EVE bindings
//| :platform: SAMD21/SAMD51
//| //|
//| The `_eve` module provides a class _EVE which //| The `_eve` module provides a class _EVE which
//| contains methods for constructing EVE command //| contains methods for constructing EVE command
//| buffers and appending basic graphics commands.""" //| buffers and appending basic graphics commands."""
//| //|

View File

@ -35,12 +35,7 @@
#include "supervisor/shared/translate.h" #include "supervisor/shared/translate.h"
//| class PewPew: //| class PewPew:
//| """.. currentmodule:: _pew //| """This is an internal module to be used by the ``pew.py`` library from
//|
//| :class:`PewPew` -- LED matrix and button driver
//| ===============================================
//|
//| This is an internal module to be used by the ``pew.py`` library from
//| https://github.com/pewpew-game/pew-pewpew-standalone-10.x to handle the //| https://github.com/pewpew-game/pew-pewpew-standalone-10.x to handle the
//| LED matrix display and buttons on the ``pewpew10`` board. //| LED matrix display and buttons on the ``pewpew10`` board.
//| //|

View File

@ -41,17 +41,7 @@ STATIC mp_obj_t get_pressed(void) {
STATIC MP_DEFINE_CONST_FUN_OBJ_0(get_pressed_obj, get_pressed); STATIC MP_DEFINE_CONST_FUN_OBJ_0(get_pressed_obj, get_pressed);
//| """:mod:`_pew` --- LED matrix driver //| """LED matrix driver"""
//| ==================================
//|
//| .. module:: _pew
//| :synopsis: LED matrix driver
//| :platform: SAMD21
//|
//| .. toctree::
//| :maxdepth: 3
//|
//| PewPew"""
//| //|
STATIC const mp_rom_map_elem_t pew_module_globals_table[] = { STATIC const mp_rom_map_elem_t pew_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR__pew) }, { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR__pew) },

View File

@ -45,12 +45,7 @@ extern const int32_t colorwheel(float pos);
static void parse_byteorder(mp_obj_t byteorder_obj, pixelbuf_byteorder_details_t* parsed); static void parse_byteorder(mp_obj_t byteorder_obj, pixelbuf_byteorder_details_t* parsed);
//| class PixelBuf: //| class PixelBuf:
//| """.. currentmodule:: _pixelbuf //| """A fast RGB[W] pixel buffer for LED and similar devices."""
//|
//| :class:`PixelBuf` -- A fast RGB[W] pixel buffer for LED and similar devices
//| ===========================================================================
//|
//| :class:`~_pixelbuf.PixelBuf` implements an RGB[W] bytearray abstraction."""
//| //|
//| def __init__(self, size: int, *, byteorder: str = "BGR", brightness: float = 0, auto_write: bool = False, header: bytes = b"", trailer: bytes = b""): //| def __init__(self, size: int, *, byteorder: str = "BGR", brightness: float = 0, auto_write: bool = False, header: bytes = b"", trailer: bytes = b""):
//| """Create a PixelBuf object of the specified size, byteorder, and bits per pixel. //| """Create a PixelBuf object of the specified size, byteorder, and bits per pixel.

View File

@ -33,35 +33,22 @@
#include "shared-bindings/_pixelbuf/PixelBuf.h" #include "shared-bindings/_pixelbuf/PixelBuf.h"
//| """:mod:`_pixelbuf` --- Fast RGB(W) pixel buffer and helpers //| """A fast RGB(W) pixel buffer library for like NeoPixel and DotStar.
//| ===========================================================
//| .. module:: _pixelbuf
//| :synopsis: A fast RGB(W) pixel buffer library for like NeoPixel and DotStar.
//| //|
//| The `_pixelbuf` module provides the :py:class:`PixelBuf` class to accelerate //| The `_pixelbuf` module provides the :py:class:`PixelBuf` class to accelerate
//| RGB(W) strip/matrix manipulation, such as DotStar and Neopixel. //| RGB(W) strip/matrix manipulation, such as DotStar and Neopixel.
//| //|
//| Byteorders are configured with strings, such as "RGB" or "RGBD". //| Byteorders are configured with strings, such as "RGB" or "RGBD"."""
//| TODO: Pull in docs from pypixelbuf. // TODO: Pull in docs from pypixelbuf.
//| Libraries //| def colorwheel(n: int) -> Any:
//|
//| .. toctree::
//| :maxdepth: 3
//|
//| PixelBuf"""
//| def colorwheel(n: Any) -> Any: ...
//|
//| def wheel(n: Any) -> Any:
//| """C implementation of the common wheel() function found in many examples. //| """C implementation of the common wheel() function found in many examples.
//| Returns the colorwheel RGB value as an integer value for n (usable in :py:class:`PixelBuf`, neopixel, and dotstar).""" //| Returns the colorwheel RGB value as an integer value for n (usable in :py:class:`PixelBuf`, neopixel, and dotstar)."""
//| ... //| ...
//| //|
//| .. function:: wheel(n) //| def wheel(n: Any) -> Any:
//| Use of wheel() is deprecated. Please use colorwheel(). //| """Use of wheel() is deprecated. Please use colorwheel()."""
//|
STATIC mp_obj_t pixelbuf_colorwheel(mp_obj_t n) { STATIC mp_obj_t pixelbuf_colorwheel(mp_obj_t n) {
return MP_OBJ_NEW_SMALL_INT(colorwheel(MP_OBJ_IS_SMALL_INT(n) ? MP_OBJ_SMALL_INT_VALUE(n) : mp_obj_float_get(n))); return MP_OBJ_NEW_SMALL_INT(colorwheel(MP_OBJ_IS_SMALL_INT(n) ? MP_OBJ_SMALL_INT_VALUE(n) : mp_obj_float_get(n)));

View File

@ -31,10 +31,7 @@
#include "supervisor/shared/translate.h" #include "supervisor/shared/translate.h"
//| class Layer: //| class Layer:
//| """.. currentmodule:: _stage //| """Keep information about a single layer of graphics"""
//|
//| :class:`Layer` -- Keep information about a single layer of graphics
//| ==================================================================="""
//| //|
//| def __init__(self, width: int, height: int, graphic: bytearray, palette: bytearray, grid: bytearray): //| def __init__(self, width: int, height: int, graphic: bytearray, palette: bytearray, grid: bytearray):
//| """Keep internal information about a layer of graphics (either a //| """Keep internal information about a layer of graphics (either a

View File

@ -31,13 +31,10 @@
#include "supervisor/shared/translate.h" #include "supervisor/shared/translate.h"
//| class Text: //| class Text:
//| """.. currentmodule:: _stage //| """Keep information about a single grid of text"""
//|
//| :class:`Text` -- Keep information about a single text of text
//| =============================================================="""
//| //|
//| def __init__(self, width: int, height: int, font: bytearray, palette: bytearray, chars: bytearray): //| def __init__(self, width: int, height: int, font: bytearray, palette: bytearray, chars: bytearray):
//| """Keep internal information about a text of text //| """Keep internal information about a grid of text
//| in a format suitable for fast rendering //| in a format suitable for fast rendering
//| with the ``render()`` function. //| with the ``render()`` function.
//| //|

View File

@ -34,22 +34,10 @@
#include "Layer.h" #include "Layer.h"
#include "Text.h" #include "Text.h"
//| """:mod:`_stage` --- C-level helpers for animation of sprites on a stage //| """C-level helpers for animation of sprites on a stage
//| =====================================================================
//|
//| .. module:: _stage
//| :synopsis: C-level helpers for animation of sprites on a stage
//| :platform: SAMD21
//| //|
//| The `_stage` module contains native code to speed-up the ```stage`` Library //| The `_stage` module contains native code to speed-up the ```stage`` Library
//| <https://github.com/python-ugame/circuitpython-stage>`_. //| <https://github.com/python-ugame/circuitpython-stage>`_."""
//| Libraries
//|
//| .. toctree::
//| :maxdepth: 3
//|
//| Layer
//| Text"""
//| //|
//| def render(x0: int, y0: int, x1: int, y1: int, layers: list, buffer: bytearray, display: displayio.Display, scale: int, background: int) -> Any: //| def render(x0: int, y0: int, x1: int, y1: int, layers: list, buffer: bytearray, display: displayio.Display, scale: int, background: int) -> Any:
//| """Render and send to the display a fragment of the screen. //| """Render and send to the display a fragment of the screen.

View File

@ -31,23 +31,10 @@
#include "__init__.h" #include "__init__.h"
//| :mod:`aesio` --- AES encryption routines //| """AES encryption routines
//| ========================================
//|
//| .. module:: aesio
//| :synopsis: Embedded implementation of AES
//| //|
//| The `AES` module contains classes used to implement encryption //| The `AES` module contains classes used to implement encryption
//| and decryption. It aims to be low overhead in terms of memory. //| and decryption. It aims to be low overhead in terms of memory."""
//|
//|
//| Libraries
//|
//| .. toctree::
//| :maxdepth: 3
//|
//| aes
STATIC const mp_obj_tuple_t mp_aes_key_size_obj = { STATIC const mp_obj_tuple_t mp_aes_key_size_obj = {

View File

@ -9,35 +9,31 @@
// Defined at the end of this file // Defined at the end of this file
//| .. currentmodule:: aesio //| class AES:
//| """Encrypt and decrypt AES streams"""
//| //|
//| :class:`aesio` -- Encrypt and decrypt AES streams //| def __init__(self, key, mode=0, iv=None, segment_size=8) -> Any:
//| ===================================================== //| """Create a new AES state with the given key.
//| //|
//| An object that represents an AES stream, including the current state. //| :param bytearray key: A 16-, 24-, or 32-byte key
//| :param int mode: AES mode to use. One of: AES.MODE_ECB, AES.MODE_CBC, or
//| AES.MODE_CTR
//| :param bytearray iv: Initialization vector to use for CBC or CTR mode
//| //|
//| .. class:: AES(key, mode=0, iv=None, segment_size=8) //| Additional arguments are supported for legacy reasons.
//| //|
//| Create a new AES state with the given key. //| Encrypting a string::
//| //|
//| :param bytearray key: A 16-, 24-, or 32-byte key //| import aesio
//| :param int mode: AES mode to use. One of: AES.MODE_ECB, AES.MODE_CBC, or //| from binascii import hexlify
//| AES.MODE_CTR
//| :param bytearray iv: Initialization vector to use for CBC or CTR mode
//| //|
//| Additional arguments are supported for legacy reasons. //| key = b'Sixteen byte key'
//| //| inp = b'Circuit Python!!' # Note: 16-bytes long
//| Encrypting a string:: //| outp = bytearray(len(inp))
//| //| cipher = aesio.AES(key, aesio.mode.MODE_ECB)
//| import aesio //| cipher.encrypt_into(inp, outp)
//| from binascii import hexlify //| hexlify(outp)"""
//| //| ...
//| key = b'Sixteen byte key'
//| inp = b'Circuit Python!!' # Note: 16-bytes long
//| outp = bytearray(len(inp))
//| cipher = aesio.AES(key, aesio.mode.MODE_ECB)
//| cipher.encrypt_into(inp, outp)
//| hexlify(outp)
//| //|
STATIC mp_obj_t aesio_aes_make_new(const mp_obj_type_t *type, size_t n_args, STATIC mp_obj_t aesio_aes_make_new(const mp_obj_type_t *type, size_t n_args,
@ -154,12 +150,13 @@ STATIC void validate_length(aesio_aes_obj_t *self, size_t src_length,
} }
} }
//| .. method:: encrypt_into(src, dest) //| def encrypt_into(src, dest) -> None:
//| """Encrypt the buffer from ``src`` into ``dest``.
//| //|
//| Encrypt the buffer from ``src`` into ``dest``. //| For ECB mode, the buffers must be 16 bytes long. For CBC mode, the
//| For ECB mode, the buffers must be 16 bytes long. For CBC mode, the //| buffers must be a multiple of 16 bytes, and must be equal length. For
//| buffers must be a multiple of 16 bytes, and must be equal length. For //| CTX mode, there are no restrictions."""
//| CTX mode, there are no restrictions. //| ...
//| //|
STATIC mp_obj_t aesio_aes_encrypt_into(mp_obj_t aesio_obj, mp_obj_t src, STATIC mp_obj_t aesio_aes_encrypt_into(mp_obj_t aesio_obj, mp_obj_t src,
mp_obj_t dest) { mp_obj_t dest) {
@ -184,12 +181,13 @@ STATIC mp_obj_t aesio_aes_encrypt_into(mp_obj_t aesio_obj, mp_obj_t src,
STATIC MP_DEFINE_CONST_FUN_OBJ_3(aesio_aes_encrypt_into_obj, STATIC MP_DEFINE_CONST_FUN_OBJ_3(aesio_aes_encrypt_into_obj,
aesio_aes_encrypt_into); aesio_aes_encrypt_into);
//| .. method:: decrypt_into(src, dest) //| def decrypt_into(src, dest) -> None:
//| //|
//| Decrypt the buffer from ``src`` into ``dest``. //| """Decrypt the buffer from ``src`` into ``dest``.
//| For ECB mode, the buffers must be 16 bytes long. For CBC mode, the //| For ECB mode, the buffers must be 16 bytes long. For CBC mode, the
//| buffers must be a multiple of 16 bytes, and must be equal length. For //| buffers must be a multiple of 16 bytes, and must be equal length. For
//| CTX mode, there are no restrictions. //| CTX mode, there are no restrictions."""
//| ...
//| //|
STATIC mp_obj_t aesio_aes_decrypt_into(mp_obj_t aesio_obj, mp_obj_t src, STATIC mp_obj_t aesio_aes_decrypt_into(mp_obj_t aesio_obj, mp_obj_t src,
mp_obj_t dest) { mp_obj_t dest) {

View File

@ -37,10 +37,7 @@
#include "shared-bindings/util.h" #include "shared-bindings/util.h"
//| class AnalogIn: //| class AnalogIn:
//| """.. currentmodule:: analogio //| """Read analog voltage levels
//|
//| :class:`AnalogIn` -- read analog voltage
//| ============================================
//| //|
//| Usage:: //| Usage::
//| //|

View File

@ -37,12 +37,7 @@
#include "supervisor/shared/translate.h" #include "supervisor/shared/translate.h"
//| class AnalogOut: //| class AnalogOut:
//| """.. currentmodule:: analogio //| """Output analog values (a specific voltage).
//|
//| :class:`AnalogOut` -- output analog voltage
//| ============================================
//|
//| The AnalogOut is used to output analog values (a specific voltage).
//| //|
//| Example usage:: //| Example usage::
//| //|

View File

@ -34,25 +34,12 @@
#include "shared-bindings/analogio/AnalogIn.h" #include "shared-bindings/analogio/AnalogIn.h"
#include "shared-bindings/analogio/AnalogOut.h" #include "shared-bindings/analogio/AnalogOut.h"
//| """:mod:`analogio` --- Analog hardware support //| """Analog hardware support
//| =================================================
//|
//| .. module:: analogio
//| :synopsis: Analog hardware support
//| :platform: SAMD21, ESP8266
//| //|
//| The `analogio` module contains classes to provide access to analog IO //| The `analogio` module contains classes to provide access to analog IO
//| typically implemented with digital-to-analog (DAC) and analog-to-digital //| typically implemented with digital-to-analog (DAC) and analog-to-digital
//| (ADC) converters. //| (ADC) converters.
//| //|
//| Libraries
//|
//| .. toctree::
//| :maxdepth: 3
//|
//| AnalogIn
//| AnalogOut
//|
//| All classes change hardware state and should be deinitialized when they //| All classes change hardware state and should be deinitialized when they
//| are no longer needed if the program continues after use. To do so, either //| are no longer needed if the program continues after use. To do so, either
//| call :py:meth:`!deinit` or use a context manager. See //| call :py:meth:`!deinit` or use a context manager. See

View File

@ -36,12 +36,7 @@
#include "supervisor/shared/translate.h" #include "supervisor/shared/translate.h"
//| class I2SOut: //| class I2SOut:
//| """.. currentmodule:: audiobusio //| """Output an I2S audio signal"""
//|
//| :class:`I2SOut` -- Output an I2S audio signal
//| ========================================================
//|
//| I2S is used to output an audio signal on an I2S bus."""
//| //|
//| def __init__(self, bit_clock: microcontroller.Pin, word_select: microcontroller.Pin, data: microcontroller.Pin, *, left_justified: bool): //| def __init__(self, bit_clock: microcontroller.Pin, word_select: microcontroller.Pin, data: microcontroller.Pin, *, left_justified: bool):
//| """Create a I2SOut object associated with the given pins. //| """Create a I2SOut object associated with the given pins.

View File

@ -37,12 +37,7 @@
#include "supervisor/shared/translate.h" #include "supervisor/shared/translate.h"
//| class PDMIn: //| class PDMIn:
//| """.. currentmodule:: audiobusio //| """Record an input PDM audio stream"""
//|
//| :class:`PDMIn` -- Record an input PDM audio stream
//| ========================================================
//|
//| PDMIn can be used to record an input audio signal on a given set of pins."""
//| //|
//| def __init__(self, clock_pin: microcontroller.Pin, data_pin: microcontroller.Pin, *, sample_rate: int = 16000, bit_depth: int = 8, mono: bool = True, oversample: int = 64, startup_delay: float = 0.11): //| def __init__(self, clock_pin: microcontroller.Pin, data_pin: microcontroller.Pin, *, sample_rate: int = 16000, bit_depth: int = 8, mono: bool = True, oversample: int = 64, startup_delay: float = 0.11):
//| """Create a PDMIn object associated with the given pins. This allows you to //| """Create a PDMIn object associated with the given pins. This allows you to

View File

@ -34,26 +34,13 @@
#include "shared-bindings/audiobusio/I2SOut.h" #include "shared-bindings/audiobusio/I2SOut.h"
#include "shared-bindings/audiobusio/PDMIn.h" #include "shared-bindings/audiobusio/PDMIn.h"
//| """:mod:`audiobusio` --- Support for audio input and output over digital bus //| """Support for audio input and output over digital buses
//| =========================================================================
//|
//| .. module:: audiobusio
//| :synopsis: Support for audio input and output over digital bus
//| :platform: SAMD21
//| //|
//| The `audiobusio` module contains classes to provide access to audio IO //| The `audiobusio` module contains classes to provide access to audio IO
//| over digital buses. These protocols are used to communicate audio to other //| over digital buses. These protocols are used to communicate audio to other
//| chips in the same circuit. It doesn't include audio interconnect protocols //| chips in the same circuit. It doesn't include audio interconnect protocols
//| such as S/PDIF. //| such as S/PDIF.
//| //|
//| Libraries
//|
//| .. toctree::
//| :maxdepth: 3
//|
//| I2SOut
//| PDMIn
//|
//| All libraries change hardware state and should be deinitialized when they //| All libraries change hardware state and should be deinitialized when they
//| are no longer needed. To do so, either call :py:meth:`!deinit` or use a //| are no longer needed. To do so, either call :py:meth:`!deinit` or use a
//| context manager.""" //| context manager."""

View File

@ -35,19 +35,8 @@
#include "shared-bindings/audiocore/RawSample.h" #include "shared-bindings/audiocore/RawSample.h"
#include "supervisor/shared/translate.h" #include "supervisor/shared/translate.h"
//| class RawSample: //| class RawSample:
//| """.. currentmodule:: audiocore //| """A raw audio sample buffer in memory"""
//|
//| :class:`RawSample` -- A raw audio sample buffer
//| ========================================================
//|
//| An in-memory sound sample"""
//| //|
//| def __init__(self, buffer: array.array, *, channel_count: int = 1, sample_rate: int = 8000): //| def __init__(self, buffer: array.array, *, channel_count: int = 1, sample_rate: int = 8000):
//| """Create a RawSample based on the given buffer of signed values. If channel_count is more than //| """Create a RawSample based on the given buffer of signed values. If channel_count is more than

View File

@ -34,10 +34,7 @@
#include "supervisor/shared/translate.h" #include "supervisor/shared/translate.h"
//| class WaveFile: //| class WaveFile:
//| """.. currentmodule:: audiocore //| """Load a wave file for audio playback
//|
//| :class:`WaveFile` -- Load a wave file for audio playback
//| ========================================================
//| //|
//| A .wav file prepped for audio playback. Only mono and stereo files are supported. Samples must //| A .wav file prepped for audio playback. Only mono and stereo files are supported. Samples must
//| be 8 bit unsigned or 16 bit signed. If a buffer is provided, it will be used instead of allocating //| be 8 bit unsigned or 16 bit signed. If a buffer is provided, it will be used instead of allocating

View File

@ -35,22 +35,7 @@
#include "shared-bindings/audiocore/WaveFile.h" #include "shared-bindings/audiocore/WaveFile.h"
//#include "shared-bindings/audiomixer/Mixer.h" //#include "shared-bindings/audiomixer/Mixer.h"
//| """:mod:`audiocore` --- Support for audio samples and mixer //| """Support for audio samples"""
//| ========================================================
//|
//| .. module:: audiocore
//| :synopsis: Support for audio samples and mixer
//| :platform: SAMD21
//|
//| The `audiocore` module contains core classes for audio IO
//|
//| Libraries
//|
//| .. toctree::
//| :maxdepth: 3
//|
//| RawSample
//| WaveFile"""
//| //|
STATIC const mp_rom_map_elem_t audiocore_module_globals_table[] = { STATIC const mp_rom_map_elem_t audiocore_module_globals_table[] = {

View File

@ -37,12 +37,7 @@
#include "supervisor/shared/translate.h" #include "supervisor/shared/translate.h"
//| class AudioOut: //| class AudioOut:
//| """.. currentmodule:: audioio //| """Output an analog audio signal"""
//|
//| :class:`AudioOut` -- Output an analog audio signal
//| ========================================================
//|
//| AudioOut can be used to output an analog audio signal on a given pin."""
//| //|
//| def __init__(self, left_channel: microcontroller.Pin, *, right_channel: microcontroller.Pin = None, quiescent_value: int = 0x8000): //| def __init__(self, left_channel: microcontroller.Pin, *, right_channel: microcontroller.Pin = None, quiescent_value: int = 0x8000):
//| """Create a AudioOut object associated with the given pin(s). This allows you to //| """Create a AudioOut object associated with the given pin(s). This allows you to

View File

@ -42,22 +42,10 @@
#include "shared-bindings/audiomixer/Mixer.h" #include "shared-bindings/audiomixer/Mixer.h"
#endif #endif
//| """:mod:`audioio` --- Support for audio input and output //| """Support for audio output
//| ======================================================
//|
//| .. module:: audioio
//| :synopsis: Support for audio input and output
//| :platform: SAMD21
//| //|
//| The `audioio` module contains classes to provide access to audio IO. //| The `audioio` module contains classes to provide access to audio IO.
//| //|
//| Libraries
//|
//| .. toctree::
//| :maxdepth: 3
//|
//| AudioOut
//|
//| All classes change hardware state and should be deinitialized when they //| All classes change hardware state and should be deinitialized when they
//| are no longer needed if the program continues after use. To do so, either //| are no longer needed if the program continues after use. To do so, either
//| call :py:meth:`!deinit` or use a context manager. See //| call :py:meth:`!deinit` or use a context manager. See

View File

@ -39,12 +39,7 @@
#include "supervisor/shared/translate.h" #include "supervisor/shared/translate.h"
//| class Mixer: //| class Mixer:
//| """.. currentmodule:: audiomixer //| """Mixes one or more audio samples together into one sample."""
//|
//| :class:`Mixer` -- Mixes one or more audio samples together
//| ===========================================================
//|
//| Mixer mixes multiple samples into one sample."""
//| //|
//| def __init__(self, voice_count: int = 2, buffer_size: int = 1024, channel_count: int = 2, bits_per_sample: int = 16, samples_signed: bool = True, sample_rate: int = 8000): //| def __init__(self, voice_count: int = 2, buffer_size: int = 1024, channel_count: int = 2, bits_per_sample: int = 16, samples_signed: bool = True, sample_rate: int = 8000):
//| """Create a Mixer object that can mix multiple channels with the same sample rate. //| """Create a Mixer object that can mix multiple channels with the same sample rate.

View File

@ -38,10 +38,7 @@
#include "supervisor/shared/translate.h" #include "supervisor/shared/translate.h"
//| class MixerVoice: //| class MixerVoice:
//| """.. currentmodule:: audiomixer //| """Voice objects used with Mixer
//|
//| :class:`MixerVoice` -- Voice objects used with Mixer
//| =====================================================
//| //|
//| Used to access and control samples with `audiomixer.Mixer`.""" //| Used to access and control samples with `audiomixer.Mixer`."""
//| //|

View File

@ -32,21 +32,7 @@
#include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/microcontroller/Pin.h"
#include "shared-bindings/audiomixer/Mixer.h" #include "shared-bindings/audiomixer/Mixer.h"
//| """:mod:`audiomixer` --- Support for audio mixer //| """Support for audio mixing"""
//| ========================================================
//|
//| .. module:: audiomixer
//| :synopsis: Support for audio mixer
//|
//| The `audiomixer` module contains core classes for mixing audio sources
//|
//| Libraries
//|
//| .. toctree::
//| :maxdepth: 3
//|
//| Mixer
//| MixerVoice"""
//| //|
STATIC const mp_rom_map_elem_t audiomixer_module_globals_table[] = { STATIC const mp_rom_map_elem_t audiomixer_module_globals_table[] = {

View File

@ -35,12 +35,7 @@
#include "supervisor/shared/translate.h" #include "supervisor/shared/translate.h"
//| class MP3: //| class MP3:
//| """.. currentmodule:: audiomp3 //| """Load a mp3 file for audio playback"""
//|
//| :class:`MP3Decoder` -- Load a mp3 file for audio playback
//| =========================================================
//|
//| An object that decodes MP3 files for playback on an audio device."""
//| //|
//| def __init__(self, file: typing.BinaryIO, buffer: bytearray): //| def __init__(self, file: typing.BinaryIO, buffer: bytearray):
//| //|

View File

@ -31,20 +31,7 @@
#include "shared-bindings/audiomp3/MP3Decoder.h" #include "shared-bindings/audiomp3/MP3Decoder.h"
//| """:mod:`audiomp3` --- Support for MP3-compressed audio files //| """Support for MP3-compressed audio files"""
//| ==========================================================
//|
//| .. module:: audiomp3
//| :synopsis: Support for mp3 files
//|
//| The `audiomp3` module contains an mp3 decoder
//|
//| Libraries
//|
//| .. toctree::
//| :maxdepth: 3
//|
//| MP3Decoder"""
//| //|
STATIC const mp_rom_map_elem_t audiomp3_module_globals_table[] = { STATIC const mp_rom_map_elem_t audiomp3_module_globals_table[] = {

View File

@ -37,12 +37,7 @@
#include "supervisor/shared/translate.h" #include "supervisor/shared/translate.h"
//| class PWMAudioOut: //| class PWMAudioOut:
//| """.. currentmodule:: audiopwmio //| """Output an analog audio signal by varying the PWM duty cycle."""
//|
//| :class:`PWMAudioOut` -- Output an analog audio signal
//| ========================================================
//|
//| AudioOut can be used to output an analog audio signal on a given pin."""
//| //|
//| def __init__(self, left_channel: microcontroller.Pin, *, right_channel: microcontroller.Pin = None, quiescent_value: int = 0x8000): //| def __init__(self, left_channel: microcontroller.Pin, *, right_channel: microcontroller.Pin = None, quiescent_value: int = 0x8000):
//| """Create a PWMAudioOut object associated with the given pin(s). This allows you to //| """Create a PWMAudioOut object associated with the given pin(s). This allows you to

View File

@ -33,22 +33,10 @@
#include "shared-bindings/audiopwmio/__init__.h" #include "shared-bindings/audiopwmio/__init__.h"
#include "shared-bindings/audiopwmio/PWMAudioOut.h" #include "shared-bindings/audiopwmio/PWMAudioOut.h"
//| """:mod:`audiopwmio` --- Support for audio input and output //| """Audio output via digital PWM
//| ========================================================
//|
//| .. module:: audiopwmio
//| :synopsis: Support for audio output via digital PWM
//| :platform: NRF52
//| //|
//| The `audiopwmio` module contains classes to provide access to audio IO. //| The `audiopwmio` module contains classes to provide access to audio IO.
//| //|
//| Libraries
//|
//| .. toctree::
//| :maxdepth: 3
//|
//| PWMAudioOut
//|
//| All classes change hardware state and should be deinitialized when they //| All classes change hardware state and should be deinitialized when they
//| are no longer needed if the program continues after use. To do so, either //| are no longer needed if the program continues after use. To do so, either
//| call :py:meth:`!deinit` or use a context manager. See //| call :py:meth:`!deinit` or use a context manager. See

View File

@ -38,10 +38,7 @@
#include "supervisor/shared/translate.h" #include "supervisor/shared/translate.h"
//| class I2C: //| class I2C:
//| """.. currentmodule:: bitbangio //| """Two wire serial protocol"""
//|
//| :class:`I2C` --- Two wire serial protocol
//| ------------------------------------------"""
//| //|
//| def __init__(self, scl: microcontroller.Pin, sda: microcontroller.Pin, *, frequency: int = 400000, timeout: int): //| def __init__(self, scl: microcontroller.Pin, sda: microcontroller.Pin, *, frequency: int = 400000, timeout: int):
//| """I2C is a two-wire protocol for communicating between devices. At the //| """I2C is a two-wire protocol for communicating between devices. At the

View File

@ -35,10 +35,7 @@
#include "shared-bindings/util.h" #include "shared-bindings/util.h"
//| class OneWire: //| class OneWire:
//| """.. currentmodule:: bitbangio //| """Lowest-level of the Maxim OneWire protocol
//|
//| :class:`OneWire` -- Lowest-level of the Maxim OneWire protocol
//| ===============================================================
//| //|
//| :class:`~bitbangio.OneWire` implements the timing-sensitive foundation of //| :class:`~bitbangio.OneWire` implements the timing-sensitive foundation of
//| the Maxim (formerly Dallas Semi) OneWire protocol. //| the Maxim (formerly Dallas Semi) OneWire protocol.

View File

@ -40,10 +40,7 @@
#include "supervisor/shared/translate.h" #include "supervisor/shared/translate.h"
//| class SPI: //| class SPI:
//| """.. currentmodule:: bitbangio //| """A 3-4 wire serial protocol
//|
//| :class:`SPI` -- a 3-4 wire serial protocol
//| -----------------------------------------------
//| //|
//| SPI is a serial protocol that has exclusive pins for data in and out of the //| SPI is a serial protocol that has exclusive pins for data in and out of the
//| master. It is typically faster than :py:class:`~bitbangio.I2C` because a //| master. It is typically faster than :py:class:`~bitbangio.I2C` because a

View File

@ -40,12 +40,7 @@
#include "py/runtime.h" #include "py/runtime.h"
//| """:mod:`bitbangio` --- Digital protocols implemented by the CPU //| """Digital protocols implemented by the CPU
//| =============================================================
//|
//| .. module:: bitbangio
//| :synopsis: Digital protocols implemented by the CPU
//| :platform: SAMD21, ESP8266
//| //|
//| The `bitbangio` module contains classes to provide digital bus protocol //| The `bitbangio` module contains classes to provide digital bus protocol
//| support regardless of whether the underlying hardware exists to use the //| support regardless of whether the underlying hardware exists to use the
@ -55,15 +50,6 @@
//| hardware to implement the protocols. Native implementations will be faster //| hardware to implement the protocols. Native implementations will be faster
//| than bitbanged versions and have more capabilities. //| than bitbanged versions and have more capabilities.
//| //|
//| Libraries
//|
//| .. toctree::
//| :maxdepth: 3
//|
//| I2C
//| OneWire
//| SPI
//|
//| All classes change hardware state and should be deinitialized when they //| All classes change hardware state and should be deinitialized when they
//| are no longer needed if the program continues after use. To do so, either //| are no longer needed if the program continues after use. To do so, either
//| call :py:meth:`!deinit` or use a context manager. See //| call :py:meth:`!deinit` or use a context manager. See

View File

@ -29,11 +29,7 @@
#include "shared-bindings/board/__init__.h" #include "shared-bindings/board/__init__.h"
//| """:mod:`board` --- Board specific pin names //| """Board specific pin names
//| ========================================================
//|
//| .. module:: board
//| :synopsis: Board specific pin names
//| //|
//| Common container for board base pin names. These will vary from board to //| Common container for board base pin names. These will vary from board to
//| board so don't expect portability when using this module. //| board so don't expect portability when using this module.

View File

@ -37,10 +37,7 @@
#include "supervisor/shared/translate.h" #include "supervisor/shared/translate.h"
//| class I2C: //| class I2C:
//| """.. currentmodule:: busio //| """Two wire serial protocol"""
//|
//| :class:`I2C` --- Two wire serial protocol
//| ------------------------------------------"""
//| //|
//| def __init__(self, scl: microcontroller.Pin, sda: microcontroller.Pin, *, frequency: int = 400000, timeout: int = 255): //| def __init__(self, scl: microcontroller.Pin, sda: microcontroller.Pin, *, frequency: int = 400000, timeout: int = 255):
//| //|

View File

@ -35,10 +35,7 @@
#include "shared-bindings/util.h" #include "shared-bindings/util.h"
//| class OneWire: //| class OneWire:
//| """.. currentmodule:: busio //| """Lowest-level of the Maxim OneWire protocol"""
//|
//| :class:`OneWire` -- Lowest-level of the Maxim OneWire protocol
//| ================================================================="""
//| //|
//| def __init__(self, pin: microcontroller.Pin): //| def __init__(self, pin: microcontroller.Pin):
//| """(formerly Dallas Semi) OneWire protocol. //| """(formerly Dallas Semi) OneWire protocol.

View File

@ -42,10 +42,7 @@
//| class SPI: //| class SPI:
//| """.. currentmodule:: busio //| """A 3-4 wire serial protocol
//|
//| `SPI` -- a 3-4 wire serial protocol
//| -----------------------------------------------
//| //|
//| SPI is a serial protocol that has exclusive pins for data in and out of the //| SPI is a serial protocol that has exclusive pins for data in and out of the
//| master. It is typically faster than :py:class:`~busio.I2C` because a //| master. It is typically faster than :py:class:`~busio.I2C` because a
@ -147,7 +144,7 @@ STATIC void check_for_deinit(busio_spi_obj_t *self) {
//| def configure(self, *, baudrate: int = 100000, polarity: int = 0, phase: int = 0, bits: int = 8) -> Any: //| def configure(self, *, baudrate: int = 100000, polarity: int = 0, phase: int = 0, bits: int = 8) -> Any:
//| """Configures the SPI bus. The SPI object must be locked. //| """Configures the SPI bus. The SPI object must be locked.
//| //|
//| :param int baudrate: the desired clock rate in Hertz. The actual clock rate may be higher or lower //| :param int baudrate: the desired clock rate in Hertz. The actual clock rate may be higher or lower
//| due to the granularity of available clock settings. //| due to the granularity of available clock settings.
//| Check the `frequency` attribute for the actual clock rate. //| Check the `frequency` attribute for the actual clock rate.
//| :param int polarity: the base state of the clock line (0 or 1) //| :param int polarity: the base state of the clock line (0 or 1)

View File

@ -43,10 +43,7 @@
// #define STREAM_DEBUG(...) mp_printf(&mp_plat_print __VA_OPT__(,) __VA_ARGS__) // #define STREAM_DEBUG(...) mp_printf(&mp_plat_print __VA_OPT__(,) __VA_ARGS__)
//| class UART: //| class UART:
//| """.. currentmodule:: busio //| """A bidirectional serial protocol"""
//|
//| :class:`UART` -- a bidirectional serial protocol
//| ================================================="""
//| def __init__(self, tx: microcontroller.Pin, rx: microcontroller.Pin, *, baudrate: int = 9600, bits: int = 8, parity: Parity = None, stop: int = 1, timeout: float = 1, receiver_buffer_size: int = 64): //| def __init__(self, tx: microcontroller.Pin, rx: microcontroller.Pin, *, baudrate: int = 9600, bits: int = 8, parity: Parity = None, stop: int = 1, timeout: float = 1, receiver_buffer_size: int = 64):
//| """A common bidirectional serial protocol that uses an an agreed upon speed //| """A common bidirectional serial protocol that uses an an agreed upon speed
//| rather than a shared clock line. //| rather than a shared clock line.

View File

@ -38,12 +38,7 @@
#include "py/runtime.h" #include "py/runtime.h"
//| """:mod:`busio` --- Hardware accelerated behavior //| """Hardware accelerated external bus access
//| =================================================
//|
//| .. module:: busio
//| :synopsis: Hardware accelerated behavior
//| :platform: SAMD21
//| //|
//| The `busio` module contains classes to support a variety of serial //| The `busio` module contains classes to support a variety of serial
//| protocols. //| protocols.
@ -54,16 +49,6 @@
//| then a RuntimeError will be raised. Use the `bitbangio` module to explicitly //| then a RuntimeError will be raised. Use the `bitbangio` module to explicitly
//| bitbang a serial protocol on any general purpose pins. //| bitbang a serial protocol on any general purpose pins.
//| //|
//| Libraries
//|
//| .. toctree::
//| :maxdepth: 3
//|
//| I2C
//| OneWire
//| SPI
//| UART
//|
//| All classes change hardware state and should be deinitialized when they //| All classes change hardware state and should be deinitialized when they
//| are no longer needed if the program continues after use. To do so, either //| are no longer needed if the program continues after use. To do so, either
//| call :py:meth:`!deinit` or use a context manager. See //| call :py:meth:`!deinit` or use a context manager. See

View File

@ -44,10 +44,7 @@
#include "supervisor/shared/translate.h" #include "supervisor/shared/translate.h"
//| class DigitalInOut: //| class DigitalInOut:
//| """.. currentmodule:: digitalio //| """Digital input and output
//|
//| :class:`DigitalInOut` -- digital input and output
//| =========================================================
//| //|
//| A DigitalInOut is used to digitally control I/O pins. For analog control of //| A DigitalInOut is used to digitally control I/O pins. For analog control of
//| a pin, see the :py:class:`analogio.AnalogIn` and //| a pin, see the :py:class:`analogio.AnalogIn` and

View File

@ -39,10 +39,7 @@
#include "shared-bindings/digitalio/DigitalInOut.h" #include "shared-bindings/digitalio/DigitalInOut.h"
//| class Direction: //| class Direction:
//| """.. currentmodule:: digitalio //| """Defines the direction of a digital pin"""
//|
//| :class:`Direction` -- defines the direction of a digital pin
//| ============================================================="""
//| //|
//| def __init__(self, ): //| def __init__(self, ):
//| """Enum-like class to define which direction the digital values are //| """Enum-like class to define which direction the digital values are

View File

@ -27,10 +27,7 @@
#include "shared-bindings/digitalio/DriveMode.h" #include "shared-bindings/digitalio/DriveMode.h"
//| class DriveMode: //| class DriveMode:
//| """.. currentmodule:: digitalio //| """Defines the drive mode of a digital pin"""
//|
//| :class:`DriveMode` -- defines the drive mode of a digital pin
//| ============================================================="""
//| //|
//| def __init__(self, ): //| def __init__(self, ):
//| """Enum-like class to define the drive mode used when outputting //| """Enum-like class to define the drive mode used when outputting

View File

@ -27,10 +27,7 @@
#include "shared-bindings/digitalio/Pull.h" #include "shared-bindings/digitalio/Pull.h"
//| class Pull: //| class Pull:
//| """.. currentmodule:: digitalio //| """Defines the pull of a digital input pin"""
//|
//| :class:`Pull` -- defines the pull of a digital input pin
//| ============================================================="""
//| //|
//| def __init__(self, ): //| def __init__(self, ):
//| """Enum-like class to define the pull value, if any, used while reading //| """Enum-like class to define the pull value, if any, used while reading

View File

@ -38,25 +38,10 @@
#include "py/runtime.h" #include "py/runtime.h"
//| """:mod:`digitalio` --- Basic digital pin support //| """Basic digital pin support
//| =================================================
//|
//| .. module:: digitalio
//| :synopsis: Basic digital pin support
//| :platform: SAMD21, ESP8266
//| //|
//| The `digitalio` module contains classes to provide access to basic digital IO. //| The `digitalio` module contains classes to provide access to basic digital IO.
//| //|
//| Libraries
//|
//| .. toctree::
//| :maxdepth: 3
//|
//| DigitalInOut
//| Direction
//| DriveMode
//| Pull
//|
//| All classes change hardware state and should be deinitialized when they //| All classes change hardware state and should be deinitialized when they
//| are no longer needed if the program continues after use. To do so, either //| are no longer needed if the program continues after use. To do so, either
//| call :py:meth:`!deinit` or use a context manager. See //| call :py:meth:`!deinit` or use a context manager. See

View File

@ -37,12 +37,7 @@
#include "supervisor/shared/translate.h" #include "supervisor/shared/translate.h"
//| class Bitmap: //| class Bitmap:
//| """.. currentmodule:: displayio //| """Stores values of a certain size in a 2D array"""
//|
//| :class:`Bitmap` -- Stores values in a 2D array
//| ==========================================================================
//|
//| Stores values of a certain size in a 2D array"""
//| //|
//| def __init__(self, width: int, height: int, value_count: int): //| def __init__(self, width: int, height: int, value_count: int):
//| """Create a Bitmap object with the given fixed size. Each pixel stores a value that is used to //| """Create a Bitmap object with the given fixed size. Each pixel stores a value that is used to

View File

@ -37,12 +37,7 @@
#include "supervisor/shared/translate.h" #include "supervisor/shared/translate.h"
//| class ColorConverter: //| class ColorConverter:
//| """.. currentmodule:: displayio //| """Converts one color format to another."""
//|
//| :class:`ColorConverter` -- Converts one color format to another
//| =========================================================================================
//|
//| Converts one color format to another."""
//| //|
//| def __init__(self, *, dither: bool = False): //| def __init__(self, *, dither: bool = False):
//| """Create a ColorConverter object to convert color formats. Only supports RGB888 to RGB565 //| """Create a ColorConverter object to convert color formats. Only supports RGB888 to RGB565

View File

@ -40,10 +40,7 @@
#include "supervisor/shared/translate.h" #include "supervisor/shared/translate.h"
//| class Display: //| class Display:
//| """.. currentmodule:: displayio //| """Manage updating a display over a display bus
//|
//| :class:`Display` -- Manage updating a display over a display bus
//| ==========================================================================
//| //|
//| This initializes a display and connects it into CircuitPython. Unlike other //| This initializes a display and connects it into CircuitPython. Unlike other
//| objects in CircuitPython, Display objects live until `displayio.release_displays()` //| objects in CircuitPython, Display objects live until `displayio.release_displays()`

View File

@ -40,10 +40,7 @@
#include "supervisor/shared/translate.h" #include "supervisor/shared/translate.h"
//| class EPaperDisplay: //| class EPaperDisplay:
//| """.. currentmodule:: displayio //| """Manage updating an epaper display over a display bus
//|
//| :class:`EPaperDisplay` -- Manage updating an epaper display over a display bus
//| ==============================================================================
//| //|
//| This initializes an epaper display and connects it into CircuitPython. Unlike other //| This initializes an epaper display and connects it into CircuitPython. Unlike other
//| objects in CircuitPython, EPaperDisplay objects live until `displayio.release_displays()` //| objects in CircuitPython, EPaperDisplay objects live until `displayio.release_displays()`

View File

@ -39,12 +39,7 @@
#include "supervisor/shared/translate.h" #include "supervisor/shared/translate.h"
//| class FourWire: //| class FourWire:
//| """.. currentmodule:: displayio //| """Manage updating a display over SPI four wire protocol in the background while Python code runs.
//|
//| :class:`FourWire` -- Manage updating a display over SPI four wire protocol
//| ==========================================================================
//|
//| Manage updating a display over SPI four wire protocol in the background while Python code runs.
//| It doesn't handle display initialization.""" //| It doesn't handle display initialization."""
//| //|
//| def __init__(self, spi_bus: busio.SPI, *, command: microcontroller.Pin, chip_select: microcontroller.Pin, reset: microcontroller.Pin = None, baudrate: int = 24000000, polarity: int = 0, phase: int = 0): //| def __init__(self, spi_bus: busio.SPI, *, command: microcontroller.Pin, chip_select: microcontroller.Pin, reset: microcontroller.Pin = None, baudrate: int = 24000000, polarity: int = 0, phase: int = 0):

View File

@ -36,12 +36,7 @@
#include "supervisor/shared/translate.h" #include "supervisor/shared/translate.h"
//| class Group: //| class Group:
//| """.. currentmodule:: displayio //| """Manage a group of sprites and groups and how they are inter-related."""
//|
//| :class:`Group` -- Group together sprites and subgroups
//| ==========================================================================
//|
//| Manage a group of sprites and groups and how they are inter-related."""
//| //|
//| def __init__(self, *, max_size: int = 4, scale: int = 1, x: int = 0, y: int = 0): //| def __init__(self, *, max_size: int = 4, scale: int = 1, x: int = 0, y: int = 0):
//| """Create a Group of a given size and scale. Scale is in one dimension. For example, scale=2 //| """Create a Group of a given size and scale. Scale is in one dimension. For example, scale=2

View File

@ -39,12 +39,7 @@
#include "supervisor/shared/translate.h" #include "supervisor/shared/translate.h"
//| class I2CDisplay: //| class I2CDisplay:
//| """.. currentmodule:: displayio //| """Manage updating a display over I2C in the background while Python code runs.
//|
//| :class:`I2CDisplay` -- Manage updating a display over I2C
//| ==========================================================================
//|
//| Manage updating a display over I2C in the background while Python code runs.
//| It doesn't handle display initialization.""" //| It doesn't handle display initialization."""
//| //|
//| def __init__(self, i2c_bus: busio.I2C, *, device_address: int, reset: microcontroller.Pin = None): //| def __init__(self, i2c_bus: busio.I2C, *, device_address: int, reset: microcontroller.Pin = None):

View File

@ -34,12 +34,7 @@
#include "shared-bindings/displayio/OnDiskBitmap.h" #include "shared-bindings/displayio/OnDiskBitmap.h"
//| class OnDiskBitmap: //| class OnDiskBitmap:
//| """.. currentmodule:: displayio //| """Loads values straight from disk. This minimizes memory use but can lead to
//|
//| :class:`OnDiskBitmap` -- Loads pixels straight from disk
//| ==========================================================================
//|
//| Loads values straight from disk. This minimizes memory use but can lead to
//| much slower pixel load times. These load times may result in frame tearing where only part of //| much slower pixel load times. These load times may result in frame tearing where only part of
//| the image is visible. //| the image is visible.
//| //|

View File

@ -43,12 +43,7 @@
//| class Palette: //| class Palette:
//| """.. currentmodule:: displayio //| """Map a pixel palette_index to a full color. Colors are transformed to the display's format internally to
//|
//| :class:`Palette` -- Stores a mapping from bitmap pixel palette_indexes to display colors
//| =========================================================================================
//|
//| Map a pixel palette_index to a full color. Colors are transformed to the display's format internally to
//| save memory.""" //| save memory."""
//| //|
//| def __init__(self, color_count: int): //| def __init__(self, color_count: int):

View File

@ -38,12 +38,7 @@
#include "supervisor/shared/translate.h" #include "supervisor/shared/translate.h"
//| class ParallelBus: //| class ParallelBus:
//| """.. currentmodule:: displayio //| """Manage updating a display over 8-bit parallel bus in the background while Python code runs. This
//|
//| :class:`ParallelBus` -- Manage updating a display over 8-bit parallel bus
//| ==============================================================================
//|
//| Manage updating a display over 8-bit parallel bus in the background while Python code runs. This
//| protocol may be refered to as 8080-I Series Parallel Interface in datasheets. It doesn't handle //| protocol may be refered to as 8080-I Series Parallel Interface in datasheets. It doesn't handle
//| display initialization.""" //| display initialization."""
//| //|

View File

@ -35,12 +35,7 @@
#include "supervisor/shared/translate.h" #include "supervisor/shared/translate.h"
//| class Shape: //| class Shape:
//| """.. currentmodule:: displayio //| """Represents a shape made by defining boundaries that may be mirrored."""
//|
//| :class:`Shape` -- Represents a shape by defining its bounds on each row
//| ==========================================================================
//|
//| Represents any shape made by defining boundaries that may be mirrored."""
//| //|
//| def __init__(self, width: int, height: int, *, mirror_x: bool = False, mirror_y: bool = False): //| def __init__(self, width: int, height: int, *, mirror_x: bool = False, mirror_y: bool = False):
//| """Create a Shape object with the given fixed size. Each pixel is one bit and is stored by the //| """Create a Shape object with the given fixed size. Each pixel is one bit and is stored by the

View File

@ -41,10 +41,7 @@
#include "supervisor/shared/translate.h" #include "supervisor/shared/translate.h"
//| class TileGrid: //| class TileGrid:
//| """.. currentmodule:: displayio //| """A grid of tiles sourced out of one bitmap
//|
//| :class:`TileGrid` -- A grid of tiles sourced out of one bitmap
//| ==========================================================================
//| //|
//| Position a grid of tiles sourced from a bitmap and pixel_shader combination. Multiple grids //| Position a grid of tiles sourced from a bitmap and pixel_shader combination. Multiple grids
//| can share bitmaps and pixel shaders. //| can share bitmaps and pixel shaders.

View File

@ -43,33 +43,10 @@
#include "shared-bindings/displayio/Shape.h" #include "shared-bindings/displayio/Shape.h"
#include "shared-bindings/displayio/TileGrid.h" #include "shared-bindings/displayio/TileGrid.h"
//| """:mod:`displayio` --- Native display driving //| """Native helpers for driving displays
//| =========================================================================
//|
//| .. module:: displayio
//| :synopsis: Native helpers for driving displays
//| :platform: SAMD21, SAMD51, nRF52
//| //|
//| The `displayio` module contains classes to manage display output //| The `displayio` module contains classes to manage display output
//| including synchronizing with refresh rates and partial updating. //| including synchronizing with refresh rates and partial updating."""
//|
//| Libraries
//|
//| .. toctree::
//| :maxdepth: 3
//|
//| Bitmap
//| ColorConverter
//| Display
//| EPaperDisplay
//| FourWire
//| Group
//| I2CDisplay
//| OnDiskBitmap
//| Palette
//| ParallelBus
//| Shape
//| TileGrid"""
//| //|

View File

@ -37,12 +37,7 @@
#include "supervisor/shared/translate.h" #include "supervisor/shared/translate.h"
//| class BuiltinFont: //| class BuiltinFont:
//| """.. currentmodule:: fontio //| """A font built into CircuitPython"""
//|
//| :class:`BuiltinFont` -- A font built into CircuitPython
//| =========================================================================================
//|
//| A font built into CircuitPython."""
//| //|
//| def __init__(self, ): //| def __init__(self, ):
//| """Creation not supported. Available fonts are defined when CircuitPython is built. See the //| """Creation not supported. Available fonts are defined when CircuitPython is built. See the

View File

@ -29,22 +29,27 @@
#include <stdint.h> #include <stdint.h>
//| class Glyph: //| class Glyph:
//| """.. currentmodule:: fontio //| """Storage of glyph info"""
//| //|
//| :class:`Glyph` -- Storage of glyph info //| def __init__(self,
//| ==========================================================================""" //| bitmap: displayio.Bitmap,
//| //| tile_index: int,
//| def __init__(self, bitmap: displayio.Bitmap, tile_index: int, width: int, height: int, dx: int, dy: int, shift_x: int, shift_y: int): //| width: int,
//| height: int,
//| dx: int,
//| dy: int,
//| shift_x: int,
//| shift_y: int):
//| """Named tuple used to capture a single glyph and its attributes. //| """Named tuple used to capture a single glyph and its attributes.
//| //|
//| :param displayio.Bitmap bitmap: the bitmap including the glyph //| :param bitmap: the bitmap including the glyph
//| :param int tile_index: the tile index within the bitmap //| :param tile_index: the tile index within the bitmap
//| :param int width: the width of the glyph's bitmap //| :param width: the width of the glyph's bitmap
//| :param int height: the height of the glyph's bitmap //| :param height: the height of the glyph's bitmap
//| :param int dx: x adjustment to the bitmap's position //| :param dx: x adjustment to the bitmap's position
//| :param int dy: y adjustment to the bitmap's position //| :param dy: y adjustment to the bitmap's position
//| :param int shift_x: the x difference to the next glyph //| :param shift_x: the x difference to the next glyph
//| :param int shift_y: the y difference to the next glyph""" //| :param shift_y: the y difference to the next glyph"""
//| ... //| ...
//| //|
const mp_obj_namedtuple_type_t fontio_glyph_type = { const mp_obj_namedtuple_type_t fontio_glyph_type = {

View File

@ -33,22 +33,7 @@
#include "shared-bindings/fontio/BuiltinFont.h" #include "shared-bindings/fontio/BuiltinFont.h"
#include "shared-bindings/fontio/Glyph.h" #include "shared-bindings/fontio/Glyph.h"
//| """:mod:`fontio` --- Core font related data structures //| """Core font related data structures"""
//| =========================================================================
//|
//| .. module:: fontio
//| :synopsis: Core font related data structures
//| :platform: SAMD21, SAMD51, nRF52
//|
//| The `fontio` module contains classes to store font related information.
//|
//| Libraries
//|
//| .. toctree::
//| :maxdepth: 3
//|
//| BuiltinFont
//| Glyph"""
//| //|
STATIC const mp_rom_map_elem_t fontio_module_globals_table[] = { STATIC const mp_rom_map_elem_t fontio_module_globals_table[] = {

View File

@ -41,10 +41,7 @@
#include "supervisor/shared/translate.h" #include "supervisor/shared/translate.h"
//| class FramebufferDisplay: //| class FramebufferDisplay:
//| """.. currentmodule:: framebufferio //| """Manage updating a display with framebuffer in RAM
//|
//| :class:`FramebufferDisplay` -- Manage updating a display with framebuffer in RAM
//| ================================================================================
//| //|
//| This initializes a display and connects it into CircuitPython. Unlike other //| This initializes a display and connects it into CircuitPython. Unlike other
//| objects in CircuitPython, Display objects live until `displayio.release_displays()` //| objects in CircuitPython, Display objects live until `displayio.release_displays()`

View File

@ -28,25 +28,13 @@
#include "shared-bindings/framebufferio/__init__.h" #include "shared-bindings/framebufferio/__init__.h"
#include "shared-bindings/framebufferio/FramebufferDisplay.h" #include "shared-bindings/framebufferio/FramebufferDisplay.h"
//| """:mod:`framebufferio` --- Native framebuffer display driving //| """Native framebuffer display driving
//| =========================================================================
//|
//| .. module:: framebufferio
//| :synopsis: Native helpers for driving displays
//| :platform: SAMD51, nRF52
//| //|
//| The `framebufferio` module contains classes to manage display output //| The `framebufferio` module contains classes to manage display output
//| including synchronizing with refresh rates and partial updating. //| including synchronizing with refresh rates and partial updating.
//| It is used in conjunction with classes from `displayio` to actually //| It is used in conjunction with classes from `displayio` to actually
//| place items on the display; and classes like `RGBMatrix` to actually //| place items on the display; and classes like `RGBMatrix` to actually
//| drive the display. //| drive the display."""
//|
//| Libraries
//|
//| .. toctree::
//| :maxdepth: 3
//|
//| FramebufferDisplay"""
//| //|
#if CIRCUITPY_FRAMEBUFFERIO #if CIRCUITPY_FRAMEBUFFERIO

View File

@ -36,10 +36,7 @@
#include "supervisor/shared/translate.h" #include "supervisor/shared/translate.h"
//| class FrequencyIn: //| class FrequencyIn:
//| """.. currentmodule:: frequencyio //| """Read a frequency signal
//|
//| :class:`FrequencyIn` -- Read a frequency signal
//| ========================================================
//| //|
//| FrequencyIn is used to measure the frequency, in hertz, of a digital signal //| FrequencyIn is used to measure the frequency, in hertz, of a digital signal
//| on an incoming pin. Accuracy has shown to be within 10%, if not better. It //| on an incoming pin. Accuracy has shown to be within 10%, if not better. It

View File

@ -33,23 +33,8 @@
#include "shared-bindings/frequencyio/__init__.h" #include "shared-bindings/frequencyio/__init__.h"
#include "shared-bindings/frequencyio/FrequencyIn.h" #include "shared-bindings/frequencyio/FrequencyIn.h"
//| """:mod:`frequencyio` --- Support for frequency based protocols //| """Support for frequency based protocols
//| =============================================================
//| //|
//| .. module:: frequencyio
//| :synopsis: Support for frequency based protocols
//| :platform: SAMD51
//|
//| The `frequencyio` module contains classes to provide access to basic frequency IO.
//|
//| Libraries
//|
//| .. toctree::
//| :maxdepth: 3
//|
//| FrequencyIn
//|
//| .. warning:: This module is not available in SAMD21 builds. See the //| .. warning:: This module is not available in SAMD21 builds. See the
//| :ref:`module-support-matrix` for more info. //| :ref:`module-support-matrix` for more info.
//| //|

View File

@ -35,10 +35,7 @@
#include "supervisor/shared/translate.h" #include "supervisor/shared/translate.h"
//| class GamePad: //| class GamePad:
//| """.. currentmodule:: gamepad //| """Scan buttons for presses
//|
//| :class:`GamePad` -- Scan buttons for presses
//| ============================================
//| //|
//| Usage:: //| Usage::
//| //|
@ -90,7 +87,7 @@
//| on delays. //| on delays.
//| //|
//| They button presses are accumulated, until the ``get_pressed`` method //| They button presses are accumulated, until the ``get_pressed`` method
//| is called, at which point the button state is cleared, and the new //| is called, at which point the button state is cleared, and the new
//| button presses start to be recorded.""" //| button presses start to be recorded."""
//| ... //| ...
//| //|

View File

@ -29,17 +29,7 @@
#include "shared-bindings/gamepad/GamePad.h" #include "shared-bindings/gamepad/GamePad.h"
#include "shared-bindings/util.h" #include "shared-bindings/util.h"
//| """:mod:`gamepad` --- Button handling //| """Button handling in the background"""
//| ==================================
//|
//| .. module:: gamepad
//| :synopsis: Button handling
//| :platform: SAMD21
//|
//| .. toctree::
//| :maxdepth: 3
//|
//| GamePad"""
//| //|
STATIC const mp_rom_map_elem_t gamepad_module_globals_table[] = { STATIC const mp_rom_map_elem_t gamepad_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_gamepad) }, { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_gamepad) },

View File

@ -33,10 +33,7 @@
#include "supervisor/shared/translate.h" #include "supervisor/shared/translate.h"
//| class GamePadShift: //| class GamePadShift:
//| """.. currentmodule:: gamepadshift //| """Scan buttons for presses through a shift register"""
//|
//| :class:`GamePadShift` -- Scan buttons for presses through a shift register
//| ==========================================================================="""
//| //|
//| def __init__(self, clock: Any, data: Any, latch: Any): //| def __init__(self, clock: Any, data: Any, latch: Any):
//| """Initializes button scanning routines. //| """Initializes button scanning routines.

View File

@ -30,17 +30,7 @@
#include "shared-bindings/digitalio/DigitalInOut.h" #include "shared-bindings/digitalio/DigitalInOut.h"
#include "shared-bindings/util.h" #include "shared-bindings/util.h"
//| """:mod:`gamepadshift` --- Tracks button presses read through a shift register //| """Tracks button presses read through a shift register"""
//| ===========================================================================
//|
//| .. module:: gamepadshift
//| :synopsis: Tracks button presses read through a shift register
//| :platform: SAMD21, SAMD51
//|
//| .. toctree::
//| :maxdepth: 3
//|
//| GamePadShift"""
//| //|
STATIC const mp_rom_map_elem_t gamepadshift_module_globals_table[] = { STATIC const mp_rom_map_elem_t gamepadshift_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_gamepadshift) }, { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_gamepadshift) },

View File

@ -1,34 +0,0 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2016 Scott Shawcroft for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
//| :func:`help` - Built-in method to provide helpful information
//| ==============================================================
//|
//| .. function:: help(object=None)
//|
//| Prints a help method about the given object. When ``object`` is none,
//| prints general port information.
//|

31
shared-bindings/help.rst Normal file
View File

@ -0,0 +1,31 @@
# This file is part of the MicroPython project, http://micropython.org/
#
# The MIT License (MIT)
#
# Copyright (c) 2016 Scott Shawcroft for Adafruit Industries
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
:func:`help` - Built-in method to provide helpful information
==============================================================
.. function:: help(object=None)
Prints a help method about the given object. When ``object`` is none,
prints general port information.

View File

@ -50,10 +50,7 @@ STATIC mp_obj_t mp_obj_new_i2cslave_i2c_slave_request(i2cslave_i2c_slave_obj_t *
} }
//| class I2CSlave: //| class I2CSlave:
//| """.. currentmodule:: i2cslave //| """Two wire serial protocol slave"""
//|
//| :class:`I2CSlave` --- Two wire serial protocol slave
//| ----------------------------------------------------"""
//| //|
//| def __init__(self, scl: microcontroller.Pin, sda: microcontroller.Pin, addresses: tuple, smbus: bool = False): //| def __init__(self, scl: microcontroller.Pin, sda: microcontroller.Pin, addresses: tuple, smbus: bool = False):
//| """I2C is a two-wire protocol for communicating between devices. //| """I2C is a two-wire protocol for communicating between devices.
@ -229,17 +226,15 @@ const mp_obj_type_t i2cslave_i2c_slave_type = {
}; };
//| class I2CSlaveRequest: //| class I2CSlaveRequest:
//| """:class:`I2CSlaveRequest` --- I2C Slave Request
//| ----------------------------------------------"""
//| //|
//| def __init__(self, slave: i2cslave.I2CSlave, address: int, is_read: bool, is_restart: bool): //| def __init__(self, slave: i2cslave.I2CSlave, address: int, is_read: bool, is_restart: bool):
//| """I2C transfer request from a master. //| """I2C transfer request from a master.
//| This cannot be instantiated directly, but is returned by :py:meth:`I2CSlave.request`. //| This cannot be instantiated directly, but is returned by :py:meth:`I2CSlave.request`.
//| //|
//| :param ~i2cslave.I2CSlave slave: The I2C Slave receiving this request //| :param slave: The I2C Slave receiving this request
//| :param int address: I2C address //| :param address: I2C address
//| :param bool is_read: I2C Master read request //| :param is_read: I2C Master read request
//| :param bool is_restart: Repeated Start Condition""" //| :param is_restart: Repeated Start Condition"""
//| //|
STATIC mp_obj_t i2cslave_i2c_slave_request_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) { STATIC mp_obj_t i2cslave_i2c_slave_request_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
mp_arg_check_num(n_args, kw_args, 4, 4, false); mp_arg_check_num(n_args, kw_args, 4, 4, false);
@ -264,7 +259,7 @@ STATIC mp_obj_t i2cslave_i2c_slave_request_obj___exit__(size_t n_args, const mp_
} }
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(i2cslave_i2c_slave_request___exit___obj, 4, 4, i2cslave_i2c_slave_request_obj___exit__); STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(i2cslave_i2c_slave_request___exit___obj, 4, 4, i2cslave_i2c_slave_request_obj___exit__);
//| address: Any = ... //| address: int = ...
//| """The I2C address of the request.""" //| """The I2C address of the request."""
//| //|
STATIC mp_obj_t i2cslave_i2c_slave_request_get_address(mp_obj_t self_in) { STATIC mp_obj_t i2cslave_i2c_slave_request_get_address(mp_obj_t self_in) {
@ -274,7 +269,7 @@ STATIC mp_obj_t i2cslave_i2c_slave_request_get_address(mp_obj_t self_in) {
} }
MP_DEFINE_CONST_PROP_GET(i2cslave_i2c_slave_request_address_obj, i2cslave_i2c_slave_request_get_address); MP_DEFINE_CONST_PROP_GET(i2cslave_i2c_slave_request_address_obj, i2cslave_i2c_slave_request_get_address);
//| is_read: Any = ... //| is_read: bool = ...
//| """The I2C master is reading from the device.""" //| """The I2C master is reading from the device."""
//| //|
STATIC mp_obj_t i2cslave_i2c_slave_request_get_is_read(mp_obj_t self_in) { STATIC mp_obj_t i2cslave_i2c_slave_request_get_is_read(mp_obj_t self_in) {
@ -284,7 +279,7 @@ STATIC mp_obj_t i2cslave_i2c_slave_request_get_is_read(mp_obj_t self_in) {
} }
MP_DEFINE_CONST_PROP_GET(i2cslave_i2c_slave_request_is_read_obj, i2cslave_i2c_slave_request_get_is_read); MP_DEFINE_CONST_PROP_GET(i2cslave_i2c_slave_request_is_read_obj, i2cslave_i2c_slave_request_get_is_read);
//| is_restart: Any = ... //| is_restart: bool = ...
//| """Is Repeated Start Condition.""" //| """Is Repeated Start Condition."""
//| //|
STATIC mp_obj_t i2cslave_i2c_slave_request_get_is_restart(mp_obj_t self_in) { STATIC mp_obj_t i2cslave_i2c_slave_request_get_is_restart(mp_obj_t self_in) {
@ -294,14 +289,13 @@ STATIC mp_obj_t i2cslave_i2c_slave_request_get_is_restart(mp_obj_t self_in) {
} }
MP_DEFINE_CONST_PROP_GET(i2cslave_i2c_slave_request_is_restart_obj, i2cslave_i2c_slave_request_get_is_restart); MP_DEFINE_CONST_PROP_GET(i2cslave_i2c_slave_request_is_restart_obj, i2cslave_i2c_slave_request_get_is_restart);
//| def read(self, n: int = -1, ack: bool = True) -> Any: //| def read(self, n: int = -1, ack: bool = True) -> bytearray:
//| """Read data. //| """Read data.
//| If ack=False, the caller is responsible for calling :py:meth:`I2CSlaveRequest.ack`. //| If ack=False, the caller is responsible for calling :py:meth:`I2CSlaveRequest.ack`.
//| //|
//| :param int n: Number of bytes to read (negative means all) //| :param n: Number of bytes to read (negative means all)
//| :param bool ack: Whether or not to send an ACK after the n'th byte //| :param ack: Whether or not to send an ACK after the n'th byte
//| :return: Bytes read //| :return: Bytes read"""
//| :rtype: bytearray"""
//| ... //| ...
//| //|
STATIC mp_obj_t i2cslave_i2c_slave_request_read(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { STATIC mp_obj_t i2cslave_i2c_slave_request_read(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
@ -355,10 +349,10 @@ STATIC mp_obj_t i2cslave_i2c_slave_request_read(size_t n_args, const mp_obj_t *p
} }
MP_DEFINE_CONST_FUN_OBJ_KW(i2cslave_i2c_slave_request_read_obj, 1, i2cslave_i2c_slave_request_read); MP_DEFINE_CONST_FUN_OBJ_KW(i2cslave_i2c_slave_request_read_obj, 1, i2cslave_i2c_slave_request_read);
//| def write(self, buffer: bytearray) -> Any: //| def write(self, buffer: bytearray) -> int:
//| """Write the data contained in buffer. //| """Write the data contained in buffer.
//| //|
//| :param bytearray buffer: Write out the data in this buffer //| :param buffer: Write out the data in this buffer
//| :return: Number of bytes written""" //| :return: Number of bytes written"""
//| ... //| ...
//| //|
@ -393,7 +387,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(i2cslave_i2c_slave_request_write_obj, i2cslave_
//| """Acknowledge or Not Acknowledge last byte received. //| """Acknowledge or Not Acknowledge last byte received.
//| Use together with :py:meth:`I2CSlaveRequest.read` ack=False. //| Use together with :py:meth:`I2CSlaveRequest.read` ack=False.
//| //|
//| :param bool ack: Whether to send an ACK or NACK""" //| :param ack: Whether to send an ACK or NACK"""
//| ... //| ...
//| //|
STATIC mp_obj_t i2cslave_i2c_slave_request_ack(uint n_args, const mp_obj_t *args) { STATIC mp_obj_t i2cslave_i2c_slave_request_ack(uint n_args, const mp_obj_t *args) {

View File

@ -35,22 +35,10 @@
#include "py/runtime.h" #include "py/runtime.h"
//| """:mod:`i2cslave` --- Two wire serial protocol slave //| """Two wire serial protocol slave
//| ==================================================
//|
//| .. module:: i2cslave
//| :synopsis: Two wire serial protocol slave
//| :platform: SAMD21, SAMD51
//| //|
//| The `i2cslave` module contains classes to support a I2C slave. //| The `i2cslave` module contains classes to support a I2C slave.
//| //|
//| Classes
//|
//| .. toctree::
//| :maxdepth: 3
//|
//| I2CSlave
//|
//| Example emulating 2 devices:: //| Example emulating 2 devices::
//| //|
//| import board //| import board

View File

@ -7,13 +7,17 @@ present or if flash space is limited. For example, a microcontroller without
analog features will not have `analogio`. See the `support_matrix` page for analog features will not have `analogio`. See the `support_matrix` page for
a list of modules supported on each board. a list of modules supported on each board.
.. toctree::
:hidden:
support_matrix
Modules Modules
--------- ---------
.. toctree:: .. toctree::
:glob: :glob:
:maxdepth: 3 :maxdepth: 2
support_matrix ../autoapi/*/index
*/__init__
help help

View File

@ -38,12 +38,7 @@
#define MP_PI MICROPY_FLOAT_CONST(3.14159265358979323846) #define MP_PI MICROPY_FLOAT_CONST(3.14159265358979323846)
//| """:mod:`math` --- mathematical functions //| """mathematical functions
//| ========================================================
//|
//| .. module:: math
//| :synopsis: mathematical functions
//| :platform: SAMD21/SAMD51
//| //|
//| The `math` module provides some basic mathematical functions for //| The `math` module provides some basic mathematical functions for
//| working with floating-point numbers.""" //| working with floating-point numbers."""

View File

@ -34,12 +34,7 @@
#include "supervisor/shared/translate.h" #include "supervisor/shared/translate.h"
//| class Pin: //| class Pin:
//| """.. currentmodule:: microcontroller //| """Identifies an IO pin on the microcontroller."""
//|
//| :class:`Pin` --- Pin reference
//| ------------------------------------------
//|
//| Identifies an IO pin on the microcontroller."""
//| //|
//| def __init__(self, ): //| def __init__(self, ):
//| """Identifies an IO pin on the microcontroller. They are fixed by the //| """Identifies an IO pin on the microcontroller. They are fixed by the

View File

@ -35,12 +35,7 @@
#include "py/runtime.h" #include "py/runtime.h"
//| class Processor: //| class Processor:
//| """.. currentmodule:: microcontroller //| """Microcontroller CPU information and control
//|
//| :class:`Processor` --- Microcontroller CPU information and control
//| ------------------------------------------------------------------
//|
//| Get information about the microcontroller CPU and control it.
//| //|
//| Usage:: //| Usage::
//| //|
@ -55,8 +50,8 @@
//| ... //| ...
//| //|
//| frequency: Any = ... //| frequency: int = ...
//| """The CPU operating frequency as an `int`, in Hertz. (read-only)""" //| """The CPU operating frequency in Hertz. (read-only)"""
//| //|
STATIC mp_obj_t mcu_processor_get_frequency(mp_obj_t self) { STATIC mp_obj_t mcu_processor_get_frequency(mp_obj_t self) {
return mp_obj_new_int_from_uint(common_hal_mcu_processor_get_frequency()); return mp_obj_new_int_from_uint(common_hal_mcu_processor_get_frequency());

View File

@ -27,10 +27,7 @@
#include "shared-bindings/microcontroller/RunMode.h" #include "shared-bindings/microcontroller/RunMode.h"
//| class RunMode: //| class RunMode:
//| """.. currentmodule:: microcontroller //| """run state of the microcontroller"""
//|
//| :class:`RunMode` -- run state of the microcontroller
//| ============================================================="""
//| //|
//| def __init__(self, ): //| def __init__(self, ):
//| """Enum-like class to define the run mode of the microcontroller and //| """Enum-like class to define the run mode of the microcontroller and

View File

@ -42,27 +42,13 @@
#include "py/runtime.h" #include "py/runtime.h"
#include "supervisor/shared/translate.h" #include "supervisor/shared/translate.h"
//| """:mod:`microcontroller` --- Pin references and cpu functionality //| """Pin references and cpu functionality
//| ================================================================
//|
//| .. module:: microcontroller
//| :synopsis: Pin references and core functionality
//| :platform: SAMD21, ESP8266
//| //|
//| The `microcontroller` module defines the pins from the perspective of the //| The `microcontroller` module defines the pins from the perspective of the
//| microcontroller. See `board` for board-specific pin mappings. //| microcontroller. See `board` for board-specific pin mappings."""
//|
//| Libraries
//|
//| .. toctree::
//| :maxdepth: 3
//|
//| Pin
//| Processor
//| RunMode"""
//| //|
//| cpu: Any = ... //| cpu: Processor = ...
//| """CPU information and control, such as ``cpu.temperature`` and ``cpu.frequency`` //| """CPU information and control, such as ``cpu.temperature`` and ``cpu.frequency``
//| (clock frequency). //| (clock frequency).
//| This object is the sole instance of `microcontroller.Processor`.""" //| This object is the sole instance of `microcontroller.Processor`."""

View File

@ -30,12 +30,7 @@
#include "py/runtime.h" #include "py/runtime.h"
#include "supervisor/shared/translate.h" #include "supervisor/shared/translate.h"
//| """:mod:`multiterminal` --- Manage additional terminal sources //| """Manage additional terminal sources
//| ===========================================================
//|
//| .. module:: multiterminal
//| :synopsis: Manage additional terminal sources
//| :platform: ESP8266
//| //|
//| The `multiterminal` module allows you to configure an additional serial //| The `multiterminal` module allows you to configure an additional serial
//| terminal source. Incoming characters are accepted from both the internal //| terminal source. Incoming characters are accepted from both the internal

Some files were not shown because too many files have changed in this diff Show More