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: |
sudo apt-get install -y eatmydata
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
run: |
gcc --version

2
.gitignore vendored
View File

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

View File

@ -69,7 +69,7 @@ clean:
rm -rf $(BUILDDIR)/*
rm -rf $(STUBDIR) $(DISTDIR) *.egg-info
html:
html: stubs
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@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 $^
stubs:
mkdir -p circuitpython-stubs
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:
@echo "Updating all frozen libraries to latest tagged version."

14
conf.py
View File

@ -55,7 +55,6 @@ extensions = [
'sphinx.ext.todo',
'sphinx.ext.coverage',
'rstjinja',
'c2rst',
'recommonmark',
]
@ -66,9 +65,17 @@ templates_path = ['templates']
source_suffix = {
'.rst': 'restructuredtext',
'.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.
#source_encoding = 'utf-8-sig'
@ -78,7 +85,7 @@ source_suffix = {
# General information about the project.
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.
# The version info for the project you're documenting, acts as replacement for
@ -105,6 +112,7 @@ exclude_patterns = ["**/build*",
".git",
".venv",
".direnv",
"docs/autoapi",
"docs/README.md",
"drivers",
"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::
bindings/samd/__init__
../../autoapi/samd/index

View File

@ -30,18 +30,12 @@
#include "py/objproperty.h"
#include "py/runtime.h"
//| .. currentmodule:: samd
//| import typing
//| class Clock:
//| """Identifies a clock on the microcontroller.
//|
//| :class:`Clock` --- Clock reference
//| ------------------------------------------
//|
//| 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.
//| 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) {
@ -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);
}
//| .. attribute:: enabled
//|
//| Is the clock enabled? (read-only)
//| enabled: bool = ...
//| """Is the clock enabled? (read-only)"""
//|
STATIC mp_obj_t samd_clock_get_enabled(mp_obj_t 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
//|
//| Clock parent. (read-only)
//| parent: typing.Union(Clock | None) = ...
//| """Clock parent. (read-only)"""
//|
STATIC mp_obj_t samd_clock_get_parent(mp_obj_t 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
//|
//| Clock frequency. (read-only)
//| frequency: int = ...
//| """Clock frequency in Herz. (read-only)"""
//|
STATIC mp_obj_t samd_clock_get_frequency(mp_obj_t 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
//|
//| Clock calibration. Not all clocks can be calibrated.
//| calibration: int = ...
//| """Clock calibration. Not all clocks can be calibrated."""
//|
STATIC mp_obj_t samd_clock_get_calibration(mp_obj_t self_in) {
samd_clock_obj_t *self = MP_OBJ_TO_PTR(self_in);

View File

@ -30,29 +30,16 @@
#include "bindings/samd/Clock.h"
//| :mod:`samd` --- SAMD implementation settings
//| =================================================
//|
//| .. module:: samd
//| :synopsis: SAMD implementation settings
//| :platform: SAMD21
//|
//| Libraries
//|
//| .. toctree::
//| :maxdepth: 3
//|
//| Clock
//|
//| """SAMD implementation settings"""
//| :mod:`samd.clock` --- samd clock names
//| """:mod:`samd.clock` --- samd clock names
//| --------------------------------------------------------
//|
//| .. module:: samd.clock
//| :synopsis: samd clock names
//| :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 = {
.base = { &mp_type_module },

View File

@ -5,18 +5,16 @@ from pathlib import Path
stub_root = Path("circuitpython-stubs")
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(
name="circuitpython-stubs",
description="PEP 561 type stubs for CircuitPython",
url="https://github.com/adafruit/circuitpython",
maintainer="CircuitPythonistas",
author_email="circuitpython@adafruit.com",
version=version,
use_scm_version=True,
license="MIT",
package_data={"circuitpython-stubs": 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)
//| class Adapter:
//| """.. currentmodule:: _bleio
//|
//| :class:`Adapter` --- BLE adapter
//| ----------------------------------------------------
//| """BLE adapter
//|
//| 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).

View File

@ -35,12 +35,7 @@
#include "shared-module/_bleio/Address.h"
//| class Address:
//| """.. currentmodule:: _bleio
//|
//| :class:`Address` -- BLE address
//| =========================================================
//|
//| Encapsulates the address of a BLE device."""
//| """Encapsulates the address of a BLE device."""
//|
//| 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
//| <Address c8:1d:f5:ed:a8:35>
//| >>> _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) {
bleio_address_obj_t *self = MP_OBJ_TO_PTR(self_in);

View File

@ -30,12 +30,8 @@
#include "shared-bindings/_bleio/UUID.h"
//| 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:`~Characteristic` and :py:class:`~Descriptor`,
//| but is not defined as a Python superclass of those classes."""

View File

@ -34,13 +34,8 @@
#include "shared-bindings/_bleio/UUID.h"
//| class Characteristic:
//| """.. currentmodule:: _bleio
//|
//| :class:`Characteristic` -- BLE service characteristic
//| =========================================================
//|
//| Stores information about a BLE service characteristic and allows reading
//| and writing of the characteristic's value."""
//| """Stores information about a BLE service characteristic and allows reading
//| and writing of the characteristic's value."""
//|
//| def __init__(self, ):
//| """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:
//| """.. currentmodule:: _bleio
//|
//| :class:`CharacteristicBuffer` -- BLE Service incoming values buffer.
//| =====================================================================
//|
//| Accumulates a Characteristic's incoming values in a FIFO buffer."""
//| """Accumulates a Characteristic's incoming values in a FIFO buffer."""
//|
//| def __init__(self, characteristic: Characteristic, *, timeout: int = 1, buffer_size: int = 64):
//|

View File

@ -43,12 +43,7 @@
#include "shared-bindings/_bleio/Service.h"
//| class Connection:
//| """.. currentmodule:: _bleio
//|
//| :class:`Connection` -- A BLE connection
//| =========================================================
//|
//| A BLE connection to another device. Used to discover and interact with services on the other
//| """A BLE connection to another device. Used to discover and interact with services on the other
//| device.
//|
//| 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);
//| .. attribute:: max_packet_length
//|
//| The maximum number of data bytes that can be sent in a single transmission,
//| attribute: Any = ...
//| """The maximum number of data bytes that can be sent in a single transmission,
//| not including overhead bytes.
//|
//| This is the maximum number of bytes that can be sent in a notification,
//| which must be sent in a single packet.
//| 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) {
bleio_connection_obj_t *self = MP_OBJ_TO_PTR(self_in);

View File

@ -34,12 +34,8 @@
#include "shared-bindings/_bleio/UUID.h"
//| 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
//| information about the characteristic."""
//|

View File

@ -36,12 +36,7 @@
#include "shared-bindings/util.h"
//| class PacketBuffer:
//| """.. currentmodule:: _bleio
//|
//| :class:`PacketBuffer` -- Packet-oriented characteristic usage.
//| =====================================================================
//|
//| Accumulates a Characteristic's incoming packets in a FIFO buffer and facilitates packet aware
//| """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
//| 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.
@ -60,7 +55,7 @@
//| 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.
//| :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) {
@ -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
//| 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.
//| :rtype: int
//| :return: number of bytes written. May include header bytes when packet is empty.
//| :rtype: int"""
//| ...
//|
// TODO: Add a kwarg `merge=False` to dictate whether subsequent writes are merged into a pending
// 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);
//| def deinit(self, ) -> Any:
//| def deinit(self) -> Any:
//| """Disable permanently."""
//| ...
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);
//| packet_size: Any = ...
//| packet_size: int = ...
//| """`packet_size` is the same as `incoming_packet_length`.
//| The name `packet_size` is deprecated and
//| 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 },
};
//| .. attribute:: outgoing_packet_length
//|
//| Maximum length in bytes of a packet we are writing.
//| outgoing_packet_length: int = ...
//| """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) {
bleio_packet_buffer_obj_t *self = MP_OBJ_TO_PTR(self_in);

View File

@ -36,12 +36,7 @@
#include "shared-module/_bleio/ScanEntry.h"
//| class ScanEntry:
//| """.. currentmodule:: _bleio
//|
//| :class:`ScanEntry` -- BLE scan data
//| =========================================================
//|
//| Encapsulates information about a device that was received during scanning. It can be
//| """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`:
//| 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_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
mp_buffer_info_t bufinfo;
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));

View File

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

View File

@ -33,12 +33,7 @@
#include "shared-bindings/_bleio/UUID.h"
//| class Service:
//| """.. currentmodule:: _bleio
//|
//| :class:`Service` -- BLE GATT Service
//| =========================================================
//|
//| Stores information about a BLE service and its characteristics."""
//| """Stores information about a BLE service and its characteristics."""
//|
//| def __init__(self, uuid: UUID, *, secondary: bool = False):
//| """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"
//| class UUID:
//| """.. currentmodule:: _bleio
//|
//| :class:`UUID` -- BLE UUID
//| =========================================================
//|
//| A 16-bit or 128-bit UUID. Can be used for services, characteristics, descriptors and more."""
//| """A 16-bit or 128-bit UUID. Can be used for services, characteristics, descriptors and more."""
//|
//| def __init__(self, value: Any):
//| """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_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
mp_buffer_info_t bufinfo;
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/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
//| 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
@ -58,24 +52,6 @@
//| provides higher-level convenience functionality, including predefined beacons, clients,
//| servers.
//|
//| Libraries
//|
//| .. toctree::
//| :maxdepth: 3
//|
//| Address
//| Adapter
//| Attribute
//| Characteristic
//| CharacteristicBuffer
//| Connection
//| Descriptor
//| PacketBuffer
//| ScanEntry
//| ScanResults
//| Service
//| UUID
//|
//| .. attribute:: adapter
//|
//| BLE Adapter used to manage device discovery and connections.

View File

@ -34,28 +34,10 @@
#include "shared-module/_eve/__init__.h"
#include "shared-bindings/_eve/__init__.h"
//| """:mod:`_eve` --- low-level BridgeTek EVE bindings
//| ================================================
//|
//| .. module:: _eve
//| :synopsis: low-level BridgeTek EVE bindings
//| :platform: SAMD21/SAMD51
//| """Low-level BridgeTek EVE bindings
//|
//| 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."""
//|

View File

@ -35,12 +35,7 @@
#include "supervisor/shared/translate.h"
//| class PewPew:
//| """.. currentmodule:: _pew
//|
//| :class:`PewPew` -- LED matrix and button driver
//| ===============================================
//|
//| This is an internal module to be used by the ``pew.py`` library from
//| """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
//| 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);
//| """:mod:`_pew` --- LED matrix driver
//| ==================================
//|
//| .. module:: _pew
//| :synopsis: LED matrix driver
//| :platform: SAMD21
//|
//| .. toctree::
//| :maxdepth: 3
//|
//| PewPew"""
//| """LED matrix driver"""
//|
STATIC const mp_rom_map_elem_t pew_module_globals_table[] = {
{ 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);
//| class PixelBuf:
//| """.. currentmodule:: _pixelbuf
//|
//| :class:`PixelBuf` -- A fast RGB[W] pixel buffer for LED and similar devices
//| ===========================================================================
//|
//| :class:`~_pixelbuf.PixelBuf` implements an RGB[W] bytearray abstraction."""
//| """A fast RGB[W] pixel buffer for LED and similar devices."""
//|
//| 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.

View File

@ -33,35 +33,22 @@
#include "shared-bindings/_pixelbuf/PixelBuf.h"
//| """:mod:`_pixelbuf` --- Fast RGB(W) pixel buffer and helpers
//| ===========================================================
//| .. module:: _pixelbuf
//| :synopsis: A fast RGB(W) pixel buffer library for like NeoPixel and DotStar.
//| """A fast RGB(W) pixel buffer library for like NeoPixel and DotStar.
//|
//| The `_pixelbuf` module provides the :py:class:`PixelBuf` class to accelerate
//| RGB(W) strip/matrix manipulation, such as DotStar and Neopixel.
//|
//| Byteorders are configured with strings, such as "RGB" or "RGBD".
//| TODO: Pull in docs from pypixelbuf.
//| Byteorders are configured with strings, such as "RGB" or "RGBD"."""
// TODO: Pull in docs from pypixelbuf.
//| Libraries
//|
//| .. toctree::
//| :maxdepth: 3
//|
//| PixelBuf"""
//| def colorwheel(n: Any) -> Any: ...
//|
//| def wheel(n: Any) -> Any:
//| def colorwheel(n: int) -> Any:
//| """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)."""
//| ...
//|
//| .. function:: wheel(n)
//| Use of wheel() is deprecated. Please use colorwheel().
//| def wheel(n: Any) -> Any:
//| """Use of wheel() is deprecated. Please use colorwheel()."""
//|
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)));

