Fix several type hints
This commit is contained in:
parent
54a342a7f5
commit
d356581651
|
@ -43,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) {
|
||||
|
@ -61,7 +61,7 @@ const mp_obj_property_t samd_clock_enabled_obj = {
|
|||
},
|
||||
};
|
||||
|
||||
//| parent: Union[Clock, None] = ...
|
||||
//| parent: Union[Clock, None]
|
||||
//| """Clock parent. (read-only)"""
|
||||
//|
|
||||
STATIC mp_obj_t samd_clock_get_parent(mp_obj_t self_in) {
|
||||
|
@ -89,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) {
|
||||
|
@ -107,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) {
|
||||
|
|
|
@ -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."""
|
||||
|
@ -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: ReadableBuffer = 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[ScanEntry]:
|
||||
//| 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)"""
|
||||
//|
|
||||
|
|
|
@ -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`,
|
||||
|
@ -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[] = {
|
||||
|
|
|
@ -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) },
|
||||
|
|
|
@ -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) },
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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[UUID] = None) -> Tuple[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.
|
||||
//|
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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."""
|
||||
|
|
|
@ -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.
|
||||
//|
|
||||
|
|
|
@ -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"""
|
||||
|
|
|
@ -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: str = ...
|
||||
//| byteorder: str
|
||||
//| """byteorder string for the buffer (read-only)"""
|
||||
//|
|
||||
STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_byteorder(mp_obj_t self_in) {
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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) -> None:
|
||||
//| 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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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."""
|
||||
//|
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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."""
|
||||
//|
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) },
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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[audiocore.WaveFile, audiocore.RawSample, 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.
|
||||
//|
|
||||
|
|
|
@ -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)"""
|
||||
//|
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -175,7 +175,7 @@ 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:
|
||||
//| 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.
|
||||
|
@ -227,7 +227,7 @@ 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:
|
||||
//| 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.
|
||||
//|
|
||||
|
@ -235,7 +235,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(busio_i2c_readfrom_into_obj, 3, busio_i2c_readfrom_in
|
|||
//| as if ``buffer[start:end]``. This will not cause an allocation like
|
||||
//| ``buffer[start:end]`` will so it saves memory.
|
||||
//|
|
||||
//| riting a buffer or slice of length zero is permitted, as it can be used
|
||||
//| Writing a buffer or slice of length zero is permitted, as it can be used
|
||||
//| to poll for the existence of a device.
|
||||
//|
|
||||
//| :param int address: 7-bit device address
|
||||
|
@ -281,12 +281,12 @@ 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:
|
||||
//| 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.
|
||||
//|
|
||||
//| f ``start`` or ``end`` is provided, then the corresponding buffer will be sliced
|
||||
//| 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.
|
||||
//|
|
||||
|
|
|
@ -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."""
|
||||
//|
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -106,7 +106,7 @@ 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:
|
||||
//| 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.
|
||||
//|
|
||||
|
@ -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`
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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."""
|
||||
//|
|
||||
|
|
|
@ -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."""
|
||||
//|
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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"""
|
||||
//|
|
||||
|
|
|
@ -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: Union[FourWire, ParallelBus], 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: 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,7 +343,7 @@ 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) {
|
||||
|
@ -354,7 +359,7 @@ 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) {
|
||||
|
@ -370,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) {
|
||||
|
@ -393,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"""
|
||||
//|
|
||||
//|
|
||||
|
@ -411,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
|
||||
|
|
|
@ -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: 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:
|
||||
//| 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) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -48,15 +48,15 @@
|
|||
//|
|
||||
//| A single tile grid is also known as a Sprite."""
|
||||
//|
|
||||
//| def __init__(self, bitmap: Bitmap, *, pixel_shader: 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``.
|
||||
//|
|
||||
|
|
|
@ -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`."""
|
||||
|
|
|
@ -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"""
|
||||
//|
|
||||
//|
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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: PositionFix = ...
|
||||
//| fix: PositionFix
|
||||
//| """Fix mode."""
|
||||
//|
|
||||
STATIC mp_obj_t gnss_obj_get_fix(mp_obj_t self_in) {
|
||||
|
|
|
@ -10,13 +10,13 @@
|
|||
//| def __init__(self) -> None:
|
||||
//| """Enum-like class to define the position fix mode."""
|
||||
//|
|
||||
//| INVALID: PositionFix = ...
|
||||
//| INVALID: PositionFix
|
||||
//| """No measurement."""
|
||||
//|
|
||||
//| FIX_2D: PositionFix = ...
|
||||
//| FIX_2D: PositionFix
|
||||
//| """2D fix."""
|
||||
//|
|
||||
//| FIX_3D: PositionFix = ...
|
||||
//| FIX_3D: PositionFix
|
||||
//| """3D fix."""
|
||||
//|
|
||||
const mp_obj_type_t gnss_positionfix_type;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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."""
|
||||
//| ...
|
||||
//|
|
||||
|
||||
|
|
|
@ -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."""
|
||||
|
|
|
@ -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:"""
|
||||
|
|
|
@ -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: Optional[nvm.ByteArray] = ...
|
||||
//| 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
|
||||
//| --------------------------------------------------------
|
||||
//|
|
||||
|
|
|
@ -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: Optional[typing.BinaryIO]) -> 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.
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
//| pixel_off = bytearray([0, 0, 0])
|
||||
//| neopixel_write.neopixel_write(pin, pixel_off)"""
|
||||
//|
|
||||
//| def neopixel_write(digitalinout: digitalio.DigitalInOut, buf: bytearray) -> None:
|
||||
//| def neopixel_write(digitalinout: digitalio.DigitalInOut, buf: ReadableBuffer) -> None:
|
||||
//| """Write buf out on the given DigitalInOut.
|
||||
//|
|
||||
//| :param digitalinout: the DigitalInOut to output with
|
||||
|
|
|
@ -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: str) -> Tuple[str, str, str, str, str, str, str, str, str, str]:
|
||||
//| 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:
|
||||
|
|
|
@ -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``.
|
||||
//|
|
||||
|
|
|
@ -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."""
|
||||
//|
|
||||
|
|
|
@ -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).
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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."""
|
||||
//|
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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(self, 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(self, start_block: int, buf: bytearray) -> None:
|
||||
//| def writeblocks(self, start_block: int, buf: ReadableBuffer) -> None:
|
||||
//|
|
||||
//| """Write one or more blocks to the card
|
||||
//|
|
||||
|
|
|
@ -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(self, 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(self, 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) {
|
||||
|
|
|
@ -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
|
||||
//|
|
||||
|
|
|
@ -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)"""
|
||||
|
|
|
@ -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`."""
|
||||
|
|
|
@ -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."""
|
||||
//| ...
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -42,7 +42,7 @@ static mp_obj_t vectorio_polygon_make_new(const mp_obj_type_t *type, size_t n_ar
|
|||
}
|
||||
|
||||
|
||||
//| points: List[Tuple[int, int]] = ...
|
||||
//| 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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -32,12 +32,12 @@
|
|||
//| def __init__(self) -> None:
|
||||
//| """Enum-like class to define the run mode of the watchdog timer."""
|
||||
//|
|
||||
//| RAISE: WatchDogMode = ...
|
||||
//| RAISE: WatchDogMode
|
||||
//| """Raise an exception when the WatchDogTimer expires.
|
||||
//|
|
||||
//| :type WatchDogMode:"""
|
||||
//|
|
||||
//| RESET: WatchDogMode = ...
|
||||
//| RESET: WatchDogMode
|
||||
//| """Reset the system if the WatchDogTimer expires.
|
||||
//|
|
||||
//| :type WatchDogMode:"""
|
||||
|
|
|
@ -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: WatchDogMode = ...
|
||||
//| mode: WatchDogMode
|
||||
//| """The current operating mode of the WatchDogTimer `watchdog.WatchDogMode`.
|
||||
//|
|
||||
//| Setting a WatchDogMode activates the WatchDog::
|
||||
|
|
|
@ -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)
|
||||
//|
|
||||
|
|
Loading…
Reference in New Issue