Merge pull request #3193 from ciscorn/type-annotations

More type hints
This commit is contained in:
Scott Shawcroft 2020-07-27 14:26:54 -07:00 committed by GitHub
commit 7be9837f73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
101 changed files with 532 additions and 478 deletions

View File

@ -37,7 +37,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 sphinx-autoapi sphinxcontrib-svg2pdfconverter polib pyyaml astroid isort
pip install requests sh click setuptools cpp-coveralls "Sphinx<4" sphinx-rtd-theme recommonmark sphinx-autoapi sphinxcontrib-svg2pdfconverter polib pyyaml astroid isort black
- name: Versions
run: |
gcc --version

View File

@ -30,7 +30,6 @@
#include "py/objproperty.h"
#include "py/runtime.h"
//| import typing
//| class Clock:
//| """Identifies a clock on the microcontroller.
//|
@ -44,7 +43,7 @@ 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);
}
//| enabled: bool = ...
//| enabled: bool
//| """Is the clock enabled? (read-only)"""
//|
STATIC mp_obj_t samd_clock_get_enabled(mp_obj_t self_in) {
@ -62,7 +61,7 @@ const mp_obj_property_t samd_clock_enabled_obj = {
},
};
//| parent: typing.Union(Clock | None) = ...
//| parent: Union[Clock, None]
//| """Clock parent. (read-only)"""
//|
STATIC mp_obj_t samd_clock_get_parent(mp_obj_t self_in) {
@ -90,7 +89,7 @@ const mp_obj_property_t samd_clock_parent_obj = {
},
};
//| frequency: int = ...
//| frequency: int
//| """Clock frequency in Herz. (read-only)"""
//|
STATIC mp_obj_t samd_clock_get_frequency(mp_obj_t self_in) {
@ -108,7 +107,7 @@ const mp_obj_property_t samd_clock_frequency_obj = {
},
};
//| calibration: int = ...
//| calibration: int
//| """Clock calibration. Not all clocks can be calibrated."""
//|
STATIC mp_obj_t samd_clock_get_calibration(mp_obj_t self_in) {

View File

@ -71,7 +71,7 @@
//| ...
//|
//| enabled: bool = ...
//| enabled: bool
//| """State of the BLE adapter."""
//|
STATIC mp_obj_t bleio_adapter_get_enabled(mp_obj_t self) {
@ -95,7 +95,7 @@ const mp_obj_property_t bleio_adapter_enabled_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| address: Address = ...
//| address: Address
//| """MAC address of the BLE adapter. (read-only)"""
//|
STATIC mp_obj_t bleio_adapter_get_address(mp_obj_t self) {
@ -111,7 +111,7 @@ const mp_obj_property_t bleio_adapter_address_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| name: str = ...
//| name: str
//| """name of the BLE adapter used once connected.
//| The name is "CIRCUITPY" + the last four hex digits of ``adapter.address``,
//| to make it easy to distinguish multiple CircuitPython boards."""
@ -135,7 +135,7 @@ const mp_obj_property_t bleio_adapter_name_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| def start_advertising(self, data: buf, *, scan_response: buf = None, connectable: bool = True, anonymous: bool = False, timeout: int = 0, interval: float = 0.1) -> None:
//| def start_advertising(self, data: ReadableBuffer, *, scan_response: Optional[ReadableBuffer] = None, connectable: bool = True, anonymous: bool = False, timeout: int = 0, interval: float = 0.1) -> None:
//| """Starts advertising until `stop_advertising` is called or if connectable, another device
//| connects to us.
//|
@ -215,7 +215,7 @@ STATIC mp_obj_t bleio_adapter_stop_advertising(mp_obj_t self_in) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_adapter_stop_advertising_obj, bleio_adapter_stop_advertising);
//| def start_scan(self, prefixes: sequence = b"", *, buffer_size: int = 512, extended: bool = False, timeout: float = None, interval: float = 0.1, window: float = 0.1, minimum_rssi: int = -80, active: bool = True) -> iterable:
//| def start_scan(self, prefixes: ReadableBuffer = b"", *, buffer_size: int = 512, extended: bool = False, timeout: Optional[float] = None, interval: float = 0.1, window: float = 0.1, minimum_rssi: int = -80, active: bool = True) -> Iterable[ScanEntry]:
//| """Starts a BLE scan and returns an iterator of results. Advertisements and scan responses are
//| filtered and returned separately.
//|
@ -301,7 +301,7 @@ STATIC mp_obj_t bleio_adapter_stop_scan(mp_obj_t self_in) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_adapter_stop_scan_obj, bleio_adapter_stop_scan);
//| advertising: bool = ...
//| advertising: bool
//| """True when the adapter is currently advertising. (read-only)"""
//|
STATIC mp_obj_t bleio_adapter_get_advertising(mp_obj_t self) {
@ -317,7 +317,7 @@ const mp_obj_property_t bleio_adapter_advertising_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| connected: bool = ...
//| connected: bool
//| """True when the adapter is connected to another device regardless of who initiated the
//| connection. (read-only)"""
//|
@ -334,7 +334,7 @@ const mp_obj_property_t bleio_adapter_connected_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| connections: tuple = ...
//| connections: tuple
//| """Tuple of active connections including those initiated through
//| :py:meth:`_bleio.Adapter.connect`. (read-only)"""
//|
@ -350,11 +350,11 @@ const mp_obj_property_t bleio_adapter_connections_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| def connect(self, address: Address, *, timeout: float/int) -> Connection:
//| def connect(self, address: Address, *, timeout: float) -> Connection:
//| """Attempts a connection to the device with the given address.
//|
//| :param Address address: The address of the peripheral to connect to
//| :param float/int timeout: Try to connect for timeout seconds."""
//| :param float timeout: Try to connect for timeout seconds."""
//| ...
//|
STATIC mp_obj_t bleio_adapter_connect(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {

View File

@ -77,7 +77,7 @@ STATIC mp_obj_t bleio_address_make_new(const mp_obj_type_t *type, size_t n_args,
return MP_OBJ_FROM_PTR(self);
}
//| address_bytes: bytes = ...
//| address_bytes: bytes
//| """The bytes that make up the device address (read-only).
//|
//| Note that the ``bytes`` object returned is in little-endian order:
@ -108,7 +108,7 @@ const mp_obj_property_t bleio_address_address_bytes_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| type: int = ...
//| type: int
//| """The address type (read-only).
//|
//| One of the integer values: `PUBLIC`, `RANDOM_STATIC`, `RANDOM_PRIVATE_RESOLVABLE`,
@ -128,7 +128,7 @@ const mp_obj_property_t bleio_address_type_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| def __eq__(self, other: Any) -> bool:
//| def __eq__(self, other: Address) -> bool:
//| """Two Address objects are equal if their addresses and address types are equal."""
//| ...
//|
@ -187,17 +187,17 @@ STATIC void bleio_address_print(const mp_print_t *print, mp_obj_t self_in, mp_pr
buf[5], buf[4], buf[3], buf[2], buf[1], buf[0]);
}
//| PUBLIC: int = ...
//| PUBLIC: int
//| """A publicly known address, with a company ID (high 24 bits)and company-assigned part (low 24 bits)."""
//|
//| RANDOM_STATIC: int = ...
//| RANDOM_STATIC: int
//| """A randomly generated address that does not change often. It may never change or may change after
//| a power cycle."""
//|
//| RANDOM_PRIVATE_RESOLVABLE: int = ...
//| RANDOM_PRIVATE_RESOLVABLE: int
//| """An address that is usable when the peer knows the other device's secret Identity Resolving Key (IRK)."""
//|
//| RANDOM_PRIVATE_NON_RESOLVABLE: int = ...
//| RANDOM_PRIVATE_NON_RESOLVABLE: int
//| """A randomly generated address that changes on every connection."""
//|
STATIC const mp_rom_map_elem_t bleio_address_locals_dict_table[] = {

View File

@ -43,25 +43,25 @@
STATIC const mp_rom_map_elem_t bleio_attribute_locals_dict_table[] = {
//| NO_ACCESS: int = ...
//| NO_ACCESS: int
//| """security mode: access not allowed"""
//|
//| OPEN: int = ...
//| OPEN: int
//| """security_mode: no security (link is not encrypted)"""
//|
//| ENCRYPT_NO_MITM: int = ...
//| ENCRYPT_NO_MITM: int
//| """security_mode: unauthenticated encryption, without man-in-the-middle protection"""
//|
//| ENCRYPT_WITH_MITM: int = ...
//| ENCRYPT_WITH_MITM: int
//| """security_mode: authenticated encryption, with man-in-the-middle protection"""
//|
//| LESC_ENCRYPT_WITH_MITM: int = ...
//| LESC_ENCRYPT_WITH_MITM: int
//| """security_mode: LESC encryption, with man-in-the-middle protection"""
//|
//| SIGNED_NO_MITM: int = ...
//| SIGNED_NO_MITM: int
//| """security_mode: unauthenticated data signing, without man-in-the-middle protection"""
//|
//| SIGNED_WITH_MITM: int = ...
//| SIGNED_WITH_MITM: int
//| """security_mode: authenticated data signing, without man-in-the-middle protection"""
//|
{ MP_ROM_QSTR(MP_QSTR_NO_ACCESS), MP_ROM_INT(SECURITY_MODE_NO_ACCESS) },

View File

@ -45,7 +45,7 @@
//| ...
//|
//| def add_to_service(self, service: Service, uuid: UUID, *, properties: int = 0, read_perm: int = Attribute.OPEN, write_perm: int = Attribute.OPEN, max_length: int = 20, fixed_length: bool = False, initial_value: buf = None) -> Characteristic:
//| def add_to_service(self, service: Service, uuid: UUID, *, properties: int = 0, read_perm: int = Attribute.OPEN, write_perm: int = Attribute.OPEN, max_length: int = 20, fixed_length: bool = False, initial_value: Optional[ReadableBuffer] = None) -> Characteristic:
//| """Create a new Characteristic object, and add it to this Service.
//|
//| :param Service service: The service that will provide this characteristic
@ -141,7 +141,7 @@ STATIC MP_DEFINE_CONST_CLASSMETHOD_OBJ(bleio_characteristic_add_to_service_obj,
//| properties: int = ...
//| properties: int
//| """An int bitmask representing which properties are set, specified as bitwise or'ing of
//| of these possible values.
//| `BROADCAST`, `INDICATE`, `NOTIFY`, `READ`, `WRITE`, `WRITE_NO_RESPONSE`."""
@ -160,7 +160,7 @@ const mp_obj_property_t bleio_characteristic_properties_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| uuid: Optional[UUID] = ...
//| uuid: Optional[UUID]
//| """The UUID of this characteristic. (read-only)
//|
//| Will be ``None`` if the 128-bit UUID for this characteristic is not known."""
@ -180,7 +180,7 @@ const mp_obj_property_t bleio_characteristic_uuid_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| value: bytearray = ...
//| value: bytearray
//| """The value of this characteristic."""
//|
STATIC mp_obj_t bleio_characteristic_get_value(mp_obj_t self_in) {
@ -211,7 +211,7 @@ const mp_obj_property_t bleio_characteristic_value_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| descriptors: Descriptor = ...
//| descriptors: Descriptor
//| """A tuple of :py:class:`Descriptor` that describe this characteristic. (read-only)"""
//|
STATIC mp_obj_t bleio_characteristic_get_descriptors(mp_obj_t self_in) {
@ -241,7 +241,7 @@ const mp_obj_property_t bleio_characteristic_descriptors_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| service: Service = ...
//| service: Service
//| """The Service this Characteristic is a part of."""
//|
STATIC mp_obj_t bleio_characteristic_get_service(mp_obj_t self_in) {
@ -258,7 +258,7 @@ const mp_obj_property_t bleio_characteristic_service_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| def set_cccd(self, *, notify: bool = False, indicate: float = False) -> None:
//| def set_cccd(self, *, notify: bool = False, indicate: bool = False) -> None:
//| """Set the remote characteristic's CCCD to enable or disable notification and indication.
//|
//| :param bool notify: True if Characteristic should receive notifications of remote writes
@ -291,22 +291,22 @@ STATIC const mp_rom_map_elem_t bleio_characteristic_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_set_cccd), MP_ROM_PTR(&bleio_characteristic_set_cccd_obj) },
// Bitmask constants to represent properties
//| BROADCAST: int = ...
//| BROADCAST: int
//| """property: allowed in advertising packets"""
//|
//| INDICATE: int = ...
//| INDICATE: int
//| """property: server will indicate to the client when the value is set and wait for a response"""
//|
//| NOTIFY: int = ...
//| NOTIFY: int
//| """property: server will notify the client when the value is set"""
//|
//| READ: int = ...
//| READ: int
//| """property: clients may read this characteristic"""
//|
//| WRITE: int = ...
//| WRITE: int
//| """property: clients may write this characteristic; a response will be sent back"""
//|
//| WRITE_NO_RESPONSE: int = ...
//| WRITE_NO_RESPONSE: int
//| """property: clients may write this characteristic; no response will be sent back"""
//|
{ MP_ROM_QSTR(MP_QSTR_BROADCAST), MP_ROM_INT(CHAR_PROP_BROADCAST) },

View File

@ -100,7 +100,7 @@ STATIC void check_for_deinit(bleio_characteristic_buffer_obj_t *self) {
// These are standard stream methods. Code is in py/stream.c.
//
//| def read(self, nbytes: int = None) -> Optional[bytes]:
//| def read(self, nbytes: Optional[int] = None) -> Optional[bytes]:
//| """Read characters. If ``nbytes`` is specified then read at most that many
//| bytes. Otherwise, read everything that arrives until the connection
//| times out. Providing the number of bytes expected is highly recommended
@ -167,7 +167,7 @@ STATIC mp_uint_t bleio_characteristic_buffer_ioctl(mp_obj_t self_in, mp_uint_t r
return ret;
}
//| in_waiting: int = ...
//| in_waiting: int
//| """The number of bytes in the input buffer, available to be read"""
//|
STATIC mp_obj_t bleio_characteristic_buffer_obj_get_in_waiting(mp_obj_t self_in) {

View File

@ -71,11 +71,11 @@ void bleio_connection_ensure_connected(bleio_connection_obj_t *self) {
//| def __init__(self) -> None:
//| """Connections cannot be made directly. Instead, to initiate a connection use `Adapter.connect`.
//| Connections may also be made when another device initiates a connection. To use a Connection
//| created by a peer, read the `Adapter.connections` property.
//| created by a peer, read the `Adapter.connections` property."""
//| ...
//|
//| def disconnect(self) -> Any:
//| ""Disconnects from the remote peripheral. Does nothing if already disconnected."""
//| def disconnect(self) -> None:
//| """Disconnects from the remote peripheral. Does nothing if already disconnected."""
//| ...
//|
STATIC mp_obj_t bleio_connection_disconnect(mp_obj_t self_in) {
@ -109,7 +109,7 @@ STATIC mp_obj_t bleio_connection_pair(mp_uint_t n_args, const mp_obj_t *pos_args
}
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_connection_pair_obj, 1, bleio_connection_pair);
//| def discover_remote_services(self, service_uuids_whitelist: iterable = None) -> Service:
//| def discover_remote_services(self, service_uuids_whitelist: Optional[Iterable[UUID]] = None) -> Tuple[Service, ...]:
//| """Do BLE discovery for all services or for the given service UUIDS,
//| to find their handles and characteristics, and return the discovered services.
//| `Connection.connected` must be True.
@ -152,7 +152,7 @@ STATIC mp_obj_t bleio_connection_discover_remote_services(mp_uint_t n_args, cons
}
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_connection_discover_remote_services_obj, 1, bleio_connection_discover_remote_services);
//| connected: bool = ...
//| connected: bool
//| """True if connected to the remote peer."""
//|
STATIC mp_obj_t bleio_connection_get_connected(mp_obj_t self_in) {
@ -170,7 +170,7 @@ const mp_obj_property_t bleio_connection_connected_obj = {
};
//| paired: bool = ...
//| paired: bool
//| """True if paired to the remote peer."""
//|
STATIC mp_obj_t bleio_connection_get_paired(mp_obj_t self_in) {
@ -188,7 +188,7 @@ const mp_obj_property_t bleio_connection_paired_obj = {
};
//| connection_interval: float = ...
//| connection_interval: float
//| """Time between transmissions in milliseconds. Will be multiple of 1.25ms. Lower numbers
//| increase speed and decrease latency but increase power consumption.
//|
@ -206,7 +206,7 @@ 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: int = ...
//| attribute: int
//| """The maximum number of data bytes that can be sent in a single transmission,
//| not including overhead bytes.
//|

View File

@ -43,27 +43,27 @@
//| """There is no regular constructor for a Descriptor. A new local Descriptor can be created
//| and attached to a Characteristic by calling `add_to_characteristic()`.
//| Remote Descriptor objects are created by `Connection.discover_remote_services()`
//| as part of remote Characteristics in the remote Services that are discovered.
//| as part of remote Characteristics in the remote Services that are discovered."""
//|
//| .. classmethod:: add_to_characteristic(characteristic, uuid, *, read_perm=`Attribute.OPEN`, write_perm=`Attribute.OPEN`, max_length=20, fixed_length=False, initial_value=b'')
//| @classmethod
//| def add_to_characteristic(characteristic: Characteristic, uuid: UUID, *, read_perm: int = Attribute.OPEN, write_perm: int = Attribute.OPEN, max_length = 20, fixed_length: bool = False, initial_value: ReadableBuffer = b'') -> Descriptor:
//| """Create a new Descriptor object, and add it to this Service.
//|
//| Create a new Descriptor object, and add it to this Service.
//| :param Characteristic characteristic: The characteristic that will hold this descriptor
//| :param UUID uuid: The uuid of the descriptor
//| :param int read_perm: Specifies whether the descriptor can be read by a client, and if so, which
//| security mode is required. Must be one of the integer values `Attribute.NO_ACCESS`, `Attribute.OPEN`,
//| `Attribute.ENCRYPT_NO_MITM`, `Attribute.ENCRYPT_WITH_MITM`, `Attribute.LESC_ENCRYPT_WITH_MITM`,
//| `Attribute.SIGNED_NO_MITM`, or `Attribute.SIGNED_WITH_MITM`.
//| :param int write_perm: Specifies whether the descriptor can be written by a client, and if so, which
//| security mode is required. Values allowed are the same as ``read_perm``.
//| :param int max_length: Maximum length in bytes of the descriptor value. The maximum allowed is
//| is 512, or possibly 510 if ``fixed_length`` is False. The default, 20, is the maximum
//| number of data bytes that fit in a single BLE 4.x ATT packet.
//| :param bool fixed_length: True if the descriptor value is of fixed length.
//| :param buf initial_value: The initial value for this descriptor.
//|
//| :param Characteristic characteristic: The characteristic that will hold this descriptor
//| :param UUID uuid: The uuid of the descriptor
//| :param int read_perm: Specifies whether the descriptor can be read by a client, and if so, which
//| security mode is required. Must be one of the integer values `Attribute.NO_ACCESS`, `Attribute.OPEN`,
//| `Attribute.ENCRYPT_NO_MITM`, `Attribute.ENCRYPT_WITH_MITM`, `Attribute.LESC_ENCRYPT_WITH_MITM`,
//| `Attribute.SIGNED_NO_MITM`, or `Attribute.SIGNED_WITH_MITM`.
//| :param int write_perm: Specifies whether the descriptor can be written by a client, and if so, which
//| security mode is required. Values allowed are the same as ``read_perm``.
//| :param int max_length: Maximum length in bytes of the descriptor value. The maximum allowed is
//| is 512, or possibly 510 if ``fixed_length`` is False. The default, 20, is the maximum
//| number of data bytes that fit in a single BLE 4.x ATT packet.
//| :param bool fixed_length: True if the descriptor value is of fixed length.
//| :param buf initial_value: The initial value for this descriptor.
//|
//| :return: the new Descriptor."""
//| :return: the new Descriptor."""
//| ...
//|
STATIC mp_obj_t bleio_descriptor_add_to_characteristic(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
@ -132,7 +132,7 @@ STATIC mp_obj_t bleio_descriptor_add_to_characteristic(size_t n_args, const mp_o
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_descriptor_add_to_characteristic_fun_obj, 3, bleio_descriptor_add_to_characteristic);
STATIC MP_DEFINE_CONST_CLASSMETHOD_OBJ(bleio_descriptor_add_to_characteristic_obj, MP_ROM_PTR(&bleio_descriptor_add_to_characteristic_fun_obj));
//| uuid: UUID = ...
//| uuid: UUID
//| """The descriptor uuid. (read-only)"""
//|
STATIC mp_obj_t bleio_descriptor_get_uuid(mp_obj_t self_in) {
@ -150,7 +150,7 @@ const mp_obj_property_t bleio_descriptor_uuid_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| characteristic: Characteristic = ...
//| characteristic: Characteristic
//| """The Characteristic this Descriptor is a part of."""
//|
STATIC mp_obj_t bleio_descriptor_get_characteristic(mp_obj_t self_in) {
@ -167,7 +167,7 @@ const mp_obj_property_t bleio_descriptor_characteristic_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| value: WriteableBuffer = ...
//| value: bytearray
//| """The value of this descriptor."""
//|
STATIC mp_obj_t bleio_descriptor_get_value(mp_obj_t self_in) {

View File

@ -117,7 +117,7 @@ STATIC mp_obj_t bleio_packet_buffer_readinto(mp_obj_t self_in, mp_obj_t buffer_o
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(bleio_packet_buffer_readinto_obj, bleio_packet_buffer_readinto);
//| def write(self, data: bytes, *, header: Optional[bytes] = None) -> int:
//| def write(self, data: ReadableBuffer, *, header: Optional[bytes] = None) -> int:
//| """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.
//|
@ -179,12 +179,12 @@ 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: int = ...
//| 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."""
//|
//| incoming_packet_length: int = ...
//| incoming_packet_length: int
//| """Maximum length in bytes of a packet we are reading."""
//|
STATIC mp_obj_t bleio_packet_buffer_get_incoming_packet_length(mp_obj_t self_in) {
@ -205,7 +205,7 @@ const mp_obj_property_t bleio_packet_buffer_incoming_packet_length_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| outgoing_packet_length: int = ...
//| 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) {

View File

@ -70,7 +70,7 @@ STATIC mp_obj_t bleio_scanentry_matches(mp_uint_t n_args, const mp_obj_t *pos_ar
}
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_scanentry_matches_obj, 2, bleio_scanentry_matches);
//| address: Address = ...
//| address: Address
//| """The address of the device (read-only), of type `_bleio.Address`."""
//|
STATIC mp_obj_t bleio_scanentry_get_address(mp_obj_t self_in) {
@ -86,7 +86,7 @@ const mp_obj_property_t bleio_scanentry_address_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| advertisement_bytes: bytes = ...
//| advertisement_bytes: bytes
//| """All the advertisement data present in the packet, returned as a ``bytes`` object. (read-only)"""
//|
STATIC mp_obj_t scanentry_get_advertisement_bytes(mp_obj_t self_in) {
@ -102,7 +102,7 @@ const mp_obj_property_t bleio_scanentry_advertisement_bytes_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| rssi: int = ...
//| rssi: int
//| """The signal strength of the device at the time of the scan, in integer dBm. (read-only)"""
//|
STATIC mp_obj_t scanentry_get_rssi(mp_obj_t self_in) {
@ -118,7 +118,7 @@ const mp_obj_property_t bleio_scanentry_rssi_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| connectable: bool = ...
//| connectable: bool
//| """True if the device can be connected to. (read-only)"""
//|
STATIC mp_obj_t scanentry_get_connectable(mp_obj_t self_in) {
@ -134,7 +134,7 @@ const mp_obj_property_t bleio_scanentry_connectable_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| scan_response: bool = ...
//| scan_response: bool
//| """True if the entry was a scan response. (read-only)"""
//|
STATIC mp_obj_t scanentry_get_scan_response(mp_obj_t self_in) {

View File

@ -73,7 +73,7 @@ STATIC mp_obj_t bleio_service_make_new(const mp_obj_type_t *type, size_t n_args,
return MP_OBJ_FROM_PTR(service);
}
//| characteristics: Tuple[Characteristic, ...] = ...
//| characteristics: Tuple[Characteristic, ...]
//| """A tuple of :py:class:`Characteristic` designating the characteristics that are offered by
//| this service. (read-only)"""
//|
@ -92,7 +92,7 @@ const mp_obj_property_t bleio_service_characteristics_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| remote: bool = ...
//| remote: bool
//| """True if this is a service provided by a remote device. (read-only)"""
//|
STATIC mp_obj_t bleio_service_get_remote(mp_obj_t self_in) {
@ -109,7 +109,7 @@ const mp_obj_property_t bleio_service_remote_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| secondary: bool = ...
//| secondary: bool
//| """True if this is a secondary service. (read-only)"""
//|
STATIC mp_obj_t bleio_service_get_secondary(mp_obj_t self_in) {
@ -126,7 +126,7 @@ const mp_obj_property_t bleio_service_secondary_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| uuid: Optional[UUID] = ...
//| uuid: Optional[UUID]
//| """The UUID of this service. (read-only)
//|
//| Will be ``None`` if the 128-bit UUID for this service is not known."""

View File

@ -120,7 +120,7 @@ STATIC mp_obj_t bleio_uuid_make_new(const mp_obj_type_t *type, size_t n_args, co
return MP_OBJ_FROM_PTR(self);
}
//| uuid16: int = ...
//| uuid16: int
//| """The 16-bit part of the UUID. (read-only)
//|
//| :type: int"""
@ -139,7 +139,7 @@ const mp_obj_property_t bleio_uuid_uuid16_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| uuid128: bytes = ...
//| uuid128: bytes
//| """The 128-bit value of the UUID
//| Raises AttributeError if this is a 16-bit UUID. (read-only)
//|
@ -165,7 +165,7 @@ const mp_obj_property_t bleio_uuid_uuid128_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| size: int = ...
//| size: int
//| """128 if this UUID represents a 128-bit vendor-specific UUID. 16 if this UUID represents a
//| 16-bit Bluetooth SIG assigned UUID. (read-only) 32-bit UUIDs are not currently supported.
//|
@ -248,7 +248,7 @@ STATIC mp_obj_t bleio_uuid_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
}
}
//| def __eq__(self, other: Any) -> bool:
//| def __eq__(self, other: UUID) -> bool:
//| """Two UUID objects are equal if their values match and they are both 128-bit or both 16-bit."""
//| ...
//|

View File

@ -70,7 +70,7 @@ STATIC mp_obj_t _flush(mp_obj_t self) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(flush_obj, _flush);
//| def cc(self, b: bytes) -> None:
//| def cc(self, b: ReadableBuffer) -> None:
//| """Append bytes to the command FIFO.
//|
//| :param bytes b: The bytes to add"""

View File

@ -45,8 +45,31 @@
//| used internally by it. All user-visible interactions are done through
//| that library."""
//|
//| def __init__(self, buffer: ReadableBuffer, rows: List[DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut], cols: List[DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut], buttons: DigitalInOut) -> None:
//| def __init__(
//| self,
//| buffer: ReadableBuffer,
//| rows: List[
//| digitalio.DigitalInOut,
//| digitalio.DigitalInOut,
//| digitalio.DigitalInOut,
//| digitalio.DigitalInOut,
//| digitalio.DigitalInOut,
//| digitalio.DigitalInOut,
//| digitalio.DigitalInOut,
//| digitalio.DigitalInOut,
//| ],
//| cols: List[
//| digitalio.DigitalInOut,
//| digitalio.DigitalInOut,
//| digitalio.DigitalInOut,
//| digitalio.DigitalInOut,
//| digitalio.DigitalInOut,
//| digitalio.DigitalInOut,
//| digitalio.DigitalInOut,
//| digitalio.DigitalInOut,
//| ],
//| buttons: digitalio.DigitalInOut,
//| ) -> None:
//| """Initializes matrix scanning routines.
//|
//| The ``buffer`` is a 64 byte long ``bytearray`` that stores what should

View File

@ -47,7 +47,7 @@ static void parse_byteorder(mp_obj_t byteorder_obj, pixelbuf_byteorder_details_t
//| class PixelBuf:
//| """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"") -> None:
//| def __init__(self, size: int, *, byteorder: str = "BGR", brightness: float = 0, auto_write: bool = False, header: ReadableBuffer = b"", trailer: ReadableBuffer = b"") -> None:
//| """Create a PixelBuf object of the specified size, byteorder, and bits per pixel.
//|
//| When brightness is less than 1.0, a second buffer will be used to store the color values
@ -152,7 +152,7 @@ static void parse_byteorder(mp_obj_t byteorder_obj, pixelbuf_byteorder_details_t
}
}
//| bpp: int = ...
//| bpp: int
//| """The number of bytes per pixel in the buffer (read-only)"""
//|
STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_bpp(mp_obj_t self_in) {
@ -168,7 +168,7 @@ const mp_obj_property_t pixelbuf_pixelbuf_bpp_obj = {
};
//| brightness: float = ...
//| brightness: float
//| """Float value between 0 and 1. Output brightness.
//|
//| When brightness is less than 1.0, a second buffer will be used to store the color values
@ -199,7 +199,7 @@ const mp_obj_property_t pixelbuf_pixelbuf_brightness_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| auto_write: bool = ...
//| auto_write: bool
//| """Whether to automatically write the pixels after each update."""
//|
STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_auto_write(mp_obj_t self_in) {
@ -221,7 +221,7 @@ const mp_obj_property_t pixelbuf_pixelbuf_auto_write_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| byteorder: string = ...
//| byteorder: str
//| """byteorder string for the buffer (read-only)"""
//|
STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_byteorder(mp_obj_t self_in) {
@ -257,7 +257,7 @@ STATIC mp_obj_t pixelbuf_pixelbuf_show(mp_obj_t self_in) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(pixelbuf_pixelbuf_show_obj, pixelbuf_pixelbuf_show);
//| def fill(color: Union[int, Tuple[int, int, int]]) -> None:
//| def fill(self, color: Union[int, Tuple[int, int, int]]) -> None:
//| """Fills the given pixelbuf with the given color."""
//| ...
//|
@ -269,13 +269,19 @@ STATIC mp_obj_t pixelbuf_pixelbuf_fill(mp_obj_t self_in, mp_obj_t value) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(pixelbuf_pixelbuf_fill_obj, pixelbuf_pixelbuf_fill);
//| def __getitem__(self, index: int) -> Tuple[int, int, int, Union[int, float]]:
//| @overload
//| def __getitem__(self, index: slice) -> Tuple[Tuple, ...]: ...
//| def __getitem__(self, index: int) -> Tuple:
//| """Returns the pixel value at the given index as a tuple of (Red, Green, Blue[, White]) values
//| between 0 and 255. When in PWM (DotStar) mode, the 4th tuple value is a float of the pixel
//| intensity from 0-1.0."""
//| ...
//|
//| def __setitem__(self, index: int, value: Union[int, Tuple[int, int, int, Union[int, float]]]) -> PixelBuf:
//| @overload
//| def __setitem__(self, index: slice, value: Tuple[Union[int, Tuple, List], ...]) -> None: ...
//| @overload
//| def __setitem__(self, index: slice, value: List[Union[int, Tuple, List]]) -> None: ...
//| def __setitem__(self, index: int, value: Union[int, Tuple, List]) -> None:
//| """Sets the pixel value at the given index. Value can either be a tuple or integer. Tuples are
//| The individual (Red, Green, Blue[, White]) values between 0 and 255. If given an integer, the
//| red, green and blue values are packed into the lower three bytes (0xRRGGBB).

View File

@ -41,12 +41,12 @@
//| Byteorders are configured with strings, such as "RGB" or "RGBD"."""
// TODO: Pull in docs from pypixelbuf.
//| def colorwheel(n: int) -> int:
//| def colorwheel(n: float) -> int:
//| """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)."""
//| ...
//|
//| def wheel(n: Any) -> Any:
//| def wheel(n: float) -> int:
//| """Use of wheel() is deprecated. Please use colorwheel()."""
//|

View File

@ -33,7 +33,7 @@
//| class Layer:
//| """Keep information about a single layer of graphics"""
//|
//| def __init__(self, width: int, height: int, graphic: bytearray, palette: bytearray, grid: bytearray) -> None:
//| def __init__(self, width: int, height: int, graphic: ReadableBuffer, palette: ReadableBuffer, grid: ReadableBuffer) -> None:
//| """Keep internal information about a layer of graphics (either a
//| ``Grid`` or a ``Sprite``) in a format suitable for fast rendering
//| with the ``render()`` function.

View File

@ -33,7 +33,7 @@
//| class Text:
//| """Keep information about a single grid of text"""
//|
//| def __init__(self, width: int, height: int, font: bytearray, palette: bytearray, chars: bytearray) -> None:
//| def __init__(self, width: int, height: int, font: ReadableBuffer, palette: ReadableBuffer, chars: ReadableBuffer) -> None:
//| """Keep internal information about a grid of text
//| in a format suitable for fast rendering
//| with the ``render()`` function.

View File

@ -39,7 +39,7 @@
//| The `_stage` module contains native code to speed-up the ```stage`` Library
//| <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:
//| def render(x0: int, y0: int, x1: int, y1: int, layers: list, buffer: WriteableBuffer, display: displayio.Display, scale: int, background: int) -> None:
//| """Render and send to the display a fragment of the screen.
//|
//| :param int x0: Left edge of the fragment.

View File

@ -12,7 +12,7 @@
//| class AES:
//| """Encrypt and decrypt AES streams"""
//|
//| def __init__(self, key: Optional[ReadableBuffer], mode: int=0, iv: ReadableBuffer=None, segment_size: int=8) -> None:
//| def __init__(self, key: ReadableBuffer, mode: int = 0, iv: Optional[ReadableBuffer] = None, segment_size: int = 8) -> None:
//| """Create a new AES state with the given key.
//|
//| :param bytearray key: A 16-, 24-, or 32-byte key
@ -152,7 +152,7 @@ STATIC void validate_length(aesio_aes_obj_t *self, size_t src_length,
}
}
//| def encrypt_into(src: ReadableBuffer, dest: WriteableBuffer) -> None:
//| def encrypt_into(self, src: ReadableBuffer, dest: WriteableBuffer) -> None:
//| """Encrypt the buffer from ``src`` into ``dest``.
//|
//| For ECB mode, the buffers must be 16 bytes long. For CBC mode, the
@ -183,8 +183,7 @@ 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);
//| def decrypt_into(src: ReadableBuffer, dest: WriteableBuffer) -> None:
//|
//| def decrypt_into(self, src: ReadableBuffer, dest: WriteableBuffer) -> 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

View File

@ -104,7 +104,7 @@ STATIC mp_obj_t analogio_analogin___exit__(size_t n_args, const mp_obj_t *args)
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(analogio_analogin___exit___obj, 4, 4, analogio_analogin___exit__);
//| value: int = ...
//| value: int
//| """The value on the analog pin between 0 and 65535 inclusive (16-bit). (read-only)
//|
//| Even if the underlying analog to digital converter (ADC) is lower
@ -124,7 +124,7 @@ const mp_obj_property_t analogio_analogin_value_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| reference_voltage: Optional[float] = ...
//| reference_voltage: Optional[float]
//| """The maximum voltage measurable (also known as the reference voltage) as a
//| `float` in Volts."""
//|

View File

@ -97,7 +97,7 @@ STATIC mp_obj_t analogio_analogout___exit__(size_t n_args, const mp_obj_t *args)
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(analogio_analogout___exit___obj, 4, 4, analogio_analogout___exit__);
//| value: int = ...
//| value: int
//| """The value on the analog pin between 0 and 65535 inclusive (16-bit). (write-only)
//|
//| Even if the underlying digital to analog converter (DAC) is lower

View File

@ -147,7 +147,7 @@ STATIC mp_obj_t audiobusio_i2sout_obj___exit__(size_t n_args, const mp_obj_t *ar
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiobusio_i2sout___exit___obj, 4, 4, audiobusio_i2sout_obj___exit__);
//| def play(self, sample: Union[audiocore.WaveFile, audiocore.RawSample, audiomixer.Mixer], *, loop: bool = False) -> None:
//| def play(self, sample: audiocore._AudioSample, *, loop: bool = False) -> None:
//| """Plays the sample once when loop=False and continuously when loop=True.
//| Does not block. Use `playing` to block.
//|
@ -186,7 +186,7 @@ STATIC mp_obj_t audiobusio_i2sout_obj_stop(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(audiobusio_i2sout_stop_obj, audiobusio_i2sout_obj_stop);
//| playing: bool = ...
//| playing: bool
//| """True when the audio sample is being output. (read-only)"""
//|
STATIC mp_obj_t audiobusio_i2sout_obj_get_playing(mp_obj_t self_in) {
@ -235,7 +235,7 @@ STATIC mp_obj_t audiobusio_i2sout_obj_resume(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(audiobusio_i2sout_resume_obj, audiobusio_i2sout_obj_resume);
//| paused: bool = ...
//| paused: bool
//| """True when playback is paused. (read-only)"""
//|
STATIC mp_obj_t audiobusio_i2sout_obj_get_paused(mp_obj_t self_in) {

View File

@ -210,7 +210,7 @@ STATIC mp_obj_t audiobusio_pdmin_obj_record(mp_obj_t self_obj, mp_obj_t destinat
}
MP_DEFINE_CONST_FUN_OBJ_3(audiobusio_pdmin_record_obj, audiobusio_pdmin_obj_record);
//| sample_rate: int = ...
//| sample_rate: int
//| """The actual sample_rate of the recording. This may not match the constructed
//| sample rate due to internal clock limitations."""
//|

View File

@ -38,13 +38,13 @@
//| class RawSample:
//| """A raw audio sample buffer in memory"""
//|
//| def __init__(self, buffer: array.array, *, channel_count: int = 1, sample_rate: int = 8000) -> None:
//| def __init__(self, buffer: ReadableBuffer, *, channel_count: int = 1, sample_rate: int = 8000) -> None:
//| """Create a RawSample based on the given buffer of signed values. If channel_count is more than
//| 1 then each channel's samples should alternate. In other words, for a two channel buffer, the
//| first sample will be for channel 1, the second sample will be for channel two, the third for
//| channel 1 and so on.
//|
//| :param array.array buffer: An `array.array` with samples
//| :param ReadableBuffer buffer: A buffer with samples
//| :param int channel_count: The number of channels in the buffer
//| :param int sample_rate: The desired playback sample rate
//|
@ -136,7 +136,7 @@ STATIC mp_obj_t audioio_rawsample_obj___exit__(size_t n_args, const mp_obj_t *ar
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audioio_rawsample___exit___obj, 4, 4, audioio_rawsample_obj___exit__);
//| sample_rate: Optional(int) = ...
//| sample_rate: Optional[int]
//| """32 bit value that dictates how quickly samples are played in Hertz (cycles per second).
//| When the sample is looped, this can change the pitch output without changing the underlying
//| sample. This will not change the sample rate of any active playback. Call ``play`` again to

View File

@ -125,7 +125,7 @@ STATIC mp_obj_t audioio_wavefile_obj___exit__(size_t n_args, const mp_obj_t *arg
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audioio_wavefile___exit___obj, 4, 4, audioio_wavefile_obj___exit__);
//| sample_rate: int = ...
//| sample_rate: int
//| """32 bit value that dictates how quickly samples are loaded into the DAC
//| in Hertz (cycles per second). When the sample is looped, this can change
//| the pitch output without changing the underlying sample."""
@ -152,7 +152,7 @@ const mp_obj_property_t audioio_wavefile_sample_rate_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| bits_per_sample: int = ...
//| bits_per_sample: int
//| """Bits per sample. (read only)"""
//|
STATIC mp_obj_t audioio_wavefile_obj_get_bits_per_sample(mp_obj_t self_in) {
@ -168,7 +168,7 @@ const mp_obj_property_t audioio_wavefile_bits_per_sample_obj = {
(mp_obj_t)&mp_const_none_obj,
(mp_obj_t)&mp_const_none_obj},
};
//| channel_count: int = ...
//| channel_count: int
//| """Number of audio channels. (read only)"""
//|
STATIC mp_obj_t audioio_wavefile_obj_get_channel_count(mp_obj_t self_in) {

View File

@ -38,6 +38,13 @@
//| """Support for audio samples"""
//|
//| _AudioSample = Union[audiocore.WaveFile, audiocore.RawSample, audiomixer.Mixer, audiomp3.MP3Decoder]
//| """An audio sample for playback with `audioio.AudioOut`, `audiobusio.I2SOut` or `audiopwmio.PWMAudioOut`.
//|
//| Supported sources are :py:class:`audiocore.WaveFile`, :py:class:`audiocore.RawSample`,
//| :py:class:`audiomixer.Mixer` and :py:class:`audiomp3.MP3Decoder`."""
//|
STATIC const mp_rom_map_elem_t audiocore_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_audiocore) },
{ MP_ROM_QSTR(MP_QSTR_RawSample), MP_ROM_PTR(&audioio_rawsample_type) },

View File

@ -39,7 +39,7 @@
//| class AudioOut:
//| """Output an analog audio signal"""
//|
//| def __init__(self, left_channel: microcontroller.Pin, *, right_channel: microcontroller.Pin = None, quiescent_value: int = 0x8000) -> None:
//| def __init__(self, left_channel: microcontroller.Pin, *, right_channel: Optional[microcontroller.Pin] = None, quiescent_value: int = 0x8000) -> None:
//| """Create a AudioOut object associated with the given pin(s). This allows you to
//| play audio signals out on the given pin(s).
//|
@ -146,7 +146,7 @@ STATIC mp_obj_t audioio_audioout_obj___exit__(size_t n_args, const mp_obj_t *arg
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audioio_audioout___exit___obj, 4, 4, audioio_audioout_obj___exit__);
//| def play(self, sample: Union[audiocore.WaveFile, audiocore.RawSample, audiomixer.Mixer], *, loop: bool = False) -> None:
//| def play(self, sample: audiocore._AudioSample, *, loop: bool = False) -> None:
//| """Plays the sample once when loop=False and continuously when loop=True.
//| Does not block. Use `playing` to block.
//|
@ -187,7 +187,7 @@ STATIC mp_obj_t audioio_audioout_obj_stop(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(audioio_audioout_stop_obj, audioio_audioout_obj_stop);
//| playing: bool = ...
//| playing: bool
//| """True when an audio sample is being output even if `paused`. (read-only)"""
//|
STATIC mp_obj_t audioio_audioout_obj_get_playing(mp_obj_t self_in) {
@ -236,7 +236,7 @@ STATIC mp_obj_t audioio_audioout_obj_resume(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(audioio_audioout_resume_obj, audioio_audioout_obj_resume);
//| paused: bool = ...
//| paused: bool
//| """True when playback is paused. (read-only)"""
//|
STATIC mp_obj_t audioio_audioout_obj_get_paused(mp_obj_t self_in) {

View File

@ -156,7 +156,7 @@ STATIC mp_obj_t audiomixer_mixer_obj___exit__(size_t n_args, const mp_obj_t *arg
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiomixer_mixer___exit___obj, 4, 4, audiomixer_mixer_obj___exit__);
//| playing: bool = ...
//| playing: bool
//| """True when any voice is being output. (read-only)"""
//|
STATIC mp_obj_t audiomixer_mixer_obj_get_playing(mp_obj_t self_in) {
@ -173,7 +173,7 @@ const mp_obj_property_t audiomixer_mixer_playing_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| sample_rate: int = ...
//| sample_rate: int
//| """32 bit value that dictates how quickly samples are played in Hertz (cycles per second)."""
//|
STATIC mp_obj_t audiomixer_mixer_obj_get_sample_rate(mp_obj_t self_in) {
@ -190,7 +190,7 @@ const mp_obj_property_t audiomixer_mixer_sample_rate_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| voice: Tuple[MixerVoice, ...] = ...
//| voice: Tuple[MixerVoice, ...]
//| """A tuple of the mixer's `audiomixer.MixerVoice` object(s).
//|
//| .. code-block:: python
@ -211,7 +211,7 @@ const mp_obj_property_t audiomixer_mixer_voice_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| def play(self, sample: Union[audiomixer.WaveFile, audiocore.RawSample, audiomixer.Mixer], *, voice: int = 0, loop: bool = False) -> None:
//| def play(self, sample: audiocore._AudioSample, *, voice: int = 0, loop: bool = False) -> None:
//| """Plays the sample once when loop=False and continuously when loop=True.
//| Does not block. Use `playing` to block.
//|

View File

@ -56,7 +56,7 @@ STATIC mp_obj_t audiomixer_mixervoice_make_new(const mp_obj_type_t *type, size_t
return MP_OBJ_FROM_PTR(self);
}
//| def play(self, sample: Union[audiocore.WaveFile, Mixer, audiocore.RawSample], *, loop: bool = False) -> None:
//| def play(self, sample: audiocore._AudioSample, *, loop: bool = False) -> None:
//| """Plays the sample once when ``loop=False``, and continuously when ``loop=True``.
//| Does not block. Use `playing` to block.
//|
@ -100,7 +100,7 @@ STATIC mp_obj_t audiomixer_mixervoice_obj_stop(size_t n_args, const mp_obj_t *po
}
MP_DEFINE_CONST_FUN_OBJ_KW(audiomixer_mixervoice_stop_obj, 1, audiomixer_mixervoice_obj_stop);
//| level: float = ...
//| level: float
//| """The volume level of a voice, as a floating point number between 0 and 1."""
//|
STATIC mp_obj_t audiomixer_mixervoice_obj_get_level(mp_obj_t self_in) {
@ -136,7 +136,7 @@ const mp_obj_property_t audiomixer_mixervoice_level_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| playing: bool = ...
//| playing: bool
//| """True when this voice is being output. (read-only)"""
//|

View File

@ -34,7 +34,7 @@
#include "shared-bindings/util.h"
#include "supervisor/shared/translate.h"
//| class MP3:
//| class MP3Decoder:
//| """Load a mp3 file for audio playback"""
//|
//| def __init__(self, file: typing.BinaryIO, buffer: WriteableBuffer) -> None:
@ -124,7 +124,7 @@ STATIC mp_obj_t audiomp3_mp3file_obj___exit__(size_t n_args, const mp_obj_t *arg
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiomp3_mp3file___exit___obj, 4, 4, audiomp3_mp3file_obj___exit__);
//| file: file = ...
//| file: file
//| """File to play back."""
//|
STATIC mp_obj_t audiomp3_mp3file_obj_get_file(mp_obj_t self_in) {
@ -154,7 +154,7 @@ const mp_obj_property_t audiomp3_mp3file_file_obj = {
//| sample_rate: int = ...
//| sample_rate: int
//| """32 bit value that dictates how quickly samples are loaded into the DAC
//| in Hertz (cycles per second). When the sample is looped, this can change
//| the pitch output without changing the underlying sample."""
@ -181,7 +181,7 @@ const mp_obj_property_t audiomp3_mp3file_sample_rate_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| bits_per_sample: int = ...
//| bits_per_sample: int
//| """Bits per sample. (read only)"""
//|
STATIC mp_obj_t audiomp3_mp3file_obj_get_bits_per_sample(mp_obj_t self_in) {
@ -198,7 +198,7 @@ const mp_obj_property_t audiomp3_mp3file_bits_per_sample_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| channel_count: int = ...
//| channel_count: int
//| """Number of audio channels. (read only)"""
//|
STATIC mp_obj_t audiomp3_mp3file_obj_get_channel_count(mp_obj_t self_in) {
@ -215,7 +215,7 @@ const mp_obj_property_t audiomp3_mp3file_channel_count_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| rms_level: float = ...
//| rms_level: float
//| """The RMS audio level of a recently played moment of audio. (read only)"""
//|
STATIC mp_obj_t audiomp3_mp3file_obj_get_rms_level(mp_obj_t self_in) {

View File

@ -39,7 +39,7 @@
//| class PWMAudioOut:
//| """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) -> None:
//| def __init__(self, left_channel: microcontroller.Pin, *, right_channel: Optional[microcontroller.Pin] = None, quiescent_value: int = 0x8000) -> None:
//| """Create a PWMAudioOut object associated with the given pin(s). This allows you to
//| play audio signals out on the given pin(s). In contrast to mod:`audioio`,
//| the pin(s) specified are digital pins, and are driven with a device-dependent PWM
@ -148,7 +148,7 @@ STATIC mp_obj_t audiopwmio_pwmaudioout_obj___exit__(size_t n_args, const mp_obj_
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiopwmio_pwmaudioout___exit___obj, 4, 4, audiopwmio_pwmaudioout_obj___exit__);
//| def play(self, sample: Union[audiocore.WaveFile, audiocore.RawSample, audiomixer.Mixer], *, loop: bool = False) -> None:
//| def play(self, sample: audiocore._AudioSample, *, loop: bool = False) -> None:
//| """Plays the sample once when loop=False and continuously when loop=True.
//| Does not block. Use `playing` to block.
//|
@ -189,7 +189,7 @@ STATIC mp_obj_t audiopwmio_pwmaudioout_obj_stop(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(audiopwmio_pwmaudioout_stop_obj, audiopwmio_pwmaudioout_obj_stop);
//| playing: bool = ...
//| playing: bool
//| """True when an audio sample is being output even if `paused`. (read-only)"""
//|
STATIC mp_obj_t audiopwmio_pwmaudioout_obj_get_playing(mp_obj_t self_in) {
@ -238,7 +238,7 @@ STATIC mp_obj_t audiopwmio_pwmaudioout_obj_resume(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(audiopwmio_pwmaudioout_resume_obj, audiopwmio_pwmaudioout_obj_resume);
//| paused: bool = ...
//| paused: bool
//| """True when playback is paused. (read-only)"""
//|
STATIC mp_obj_t audiopwmio_pwmaudioout_obj_get_paused(mp_obj_t self_in) {

View File

@ -40,7 +40,7 @@
//| class I2C:
//| """Two wire serial protocol"""
//|
//| def __init__(self, scl: microcontroller.Pin, sda: microcontroller.Pin, *, frequency: int = 400000, timeout: int) -> None:
//| def __init__(self, scl: microcontroller.Pin, sda: microcontroller.Pin, *, frequency: int = 400000, timeout: int = 255) -> None:
//| """I2C is a two-wire protocol for communicating between devices. At the
//| physical level it consists of 2 wires: SCL and SDA, the clock and data
//| lines respectively.
@ -165,7 +165,7 @@ STATIC mp_obj_t bitbangio_i2c_obj_unlock(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_i2c_unlock_obj, bitbangio_i2c_obj_unlock);
//| def readfrom_into(self, address: int, buffer: WriteableBuffer, *, start: int = 0, end: int = None) -> None:
//| def readfrom_into(self, address: int, buffer: WriteableBuffer, *, start: int = 0, end: Optional[int] = None) -> None:
//| """Read into ``buffer`` from the device selected by ``address``.
//| The number of bytes read will be the length of ``buffer``.
//| At least one byte must be read.
@ -217,7 +217,7 @@ STATIC mp_obj_t bitbangio_i2c_readfrom_into(size_t n_args, const mp_obj_t *pos_a
}
MP_DEFINE_CONST_FUN_OBJ_KW(bitbangio_i2c_readfrom_into_obj, 3, bitbangio_i2c_readfrom_into);
//| def writeto(self, address: int, buffer: ReadableBuffer, *, start: int = 0, end: int = None, stop: bool = True) -> None:
//| def writeto(self, address: int, buffer: ReadableBuffer, *, start: int = 0, end: Optional[int] = None, stop: bool = True) -> None:
//| """Write the bytes from ``buffer`` to the device selected by ``address`` and then transmits a
//| stop bit. Use `writeto_then_readfrom` when needing a write, no stop and repeated start
//| before a read.
@ -274,7 +274,7 @@ STATIC mp_obj_t bitbangio_i2c_writeto(size_t n_args, const mp_obj_t *pos_args, m
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bitbangio_i2c_writeto_obj, 1, bitbangio_i2c_writeto);
//| def writeto_then_readfrom(self, address: int, out_buffer: WriteableBuffer, in_buffer: ReadableBuffer, *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> None:
//| def writeto_then_readfrom(self, address: int, out_buffer: WriteableBuffer, in_buffer: ReadableBuffer, *, out_start: int = 0, out_end: Optional[int] = None, in_start: int = 0, in_end: Optional[int] = None) -> None:
//| """Write the bytes from ``out_buffer`` to the device selected by ``address``, generate no stop
//| bit, generate a repeated start and read into ``in_buffer``. ``out_buffer`` and
//| ``in_buffer`` can be the same buffer because they are used sequentially.

View File

@ -51,7 +51,7 @@
//| multiple secondaries can share the `!clock`, `!MOSI` and `!MISO` lines
//| and therefore the hardware.)"""
//|
//| def __init__(self, clock: microcontroller.Pin, MOSI: microcontroller.Pin = None, MISO: microcontroller.Pin = None) -> None:
//| def __init__(self, clock: microcontroller.Pin, MOSI: Optional[microcontroller.Pin] = None, MISO: Optional[microcontroller.Pin] = None) -> None:
//| """Construct an SPI object on the given pins.
//|
//| .. seealso:: Using this class directly requires careful lock management.
@ -248,7 +248,7 @@ STATIC mp_obj_t bitbangio_spi_readinto(size_t n_args, const mp_obj_t *args) {
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitbangio_spi_readinto_obj, 2, 2, bitbangio_spi_readinto);
//| def write_readinto(self, buffer_out: ReadableBuffer, buffer_in: WriteableBuffer, *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> None:
//| def write_readinto(self, buffer_out: ReadableBuffer, buffer_in: WriteableBuffer, *, out_start: int = 0, out_end: Optional[int] = None, in_start: int = 0, in_end: Optional[int] = None) -> None:
//| """Write out the data in ``buffer_out`` while simultaneously reading data into ``buffer_in``.
//| The lengths of the slices defined by ``buffer_out[out_start:out_end]`` and ``buffer_in[in_start:in_end]``
//| must be equal.

View File

@ -126,13 +126,12 @@ static void check_lock(busio_i2c_obj_t *self) {
}
//| def scan(self) -> list:
//| """Scan all I2C addresses between 0x08 and 0x77 inclusive and return a
//| list of those that respond.
//|
//| """Scan all I2C addresses between 0x08 and 0x77 inclusive and return a
//| list of those that respond.
//|
//| :return: List of device ids on the I2C bus
//| :rtype: list"""
//| ...
//| :return: List of device ids on the I2C bus
//| :rtype: list"""
//| ...
//|
STATIC mp_obj_t busio_i2c_scan(mp_obj_t self_in) {
busio_i2c_obj_t *self = MP_OBJ_TO_PTR(self_in);
@ -176,20 +175,20 @@ STATIC mp_obj_t busio_i2c_obj_unlock(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(busio_i2c_unlock_obj, busio_i2c_obj_unlock);
//| def readfrom_into(self, address: int, buffer: WriteableBuffer, *, start: int = 0, end: int = None) -> None:
//| """Read into ``buffer`` from the device selected by ``address``.
//| The number of bytes read will be the length of ``buffer``.
//| At least one byte must be read.
//| def readfrom_into(self, address: int, buffer: WriteableBuffer, *, start: int = 0, end: Optional[int] = None) -> None:
//| """Read into ``buffer`` from the device selected by ``address``.
//| The number of bytes read will be the length of ``buffer``.
//| At least one byte must be read.
//|
//| If ``start`` or ``end`` is provided, then the buffer will be sliced
//| as if ``buffer[start:end]``. This will not cause an allocation like
//| ``buf[start:end]`` will so it saves memory.
//| If ``start`` or ``end`` is provided, then the buffer will be sliced
//| as if ``buffer[start:end]``. This will not cause an allocation like
//| ``buf[start:end]`` will so it saves memory.
//|
//| :param int address: 7-bit device address
//| :param bytearray buffer: buffer to write into
//| :param int start: Index to start writing at
//| :param int end: Index to write up to but not include. Defaults to ``len(buffer)``"""
//| ...
//| :param int address: 7-bit device address
//| :param bytearray buffer: buffer to write into
//| :param int start: Index to start writing at
//| :param int end: Index to write up to but not include. Defaults to ``len(buffer)``"""
//| ...
//|
// Shared arg parsing for readfrom_into and writeto_then_readfrom.
STATIC void readfrom(busio_i2c_obj_t *self, mp_int_t address, mp_obj_t buffer, int32_t start, mp_int_t end) {
@ -228,22 +227,22 @@ STATIC mp_obj_t busio_i2c_readfrom_into(size_t n_args, const mp_obj_t *pos_args,
}
MP_DEFINE_CONST_FUN_OBJ_KW(busio_i2c_readfrom_into_obj, 3, busio_i2c_readfrom_into);
//| def writeto(self, address: int, buffer: ReadableBuffer, *, start: int = 0, end: int = None, stop: bool = True) -> None:
//| """Write the bytes from ``buffer`` to the device selected by ``address`` and
//| then transmit a stop bit.
//| def writeto(self, address: int, buffer: ReadableBuffer, *, start: int = 0, end: Optional[int] = None, stop: bool = True) -> None:
//| """Write the bytes from ``buffer`` to the device selected by ``address`` and
//| then transmit a stop bit.
//|
//| If ``start`` or ``end`` is provided, then the buffer will be sliced
//| as if ``buffer[start:end]``. This will not cause an allocation like
//| ``buffer[start:end]`` will so it saves memory.
//| If ``start`` or ``end`` is provided, then the buffer will be sliced
//| as if ``buffer[start:end]``. This will not cause an allocation like
//| ``buffer[start:end]`` will so it saves memory.
//|
//| Writing a buffer or slice of length zero is permitted, as it can be used
//| to poll for the existence of a device.
//| to poll for the existence of a device.
//|
//| :param int address: 7-bit device address
//| :param bytearray buffer: buffer containing the bytes to write
//| :param int start: Index to start writing from
//| :param int end: Index to read up to but not include. Defaults to ``len(buffer)``"""
//| ...
//| :param int address: 7-bit device address
//| :param bytearray buffer: buffer containing the bytes to write
//| :param int start: Index to start writing from
//| :param int end: Index to read up to but not include. Defaults to ``len(buffer)``"""
//| ...
//|
// Shared arg parsing for writeto and writeto_then_readfrom.
STATIC void writeto(busio_i2c_obj_t *self, mp_int_t address, mp_obj_t buffer, int32_t start, mp_int_t end, bool stop) {
@ -282,23 +281,23 @@ STATIC mp_obj_t busio_i2c_writeto(size_t n_args, const mp_obj_t *pos_args, mp_ma
}
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(busio_i2c_writeto_obj, 1, busio_i2c_writeto);
//| def writeto_then_readfrom(self, address: int, out_buffer: ReadableBuffer, in_buffer: WriteableBuffer, *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> None:
//| """Write the bytes from ``out_buffer`` to the device selected by ``address``, generate no stop
//| bit, generate a repeated start and read into ``in_buffer``. ``out_buffer`` and
//| ``in_buffer`` can be the same buffer because they are used sequentially.
//| def writeto_then_readfrom(self, address: int, out_buffer: ReadableBuffer, in_buffer: WriteableBuffer, *, out_start: int = 0, out_end: Optional[int] = None, in_start: int = 0, in_end: Optional[int] = None) -> None:
//| """Write the bytes from ``out_buffer`` to the device selected by ``address``, generate no stop
//| bit, generate a repeated start and read into ``in_buffer``. ``out_buffer`` and
//| ``in_buffer`` can be the same buffer because they are used sequentially.
//|
//| If ``start`` or ``end`` is provided, then the corresponding buffer will be sliced
//| as if ``buffer[start:end]``. This will not cause an allocation like ``buf[start:end]``
//| will so it saves memory.
//| if ``start`` or ``end`` is provided, then the corresponding buffer will be sliced
//| as if ``buffer[start:end]``. This will not cause an allocation like ``buf[start:end]``
//| will so it saves memory.
//|
//| :param int address: 7-bit device address
//| :param bytearray out_buffer: buffer containing the bytes to write
//| :param bytearray in_buffer: buffer to write into
//| :param int out_start: Index to start writing from
//| :param int out_end: Index to read up to but not include. Defaults to ``len(buffer)``
//| :param int in_start: Index to start writing at
//| :param int in_end: Index to write up to but not include. Defaults to ``len(buffer)``"""
//| ...
//| :param int address: 7-bit device address
//| :param bytearray out_buffer: buffer containing the bytes to write
//| :param bytearray in_buffer: buffer to write into
//| :param int out_start: Index to start writing from
//| :param int out_end: Index to read up to but not include. Defaults to ``len(buffer)``
//| :param int in_start: Index to start writing at
//| :param int in_end: Index to write up to but not include. Defaults to ``len(buffer)``"""
//| ...
//|
STATIC mp_obj_t busio_i2c_writeto_then_readfrom(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_address, ARG_out_buffer, ARG_in_buffer, ARG_out_start, ARG_out_end, ARG_in_start, ARG_in_end };

View File

@ -53,7 +53,7 @@
//| multiple secondaries can share the `!clock`, `!MOSI` and `!MISO` lines
//| and therefore the hardware.)"""
//|
//| def __init__(self, clock: microcontroller.Pin, MOSI: microcontroller.Pin = None, MISO: microcontroller.Pin = None) -> None:
//| def __init__(self, clock: microcontroller.Pin, MOSI: Optional[microcontroller.Pin] = None, MISO: Optional[microcontroller.Pin] = None) -> None:
//|
//| """Construct an SPI object on the given pins.
//|
@ -153,7 +153,7 @@ STATIC void check_for_deinit(busio_spi_obj_t *self) {
//| or second (1). Rising or falling depends on clock polarity.
//| :param int bits: the number of bits per word
//|
//| .. note:: On the SAMD21, it is possible to set the baudrate to 24 MHz, but that
//| .. note:: On the SAMD21, it is possible to set the baudrate to 24 MHz, but that
//| speed is not guaranteed to work. 12 MHz is the next available lower speed, and is
//| within spec for the SAMD21.
//|
@ -270,7 +270,7 @@ STATIC mp_obj_t busio_spi_write(size_t n_args, const mp_obj_t *pos_args, mp_map_
MP_DEFINE_CONST_FUN_OBJ_KW(busio_spi_write_obj, 2, busio_spi_write);
//| def readinto(self, buffer: bytearray, *, start: int = 0, end: Optional[int] = None, write_value: int = 0) -> None:
//| def readinto(self, buffer: WriteableBuffer, *, start: int = 0, end: Optional[int] = None, write_value: int = 0) -> None:
//| """Read into ``buffer`` while writing ``write_value`` for each byte read.
//| The SPI object must be locked.
//| If the number of bytes to read is 0, nothing happens.
@ -377,7 +377,7 @@ STATIC mp_obj_t busio_spi_write_readinto(size_t n_args, const mp_obj_t *pos_args
}
MP_DEFINE_CONST_FUN_OBJ_KW(busio_spi_write_readinto_obj, 2, busio_spi_write_readinto);
//| frequency: int = ...
//| frequency: int
//| """The actual SPI bus frequency. This may not match the frequency requested
//| due to internal limitations."""
//|

View File

@ -44,7 +44,7 @@
//| 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) -> None:
//| def __init__(self, tx: microcontroller.Pin, rx: microcontroller.Pin, *, baudrate: int = 9600, bits: int = 8, parity: Optional[Parity] = None, stop: int = 1, timeout: float = 1, receiver_buffer_size: int = 64) -> None:
//| """A common bidirectional serial protocol that uses an an agreed upon speed
//| rather than a shared clock line.
//|
@ -263,7 +263,7 @@ STATIC mp_uint_t busio_uart_ioctl(mp_obj_t self_in, mp_uint_t request, mp_uint_t
return ret;
}
//| baudrate: int = ...
//| baudrate: int
//| """The current baudrate."""
//|
STATIC mp_obj_t busio_uart_obj_get_baudrate(mp_obj_t self_in) {
@ -289,7 +289,7 @@ const mp_obj_property_t busio_uart_baudrate_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| in_waiting: int = ...
//| in_waiting: int
//| """The number of bytes in the input buffer, available to be read"""
//|
STATIC mp_obj_t busio_uart_obj_get_in_waiting(mp_obj_t self_in) {
@ -306,7 +306,7 @@ const mp_obj_property_t busio_uart_in_waiting_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| timeout: float = ...
//| timeout: float
//| """The current timeout, in seconds (float)."""
//|
STATIC mp_obj_t busio_uart_obj_get_timeout(mp_obj_t self_in) {
@ -349,10 +349,10 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(busio_uart_reset_input_buffer_obj, busio_uart_o
//| class Parity:
//| """Enum-like class to define the parity used to verify correct data transfer."""
//|
//| ODD: int = ...
//| ODD: int
//| """Total number of ones should be odd."""
//|
//| EVEN: int = ...
//| EVEN: int
//| """Total number of ones should be even."""
//|
const mp_obj_type_t busio_uart_parity_type;

View File

@ -53,7 +53,7 @@ STATIC mp_obj_t countio_counter_make_new(const mp_obj_type_t *type, size_t n_arg
return MP_OBJ_FROM_PTR(self);
}
//| def deinit(self):
//| def deinit(self) -> None:
//| """Deinitializes the Counter and releases any hardware resources for reuse."""
//|
STATIC mp_obj_t countio_counter_deinit(mp_obj_t self_in) {
@ -69,12 +69,12 @@ STATIC void check_for_deinit(countio_counter_obj_t *self) {
}
}
//| def __enter__(self):
//| def __enter__(self) -> Counter:
//| """No-op used by Context Managers."""
//|
// Provided by context manager helper.
//| def __exit__(self):
//| def __exit__(self) -> None:
//| """Automatically deinitializes the hardware when exiting a context. See
//| :ref:`lifetime-and-contextmanagers` for more info."""
//|
@ -86,7 +86,7 @@ STATIC mp_obj_t countio_counter_obj___exit__(size_t n_args, const mp_obj_t *args
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(countio_counter___exit___obj, 4, 4, countio_counter_obj___exit__);
//| count: int = ...
//| count: int
//| """The current count in terms of pulses."""
//|
STATIC mp_obj_t countio_counter_obj_get_count(mp_obj_t self_in) {
@ -113,7 +113,7 @@ const mp_obj_property_t countio_counter_count_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| def reset(self):
//| def reset(self) -> None:
//| """Resets the count back to 0."""
//|
STATIC mp_obj_t countio_counter_reset(mp_obj_t self_in){

View File

@ -106,14 +106,14 @@ STATIC void check_for_deinit(digitalio_digitalinout_obj_t *self) {
}
}
//| def switch_to_output(self, value: bool = False, drive_mode: digitalio.DriveMode = digitalio.DriveMode.PUSH_PULL) -> None:
//| """Set the drive mode and value and then switch to writing out digital
//| values.
//| def switch_to_output(self, value: bool = False, drive_mode: DriveMode = DriveMode.PUSH_PULL) -> None:
//| """Set the drive mode and value and then switch to writing out digital
//| values.
//|
//| :param bool value: default value to set upon switching
//| :param ~digitalio.DriveMode drive_mode: drive mode for the output
//| """
//| ...
//| :param bool value: default value to set upon switching
//| :param ~digitalio.DriveMode drive_mode: drive mode for the output
//| """
//| ...
//|
STATIC mp_obj_t digitalio_digitalinout_switch_to_output(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_value, ARG_drive_mode };
@ -139,7 +139,7 @@ STATIC mp_obj_t digitalio_digitalinout_switch_to_output(size_t n_args, const mp_
}
MP_DEFINE_CONST_FUN_OBJ_KW(digitalio_digitalinout_switch_to_output_obj, 1, digitalio_digitalinout_switch_to_output);
//| def switch_to_input(self, pull: Pull = None) -> None:
//| def switch_to_input(self, pull: Optional[Pull] = None) -> None:
//| """Set the pull and then switch to read in digital values.
//|
//| :param Pull pull: pull configuration for the input
@ -179,7 +179,7 @@ STATIC mp_obj_t digitalio_digitalinout_switch_to_input(size_t n_args, const mp_o
}
MP_DEFINE_CONST_FUN_OBJ_KW(digitalio_digitalinout_switch_to_input_obj, 1, digitalio_digitalinout_switch_to_input);
//| direction: Direction = ...
//| direction: Direction
//| """The direction of the pin.
//|
//| Setting this will use the defaults from the corresponding
@ -228,7 +228,7 @@ const mp_obj_property_t digitalio_digitalio_direction_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| value: Bool = ...
//| value: bool
//| """The digital logic level of the pin."""
//|
STATIC mp_obj_t digitalio_digitalinout_obj_get_value(mp_obj_t self_in) {
@ -258,7 +258,7 @@ const mp_obj_property_t digitalio_digitalinout_value_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| drive_mode: DriveMode = ...
//| drive_mode: DriveMode
//| """The pin drive mode. One of:
//|
//| - `digitalio.DriveMode.PUSH_PULL`
@ -302,7 +302,7 @@ const mp_obj_property_t digitalio_digitalio_drive_mode_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| pull: Optional[Pull] = ...
//| pull: Optional[Pull]
//| """The pin pull direction. One of:
//|
//| - `digitalio.Pull.UP`

View File

@ -46,10 +46,10 @@
//| going."""
//| ...
//|
//| INPUT: Direction = ...
//| INPUT: Direction
//| """Read digital data in"""
//|
//| OUTPUT: Direction = ...
//| OUTPUT: Direction
//| """Write digital data out"""
//|
const mp_obj_type_t digitalio_direction_type;

View File

@ -34,10 +34,10 @@
//| digital values."""
//| ...
//|
//| PUSH_PULL: DriveMode = ...
//| PUSH_PULL: DriveMode
//| """Output both high and low digital values"""
//|
//| OPEN_DRAIN: DriveMode = ...
//| OPEN_DRAIN: DriveMode
//| """Output low digital values but go into high z for digital high. This is
//| useful for i2c and other protocols that share a digital line."""
//|

View File

@ -34,11 +34,11 @@
//| digital values in."""
//| ...
//|
//| UP: Pull = ...
//| UP: Pull
//| """When the input line isn't being driven the pull up can pull the state
//| of the line high so it reads as true."""
//|
//| DOWN: Pull = ...
//| DOWN: Pull
//| """When the input line isn't being driven the pull down can pull the
//| state of the line low so it reads as false."""
//|

View File

@ -73,7 +73,7 @@ STATIC mp_obj_t displayio_bitmap_make_new(const mp_obj_type_t *type, size_t n_ar
return MP_OBJ_FROM_PTR(self);
}
//| width: int = ...
//| width: int
//| """Width of the bitmap. (read only)"""
//|
STATIC mp_obj_t displayio_bitmap_obj_get_width(mp_obj_t self_in) {
@ -91,7 +91,7 @@ const mp_obj_property_t displayio_bitmap_width_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| height: int = ...
//| height: int
//| """Height of the bitmap. (read only)"""
//|
STATIC mp_obj_t displayio_bitmap_obj_get_height(mp_obj_t self_in) {

View File

@ -84,7 +84,7 @@ STATIC mp_obj_t displayio_colorconverter_obj_convert(mp_obj_t self_in, mp_obj_t
}
MP_DEFINE_CONST_FUN_OBJ_2(displayio_colorconverter_convert_obj, displayio_colorconverter_obj_convert);
//| dither: bool = ...
//| dither: bool
//| """When true the color converter dithers the output by adding random noise when
//| truncating to display bitdepth"""
//|

View File

@ -39,6 +39,11 @@
#include "shared-module/displayio/__init__.h"
#include "supervisor/shared/translate.h"
//| _DisplayBus = Union[FourWire, ParallelBus, I2CDisplay]
//| """:py:class:`FourWire`, :py:class:`ParallelBus` or :py:class:`I2CDisplay`"""
//|
//|
//| class Display:
//| """Manage updating a display over a display bus
//|
@ -49,8 +54,8 @@
//| Most people should not use this class directly. Use a specific display driver instead that will
//| contain the initialization sequence at minimum."""
//|
//| def __init__(self, display_bus: displayio, init_sequence: buffer, *, width: int, height: int, colstart: int = 0, rowstart: int = 0, rotation: int = 0, color_depth: int = 16, grayscale: bool = False, pixels_in_byte_share_row: bool = True, bytes_per_cell: int = 1, reverse_pixels_in_byte: bool = False, set_column_command: int = 0x2a, set_row_command: int = 0x2b, write_ram_command: int = 0x2c, set_vertical_scroll: int = 0, backlight_pin: Optional[microcontroller.Pin] = None, brightness_command: int = None, brightness: bool = 1.0, auto_brightness: bool = False, single_byte_bounds: bool = False, data_as_commands: bool = False, auto_refresh: bool = True, native_frames_per_second: int = 60) -> None:
//| r"""Create a Display object on the given display bus (`displayio.FourWire` or `displayio.ParallelBus`).
//| def __init__(self, display_bus: _DisplayBus, init_sequence: ReadableBuffer, *, width: int, height: int, colstart: int = 0, rowstart: int = 0, rotation: int = 0, color_depth: int = 16, grayscale: bool = False, pixels_in_byte_share_row: bool = True, bytes_per_cell: int = 1, reverse_pixels_in_byte: bool = False, set_column_command: int = 0x2a, set_row_command: int = 0x2b, write_ram_command: int = 0x2c, set_vertical_scroll: int = 0, backlight_pin: Optional[microcontroller.Pin] = None, brightness_command: Optional[int] = None, brightness: float = 1.0, auto_brightness: bool = False, single_byte_bounds: bool = False, data_as_commands: bool = False, auto_refresh: bool = True, native_frames_per_second: int = 60) -> None:
//| r"""Create a Display object on the given display bus (`FourWire`, `ParallelBus` or `I2CDisplay`).
//|
//| The ``init_sequence`` is bitpacked to minimize the ram impact. Every command begins with a
//| command byte followed by a byte to determine the parameter count and if a delay is need after.
@ -76,7 +81,7 @@
//| of the display to minimize tearing artifacts.
//|
//| :param display_bus: The bus that the display is connected to
//| :type display_bus: displayio.FourWire or displayio.ParallelBus
//| :type display_bus: FourWire, ParallelBus or I2CDisplay
//| :param buffer init_sequence: Byte-packed initialization sequence.
//| :param int width: Width in pixels
//| :param int height: Height in pixels
@ -96,7 +101,7 @@
//| :param int set_vertical_scroll: Command used to set the first row to show
//| :param microcontroller.Pin backlight_pin: Pin connected to the display's backlight
//| :param int brightness_command: Command to set display brightness. Usually available in OLED controllers.
//| :param bool brightness: Initial display brightness. This value is ignored if auto_brightness is True.
//| :param float brightness: Initial display brightness. This value is ignored if auto_brightness is True.
//| :param bool auto_brightness: If True, brightness is controlled via an ambient light sensor or other mechanism.
//| :param bool single_byte_bounds: Display column and row commands use single bytes
//| :param bool data_as_commands: Treat all init and boundary data as SPI commands. Certain displays require this.
@ -245,7 +250,7 @@ STATIC mp_obj_t displayio_display_obj_refresh(size_t n_args, const mp_obj_t *pos
}
MP_DEFINE_CONST_FUN_OBJ_KW(displayio_display_refresh_obj, 1, displayio_display_obj_refresh);
//| auto_refresh: None = ...
//| auto_refresh: bool
//| """True when the display is refreshed automatically."""
//|
STATIC mp_obj_t displayio_display_obj_get_auto_refresh(mp_obj_t self_in) {
@ -270,7 +275,7 @@ const mp_obj_property_t displayio_display_auto_refresh_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| brightness: float = ...
//| brightness: float
//| """The brightness of the display as a float. 0.0 is off and 1.0 is full brightness. When
//| `auto_brightness` is True, the value of `brightness` will change automatically.
//| If `brightness` is set, `auto_brightness` will be disabled and will be set to False."""
@ -307,7 +312,7 @@ const mp_obj_property_t displayio_display_brightness_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| auto_brightness: Optional[bool] = ...
//| auto_brightness: bool
//| """True when the display brightness is adjusted automatically, based on an ambient
//| light sensor or other method. Note that some displays may have this set to True by default,
//| but not actually implement automatic brightness adjustment. `auto_brightness` is set to False
@ -338,10 +343,9 @@ const mp_obj_property_t displayio_display_auto_brightness_obj = {
//| width: int = ...
//| width: int
//| Gets the width of the board
//|
//|
STATIC mp_obj_t displayio_display_obj_get_width(mp_obj_t self_in) {
displayio_display_obj_t *self = native_display(self_in);
return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_display_get_width(self));
@ -355,10 +359,9 @@ const mp_obj_property_t displayio_display_width_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| height: int = ...
//| height: int
//| """Gets the height of the board"""
//|
//|
STATIC mp_obj_t displayio_display_obj_get_height(mp_obj_t self_in) {
displayio_display_obj_t *self = native_display(self_in);
return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_display_get_height(self));
@ -372,7 +375,7 @@ const mp_obj_property_t displayio_display_height_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| rotation: int = ...
//| rotation: int
//| """The rotation of the display as an int in degrees."""
//|
STATIC mp_obj_t displayio_display_obj_get_rotation(mp_obj_t self_in) {
@ -395,7 +398,7 @@ const mp_obj_property_t displayio_display_rotation_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| bus: Union[ParallelBus, FourWire, I2CDisplay] = ...
//| bus: _DisplayBus
//| """The bus being used by the display"""
//|
//|
@ -413,7 +416,7 @@ const mp_obj_property_t displayio_display_bus_obj = {
};
//| def fill_row(self, y: int, buffer: WriteableBuffer) -> bytearray:
//| def fill_row(self, y: int, buffer: WriteableBuffer) -> WriteableBuffer:
//| """Extract the pixels from a single row
//|
//| :param int y: The top edge of the area

View File

@ -49,7 +49,7 @@
//| Most people should not use this class directly. Use a specific display driver instead that will
//| contain the startup and shutdown sequences at minimum."""
//|
//| def __init__(self, display_bus: displayio, start_sequence: buffer, stop_sequence: buffer, *, width: int, height: int, ram_width: int, ram_height: int, colstart: int = 0, rowstart: int = 0, rotation: int = 0, set_column_window_command: Optional[int] = None, set_row_window_command: Optional[int] = None, single_byte_bounds: bool = False, write_black_ram_command: int, black_bits_inverted: bool = False, write_color_ram_command: Optional[int] = None, color_bits_inverted: bool = False, highlight_color: int = 0x000000, refresh_display_command: int, refresh_time: float = 40, busy_pin: Optional[microcontroller.Pin] = None, busy_state: bool = True, seconds_per_frame: float = 180, always_toggle_chip_select: bool = False) -> None:
//| def __init__(self, display_bus: _DisplayBus, start_sequence: ReadableBuffer, stop_sequence: ReadableBuffer, *, width: int, height: int, ram_width: int, ram_height: int, colstart: int = 0, rowstart: int = 0, rotation: int = 0, set_column_window_command: Optional[int] = None, set_row_window_command: Optional[int] = None, single_byte_bounds: bool = False, write_black_ram_command: int, black_bits_inverted: bool = False, write_color_ram_command: Optional[int] = None, color_bits_inverted: bool = False, highlight_color: int = 0x000000, refresh_display_command: int, refresh_time: float = 40, busy_pin: Optional[microcontroller.Pin] = None, busy_state: bool = True, seconds_per_frame: float = 180, always_toggle_chip_select: bool = False) -> None:
//| """Create a EPaperDisplay object on the given display bus (`displayio.FourWire` or `displayio.ParallelBus`).
//|
//| The ``start_sequence`` and ``stop_sequence`` are bitpacked to minimize the ram impact. Every
@ -205,7 +205,7 @@ STATIC mp_obj_t displayio_epaperdisplay_obj_refresh(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(displayio_epaperdisplay_refresh_obj, displayio_epaperdisplay_obj_refresh);
//| time_to_refresh: float = ...
//| time_to_refresh: float
//| """Time, in fractional seconds, until the ePaper display can be refreshed."""
//|
STATIC mp_obj_t displayio_epaperdisplay_obj_get_time_to_refresh(mp_obj_t self_in) {
@ -221,7 +221,7 @@ const mp_obj_property_t displayio_epaperdisplay_time_to_refresh_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| width: int = ...
//| width: int
//| """Gets the width of the display in pixels"""
//|
STATIC mp_obj_t displayio_epaperdisplay_obj_get_width(mp_obj_t self_in) {
@ -237,7 +237,7 @@ const mp_obj_property_t displayio_epaperdisplay_width_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| height: int = ...
//| height: int
//| """Gets the height of the display in pixels"""
//|
STATIC mp_obj_t displayio_epaperdisplay_obj_get_height(mp_obj_t self_in) {
@ -253,7 +253,7 @@ const mp_obj_property_t displayio_epaperdisplay_height_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| bus: displayio = ...
//| bus: _DisplayBus
//| """The bus being used by the display"""
//|
STATIC mp_obj_t displayio_epaperdisplay_obj_get_bus(mp_obj_t self_in) {

View File

@ -42,7 +42,7 @@
//| """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) -> None:
//| def __init__(self, spi_bus: busio.SPI, *, command: microcontroller.Pin, chip_select: microcontroller.Pin, reset: Optional[microcontroller.Pin] = None, baudrate: int = 24000000, polarity: int = 0, phase: int = 0) -> None:
//| """Create a FourWire object associated with the given pins.
//|
//| The SPI bus and pins are then in use by the display until `displayio.release_displays()` is

View File

@ -86,7 +86,7 @@ displayio_group_t* native_group(mp_obj_t group_obj) {
return MP_OBJ_TO_PTR(native_group);
}
//| hidden: bool = ...
//| hidden: bool
//| """True when the Group and all of it's layers are not visible. When False, the Group's layers
//| are visible if they haven't been hidden."""
//|
@ -111,7 +111,7 @@ const mp_obj_property_t displayio_group_hidden_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| scale: int = ...
//| scale: int
//| """Scales each pixel within the Group in both directions. For example, when scale=2 each pixel
//| will be represented by 2x2 pixels."""
//|
@ -140,7 +140,7 @@ const mp_obj_property_t displayio_group_scale_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| x: int = ...
//| x: int
//| """X position of the Group in the parent."""
//|
STATIC mp_obj_t displayio_group_obj_get_x(mp_obj_t self_in) {
@ -165,7 +165,7 @@ const mp_obj_property_t displayio_group_x_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| y: int = ...
//| y: int
//| """Y position of the Group in the parent."""
//|
STATIC mp_obj_t displayio_group_obj_get_y(mp_obj_t self_in) {
@ -264,7 +264,8 @@ STATIC mp_obj_t displayio_group_obj_remove(mp_obj_t self_in, mp_obj_t layer) {
}
MP_DEFINE_CONST_FUN_OBJ_2(displayio_group_remove_obj, displayio_group_obj_remove);
//| def __bool__(self) -> bool: ...
//| def __bool__(self) -> bool:
//| ...
//|
//| def __len__(self) -> int:
//| """Returns the number of layers in a Group"""

View File

@ -42,7 +42,7 @@
//| """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) -> None:
//| def __init__(self, i2c_bus: busio.I2C, *, device_address: int, reset: Optional[microcontroller.Pin] = None) -> None:
//| """Create a I2CDisplay object associated with the given I2C bus and reset pin.
//|
//| The I2C bus and pins are then in use by the display until `displayio.release_displays()` is

View File

@ -69,7 +69,7 @@
//| while True:
//| pass"""
//|
//| def __init__(self, file: file) -> None:
//| def __init__(self, file: typing.BinaryIO) -> None:
//| """Create an OnDiskBitmap object with the given file.
//|
//| :param file file: The open bitmap file"""
@ -89,7 +89,7 @@ STATIC mp_obj_t displayio_ondiskbitmap_make_new(const mp_obj_type_t *type, size_
return MP_OBJ_FROM_PTR(self);
}
//| width: int = ...
//| width: int
//| """Width of the bitmap. (read only)"""
//|
STATIC mp_obj_t displayio_ondiskbitmap_obj_get_width(mp_obj_t self_in) {
@ -108,7 +108,7 @@ const mp_obj_property_t displayio_ondiskbitmap_width_obj = {
};
//| height: int = ...
//| height: int
//| """Height of the bitmap. (read only)"""
//|
STATIC mp_obj_t displayio_ondiskbitmap_obj_get_height(mp_obj_t self_in) {

View File

@ -36,12 +36,6 @@
#include "shared-bindings/util.h"
#include "supervisor/shared/translate.h"
//| class Palette:
//| """Map a pixel palette_index to a full color. Colors are transformed to the display's format internally to
//| save memory."""
@ -70,7 +64,8 @@ STATIC mp_obj_t displayio_palette_make_new(const mp_obj_type_t *type, size_t n_a
return MP_OBJ_FROM_PTR(self);
}
//| def __bool__(self) -> bool: ...
//| def __bool__(self) -> bool:
//| ...
//|
//| def __len__(self) -> int:
//| """Returns the number of colors in a Palette"""
@ -86,7 +81,11 @@ STATIC mp_obj_t group_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
}
}
//| def __setitem__(self, index: int, value: Union[int, ReadableBuffer]) -> Optional[int]:
//| def __getitem__(self, index: int) -> Optional[int]:
//| r"""Return the pixel color at the given index as an integer."""
//| ...
//|
//| def __setitem__(self, index: int, value: Union[int, ReadableBuffer, Tuple[int, int, int]]) -> None:
//| r"""Sets the pixel color at the given index. The index should be an integer in the range 0 to color_count-1.
//|
//| The value argument represents a color, and can be from 0x000000 to 0xFFFFFF (to represent an RGB value).
@ -149,7 +148,8 @@ STATIC mp_obj_t palette_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t val
return mp_const_none;
}
//| def make_transparent(self, palette_index: int) -> None: ...
//| def make_transparent(self, palette_index: int) -> None:
//| ...
//|
STATIC mp_obj_t displayio_palette_obj_make_transparent(mp_obj_t self_in, mp_obj_t palette_index_obj) {
displayio_palette_t *self = MP_OBJ_TO_PTR(self_in);
@ -163,7 +163,8 @@ STATIC mp_obj_t displayio_palette_obj_make_transparent(mp_obj_t self_in, mp_obj_
}
MP_DEFINE_CONST_FUN_OBJ_2(displayio_palette_make_transparent_obj, displayio_palette_obj_make_transparent);
//| def make_opaque(self, palette_index: int) -> None: ...
//| def make_opaque(self, palette_index: int) -> None:
//| ...
//|
STATIC mp_obj_t displayio_palette_obj_make_opaque(mp_obj_t self_in, mp_obj_t palette_index_obj) {
displayio_palette_t *self = MP_OBJ_TO_PTR(self_in);

View File

@ -48,15 +48,15 @@
//|
//| A single tile grid is also known as a Sprite."""
//|
//| def __init__(self, bitmap: displayio.Bitmap, *, pixel_shader: displayio.Palette, width: int = 1, height: int = 1, tile_width: int = None, tile_height: int = None, default_tile: int = 0, x: int = 0, y: int = 0) -> None:
//| def __init__(self, bitmap: Bitmap, *, pixel_shader: Union[ColorConverter, Palette], width: int = 1, height: int = 1, tile_width: Optional[int] = None, tile_height: Optional[int] = None, default_tile: int = 0, x: int = 0, y: int = 0) -> None:
//| """Create a TileGrid object. The bitmap is source for 2d pixels. The pixel_shader is used to
//| convert the value and its location to a display native pixel color. This may be a simple color
//| palette lookup, a gradient, a pattern or a color transformer.
//|
//| tile_width and tile_height match the height of the bitmap by default.
//|
//| :param displayio.Bitmap bitmap: The bitmap storing one or more tiles.
//| :param displayio.Palette pixel_shader: The pixel shader that produces colors from values
//| :param Bitmap bitmap: The bitmap storing one or more tiles.
//| :param ColorConverter or Palette pixel_shader: The pixel shader that produces colors from values
//| :param int width: Width of the grid in tiles.
//| :param int height: Height of the grid in tiles.
//| :param int tile_width: Width of a single tile in pixels. Defaults to the full Bitmap and must evenly divide into the Bitmap's dimensions.
@ -141,7 +141,7 @@ static displayio_tilegrid_t* native_tilegrid(mp_obj_t tilegrid_obj) {
mp_obj_assert_native_inited(native_tilegrid);
return MP_OBJ_TO_PTR(native_tilegrid);
}
//| hidden: bool = ...
//| hidden: bool
//| """True when the TileGrid is hidden. This may be False even when a part of a hidden Group."""
//|
STATIC mp_obj_t displayio_tilegrid_obj_get_hidden(mp_obj_t self_in) {
@ -165,7 +165,7 @@ const mp_obj_property_t displayio_tilegrid_hidden_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| x: int = ...
//| x: int
//| """X position of the left edge in the parent."""
//|
STATIC mp_obj_t displayio_tilegrid_obj_get_x(mp_obj_t self_in) {
@ -190,7 +190,7 @@ const mp_obj_property_t displayio_tilegrid_x_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| y: int = ...
//| y: int
//| """Y position of the top edge in the parent."""
//|
STATIC mp_obj_t displayio_tilegrid_obj_get_y(mp_obj_t self_in) {
@ -215,7 +215,7 @@ const mp_obj_property_t displayio_tilegrid_y_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| flip_x: bool = ...
//| flip_x: bool
//| """If true, the left edge rendered will be the right edge of the right-most tile."""
//|
STATIC mp_obj_t displayio_tilegrid_obj_get_flip_x(mp_obj_t self_in) {
@ -239,7 +239,7 @@ const mp_obj_property_t displayio_tilegrid_flip_x_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| flip_y: bool = ...
//| flip_y: bool
//| """If true, the top edge rendered will be the bottom edge of the bottom-most tile."""
//|
STATIC mp_obj_t displayio_tilegrid_obj_get_flip_y(mp_obj_t self_in) {
@ -264,7 +264,7 @@ const mp_obj_property_t displayio_tilegrid_flip_y_obj = {
};
//| transpose_xy: bool = ...
//| transpose_xy: bool
//| """If true, the TileGrid's axis will be swapped. When combined with mirroring, any 90 degree
//| rotation can be achieved along with the corresponding mirrored version."""
//|
@ -289,7 +289,7 @@ const mp_obj_property_t displayio_tilegrid_transpose_xy_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| pixel_shader: Union[ColorConverter, Palette] = ...
//| pixel_shader: Union[ColorConverter, Palette]
//| """The pixel shader of the tilegrid."""
//|
STATIC mp_obj_t displayio_tilegrid_obj_get_pixel_shader(mp_obj_t self_in) {
@ -326,7 +326,7 @@ const mp_obj_property_t displayio_tilegrid_pixel_shader_obj = {
//| print(grid[0])"""
//| ...
//|
//| def __setitem__(self, index: Union[Tuple[int, int], int], tile_index: int) -> None:
//| def __setitem__(self, index: Union[Tuple[int, int], int], value: int) -> None:
//| """Sets the tile index at the given index. The index can either be an x,y tuple or an int equal
//| to ``y * width + x``.
//|

View File

@ -46,7 +46,7 @@
//| ...
//|
//| bitmap: displayio.Bitmap = ...
//| bitmap: displayio.Bitmap
//| """Bitmap containing all font glyphs starting with ASCII and followed by unicode. Use
//| `get_glyph` in most cases. This is useful for use with `displayio.TileGrid` and
//| `terminalio.Terminal`."""

View File

@ -94,7 +94,7 @@ static framebufferio_framebufferdisplay_obj_t* native_display(mp_obj_t display_o
return MP_OBJ_TO_PTR(native_display);
}
//| def show(self, group: Group) -> None:
//| def show(self, group: displayio.Group) -> None:
//| """Switches to displaying the given group of layers. When group is None, the default
//| CircuitPython terminal will be shown.
//|
@ -151,7 +151,7 @@ STATIC mp_obj_t framebufferio_framebufferdisplay_obj_refresh(size_t n_args, cons
}
MP_DEFINE_CONST_FUN_OBJ_KW(framebufferio_framebufferdisplay_refresh_obj, 1, framebufferio_framebufferdisplay_obj_refresh);
//| auto_refresh: bool = ...
//| auto_refresh: bool
//| """True when the display is refreshed automatically."""
//|
STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_auto_refresh(mp_obj_t self_in) {
@ -176,7 +176,7 @@ const mp_obj_property_t framebufferio_framebufferdisplay_auto_refresh_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| brightness: float = ...
//| brightness: float
//| """The brightness of the display as a float. 0.0 is off and 1.0 is full brightness. When
//| `auto_brightness` is True, the value of `brightness` will change automatically.
//| If `brightness` is set, `auto_brightness` will be disabled and will be set to False."""
@ -213,7 +213,7 @@ const mp_obj_property_t framebufferio_framebufferdisplay_brightness_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| auto_brightness: bool = ...
//| auto_brightness: bool
//| """True when the display brightness is adjusted automatically, based on an ambient
//| light sensor or other method. Note that some displays may have this set to True by default,
//| but not actually implement automatic brightness adjustment. `auto_brightness` is set to False
@ -244,7 +244,7 @@ const mp_obj_property_t framebufferio_framebufferdisplay_auto_brightness_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| width: int = ...
//| width: int
//| """Gets the width of the framebuffer"""
//|
STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_width(mp_obj_t self_in) {
@ -260,7 +260,7 @@ const mp_obj_property_t framebufferio_framebufferdisplay_width_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| height: int = ...
//| height: int
//| """Gets the height of the framebuffer"""
//|
STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_height(mp_obj_t self_in) {
@ -276,7 +276,7 @@ const mp_obj_property_t framebufferio_framebufferdisplay_height_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| rotation: int = ...
//| rotation: int
//| """The rotation of the display as an int in degrees."""
//|
STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_rotation(mp_obj_t self_in) {
@ -299,7 +299,7 @@ const mp_obj_property_t framebufferio_framebufferdisplay_rotation_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| framebuffer: rgbmatrix.RGBMatrix = ...
//| framebuffer: rgbmatrix.RGBMatrix
//| """The framebuffer being used by the display"""
//|
//|

View File

@ -169,7 +169,7 @@ STATIC mp_obj_t frequencyio_frequencyin_obj_clear(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(frequencyio_frequencyin_clear_obj, frequencyio_frequencyin_obj_clear);
//| capture_period: int = ...
//| capture_period: int
//| """The capture measurement period. Lower incoming frequencies will be measured
//| more accurately with longer capture periods. Higher frequencies are more
//| accurate with shorter capture periods.

View File

@ -69,8 +69,17 @@
//| buttons = pad.get_pressed()
//| time.sleep(0.1)"""
//|
//| def __init__(self, b1: DigitalInOut, b2: DigitalInOut, b3: DigitalInOut, b4: DigitalInOut, b5: DigitalInOut, b6: DigitalInOut, b7: DigitalInOut, b8: DigitalInOut) -> None:
//| def __init__(
//| self,
//| b1: digitalio.DigitalInOut,
//| b2: digitalio.DigitalInOut,
//| b3: digitalio.DigitalInOut,
//| b4: digitalio.DigitalInOut,
//| b5: digitalio.DigitalInOut,
//| b6: digitalio.DigitalInOut,
//| b7: digitalio.DigitalInOut,
//| b8: digitalio.DigitalInOut,
//| ) -> None:
//| """Initializes button scanning routines.
//|
//| The ``b1``-``b8`` parameters are ``DigitalInOut`` objects, which

View File

@ -36,7 +36,7 @@
//| class GamePadShift:
//| """Scan buttons for presses through a shift register"""
//|
//| def __init__(self, clock: DigitalInOut, data: DigitalInOut, latch: DigitalInOut) -> None:
//| def __init__(self, clock: digitalio.DigitalInOut, data: digitalio.DigitalInOut, latch: digitalio.DigitalInOut) -> None:
//| """Initializes button scanning routines.
//|
//| The ``clock``, ``data`` and ``latch`` parameters are ``DigitalInOut``

View File

@ -31,10 +31,10 @@
//| print("Longitude: {0:.6f} degrees".format(nav.longitude))"""
//|
//| def __init__(self) -> None:
//| def __init__(self, system: Union[SatelliteSystem, List[SatelliteSystem]]) -> None:
//| """Turn on the GNSS.
//|
//| :param gnss.SatelliteSystem system: satellite system to use"""
//| :param system: satellite system to use"""
//| ...
//|
STATIC mp_obj_t gnss_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
@ -98,7 +98,7 @@ STATIC mp_obj_t gnss_obj_update(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(gnss_update_obj, gnss_obj_update);
//| latitude: float = ...
//| latitude: float
//| """Latitude of current position in degrees (float)."""
//|
STATIC mp_obj_t gnss_obj_get_latitude(mp_obj_t self_in) {
@ -115,7 +115,7 @@ const mp_obj_property_t gnss_latitude_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| longitude: float = ...
//| longitude: float
//| """Longitude of current position in degrees (float)."""
//|
STATIC mp_obj_t gnss_obj_get_longitude(mp_obj_t self_in) {
@ -132,7 +132,7 @@ const mp_obj_property_t gnss_longitude_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| altitude: float = ...
//| altitude: float
//| """Altitude of current position in meters (float)."""
//|
STATIC mp_obj_t gnss_obj_get_altitude(mp_obj_t self_in) {
@ -149,7 +149,7 @@ const mp_obj_property_t gnss_altitude_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| timestamp: time.struct_time = ...
//| timestamp: time.struct_time
//| """Time when the position data was updated."""
//|
STATIC mp_obj_t gnss_obj_get_timestamp(mp_obj_t self_in) {
@ -168,7 +168,7 @@ const mp_obj_property_t gnss_timestamp_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| fix: gnss.PositionFix = ...
//| fix: PositionFix
//| """Fix mode."""
//|
STATIC mp_obj_t gnss_obj_get_fix(mp_obj_t self_in) {

View File

@ -10,20 +10,14 @@
//| def __init__(self) -> None:
//| """Enum-like class to define the position fix mode."""
//|
//| INVALID: PositionFix = ...
//| """No measurement.
//| INVALID: PositionFix
//| """No measurement."""
//|
//| :type PositionFix:"""
//| FIX_2D: PositionFix
//| """2D fix."""
//|
//| FIX_2D: PositionFix = ...
//| """2D fix.
//|
//| :type PositionFix:"""
//|
//| FIX_3D: PositionFix = ...
//| """3D fix.
//|
//| :type gnss.PositionFix:"""
//| FIX_3D: PositionFix
//| """3D fix."""
//|
const mp_obj_type_t gnss_positionfix_type;

View File

@ -10,30 +10,20 @@
//| def __init__(self) -> None:
//| """Enum-like class to define the satellite system type."""
//|
//| GPS: SatelliteSystem = ...
//| """Global Positioning System.
//| GPS: SatelliteSystem
//| """Global Positioning System."""
//|
//| :type gnss.SatelliteSystem:"""
//| GLONASS: SatelliteSystem
//| """GLObal NAvigation Satellite System."""
//|
//| GLONASS: SatelliteSystem = ...
//| """GLObal NAvigation Satellite System.
//| SBAS: SatelliteSystem
//| """Satellite Based Augmentation System."""
//|
//| :type gnss.SatelliteSystem:"""
//| QZSS_L1CA: SatelliteSystem
//| """Quasi-Zenith Satellite System L1C/A."""
//|
//| SBAS: SatelliteSystem = ...
//| """Satellite Based Augmentation System.
//|
//| :type gnss.SatelliteSystem:"""
//|
//| QZSS_L1CA: SatelliteSystem = ...
//| """Quasi-Zenith Satellite System L1C/A.
//|
//| :type gnss.SatelliteSystem:"""
//|
//| QZSS_L1S: SatelliteSystem = ...
//| """Quasi-Zenith Satellite System L1S.
//|
//| :type gnss.SatelliteSystem:"""
//| QZSS_L1S: SatelliteSystem
//| """Quasi-Zenith Satellite System L1S."""
//|
const mp_obj_type_t gnss_satellitesystem_type;

View File

@ -259,7 +259,7 @@ STATIC mp_obj_t i2cperipheral_i2c_peripheral_request_obj___exit__(size_t n_args,
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(i2cperipheral_i2c_peripheral_request___exit___obj, 4, 4, i2cperipheral_i2c_peripheral_request_obj___exit__);
//| address: int = ...
//| address: int
//| """The I2C address of the request."""
//|
STATIC mp_obj_t i2cperipheral_i2c_peripheral_request_get_address(mp_obj_t self_in) {
@ -269,7 +269,7 @@ STATIC mp_obj_t i2cperipheral_i2c_peripheral_request_get_address(mp_obj_t self_i
}
MP_DEFINE_CONST_PROP_GET(i2cperipheral_i2c_peripheral_request_address_obj, i2cperipheral_i2c_peripheral_request_get_address);
//| is_read: bool = ...
//| is_read: bool
//| """The I2C main controller is reading from this peripheral."""
//|
STATIC mp_obj_t i2cperipheral_i2c_peripheral_request_get_is_read(mp_obj_t self_in) {
@ -279,7 +279,7 @@ STATIC mp_obj_t i2cperipheral_i2c_peripheral_request_get_is_read(mp_obj_t self_i
}
MP_DEFINE_CONST_PROP_GET(i2cperipheral_i2c_peripheral_request_is_read_obj, i2cperipheral_i2c_peripheral_request_get_is_read);
//| is_restart: bool = ...
//| is_restart: bool
//| """Is Repeated Start Condition."""
//|
STATIC mp_obj_t i2cperipheral_i2c_peripheral_request_get_is_restart(mp_obj_t self_in) {
@ -349,7 +349,7 @@ STATIC mp_obj_t i2cperipheral_i2c_peripheral_request_read(size_t n_args, const m
}
MP_DEFINE_CONST_FUN_OBJ_KW(i2cperipheral_i2c_peripheral_request_read_obj, 1, i2cperipheral_i2c_peripheral_request_read);
//| def write(self, buffer: bytearray) -> int:
//| def write(self, buffer: ReadableBuffer) -> int:
//| """Write the data contained in buffer.
//|
//| :param buffer: Write out the data in this buffer

View File

@ -79,10 +79,10 @@ STATIC NORETURN void math_error(void) {
#define log2(x) (log(x) * 1.442695040888963407354163704)
#endif
//| e: float = ...
//| e: float
//| """base of the natural logarithm"""
//|
//| pi: float = ...
//| pi: float
//| """the ratio of a circle's circumference to its diameter"""
//|
@ -126,7 +126,7 @@ STATIC NORETURN void math_error(void) {
//| """Return the absolute value of ``x``."""
//| ...
//|
//| def floor(x: float) -> float:
//| def floor(x: float) -> int:
//| """Return an integer, being ``x`` rounded towards negative infinity."""
//| ...
//|

View File

@ -35,7 +35,7 @@
//| class AllocationAlarm:
//|
//| def __init__(self, *, minimum_block_count=1):
//| def __init__(self, *, minimum_block_count: int = 1) -> None:
//| """Throw an exception when an allocation of ``minimum_block_count`` or more blocks
//| occurs while active.
//|
@ -76,7 +76,7 @@ STATIC mp_obj_t memorymonitor_allocationalarm_make_new(const mp_obj_type_t *type
return MP_OBJ_FROM_PTR(self);
}
//| def ignore(self, count) -> AllocationAlarm:
//| def ignore(self, count: int) -> AllocationAlarm:
//| """Sets the number of applicable allocations to ignore before raising the exception.
//| Automatically set back to zero at context exit.
//|
@ -98,7 +98,7 @@ STATIC mp_obj_t memorymonitor_allocationalarm_obj_ignore(mp_obj_t self_in, mp_ob
}
MP_DEFINE_CONST_FUN_OBJ_2(memorymonitor_allocationalarm_ignore_obj, memorymonitor_allocationalarm_obj_ignore);
//| def __enter__(self) -> memorymonitor.AllocationAlarm:
//| def __enter__(self) -> AllocationAlarm:
//| """Enables the alarm."""
//| ...
//|

View File

@ -35,7 +35,7 @@
//| class AllocationSize:
//|
//| def __init__(self):
//| def __init__(self) -> None:
//| """Tracks the number of allocations in power of two buckets.
//|
//| It will have 16 16-bit buckets to track allocation counts. It is total allocations
@ -72,7 +72,7 @@ STATIC mp_obj_t memorymonitor_allocationsize_make_new(const mp_obj_type_t *type,
return MP_OBJ_FROM_PTR(self);
}
//| def __enter__(self, ) -> Any:
//| def __enter__(self) -> AllocationSize:
//| """Clears counts and resumes tracking."""
//| ...
//|
@ -83,7 +83,7 @@ STATIC mp_obj_t memorymonitor_allocationsize_obj___enter__(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(memorymonitor_allocationsize___enter___obj, memorymonitor_allocationsize_obj___enter__);
//| def __exit__(self, ) -> Any:
//| def __exit__(self) -> None:
//| """Automatically pauses allocation tracking when exiting a context. See
//| :ref:`lifetime-and-contextmanagers` for more info."""
//| ...
@ -95,7 +95,7 @@ STATIC mp_obj_t memorymonitor_allocationsize_obj___exit__(size_t n_args, const m
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(memorymonitor_allocationsize___exit___obj, 4, 4, memorymonitor_allocationsize_obj___exit__);
//| bytes_per_block: int = ...
//| bytes_per_block: int
//| """Number of bytes per block"""
//|
STATIC mp_obj_t memorymonitor_allocationsize_obj_get_bytes_per_block(mp_obj_t self_in) {
@ -112,7 +112,7 @@ const mp_obj_property_t memorymonitor_allocationsize_bytes_per_block_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| def __len__(self, ) -> Any:
//| def __len__(self) -> int:
//| """Returns the number of allocation buckets.
//|
//| This allows you to::
@ -131,7 +131,7 @@ STATIC mp_obj_t memorymonitor_allocationsize_unary_op(mp_unary_op_t op, mp_obj_t
}
}
//| def __getitem__(self, index: Any) -> Any:
//| def __getitem__(self, index: int) -> Optional[int]:
//| """Returns the allocation count for the given bucket.
//|
//| This allows you to::

View File

@ -36,10 +36,9 @@
//| """Memory monitoring helpers"""
//|
//| class AllocationError:
//| def __init__(self, Exception: Any):
//| """Catchall exception for allocation related errors."""
//| ...
//| class AllocationError(Exception):
//| """Catchall exception for allocation related errors."""
//| ...
MP_DEFINE_MEMORYMONITOR_EXCEPTION(AllocationError, Exception)
NORETURN void mp_raise_memorymonitor_AllocationError(const compressed_string_t* fmt, ...) {

View File

@ -39,7 +39,7 @@
//| def __init__(self) -> None:
//| """Identifies an IO pin on the microcontroller. They are fixed by the
//| hardware so they cannot be constructed on demand. Instead, use
//| `board` or `microcontroller.pin` to reference the desired pin."""
//| :mod:`board` or :mod:`microcontroller.pin` to reference the desired pin."""
//| ...
//|

View File

@ -50,7 +50,7 @@
//| ...
//|
//| frequency: int = ...
//| frequency: int
//| """The CPU operating frequency in Hertz. (read-only)"""
//|
STATIC mp_obj_t mcu_processor_get_frequency(mp_obj_t self) {
@ -67,7 +67,7 @@ const mp_obj_property_t mcu_processor_frequency_obj = {
},
};
//| temperature: Optional[float] = ...
//| temperature: Optional[float]
//| """The on-chip temperature, in Celsius, as a float. (read-only)
//|
//| Is `None` if the temperature is not available."""
@ -87,7 +87,7 @@ const mp_obj_property_t mcu_processor_temperature_obj = {
},
};
//| uid: bytearray = ...
//| uid: bytearray
//| """The unique id (aka serial number) of the chip as a `bytearray`. (read-only)"""
//|
STATIC mp_obj_t mcu_processor_get_uid(mp_obj_t self) {
@ -106,7 +106,7 @@ const mp_obj_property_t mcu_processor_uid_obj = {
},
};
//| voltage: Optional[float] = ...
//| voltage: Optional[float]
//| """The input voltage to the microcontroller, as a float. (read-only)
//|
//| Is `None` if the voltage is not available."""

View File

@ -33,18 +33,18 @@
//| """Enum-like class to define the run mode of the microcontroller and
//| CircuitPython."""
//|
//| NORMAL: RunMode = ...
//| NORMAL: RunMode
//| """Run CircuitPython as normal.
//|
//| :type microcontroller.RunMode:"""
//|
//| SAFE_MODE: RunMode = ...
//| SAFE_MODE: RunMode
//| """Run CircuitPython in safe mode. User code will not be run and the
//| file system will be writeable over USB.
//|
//| :type microcontroller.RunMode:"""
//|
//| BOOTLOADER: RunMode = ...
//| BOOTLOADER: RunMode
//| """Run the bootloader.
//|
//| :type microcontroller.RunMode:"""

View File

@ -48,7 +48,7 @@
//| microcontroller. See `board` for board-specific pin mappings."""
//|
//| cpu: Processor = ...
//| cpu: Processor
//| """CPU information and control, such as ``cpu.temperature`` and ``cpu.frequency``
//| (clock frequency).
//| This object is the sole instance of `microcontroller.Processor`."""
@ -133,13 +133,19 @@ STATIC mp_obj_t mcu_reset(void) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_0(mcu_reset_obj, mcu_reset);
//| nvm: Any = ...
//| nvm: Optional[nvm.ByteArray]
//| """Available non-volatile memory.
//| This object is the sole instance of `nvm.ByteArray` when available or ``None`` otherwise.
//|
//| :type: nvm.ByteArray or None"""
//|
//| watchdog: Optional[watchdog.WatchDogTimer]
//| """Available watchdog timer.
//| This object is the sole instance of `watchdog.WatchDogTimer` when available or ``None`` otherwise."""
//|
//| """:mod:`microcontroller.pin` --- Microcontroller pin names
//| --------------------------------------------------------
//|

View File

@ -37,7 +37,7 @@
//| serial connection and the optional secondary connection."""
//|
//| def get_secondary_terminal() -> secondary_terminal:
//| def get_secondary_terminal() -> Optional[typing.BinaryIO]:
//| """Returns the current secondary terminal."""
//| ...
//|
@ -46,7 +46,7 @@ STATIC mp_obj_t multiterminal_obj_get_secondary_terminal() {
}
MP_DEFINE_CONST_FUN_OBJ_0(multiterminal_get_secondary_terminal_obj, multiterminal_obj_get_secondary_terminal);
//| def set_secondary_terminal(stream: stream) -> None:
//| def set_secondary_terminal(stream: typing.BinaryIO) -> None:
//| """Read additional input from the given stream and write out back to it.
//| This doesn't replace the core stream (usually UART or native USB) but is
//| mixed in instead.

View File

@ -50,12 +50,12 @@
//| pixel_off = bytearray([0, 0, 0])
//| neopixel_write.neopixel_write(pin, pixel_off)"""
//|
//| def neopixel_write(digitalinout: digitalio.DigitalInOut, buf: bytearray) -> None:
//| """Write buf out on the given DigitalInOut.
//| def neopixel_write(digitalinout: digitalio.DigitalInOut, buf: ReadableBuffer) -> None:
//| """Write buf out on the given DigitalInOut.
//|
//| :param digitalinout: the DigitalInOut to output with
//| :param buf: The bytes to clock out. No assumption is made about color order"""
//| ...
//| :param digitalinout: the DigitalInOut to output with
//| :param buf: The bytes to clock out. No assumption is made about color order"""
//| ...
STATIC mp_obj_t neopixel_write_neopixel_write_(mp_obj_t digitalinout_obj, mp_obj_t buf) {
if (!MP_OBJ_IS_TYPE(digitalinout_obj, &digitalio_digitalinout_type)) {
mp_raise_TypeError_varg(translate("Expected a %q"), digitalio_digitalinout_type.name);

View File

@ -49,7 +49,8 @@
//| ...
//|
//| def __bool__(self) -> bool: ...
//| def __bool__(self) -> bool:
//| ...
//|
//| def __len__(self) -> int:
//| """Return the length. This is used by (`len`)"""
@ -70,6 +71,18 @@ STATIC const mp_rom_map_elem_t nvm_bytearray_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(nvm_bytearray_locals_dict, nvm_bytearray_locals_dict_table);
//| @overload
//| def __getitem__(self, index: slice) -> bytearray: ...
//| def __getitem__(self, index: int) -> int:
//| """Returns the value at the given index."""
//| ...
//|
//| @overload
//| def __setitem__(self, index: slice, value: ReadableBuffer) -> None: ...
//| def __setitem__(self, index: int, value: int) -> None:
//| """Set the value at the given index."""
//| ...
//|
STATIC mp_obj_t nvm_bytearray_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t value) {
if (value == MP_OBJ_NULL) {
// delete item

View File

@ -54,7 +54,7 @@ STATIC mp_obj_t os_uname(void) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_0(os_uname_obj, os_uname);
//| def chdir(path: string) -> None:
//| def chdir(path: str) -> None:
//| """Change current directory."""
//| ...
//|
@ -65,7 +65,7 @@ mp_obj_t os_chdir(mp_obj_t path_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(os_chdir_obj, os_chdir);
//| def getcwd() -> string:
//| def getcwd() -> str:
//| """Get the current directory."""
//| ...
//|
@ -74,7 +74,7 @@ mp_obj_t os_getcwd(void) {
}
MP_DEFINE_CONST_FUN_OBJ_0(os_getcwd_obj, os_getcwd);
//| def listdir(dir: string) -> string:
//| def listdir(dir: str) -> str:
//| """With no argument, list the current directory. Otherwise list the given directory."""
//| ...
//|
@ -89,7 +89,7 @@ mp_obj_t os_listdir(size_t n_args, const mp_obj_t *args) {
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(os_listdir_obj, 0, 1, os_listdir);
//| def mkdir(path: string) -> None:
//| def mkdir(path: str) -> None:
//| """Create a new directory."""
//| ...
//|
@ -100,7 +100,7 @@ mp_obj_t os_mkdir(mp_obj_t path_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(os_mkdir_obj, os_mkdir);
//| def remove(path: string) -> None:
//| def remove(path: str) -> None:
//| """Remove a file."""
//| ...
//|
@ -111,7 +111,7 @@ mp_obj_t os_remove(mp_obj_t path_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(os_remove_obj, os_remove);
//| def rmdir(path: string) -> None:
//| def rmdir(path: str) -> None:
//| """Remove a directory."""
//| ...
//|
@ -123,7 +123,7 @@ mp_obj_t os_rename(mp_obj_t old_path_in, mp_obj_t new_path_in) {
}
MP_DEFINE_CONST_FUN_OBJ_2(os_rename_obj, os_rename);
//| def rename(old_path: string, new_path: string) -> string:
//| def rename(old_path: str, new_path: str) -> str:
//| """Rename a file."""
//| ...
//|
@ -134,7 +134,7 @@ mp_obj_t os_rmdir(mp_obj_t path_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(os_rmdir_obj, os_rmdir);
//| def stat(path: string) -> string:
//| def stat(path: str) -> str:
//| """Get the status of a file or directory.
//|
//| .. note:: On builds without long integers, the number of seconds
@ -149,7 +149,7 @@ mp_obj_t os_stat(mp_obj_t path_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(os_stat_obj, os_stat);
//| def statvfs(path: string) -> Tuple[string, string, string, string, string, string, string, string, string, string]:
//| def statvfs(path: str) -> Tuple[int, int, int, int, int, int, int, int, int, int]:
//| """Get the status of a fileystem.
//|
//| Returns a tuple with the filesystem information in the following order:
@ -189,7 +189,7 @@ STATIC mp_obj_t os_sync(void) {
}
MP_DEFINE_CONST_FUN_OBJ_0(os_sync_obj, os_sync);
//| def urandom(size: int) -> string:
//| def urandom(size: int) -> str:
//| """Returns a string of *size* random bytes based on a hardware True Random
//| Number Generator. When not available, it will raise a NotImplementedError."""
//| ...
@ -224,9 +224,9 @@ STATIC const mp_rom_map_elem_t os_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_urandom), MP_ROM_PTR(&os_urandom_obj) },
//| """.. data:: sep
//|
//| Separator used to delineate path components such as folder and file names."""
//| sep: str
//| """Separator used to delineate path components such as folder and file names."""
//|
{ MP_ROM_QSTR(MP_QSTR_sep), MP_ROM_QSTR(MP_QSTR__slash_) },
};

View File

@ -150,7 +150,7 @@ STATIC mp_obj_t pulseio_pwmout_obj___exit__(size_t n_args, const mp_obj_t *args)
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pulseio_pwmout___exit___obj, 4, 4, pulseio_pwmout_obj___exit__);
//| duty_cycle: int = ...
//| duty_cycle: int
//| """16 bit value that dictates how much of one cycle is high (1) versus low
//| (0). 0xffff will always be high, 0 will always be low and 0x7fff will
//| be half high and then half low.
@ -186,7 +186,7 @@ const mp_obj_property_t pulseio_pwmout_duty_cycle_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| frequency: int = ...
//| frequency: int
//| """32 bit value that dictates the PWM frequency in Hertz (cycles per
//| second). Only writeable when constructed with ``variable_frequency=True``.
//|

View File

@ -196,7 +196,7 @@ STATIC mp_obj_t pulseio_pulsein_obj_popleft(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(pulseio_pulsein_popleft_obj, pulseio_pulsein_obj_popleft);
//| maxlen: int = ...
//| maxlen: int
//| """The maximum length of the PulseIn. When len() is equal to maxlen,
//| it is unclear which pulses are active and which are idle."""
//|
@ -215,7 +215,7 @@ const mp_obj_property_t pulseio_pulsein_maxlen_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| paused: bool = ...
//| paused: bool
//| """True when pulse capture is paused as a result of :py:func:`pause` or an error during capture
//| such as a signal that is too fast."""
//|

View File

@ -41,7 +41,7 @@
//| pulsed signal consists of timed on and off periods. Unlike PWM, there is no set duration
//| for on and off pairs."""
//|
//| def __init__(self, carrier: pulseio.PWMOut) -> None:
//| def __init__(self, carrier: PWMOut) -> None:
//| """Create a PulseOut object associated with the given PWMout object.
//|
//| :param ~pulseio.PWMOut carrier: PWMOut that is set to output on the desired pin.
@ -110,7 +110,7 @@ STATIC mp_obj_t pulseio_pulseout_obj___exit__(size_t n_args, const mp_obj_t *arg
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pulseio_pulseout___exit___obj, 4, 4, pulseio_pulseout_obj___exit__);
//| def send(self, pulses: array.array) -> None:
//| def send(self, pulses: ReadableBuffer) -> None:
//| """Pulse alternating on and off durations in microseconds starting with on.
//| ``pulses`` must be an `array.array` with data type 'H' for unsigned
//| halfword (two bytes).

View File

@ -46,6 +46,9 @@
//| .. warning:: Numbers from this module are not cryptographically strong! Use
//| bytes from `os.urandom` directly for true randomness."""
//|
//| from typing import TypeVar
//| _T = TypeVar('_T')
//|
//| def seed(seed: int) -> None:
//| """Sets the starting seed of the random number generation. Further calls to
@ -129,7 +132,7 @@ STATIC mp_obj_t random_randint(mp_obj_t a_in, mp_obj_t b_in) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(random_randint_obj, random_randint);
//| def choice(seq: list) -> Any:
//| def choice(seq: Sequence[_T]) -> _T:
//| """Returns a randomly selected element from the given sequence. Raises
//| IndexError when the sequence is empty."""
//| ...

View File

@ -128,7 +128,7 @@ STATIC void preflight_pins_or_throw(uint8_t clock_pin, uint8_t *rgb_pins, uint8_
}
}
//| def __init__(self, *, width: int, bit_depth: List[digitalio.DigitalInOut], rgb_pins: List[digitalio.DigitalInOut], addr_pins: List[digitalio.DigitalInOut], clock_pin: digitalio.DigitalInOut, latch_pin: digitalio.DigitalInOut, output_enable_pin: digitalio.DigitalInOut, doublebuffer: bool = True, framebuffer: Optional[WriteableBuffer] = None, height: int = 0) -> None:
//| def __init__(self, *, width: int, bit_depth: int, rgb_pins: Sequence[digitalio.DigitalInOut], addr_pins: List[digitalio.DigitalInOut], clock_pin: digitalio.DigitalInOut, latch_pin: digitalio.DigitalInOut, output_enable_pin: digitalio.DigitalInOut, doublebuffer: bool = True, framebuffer: Optional[WriteableBuffer] = None, height: int = 0) -> None:
//| """Create a RGBMatrix object with the given attributes. The height of
//| the display is determined by the number of rgb and address pins:
//| len(rgb_pins) // 3 * 2 ** len(address_pins). With 6 RGB pins and 4
@ -257,7 +257,7 @@ static void check_for_deinit(rgbmatrix_rgbmatrix_obj_t *self) {
}
}
//| brightness: float = ...
//| brightness: float
//| """In the current implementation, 0.0 turns the display off entirely
//| and any other value up to 1.0 turns the display on fully."""
//|
@ -301,7 +301,7 @@ STATIC mp_obj_t rgbmatrix_rgbmatrix_refresh(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(rgbmatrix_rgbmatrix_refresh_obj, rgbmatrix_rgbmatrix_refresh);
//| width: int = ...
//| width: int
//| """The width of the display, in pixels"""
//|
STATIC mp_obj_t rgbmatrix_rgbmatrix_get_width(mp_obj_t self_in) {
@ -317,7 +317,7 @@ const mp_obj_property_t rgbmatrix_rgbmatrix_width_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| height: int = ...
//| height: int
//| """The height of the display, in pixels"""
//|
STATIC mp_obj_t rgbmatrix_rgbmatrix_get_height(mp_obj_t self_in) {

View File

@ -116,7 +116,7 @@ STATIC mp_obj_t rotaryio_incrementalencoder_obj___exit__(size_t n_args, const mp
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(rotaryio_incrementalencoder___exit___obj, 4, 4, rotaryio_incrementalencoder_obj___exit__);
//| position: int = ...
//| position: int
//| """The current position in terms of pulses. The number of pulses per rotation is defined by the
//| specific hardware."""
//|

View File

@ -53,7 +53,7 @@ STATIC mp_obj_t rtc_rtc_make_new(const mp_obj_type_t *type, size_t n_args, const
return (mp_obj_t)&rtc_rtc_obj;
}
//| datetime: time.struct_time = ...
//| datetime: time.struct_time
//| """The current date and time of the RTC as a `time.struct_time`.
//|
//| This must be set to the current date and time whenever the board loses power::
@ -94,7 +94,7 @@ const mp_obj_property_t rtc_rtc_datetime_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| calibration: int = ...
//| calibration: int
//| """The RTC calibration value as an `int`.
//|
//| A positive value speeds up the clock and a negative value slows it down.

View File

@ -44,7 +44,7 @@
//| `busio.SPI`, not `bitbangio.SPI`. Usually an SDCard object is used
//| with ``storage.VfsFat`` to allow file I/O to an SD card."""
//|
//| def __init__(bus:busio.SPI, cs: digitalio.DigitalInOut=digitalio.DigitalInOut, baudrate: int=8000000) -> None:
//| def __init__(self, bus: busio.SPI, cs: microcontroller.Pin, baudrate: int = 8000000) -> None:
//| """Construct an SPI SD Card object with the given properties
//|
//| :param busio.SPI spi: The SPI bus
@ -94,7 +94,7 @@ STATIC mp_obj_t sdcardio_sdcard_make_new(const mp_obj_type_t *type, size_t n_arg
}
//| def count() -> int:
//| def count(self) -> int:
//| """Returns the total number of sectors
//|
//| Due to technical limitations, this is a function and not a property.
@ -107,7 +107,7 @@ mp_obj_t sdcardio_sdcard_count(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(sdcardio_sdcard_count_obj, sdcardio_sdcard_count);
//| def deinit() -> None:
//| def deinit(self) -> None:
//| """Disable permanently.
//|
//| :return: None"""
@ -120,7 +120,7 @@ mp_obj_t sdcardio_sdcard_deinit(mp_obj_t self_in) {
MP_DEFINE_CONST_FUN_OBJ_1(sdcardio_sdcard_deinit_obj, sdcardio_sdcard_deinit);
//| def readblocks(start_block: int, buf: bytearray) -> None:
//| def readblocks(self, start_block: int, buf: WriteableBuffer) -> None:
//|
//| """Read one or more blocks from the card
//|
@ -144,7 +144,7 @@ mp_obj_t sdcardio_sdcard_readblocks(mp_obj_t self_in, mp_obj_t start_block_in, m
MP_DEFINE_CONST_FUN_OBJ_3(sdcardio_sdcard_readblocks_obj, sdcardio_sdcard_readblocks);
//| def writeblocks(start_block: int, buf: bytearray) -> None:
//| def writeblocks(self, start_block: int, buf: ReadableBuffer) -> None:
//|
//| """Write one or more blocks to the card
//|

View File

@ -49,7 +49,7 @@
//| 25MHz. Usually an SDCard object is used with ``storage.VfsFat``
//| to allow file I/O to an SD card."""
//|
//| def __init__(*, clock: digitalio.DigitalInOut, command: digitalio.DigitalInOut, data: List[digitalio.DigitalInOut], frequency: int) -> None:
//| def __init__(self, clock: microcontroller.Pin, command: microcontroller.Pin, data: Sequence[microcontroller.Pin], frequency: int) -> None:
//| """Construct an SDIO SD Card object with the given properties
//|
//| :param ~microcontroller.Pin clock: the pin to use for the clock.
@ -109,7 +109,7 @@ STATIC void check_for_deinit(sdioio_sdcard_obj_t *self) {
}
}
//| def configure(*, frequency: int=0, width: int=0) -> None:
//| def configure(self, frequency: int = 0, width: int = 0) -> None:
//| """Configures the SDIO bus.
//|
//| :param int frequency: 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.
@ -146,7 +146,7 @@ STATIC mp_obj_t sdioio_sdcard_configure(size_t n_args, const mp_obj_t *pos_args,
}
MP_DEFINE_CONST_FUN_OBJ_KW(sdioio_sdcard_configure_obj, 1, sdioio_sdcard_configure);
//| def count() -> int:
//| def count(self) -> int:
//| """Returns the total number of sectors
//|
//| Due to technical limitations, this is a function and not a property.
@ -160,7 +160,7 @@ STATIC mp_obj_t sdioio_sdcard_count(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(sdioio_sdcard_count_obj, sdioio_sdcard_count);
//| def readblocks(start_block: int, buf: bytearray) -> None:
//| def readblocks(self, start_block: int, buf: WriteableBuffer) -> None:
//|
//| """Read one or more blocks from the card
//|
@ -182,7 +182,7 @@ mp_obj_t sdioio_sdcard_readblocks(mp_obj_t self_in, mp_obj_t start_block_in, mp_
MP_DEFINE_CONST_FUN_OBJ_3(sdioio_sdcard_readblocks_obj, sdioio_sdcard_readblocks);
//| def writeblocks(start_block: int, buf: bytearray) -> None:
//| def writeblocks(self, start_block: int, buf: WriteableBuffer) -> None:
//|
//| """Write one or more blocks to the card
//|
@ -194,7 +194,7 @@ MP_DEFINE_CONST_FUN_OBJ_3(sdioio_sdcard_readblocks_obj, sdioio_sdcard_readblocks
mp_obj_t sdioio_sdcard_writeblocks(mp_obj_t self_in, mp_obj_t start_block_in, mp_obj_t buf_in) {
uint32_t start_block = mp_obj_get_int(start_block_in);
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(buf_in, &bufinfo, MP_BUFFER_WRITE);
mp_get_buffer_raise(buf_in, &bufinfo, MP_BUFFER_READ);
sdioio_sdcard_obj_t *self = (sdioio_sdcard_obj_t*)self_in;
int result = common_hal_sdioio_sdcard_writeblocks(self, start_block, &bufinfo);
if (result < 0) {
@ -244,7 +244,7 @@ const mp_obj_property_t sdioio_sdcard_width_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| def deinit() -> None:
//| def deinit(self) -> None:
//| """Disable permanently.
//|
//| :return: None"""

View File

@ -212,7 +212,7 @@ STATIC mp_obj_t socket_connect(mp_obj_t self_in, mp_obj_t addr_in) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_connect_obj, socket_connect);
//| def send(self, bytes: bytes) -> int:
//| def send(self, bytes: ReadableBuffer) -> int:
//| """Send some bytes to the connected remote address.
//| Suits sockets of type SOCK_STREAM
//|
@ -312,7 +312,7 @@ STATIC mp_obj_t socket_recv(mp_obj_t self_in, mp_obj_t len_in) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_recv_obj, socket_recv);
//| def sendto(self, bytes: bytes, address: tuple) -> int:
//| def sendto(self, bytes: ReadableBuffer, address: tuple) -> int:
//| """Send some bytes to a specific address.
//| Suits sockets of type SOCK_DGRAM
//|
@ -512,7 +512,7 @@ STATIC const mp_obj_type_t socket_type = {
.locals_dict = (mp_obj_dict_t*)&socket_locals_dict,
};
//| def getaddrinfo(host: string, port: string) -> tuple:
//| def getaddrinfo(host: str, port: int) -> tuple:
//| """Gets the address information for a hostname and port
//|
//| Returns the appropriate family, socket type, socket protocol and

View File

@ -43,7 +43,7 @@
//| directly."""
//|
//| def mount(filesystem: VfsFat, mount_path: string, *, readonly: bool = False) -> None:
//| def mount(filesystem: VfsFat, mount_path: str, *, readonly: bool = False) -> None:
//| """Mounts the given filesystem object at the given path.
//|
//| This is the CircuitPython analog to the UNIX ``mount`` command.
@ -80,7 +80,7 @@ mp_obj_t storage_mount(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_arg
}
MP_DEFINE_CONST_FUN_OBJ_KW(storage_mount_obj, 2, storage_mount);
//| def umount(mount: Union[string, VfsFat]) -> None:
//| def umount(mount: Union[str, VfsFat]) -> None:
//| """Unmounts the given filesystem object or if *mount* is a path, then unmount
//| the filesystem mounted at that location.
//|
@ -98,7 +98,7 @@ mp_obj_t storage_umount(mp_obj_t mnt_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(storage_umount_obj, storage_umount);
//| def remount(mount_path: string, readonly: bool = False, *, disable_concurrent_write_protection: bool = False) -> None:
//| def remount(mount_path: str, readonly: bool = False, *, disable_concurrent_write_protection: bool = False) -> None:
//| """Remounts the given path with new parameters.
//|
//| :param bool readonly: True when the filesystem should be readonly to CircuitPython.
@ -128,7 +128,7 @@ mp_obj_t storage_remount(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_a
}
MP_DEFINE_CONST_FUN_OBJ_KW(storage_remount_obj, 1, storage_remount);
//| def getmount(mount_path: string) -> VfsFat:
//| def getmount(mount_path: str) -> VfsFat:
//| """Retrieves the mount object associated with the mount path"""
//| ...
//|
@ -168,43 +168,43 @@ STATIC const mp_rom_map_elem_t storage_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_erase_filesystem), MP_ROM_PTR(&storage_erase_filesystem_obj) },
//| class VfsFat:
//| def __init__(self, block_device: string) -> None:
//| def __init__(self, block_device: str) -> None:
//| """Create a new VfsFat filesystem around the given block device.
//|
//| :param block_device: Block device the the filesystem lives on"""
//|
//| label: string = ...
//| """The filesystem label, up to 11 case-insensitive bytes. Note that
//| this property can only be set when the device is writable by the
//| microcontroller."""
//| ...
//| label: str
//| """The filesystem label, up to 11 case-insensitive bytes. Note that
//| this property can only be set when the device is writable by the
//| microcontroller."""
//| ...
//|
//| def mkfs(self) -> None:
//| """Format the block device, deleting any data that may have been there"""
//| ...
//|
//| def open(self, path: string, mode: string) -> None:
//| def open(self, path: str, mode: str) -> None:
//| """Like builtin ``open()``"""
//| ...
//|
//| def ilistdir(self, path: string) -> iterator:
//| def ilistdir(self, path: str) -> Iterator[Tuple[AnyStr, int, int, int]]:
//| """Return an iterator whose values describe files and folders within
//| ``path``"""
//| ...
//|
//| def mkdir(self, path: string) -> None:
//| def mkdir(self, path: str) -> None:
//| """Like `os.mkdir`"""
//| ...
//|
//| def rmdir(self, path: string) -> None:
//| def rmdir(self, path: str) -> None:
//| """Like `os.rmdir`"""
//| ...
//|
//| def stat(self, path: string) -> string:
//| def stat(self, path: str) -> str:
//| """Like `os.stat`"""
//| ...
//|
//| def statvfs(self, path: string) -> Tuple[string, string, string, string, string, string, string, string, string, string]:
//| def statvfs(self, path: str) -> Tuple[str, str, str, str, str, str, str, str, str, str]:
//| """Like `os.statvfs`"""
//| ...
//|

View File

@ -62,7 +62,7 @@ STATIC mp_obj_t struct_calcsize(mp_obj_t fmt_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(struct_calcsize_obj, struct_calcsize);
//| def pack(fmt: string, *values: ReadableBuffer) -> bytes:
//| def pack(fmt: str, *values: ReadableBuffer) -> bytes:
//| """Pack the values according to the format string fmt.
//| The return value is a bytes object encoding the values."""
//| ...
@ -80,7 +80,7 @@ STATIC mp_obj_t struct_pack(size_t n_args, const mp_obj_t *args) {
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(struct_pack_obj, 1, MP_OBJ_FUN_ARGS_MAX, struct_pack);
//| def pack_into(fmt: string, buffer: WriteableBuffer, offset: int, *values: readableBuffer) -> None:
//| def pack_into(fmt: str, buffer: WriteableBuffer, offset: int, *values: ReadableBuffer) -> None:
//| """Pack the values according to the format string fmt into a buffer
//| starting at offset. offset may be negative to count from the end of buffer."""
//| ...
@ -106,7 +106,7 @@ STATIC mp_obj_t struct_pack_into(size_t n_args, const mp_obj_t *args) {
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(struct_pack_into_obj, 3, MP_OBJ_FUN_ARGS_MAX, struct_pack_into);
//| def unpack(fmt: string, data: ReadableBuffer) -> tuple:
//| def unpack(fmt: str, data: ReadableBuffer) -> tuple:
//| """Unpack from the data according to the format string fmt. The return value
//| is a tuple of the unpacked values. The buffer size must match the size
//| required by the format."""
@ -124,7 +124,7 @@ STATIC mp_obj_t struct_unpack(size_t n_args, const mp_obj_t *args) {
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(struct_unpack_obj, 2, 3, struct_unpack);
//| def unpack_from(fmt: string, data: ReadableBuffer, offset: int = 0) -> tuple:
//| def unpack_from(fmt: str, data: ReadableBuffer, offset: int = 0) -> tuple:
//| """Unpack from the data starting at offset according to the format string fmt.
//| offset may be negative to count from the end of buffer. The return value is
//| a tuple of the unpacked values. The buffer size must be at least as big

View File

@ -45,7 +45,7 @@
//| ...
//|
//| serial_connected: bool = ...
//| serial_connected: bool
//| """Returns the USB serial communication status (read-only).
//|
//| .. note::
@ -73,7 +73,7 @@ const mp_obj_property_t supervisor_serial_connected_obj = {
};
//| serial_bytes_available: int = ...
//| serial_bytes_available: int
//| """Returns the whether any bytes are available to read
//| on the USB serial input. Allows for polling to see whether
//| to call the built-in input() or wait. (read-only)"""

View File

@ -39,7 +39,7 @@
//| """Supervisor settings"""
//|
//| runtime: Runtime = ...
//| runtime: Runtime
//| """Runtime information, such as ``runtime.serial_connected``
//| (USB serial connection status).
//| This object is the sole instance of `supervisor.Runtime`."""

View File

@ -40,7 +40,7 @@
//| class Terminal:
//| """Display a character stream with a TileGrid"""
//|
//| def __init__(self, tilegrid: bitmap, font: fontio.BuiltinFont) -> None:
//| def __init__(self, tilegrid: displayio.TileGrid, font: fontio.BuiltinFont) -> None:
//| """Terminal manages tile indices and cursor position based on VT100 commands. The font should be
//| a `fontio.BuiltinFont` and the TileGrid's bitmap should match the font's bitmap."""
//| ...

View File

@ -108,7 +108,7 @@ STATIC mp_obj_t touchio_touchin_obj___exit__(size_t n_args, const mp_obj_t *args
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(touchio_touchin___exit___obj, 4, 4, touchio_touchin_obj___exit__);
//| value: bool = ...
//| value: bool
//| """Whether the touch pad is being touched or not. (read-only)
//|
//| True when `raw_value` > `threshold`."""
@ -128,7 +128,7 @@ const mp_obj_property_t touchio_touchin_value_obj = {
};
//| raw_value: int = ...
//| raw_value: int
//| """The raw touch measurement as an `int`. (read-only)"""
//|
STATIC mp_obj_t touchio_touchin_obj_get_raw_value(mp_obj_t self_in) {
@ -147,7 +147,7 @@ const mp_obj_property_t touchio_touchin_raw_value_obj = {
};
//| threshold: Optional[int] = ...
//| threshold: Optional[int]
//| """Minimum `raw_value` needed to detect a touch (and for `value` to be `True`).
//|
//| When the **TouchIn** object is created, an initial `raw_value` is read from the pin,

View File

@ -34,7 +34,7 @@
//| """Heap size analysis"""
//|
//| def info(object: Any) -> int:
//| def info(object: object) -> int:
//| """Prints memory debugging info for the given object and returns the
//| estimated size."""
//| ...

View File

@ -58,7 +58,7 @@ STATIC mp_obj_t usb_hid_device_send_report(mp_obj_t self_in, mp_obj_t buffer) {
}
MP_DEFINE_CONST_FUN_OBJ_2(usb_hid_device_send_report_obj, usb_hid_device_send_report);
//| usage_page: int = ...
//| usage_page: int
//| """The usage page of the device as an `int`. Can be thought of a category. (read-only)"""
//|
STATIC mp_obj_t usb_hid_device_obj_get_usage_page(mp_obj_t self_in) {
@ -74,7 +74,7 @@ const mp_obj_property_t usb_hid_device_usage_page_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| usage: int = ...
//| usage: int
//| """The functionality of the device as an int. (read-only)
//|
//| For example, Keyboard is 0x06 within the generic desktop usage page 0x01.

View File

@ -36,7 +36,7 @@
//| The `usb_hid` module allows you to output data as a HID device."""
//|
//| usb_hid.devices: Any = ...
//| devices: Tuple[Device, ...]
//| """Tuple of all active HID device interfaces."""
//|
STATIC const mp_rom_map_elem_t usb_hid_module_globals_table[] = {

View File

@ -48,7 +48,7 @@
// These are standard stream methods. Code is in py/stream.c.
//
//| def read(self, nbytes: int = None) -> Optional[bytes]:
//| def read(self, nbytes: Optional[int] = None) -> Optional[bytes]:
//| """Read characters. If ``nbytes`` is specified then read at most that many
//| bytes. Otherwise, read everything that arrives until the connection
//| times out. Providing the number of bytes expected is highly recommended

View File

@ -37,7 +37,7 @@ static mp_obj_t vectorio_circle_make_new(const mp_obj_type_t *type, size_t n_arg
}
//| radius : int = ...
//| radius : int
//| """The radius of the circle in pixels."""
//|
STATIC mp_obj_t vectorio_circle_obj_get_radius(mp_obj_t self_in) {

View File

@ -15,10 +15,8 @@
// #define VECTORIO_POLYGON_DEBUG(...) mp_printf(&mp_plat_print __VA_OPT__(,) __VA_ARGS__)
//| from typing import List, Tuple
//|
//| class Polygon:
//| def __init__(self, points: List[ Tuple[ x, y ], ... ] ) -> None:
//| def __init__(self, points: List[Tuple[int, int]]) -> None:
//| """Represents a closed shape by ordered vertices
//|
//| :param points: Vertices for the polygon"""
@ -44,7 +42,7 @@ static mp_obj_t vectorio_polygon_make_new(const mp_obj_type_t *type, size_t n_ar
}
//| points: List[ Tuple[ x, y ], ... ] = ...
//| points: List[Tuple[int, int]]
//| """Set a new look and shape for this polygon"""
//|
STATIC mp_obj_t vectorio_polygon_obj_get_points(mp_obj_t self_in) {

View File

@ -20,7 +20,7 @@
//| class VectorShape:
//| def __init__(self, shape: vectorio.Polygon, pixel_shader: displayio.Palette, x: int=0, y: int=0) -> None:
//| def __init__(self, shape: Polygon, pixel_shader: displayio.Palette, x: int=0, y: int=0) -> None:
//| """Binds a vector shape to a location and pixel color
//|
//| :param shape: The shape to draw.
@ -93,7 +93,7 @@ STATIC mp_obj_t vectorio_vector_shape_make_new(const mp_obj_type_t *type, size_t
}
//| x: int = ...
//| x: int
//| """X position of the center point of the shape in the parent."""
//|
STATIC mp_obj_t vectorio_vector_shape_obj_get_x(mp_obj_t self_in) {
@ -119,7 +119,7 @@ const mp_obj_property_t vectorio_vector_shape_x_obj = {
};
//| y: int = ...
//| y: int
//| """Y position of the center point of the shape in the parent."""
//|
STATIC mp_obj_t vectorio_vector_shape_obj_get_y(mp_obj_t self_in) {
@ -145,7 +145,7 @@ const mp_obj_property_t vectorio_vector_shape_y_obj = {
};
//| pixel_shader: displayio.Palette = ...
//| pixel_shader: displayio.Palette
//| """The pixel shader of the shape."""
//|
STATIC mp_obj_t vectorio_vector_shape_obj_get_pixel_shader(mp_obj_t self_in) {

View File

@ -32,15 +32,15 @@
//| def __init__(self) -> None:
//| """Enum-like class to define the run mode of the watchdog timer."""
//|
//| RAISE: watchdog.WatchDogMode = ...
//| RAISE: WatchDogMode
//| """Raise an exception when the WatchDogTimer expires.
//|
//| :type watchdog.WatchDogMode:"""
//| :type WatchDogMode:"""
//|
//| RESET: watchdog.WatchDogMode = ...
//| RESET: WatchDogMode
//| """Reset the system if the WatchDogTimer expires.
//|
//| :type watchdog.WatchDogMode:"""
//| :type WatchDogMode:"""
//|
const mp_obj_type_t watchdog_watchdogmode_type;

View File

@ -54,7 +54,7 @@
//| ...
//|
//| def feed(self):
//| def feed(self) -> None:
//| """Feed the watchdog timer. This must be called regularly, otherwise
//| the timer will expire."""
//| ...
@ -71,7 +71,7 @@ STATIC mp_obj_t watchdog_watchdogtimer_feed(mp_obj_t self_in) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(watchdog_watchdogtimer_feed_obj, watchdog_watchdogtimer_feed);
//| def deinit(self):
//| def deinit(self) -> None:
//| """Stop the watchdog timer. This may raise an error if the watchdog
//| timer cannot be disabled on this platform."""
//| ...
@ -89,7 +89,7 @@ STATIC mp_obj_t watchdog_watchdogtimer_deinit(mp_obj_t self_in) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(watchdog_watchdogtimer_deinit_obj, watchdog_watchdogtimer_deinit);
//| timeout: float = ...
//| timeout: float
//| """The maximum number of seconds that can elapse between calls
//| to feed()"""
//|
@ -119,7 +119,7 @@ const mp_obj_property_t watchdog_watchdogtimer_timeout_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| mode: watchdog.WatchDogMode = ...
//| mode: WatchDogMode
//| """The current operating mode of the WatchDogTimer `watchdog.WatchDogMode`.
//|
//| Setting a WatchDogMode activates the WatchDog::

View File

@ -84,7 +84,7 @@ STATIC mp_obj_t wiznet5k_make_new(const mp_obj_type_t *type, size_t n_args, cons
return ret;
}
//| connected: bool = ...
//| connected: bool
//| """(boolean, readonly) is this device physically connected?"""
//|
@ -101,7 +101,7 @@ const mp_obj_property_t wiznet5k_connected_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| dhcp: bool = ...
//| dhcp: bool
//| """(boolean, readwrite) is DHCP active on this device?
//|
//| * set to True to activate DHCP, False to turn it off"""
@ -134,7 +134,7 @@ const mp_obj_property_t wiznet5k_dhcp_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| def ifconfig(self, params: tuple = None) -> Optional[tuple]:
//| def ifconfig(self, params: Optional[Tuple] = None) -> Optional[Tuple]:
//| """Called without parameters, returns a tuple of
//| (ip_address, subnet_mask, gateway_address, dns_server)
//|

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