View File

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

View File

@ -31,13 +31,10 @@
#include "supervisor/shared/translate.h"
//| class Text:
//| """.. currentmodule:: _stage
//|
//| :class:`Text` -- Keep information about a single text of text
//| =============================================================="""
//| """Keep information about a single grid of text"""
//|
//| 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
//| with the ``render()`` function.
//|

View File

@ -34,22 +34,10 @@
#include "Layer.h"
#include "Text.h"
//| """:mod:`_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
//| """C-level helpers for animation of sprites on a stage
//|
//| The `_stage` module contains native code to speed-up the ```stage`` Library
//| <https://github.com/python-ugame/circuitpython-stage>`_.
//| Libraries
//|
//| .. toctree::
//| :maxdepth: 3
//|
//| Layer
//| Text"""
//| <https://github.com/python-ugame/circuitpython-stage>`_."""
//|
//| 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.

View File

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

View File

@ -9,35 +9,31 @@
// 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
//| :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
//| import aesio
//| from binascii import hexlify
//|
//| Additional arguments are supported for legacy reasons.
//|
//| Encrypting a string::
//|
//| import aesio
//| from binascii import hexlify
//|
//| 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)
//| 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,
@ -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
//| buffers must be a multiple of 16 bytes, and must be equal length. For
//| CTX mode, there are no restrictions.
//| 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
//| CTX mode, there are no restrictions."""
//| ...
//|
STATIC mp_obj_t aesio_aes_encrypt_into(mp_obj_t aesio_obj, mp_obj_t src,
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,
aesio_aes_encrypt_into);
//| .. method:: decrypt_into(src, dest)
//| def decrypt_into(src, dest) -> None:
//|
//| Decrypt the buffer from ``src`` into ``dest``.
//| 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
//| CTX mode, there are no restrictions.
//| """Decrypt the buffer from ``src`` into ``dest``.
//| 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
//| CTX mode, there are no restrictions."""
//| ...
//|
STATIC mp_obj_t aesio_aes_decrypt_into(mp_obj_t aesio_obj, mp_obj_t src,
mp_obj_t dest) {

View File

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

View File

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

View File

@ -34,25 +34,12 @@
#include "shared-bindings/analogio/AnalogIn.h"
#include "shared-bindings/analogio/AnalogOut.h"
//| """:mod:`analogio` --- Analog hardware support
//| =================================================
//|
//| .. module:: analogio
//| :synopsis: Analog hardware support
//| :platform: SAMD21, ESP8266
//| """Analog hardware support
//|
//| The `analogio` module contains classes to provide access to analog IO
//| typically implemented with digital-to-analog (DAC) and analog-to-digital
//| (ADC) converters.
//|
//| Libraries
//|
//| .. toctree::
//| :maxdepth: 3
//|
//| AnalogIn
//| AnalogOut
//|
//| 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
//| call :py:meth:`!deinit` or use a context manager. See

View File

@ -36,12 +36,7 @@
#include "supervisor/shared/translate.h"
//| class I2SOut:
//| """.. currentmodule:: audiobusio
//|
//| :class:`I2SOut` -- Output an I2S audio signal
//| ========================================================
//|
//| I2S is used to output an audio signal on an I2S bus."""
//| """Output an I2S audio signal"""
//|
//| 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.

View File

@ -37,12 +37,7 @@
#include "supervisor/shared/translate.h"
//| class PDMIn:
//| """.. currentmodule:: audiobusio
//|
//| :class:`PDMIn` -- Record an input PDM audio stream
//| ========================================================
//|
//| PDMIn can be used to record an input audio signal on a given set of pins."""
//| """Record an input PDM audio stream"""
//|
//| 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

View File

@ -34,26 +34,13 @@
#include "shared-bindings/audiobusio/I2SOut.h"
#include "shared-bindings/audiobusio/PDMIn.h"
//| """:mod:`audiobusio` --- Support for audio input and output over digital bus
//| =========================================================================
//|
//| .. module:: audiobusio
//| :synopsis: Support for audio input and output over digital bus
//| :platform: SAMD21
//| """Support for audio input and output over digital buses
//|
//| The `audiobusio` module contains classes to provide access to audio IO
//| over digital buses. These protocols are used to communicate audio to other
//| chips in the same circuit. It doesn't include audio interconnect protocols
//| such as S/PDIF.
//|
//| Libraries
//|
//| .. toctree::
//| :maxdepth: 3
//|
//| I2SOut
//| PDMIn
//|
//| 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
//| context manager."""

View File

@ -35,19 +35,8 @@
#include "shared-bindings/audiocore/RawSample.h"
#include "supervisor/shared/translate.h"
//| class RawSample:
//| """.. currentmodule:: audiocore
//|
//| :class:`RawSample` -- A raw audio sample buffer
//| ========================================================
//|
//| An in-memory sound sample"""
//| """A raw audio sample buffer in memory"""
//|
//| 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

View File

@ -34,10 +34,7 @@
#include "supervisor/shared/translate.h"
//| class WaveFile:
//| """.. currentmodule:: audiocore
//|
//| :class:`WaveFile` -- Load a wave file for audio playback
//| ========================================================
//| """Load a wave file for audio playback
//|
//| 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

View File

@ -35,22 +35,7 @@
#include "shared-bindings/audiocore/WaveFile.h"
//#include "shared-bindings/audiomixer/Mixer.h"
//| """:mod:`audiocore` --- Support for audio samples and mixer
//| ========================================================
//|
//| .. 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"""
//| """Support for audio samples"""
//|
STATIC const mp_rom_map_elem_t audiocore_module_globals_table[] = {

View File

@ -37,12 +37,7 @@
#include "supervisor/shared/translate.h"
//| class AudioOut:
//| """.. currentmodule:: audioio
//|
//| :class:`AudioOut` -- Output an analog audio signal
//| ========================================================
//|
//| AudioOut can be used to output an analog audio signal on a given pin."""
//| """Output an analog audio signal"""
//|
//| 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

View File

@ -42,22 +42,10 @@
#include "shared-bindings/audiomixer/Mixer.h"
#endif
//| """:mod:`audioio` --- Support for audio input and output
//| ======================================================
//|
//| .. module:: audioio
//| :synopsis: Support for audio input and output
//| :platform: SAMD21
//| """Support for audio output
//|
//| 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
//| are no longer needed if the program continues after use. To do so, either
//| call :py:meth:`!deinit` or use a context manager. See

View File

@ -39,12 +39,7 @@
#include "supervisor/shared/translate.h"
//| class Mixer:
//| """.. currentmodule:: audiomixer
//|
//| :class:`Mixer` -- Mixes one or more audio samples together
//| ===========================================================
//|
//| Mixer mixes multiple samples into one sample."""
//| """Mixes one or more audio samples together 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):
//| """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"
//| class MixerVoice:
//| """.. currentmodule:: audiomixer
//|
//| :class:`MixerVoice` -- Voice objects used with Mixer
//| =====================================================
//| """Voice objects used with 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/audiomixer/Mixer.h"
//| """:mod:`audiomixer` --- Support for audio mixer
//| ========================================================
//|
//| .. module:: audiomixer
//| :synopsis: Support for audio mixer
//|
//| The `audiomixer` module contains core classes for mixing audio sources
//|
//| Libraries
//|
//| .. toctree::
//| :maxdepth: 3
//|
//| Mixer
//| MixerVoice"""
//| """Support for audio mixing"""
//|
STATIC const mp_rom_map_elem_t audiomixer_module_globals_table[] = {

View File

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

View File

@ -31,20 +31,7 @@
#include "shared-bindings/audiomp3/MP3Decoder.h"
//| """:mod:`audiomp3` --- 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"""
//| """Support for MP3-compressed audio files"""
//|
STATIC const mp_rom_map_elem_t audiomp3_module_globals_table[] = {

View File

@ -37,12 +37,7 @@
#include "supervisor/shared/translate.h"
//| class PWMAudioOut:
//| """.. currentmodule:: audiopwmio
//|
//| :class:`PWMAudioOut` -- Output an analog audio signal
//| ========================================================
//|
//| AudioOut can be used to output an analog audio signal on a given pin."""
//| """Output an analog audio signal by varying the PWM duty cycle."""
//|
//| 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

View File

@ -33,22 +33,10 @@
#include "shared-bindings/audiopwmio/__init__.h"
#include "shared-bindings/audiopwmio/PWMAudioOut.h"
//| """:mod:`audiopwmio` --- Support for audio input and output
//| ========================================================
//|
//| .. module:: audiopwmio
//| :synopsis: Support for audio output via digital PWM
//| :platform: NRF52
//| """Audio output via digital PWM
//|
//| 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
//| are no longer needed if the program continues after use. To do so, either
//| call :py:meth:`!deinit` or use a context manager. See

View File

@ -38,10 +38,7 @@
#include "supervisor/shared/translate.h"
//| class I2C:
//| """.. currentmodule:: bitbangio
//|
//| :class:`I2C` --- Two wire serial protocol
//| ------------------------------------------"""
//| """Two wire serial protocol"""
//|
//| 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

View File

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

View File

@ -40,10 +40,7 @@
#include "supervisor/shared/translate.h"
//| class SPI:
//| """.. currentmodule:: bitbangio
//|
//| :class:`SPI` -- a 3-4 wire serial protocol
//| -----------------------------------------------
//| """A 3-4 wire serial protocol
//|
//| 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

View File

@ -40,12 +40,7 @@
#include "py/runtime.h"
//| """:mod:`bitbangio` --- Digital protocols implemented by the CPU
//| =============================================================
//|
//| .. module:: bitbangio
//| :synopsis: Digital protocols implemented by the CPU
//| :platform: SAMD21, ESP8266
//| """Digital protocols implemented by the CPU
//|
//| The `bitbangio` module contains classes to provide digital bus protocol
//| 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
//| 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
//| are no longer needed if the program continues after use. To do so, either
//| call :py:meth:`!deinit` or use a context manager. See

View File

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

View File

@ -37,10 +37,7 @@
#include "supervisor/shared/translate.h"
//| class I2C:
//| """.. currentmodule:: busio
//|
//| :class:`I2C` --- Two wire serial protocol
//| ------------------------------------------"""
//| """Two wire serial protocol"""
//|
//| 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"
//| class OneWire:
//| """.. currentmodule:: busio
//|
//| :class:`OneWire` -- Lowest-level of the Maxim OneWire protocol
//| ================================================================="""
//| """Lowest-level of the Maxim OneWire protocol"""
//|
//| def __init__(self, pin: microcontroller.Pin):
//| """(formerly Dallas Semi) OneWire protocol.

View File

@ -42,10 +42,7 @@
//| class SPI:
//| """.. currentmodule:: busio
//|
//| `SPI` -- a 3-4 wire serial protocol
//| -----------------------------------------------
//| """A 3-4 wire serial protocol
//|
//| 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
@ -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:
//| """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.
//| Check the `frequency` attribute for the actual clock rate.
//| :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__)
//| class UART:
//| """.. currentmodule:: busio
//|
//| :class:`UART` -- a bidirectional serial protocol
//| ================================================="""
//| """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):
//| """A common bidirectional serial protocol that uses an an agreed upon speed
//| rather than a shared clock line.

View File

@ -38,12 +38,7 @@
#include "py/runtime.h"
//| """:mod:`busio` --- Hardware accelerated behavior
//| =================================================
//|
//| .. module:: busio
//| :synopsis: Hardware accelerated behavior
//| :platform: SAMD21
//| """Hardware accelerated external bus access
//|
//| The `busio` module contains classes to support a variety of serial
//| protocols.
@ -54,16 +49,6 @@
//| then a RuntimeError will be raised. Use the `bitbangio` module to explicitly
//| 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
//| are no longer needed if the program continues after use. To do so, either
//| call :py:meth:`!deinit` or use a context manager. See

View File

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

View File

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

View File

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

View File

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

View File

@ -38,25 +38,10 @@
#include "py/runtime.h"
//| """:mod:`digitalio` --- Basic digital pin support
//| =================================================
//|
//| .. module:: digitalio
//| :synopsis: Basic digital pin support
//| :platform: SAMD21, ESP8266
//| """Basic digital pin support
//|
//| 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
//| are no longer needed if the program continues after use. To do so, either
//| call :py:meth:`!deinit` or use a context manager. See

View File

@ -37,12 +37,7 @@
#include "supervisor/shared/translate.h"
//| class Bitmap:
//| """.. currentmodule:: displayio
//|
//| :class:`Bitmap` -- Stores values in a 2D array
//| ==========================================================================
//|
//| Stores values of a certain size in a 2D array"""
//| """Stores values of a certain size in a 2D array"""
//|
//| 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

View File

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

View File

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

View File

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

View File

@ -39,12 +39,7 @@
#include "supervisor/shared/translate.h"
//| class FourWire:
//| """.. currentmodule:: displayio
//|
//| :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.
//| """Manage updating a display over SPI four wire protocol in the background while Python code runs.
//| 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):

View File

@ -36,12 +36,7 @@
#include "supervisor/shared/translate.h"
//| class Group:
//| """.. currentmodule:: displayio
//|
//| :class:`Group` -- Group together sprites and subgroups
//| ==========================================================================
//|
//| Manage a group of sprites and groups and how they are inter-related."""
//| """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):
//| """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"
//| class I2CDisplay:
//| """.. currentmodule:: displayio
//|
//| :class:`I2CDisplay` -- Manage updating a display over I2C
//| ==========================================================================
//|
//| Manage updating a display over I2C in the background while Python code runs.
//| """Manage updating a display over I2C in the background while Python code runs.
//| It doesn't handle display initialization."""
//|
//| 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"
//| class OnDiskBitmap:
//| """.. currentmodule:: displayio
//|
//| :class:`OnDiskBitmap` -- Loads pixels straight from disk
//| ==========================================================================
//|
//| Loads values straight from disk. This minimizes memory use but can lead to
//| """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
//| the image is visible.
//|

View File

@ -43,12 +43,7 @@
//| class Palette:
//| """.. currentmodule:: displayio
//|
//| :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
//| """Map a pixel palette_index to a full color. Colors are transformed to the display's format internally to
//| save memory."""
//|
//| def __init__(self, color_count: int):

View File

@ -38,12 +38,7 @@
#include "supervisor/shared/translate.h"
//| class ParallelBus:
//| """.. currentmodule:: displayio
//|
//| :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
//| """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
//| display initialization."""
//|

View File

@ -35,12 +35,7 @@
#include "supervisor/shared/translate.h"
//| class Shape:
//| """.. currentmodule:: displayio
//|
//| :class:`Shape` -- Represents a shape by defining its bounds on each row
//| ==========================================================================
//|
//| Represents any shape made by defining boundaries that may be mirrored."""
//| """Represents a shape made by defining boundaries that may be mirrored."""
//|
//| 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

View File

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

View File

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

View File

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

View File

@ -29,22 +29,27 @@
#include <stdint.h>
//| class Glyph:
//| """.. currentmodule:: fontio
//| """Storage of glyph info"""
//|
//| :class:`Glyph` -- Storage of glyph info
//| =========================================================================="""
//|
//| def __init__(self, bitmap: displayio.Bitmap, tile_index: int, width: int, height: int, dx: int, dy: int, shift_x: int, shift_y: int):
//| def __init__(self,
//| bitmap: displayio.Bitmap,
//| tile_index: 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.
//|
//| :param displayio.Bitmap bitmap: the bitmap including the glyph
//| :param int tile_index: the tile index within the bitmap
//| :param int width: the width of the glyph's bitmap
//| :param int height: the height of the glyph's bitmap
//| :param int dx: x adjustment to the bitmap's position
//| :param int dy: y adjustment to the bitmap's position
//| :param int shift_x: the x difference to the next glyph
//| :param int shift_y: the y difference to the next glyph"""
//| :param bitmap: the bitmap including the glyph
//| :param tile_index: the tile index within the bitmap
//| :param width: the width of the glyph's bitmap
//| :param height: the height of the glyph's bitmap
//| :param dx: x adjustment to the bitmap's position
//| :param dy: y adjustment to the bitmap's position
//| :param shift_x: the x difference to the next glyph
//| :param shift_y: the y difference to the next glyph"""
//| ...
//|
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/Glyph.h"
//| """:mod:`fontio` --- 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"""
//| """Core font related data structures"""
//|
STATIC const mp_rom_map_elem_t fontio_module_globals_table[] = {

View File

@ -41,10 +41,7 @@
#include "supervisor/shared/translate.h"
//| class FramebufferDisplay:
//| """.. currentmodule:: framebufferio
//|
//| :class:`FramebufferDisplay` -- Manage updating a display with framebuffer in RAM
//| ================================================================================
//| """Manage updating a display with framebuffer in RAM
//|
//| This initializes a display and connects it into CircuitPython. Unlike other
//| 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/FramebufferDisplay.h"
//| """:mod:`framebufferio` --- Native framebuffer display driving
//| =========================================================================
//|
//| .. module:: framebufferio
//| :synopsis: Native helpers for driving displays
//| :platform: SAMD51, nRF52
//| """Native framebuffer display driving
//|
//| The `framebufferio` module contains classes to manage display output
//| including synchronizing with refresh rates and partial updating.
//| It is used in conjunction with classes from `displayio` to actually
//| place items on the display; and classes like `RGBMatrix` to actually
//| drive the display.
//|
//| Libraries
//|
//| .. toctree::
//| :maxdepth: 3
//|
//| FramebufferDisplay"""
//| drive the display."""
//|
#if CIRCUITPY_FRAMEBUFFERIO

View File

@ -36,10 +36,7 @@
#include "supervisor/shared/translate.h"
//| class FrequencyIn:
//| """.. currentmodule:: frequencyio
//|
//| :class:`FrequencyIn` -- Read a frequency signal
//| ========================================================
//| """Read a frequency 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

View File

@ -33,23 +33,8 @@
#include "shared-bindings/frequencyio/__init__.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
//| :ref:`module-support-matrix` for more info.
//|

View File

@ -35,10 +35,7 @@
#include "supervisor/shared/translate.h"
//| class GamePad:
//| """.. currentmodule:: gamepad
//|
//| :class:`GamePad` -- Scan buttons for presses
//| ============================================
//| """Scan buttons for presses
//|
//| Usage::
//|
@ -90,7 +87,7 @@
//| on delays.
//|
//| 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."""
//| ...
//|

View File

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

View File

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

View File

@ -30,17 +30,7 @@
#include "shared-bindings/digitalio/DigitalInOut.h"
#include "shared-bindings/util.h"
//| """:mod:`gamepadshift` --- 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"""
//| """Tracks button presses read through a shift register"""
//|
STATIC const mp_rom_map_elem_t gamepadshift_module_globals_table[] = {
{ 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:
//| """.. currentmodule:: i2cslave
//|
//| :class:`I2CSlave` --- Two wire serial protocol slave
//| ----------------------------------------------------"""
//| """Two wire serial protocol slave"""
//|
//| def __init__(self, scl: microcontroller.Pin, sda: microcontroller.Pin, addresses: tuple, smbus: bool = False):
//| """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` --- I2C Slave Request
//| ----------------------------------------------"""
//|
//| def __init__(self, slave: i2cslave.I2CSlave, address: int, is_read: bool, is_restart: bool):
//| """I2C transfer request from a master.
//| This cannot be instantiated directly, but is returned by :py:meth:`I2CSlave.request`.
//|
//| :param ~i2cslave.I2CSlave slave: The I2C Slave receiving this request
//| :param int address: I2C address
//| :param bool is_read: I2C Master read request
//| :param bool is_restart: Repeated Start Condition"""
//| :param slave: The I2C Slave receiving this request
//| :param address: I2C address
//| :param is_read: I2C Master read request
//| :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) {
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__);
//| address: Any = ...
//| address: int = ...
//| """The I2C address of the request."""
//|
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);
//| is_read: Any = ...
//| is_read: bool = ...
//| """The I2C master is reading from the device."""
//|
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);
//| is_restart: Any = ...
//| is_restart: bool = ...
//| """Is Repeated Start Condition."""
//|
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);
//| def read(self, n: int = -1, ack: bool = True) -> Any:
//| def read(self, n: int = -1, ack: bool = True) -> bytearray:
//| """Read data.
//| 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 bool ack: Whether or not to send an ACK after the n'th byte
//| :return: Bytes read
//| :rtype: bytearray"""
//| :param n: Number of bytes to read (negative means all)
//| :param ack: Whether or not to send an ACK after the n'th byte
//| :return: Bytes read"""
//| ...
//|
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);
//| def write(self, buffer: bytearray) -> Any:
//| def write(self, buffer: bytearray) -> int:
//| """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"""
//| ...
//|
@ -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.
//| 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) {

View File

@ -35,22 +35,10 @@
#include "py/runtime.h"
//| """:mod:`i2cslave` --- Two wire serial protocol slave
//| ==================================================
//|
//| .. module:: i2cslave
//| :synopsis: Two wire serial protocol slave
//| :platform: SAMD21, SAMD51
//| """Two wire serial protocol slave
//|
//| The `i2cslave` module contains classes to support a I2C slave.
//|
//| Classes
//|
//| .. toctree::
//| :maxdepth: 3
//|
//| I2CSlave
//|
//| Example emulating 2 devices::
//|
//| 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
a list of modules supported on each board.
.. toctree::
:hidden:
support_matrix
Modules
---------
.. toctree::
:glob:
:maxdepth: 3
:maxdepth: 2
support_matrix
*/__init__
../autoapi/*/index
help

View File

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

View File

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

View File

@ -35,12 +35,7 @@
#include "py/runtime.h"
//| class Processor:
//| """.. currentmodule:: microcontroller
//|
//| :class:`Processor` --- Microcontroller CPU information and control
//| ------------------------------------------------------------------
//|
//| Get information about the microcontroller CPU and control it.
//| """Microcontroller CPU information and control
//|
//| Usage::
//|
@ -55,8 +50,8 @@
//| ...
//|
//| frequency: Any = ...
//| """The CPU operating frequency as an `int`, in Hertz. (read-only)"""
//| frequency: int = ...
//| """The CPU operating frequency in Hertz. (read-only)"""
//|
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());

View File

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

View File

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

View File

@ -30,12 +30,7 @@
#include "py/runtime.h"
#include "supervisor/shared/translate.h"
//| """:mod:`multiterminal` --- Manage additional terminal sources
//| ===========================================================
//|
//| .. module:: multiterminal
//| :synopsis: Manage additional terminal sources
//| :platform: ESP8266
//| """Manage additional terminal sources
//|
//| The `multiterminal` module allows you to configure an additional serial
//| 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