commit
02b71e013a
@ -65,13 +65,13 @@
|
|||||||
//| connections and also initiate connections."""
|
//| connections and also initiate connections."""
|
||||||
//|
|
//|
|
||||||
|
|
||||||
//| def __init__(self, ):
|
//| def __init__(self) -> None:
|
||||||
//| """You cannot create an instance of `_bleio.Adapter`.
|
//| """You cannot create an instance of `_bleio.Adapter`.
|
||||||
//| Use `_bleio.adapter` to access the sole instance available."""
|
//| Use `_bleio.adapter` to access the sole instance available."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
|
|
||||||
//| enabled: Any = ...
|
//| enabled: bool = ...
|
||||||
//| """State of the BLE adapter."""
|
//| """State of the BLE adapter."""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t bleio_adapter_get_enabled(mp_obj_t self) {
|
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 },
|
(mp_obj_t)&mp_const_none_obj },
|
||||||
};
|
};
|
||||||
|
|
||||||
//| address: Any = ...
|
//| address: Address = ...
|
||||||
//| """MAC address of the BLE adapter. (read-only)"""
|
//| """MAC address of the BLE adapter. (read-only)"""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t bleio_adapter_get_address(mp_obj_t self) {
|
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 },
|
(mp_obj_t)&mp_const_none_obj },
|
||||||
};
|
};
|
||||||
|
|
||||||
//| name: Any = ...
|
//| name: str = ...
|
||||||
//| """name of the BLE adapter used once connected.
|
//| """name of the BLE adapter used once connected.
|
||||||
//| The name is "CIRCUITPY" + the last four hex digits of ``adapter.address``,
|
//| The name is "CIRCUITPY" + the last four hex digits of ``adapter.address``,
|
||||||
//| to make it easy to distinguish multiple CircuitPython boards."""
|
//| to make it easy to distinguish multiple CircuitPython boards."""
|
||||||
@ -135,7 +135,7 @@ const mp_obj_property_t bleio_adapter_name_obj = {
|
|||||||
(mp_obj_t)&mp_const_none_obj },
|
(mp_obj_t)&mp_const_none_obj },
|
||||||
};
|
};
|
||||||
|
|
||||||
//| def start_advertising(self, data: buf, *, scan_response: buf = None, connectable: bool = True, anonymous: bool = False, timeout: int = 0, interval: float = 0.1) -> Any:
|
//| def start_advertising(self, data: buf, *, scan_response: buf = None, connectable: bool = True, anonymous: bool = False, timeout: int = 0, interval: float = 0.1) -> None:
|
||||||
//| """Starts advertising until `stop_advertising` is called or if connectable, another device
|
//| """Starts advertising until `stop_advertising` is called or if connectable, another device
|
||||||
//| connects to us.
|
//| connects to us.
|
||||||
//|
|
//|
|
||||||
@ -202,7 +202,7 @@ STATIC mp_obj_t bleio_adapter_start_advertising(mp_uint_t n_args, const mp_obj_t
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_adapter_start_advertising_obj, 2, bleio_adapter_start_advertising);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_adapter_start_advertising_obj, 2, bleio_adapter_start_advertising);
|
||||||
|
|
||||||
//| def stop_advertising(self, ) -> Any:
|
//| def stop_advertising(self) -> None:
|
||||||
//| """Stop sending advertising packets."""
|
//| """Stop sending advertising packets."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -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);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_adapter_stop_advertising_obj, bleio_adapter_stop_advertising);
|
||||||
|
|
||||||
//| def start_scan(self, prefixes: sequence = b"", *, buffer_size: int = 512, extended: bool = False, timeout: float = None, interval: float = 0.1, window: float = 0.1, minimum_rssi: int = -80, active: bool = True) -> Any:
|
//| def start_scan(self, prefixes: sequence = b"", *, buffer_size: int = 512, extended: bool = False, timeout: float = None, interval: float = 0.1, window: float = 0.1, minimum_rssi: int = -80, active: bool = True) -> iterable:
|
||||||
//| """Starts a BLE scan and returns an iterator of results. Advertisements and scan responses are
|
//| """Starts a BLE scan and returns an iterator of results. Advertisements and scan responses are
|
||||||
//| filtered and returned separately.
|
//| filtered and returned separately.
|
||||||
//|
|
//|
|
||||||
@ -288,7 +288,7 @@ STATIC mp_obj_t bleio_adapter_start_scan(size_t n_args, const mp_obj_t *pos_args
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_adapter_start_scan_obj, 1, bleio_adapter_start_scan);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_adapter_start_scan_obj, 1, bleio_adapter_start_scan);
|
||||||
|
|
||||||
//| def stop_scan(self, ) -> Any:
|
//| def stop_scan(self) -> None:
|
||||||
//| """Stop the current scan."""
|
//| """Stop the current scan."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -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);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_adapter_stop_scan_obj, bleio_adapter_stop_scan);
|
||||||
|
|
||||||
//| advertising: Any = ...
|
//| advertising: bool = ...
|
||||||
//| """True when the adapter is currently advertising. (read-only)"""
|
//| """True when the adapter is currently advertising. (read-only)"""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t bleio_adapter_get_advertising(mp_obj_t self) {
|
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 },
|
(mp_obj_t)&mp_const_none_obj },
|
||||||
};
|
};
|
||||||
|
|
||||||
//| connected: Any = ...
|
//| connected: bool = ...
|
||||||
//| """True when the adapter is connected to another device regardless of who initiated the
|
//| """True when the adapter is connected to another device regardless of who initiated the
|
||||||
//| connection. (read-only)"""
|
//| connection. (read-only)"""
|
||||||
//|
|
//|
|
||||||
@ -334,7 +334,7 @@ const mp_obj_property_t bleio_adapter_connected_obj = {
|
|||||||
(mp_obj_t)&mp_const_none_obj },
|
(mp_obj_t)&mp_const_none_obj },
|
||||||
};
|
};
|
||||||
|
|
||||||
//| connections: Any = ...
|
//| connections: tuple = ...
|
||||||
//| """Tuple of active connections including those initiated through
|
//| """Tuple of active connections including those initiated through
|
||||||
//| :py:meth:`_bleio.Adapter.connect`. (read-only)"""
|
//| :py:meth:`_bleio.Adapter.connect`. (read-only)"""
|
||||||
//|
|
//|
|
||||||
@ -350,7 +350,7 @@ const mp_obj_property_t bleio_adapter_connections_obj = {
|
|||||||
(mp_obj_t)&mp_const_none_obj },
|
(mp_obj_t)&mp_const_none_obj },
|
||||||
};
|
};
|
||||||
|
|
||||||
//| def connect(self, address: Address, *, timeout: float/int) -> Any:
|
//| def connect(self, address: Address, *, timeout: float/int) -> Connection:
|
||||||
//| """Attempts a connection to the device with the given address.
|
//| """Attempts a connection to the device with the given address.
|
||||||
//|
|
//|
|
||||||
//| :param Address address: The address of the peripheral to connect to
|
//| :param Address address: The address of the peripheral to connect to
|
||||||
@ -380,7 +380,7 @@ STATIC mp_obj_t bleio_adapter_connect(mp_uint_t n_args, const mp_obj_t *pos_args
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_adapter_connect_obj, 2, bleio_adapter_connect);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_adapter_connect_obj, 2, bleio_adapter_connect);
|
||||||
|
|
||||||
//| def erase_bonding(self, ) -> Any:
|
//| def erase_bonding(self) -> None:
|
||||||
//| """Erase all bonding information stored in flash memory."""
|
//| """Erase all bonding information stored in flash memory."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
//| """Encapsulates the address of a BLE device."""
|
//| """Encapsulates the address of a BLE device."""
|
||||||
//|
|
//|
|
||||||
|
|
||||||
//| def __init__(self, address: buf, address_type: Any):
|
//| def __init__(self, address: ReadableBuffer, address_type: int) -> None:
|
||||||
//| """Create a new Address object encapsulating the address value.
|
//| """Create a new Address object encapsulating the address value.
|
||||||
//| The value itself can be one of:
|
//| The value itself can be one of:
|
||||||
//|
|
//|
|
||||||
@ -77,8 +77,8 @@ STATIC mp_obj_t bleio_address_make_new(const mp_obj_type_t *type, size_t n_args,
|
|||||||
return MP_OBJ_FROM_PTR(self);
|
return MP_OBJ_FROM_PTR(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
//| address_bytes: Any = ...
|
//| address_bytes: bytes = ...
|
||||||
//| r"""The bytes that make up the device address (read-only).
|
//| """The bytes that make up the device address (read-only).
|
||||||
//|
|
//|
|
||||||
//| Note that the ``bytes`` object returned is in little-endian order:
|
//| Note that the ``bytes`` object returned is in little-endian order:
|
||||||
//| The least significant byte is ``address_bytes[0]``. So the address will
|
//| The least significant byte is ``address_bytes[0]``. So the address will
|
||||||
@ -108,7 +108,7 @@ const mp_obj_property_t bleio_address_address_bytes_obj = {
|
|||||||
(mp_obj_t)&mp_const_none_obj},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| type: Any = ...
|
//| type: int = ...
|
||||||
//| """The address type (read-only).
|
//| """The address type (read-only).
|
||||||
//|
|
//|
|
||||||
//| One of the integer values: `PUBLIC`, `RANDOM_STATIC`, `RANDOM_PRIVATE_RESOLVABLE`,
|
//| One of the integer values: `PUBLIC`, `RANDOM_STATIC`, `RANDOM_PRIVATE_RESOLVABLE`,
|
||||||
@ -128,7 +128,7 @@ const mp_obj_property_t bleio_address_type_obj = {
|
|||||||
(mp_obj_t)&mp_const_none_obj},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| def __eq__(self, other: Any) -> Any:
|
//| def __eq__(self, other: Any) -> bool:
|
||||||
//| """Two Address objects are equal if their addresses and address types are equal."""
|
//| """Two Address objects are equal if their addresses and address types are equal."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -154,7 +154,7 @@ STATIC mp_obj_t bleio_address_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_o
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def __hash__(self, ) -> Any:
|
//| def __hash__(self) -> int:
|
||||||
//| """Returns a hash for the Address data."""
|
//| """Returns a hash for the Address data."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -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]);
|
buf[5], buf[4], buf[3], buf[2], buf[1], buf[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//| PUBLIC: Any = ...
|
//| PUBLIC: int = ...
|
||||||
//| """A publicly known address, with a company ID (high 24 bits)and company-assigned part (low 24 bits)."""
|
//| """A publicly known address, with a company ID (high 24 bits)and company-assigned part (low 24 bits)."""
|
||||||
//|
|
//|
|
||||||
//| RANDOM_STATIC: Any = ...
|
//| RANDOM_STATIC: int = ...
|
||||||
//| """A randomly generated address that does not change often. It may never change or may change after
|
//| """A randomly generated address that does not change often. It may never change or may change after
|
||||||
//| a power cycle."""
|
//| a power cycle."""
|
||||||
//|
|
//|
|
||||||
//| RANDOM_PRIVATE_RESOLVABLE: Any = ...
|
//| RANDOM_PRIVATE_RESOLVABLE: int = ...
|
||||||
//| """An address that is usable when the peer knows the other device's secret Identity Resolving Key (IRK)."""
|
//| """An address that is usable when the peer knows the other device's secret Identity Resolving Key (IRK)."""
|
||||||
//|
|
//|
|
||||||
//| RANDOM_PRIVATE_NON_RESOLVABLE: Any = ...
|
//| RANDOM_PRIVATE_NON_RESOLVABLE: int = ...
|
||||||
//| """A randomly generated address that changes on every connection."""
|
//| """A randomly generated address that changes on every connection."""
|
||||||
//|
|
//|
|
||||||
STATIC const mp_rom_map_elem_t bleio_address_locals_dict_table[] = {
|
STATIC const mp_rom_map_elem_t bleio_address_locals_dict_table[] = {
|
||||||
|
@ -36,32 +36,32 @@
|
|||||||
//| :py:class:`~Characteristic` and :py:class:`~Descriptor`,
|
//| :py:class:`~Characteristic` and :py:class:`~Descriptor`,
|
||||||
//| but is not defined as a Python superclass of those classes."""
|
//| but is not defined as a Python superclass of those classes."""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, ):
|
//| def __init__(self) -> None:
|
||||||
//| """You cannot create an instance of :py:class:`~_bleio.Attribute`."""
|
//| """You cannot create an instance of :py:class:`~_bleio.Attribute`."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
|
|
||||||
STATIC const mp_rom_map_elem_t bleio_attribute_locals_dict_table[] = {
|
STATIC const mp_rom_map_elem_t bleio_attribute_locals_dict_table[] = {
|
||||||
|
|
||||||
//| NO_ACCESS: Any = ...
|
//| NO_ACCESS: int = ...
|
||||||
//| """security mode: access not allowed"""
|
//| """security mode: access not allowed"""
|
||||||
//|
|
//|
|
||||||
//| OPEN: Any = ...
|
//| OPEN: int = ...
|
||||||
//| """security_mode: no security (link is not encrypted)"""
|
//| """security_mode: no security (link is not encrypted)"""
|
||||||
//|
|
//|
|
||||||
//| ENCRYPT_NO_MITM: Any = ...
|
//| ENCRYPT_NO_MITM: int = ...
|
||||||
//| """security_mode: unauthenticated encryption, without man-in-the-middle protection"""
|
//| """security_mode: unauthenticated encryption, without man-in-the-middle protection"""
|
||||||
//|
|
//|
|
||||||
//| ENCRYPT_WITH_MITM: Any = ...
|
//| ENCRYPT_WITH_MITM: int = ...
|
||||||
//| """security_mode: authenticated encryption, with man-in-the-middle protection"""
|
//| """security_mode: authenticated encryption, with man-in-the-middle protection"""
|
||||||
//|
|
//|
|
||||||
//| LESC_ENCRYPT_WITH_MITM: Any = ...
|
//| LESC_ENCRYPT_WITH_MITM: int = ...
|
||||||
//| """security_mode: LESC encryption, with man-in-the-middle protection"""
|
//| """security_mode: LESC encryption, with man-in-the-middle protection"""
|
||||||
//|
|
//|
|
||||||
//| SIGNED_NO_MITM: Any = ...
|
//| SIGNED_NO_MITM: int = ...
|
||||||
//| """security_mode: unauthenticated data signing, without man-in-the-middle protection"""
|
//| """security_mode: unauthenticated data signing, without man-in-the-middle protection"""
|
||||||
//|
|
//|
|
||||||
//| SIGNED_WITH_MITM: Any = ...
|
//| SIGNED_WITH_MITM: int = ...
|
||||||
//| """security_mode: authenticated data signing, without man-in-the-middle protection"""
|
//| """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) },
|
{ MP_ROM_QSTR(MP_QSTR_NO_ACCESS), MP_ROM_INT(SECURITY_MODE_NO_ACCESS) },
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
//| """Stores information about a BLE service characteristic and allows reading
|
//| """Stores information about a BLE service characteristic and allows reading
|
||||||
//| and writing of the characteristic's value."""
|
//| and writing of the characteristic's value."""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, ):
|
//| def __init__(self) -> None:
|
||||||
//| """There is no regular constructor for a Characteristic. A new local Characteristic can be created
|
//| """There is no regular constructor for a Characteristic. A new local Characteristic can be created
|
||||||
//| and attached to a Service by calling `add_to_service()`.
|
//| and attached to a Service by calling `add_to_service()`.
|
||||||
//| Remote Characteristic objects are created by `Connection.discover_remote_services()`
|
//| Remote Characteristic objects are created by `Connection.discover_remote_services()`
|
||||||
@ -45,7 +45,7 @@
|
|||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
|
|
||||||
//| def add_to_service(self, service: Service, uuid: UUID, *, properties: int = 0, read_perm: int = Attribute.OPEN, write_perm: int = Attribute.OPEN, max_length: int = 20, fixed_length: bool = False, initial_value: buf = None) -> Any:
|
//| def add_to_service(self, service: Service, uuid: UUID, *, properties: int = 0, read_perm: int = Attribute.OPEN, write_perm: int = Attribute.OPEN, max_length: int = 20, fixed_length: bool = False, initial_value: buf = None) -> Characteristic:
|
||||||
//| """Create a new Characteristic object, and add it to this Service.
|
//| """Create a new Characteristic object, and add it to this Service.
|
||||||
//|
|
//|
|
||||||
//| :param Service service: The service that will provide this characteristic
|
//| :param Service service: The service that will provide this characteristic
|
||||||
@ -141,7 +141,7 @@ STATIC MP_DEFINE_CONST_CLASSMETHOD_OBJ(bleio_characteristic_add_to_service_obj,
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
//| properties: Any = ...
|
//| properties: int = ...
|
||||||
//| """An int bitmask representing which properties are set, specified as bitwise or'ing of
|
//| """An int bitmask representing which properties are set, specified as bitwise or'ing of
|
||||||
//| of these possible values.
|
//| of these possible values.
|
||||||
//| `BROADCAST`, `INDICATE`, `NOTIFY`, `READ`, `WRITE`, `WRITE_NO_RESPONSE`."""
|
//| `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 },
|
(mp_obj_t)&mp_const_none_obj },
|
||||||
};
|
};
|
||||||
|
|
||||||
//| uuid: Any = ...
|
//| uuid: Optional[UUID] = ...
|
||||||
//| """The UUID of this characteristic. (read-only)
|
//| """The UUID of this characteristic. (read-only)
|
||||||
//|
|
//|
|
||||||
//| Will be ``None`` if the 128-bit UUID for this characteristic is not known."""
|
//| 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 },
|
(mp_obj_t)&mp_const_none_obj },
|
||||||
};
|
};
|
||||||
|
|
||||||
//| value: Any = ...
|
//| value: bytearray = ...
|
||||||
//| """The value of this characteristic."""
|
//| """The value of this characteristic."""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t bleio_characteristic_get_value(mp_obj_t self_in) {
|
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 },
|
(mp_obj_t)&mp_const_none_obj },
|
||||||
};
|
};
|
||||||
|
|
||||||
//| descriptors: Any = ...
|
//| descriptors: Descriptor = ...
|
||||||
//| """A tuple of :py:class:`Descriptor` that describe this characteristic. (read-only)"""
|
//| """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) {
|
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 },
|
(mp_obj_t)&mp_const_none_obj },
|
||||||
};
|
};
|
||||||
|
|
||||||
//| service: Any = ...
|
//| service: Service = ...
|
||||||
//| """The Service this Characteristic is a part of."""
|
//| """The Service this Characteristic is a part of."""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t bleio_characteristic_get_service(mp_obj_t self_in) {
|
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 },
|
(mp_obj_t)&mp_const_none_obj },
|
||||||
};
|
};
|
||||||
|
|
||||||
//| def set_cccd(self, *, notify: bool = False, indicate: float = False) -> Any:
|
//| def set_cccd(self, *, notify: bool = False, indicate: float = False) -> None:
|
||||||
//| """Set the remote characteristic's CCCD to enable or disable notification and indication.
|
//| """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
|
//| :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) },
|
{ MP_ROM_QSTR(MP_QSTR_set_cccd), MP_ROM_PTR(&bleio_characteristic_set_cccd_obj) },
|
||||||
|
|
||||||
// Bitmask constants to represent properties
|
// Bitmask constants to represent properties
|
||||||
//| BROADCAST: Any = ...
|
//| BROADCAST: int = ...
|
||||||
//| """property: allowed in advertising packets"""
|
//| """property: allowed in advertising packets"""
|
||||||
//|
|
//|
|
||||||
//| INDICATE: Any = ...
|
//| INDICATE: int = ...
|
||||||
//| """property: server will indicate to the client when the value is set and wait for a response"""
|
//| """property: server will indicate to the client when the value is set and wait for a response"""
|
||||||
//|
|
//|
|
||||||
//| NOTIFY: Any = ...
|
//| NOTIFY: int = ...
|
||||||
//| """property: server will notify the client when the value is set"""
|
//| """property: server will notify the client when the value is set"""
|
||||||
//|
|
//|
|
||||||
//| READ: Any = ...
|
//| READ: int = ...
|
||||||
//| """property: clients may read this characteristic"""
|
//| """property: clients may read this characteristic"""
|
||||||
//|
|
//|
|
||||||
//| WRITE: Any = ...
|
//| WRITE: int = ...
|
||||||
//| """property: clients may write this characteristic; a response will be sent back"""
|
//| """property: clients may write this characteristic; a response will be sent back"""
|
||||||
//|
|
//|
|
||||||
//| WRITE_NO_RESPONSE: Any = ...
|
//| WRITE_NO_RESPONSE: int = ...
|
||||||
//| """property: clients may write this characteristic; no response will be sent back"""
|
//| """property: clients may write this characteristic; no response will be sent back"""
|
||||||
//|
|
//|
|
||||||
{ MP_ROM_QSTR(MP_QSTR_BROADCAST), MP_ROM_INT(CHAR_PROP_BROADCAST) },
|
{ MP_ROM_QSTR(MP_QSTR_BROADCAST), MP_ROM_INT(CHAR_PROP_BROADCAST) },
|
||||||
|
@ -44,7 +44,7 @@ STATIC void raise_error_if_not_connected(bleio_characteristic_buffer_obj_t *self
|
|||||||
//| class CharacteristicBuffer:
|
//| class CharacteristicBuffer:
|
||||||
//| """Accumulates a Characteristic's incoming values in a FIFO buffer."""
|
//| """Accumulates a Characteristic's incoming values in a FIFO buffer."""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, characteristic: Characteristic, *, timeout: int = 1, buffer_size: int = 64):
|
//| def __init__(self, characteristic: Characteristic, *, timeout: int = 1, buffer_size: int = 64) -> None:
|
||||||
//|
|
//|
|
||||||
//| """Monitor the given Characteristic. Each time a new value is written to the Characteristic
|
//| """Monitor the given Characteristic. Each time a new value is written to the Characteristic
|
||||||
//| add the newly-written bytes to a FIFO buffer.
|
//| add the newly-written bytes to a FIFO buffer.
|
||||||
@ -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.
|
// These are standard stream methods. Code is in py/stream.c.
|
||||||
//
|
//
|
||||||
//| def read(self, nbytes: Any = None) -> Any:
|
//| def read(self, nbytes: int = None) -> Optional[bytes]:
|
||||||
//| """Read characters. If ``nbytes`` is specified then read at most that many
|
//| """Read characters. If ``nbytes`` is specified then read at most that many
|
||||||
//| bytes. Otherwise, read everything that arrives until the connection
|
//| bytes. Otherwise, read everything that arrives until the connection
|
||||||
//| times out. Providing the number of bytes expected is highly recommended
|
//| times out. Providing the number of bytes expected is highly recommended
|
||||||
@ -110,14 +110,14 @@ STATIC void check_for_deinit(bleio_characteristic_buffer_obj_t *self) {
|
|||||||
//| :rtype: bytes or None"""
|
//| :rtype: bytes or None"""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def readinto(self, buf: Any) -> Any:
|
//| def readinto(self, buf: WriteableBuffer) -> Optional[int]:
|
||||||
//| """Read bytes into the ``buf``. Read at most ``len(buf)`` bytes.
|
//| """Read bytes into the ``buf``. Read at most ``len(buf)`` bytes.
|
||||||
//|
|
//|
|
||||||
//| :return: number of bytes read and stored into ``buf``
|
//| :return: number of bytes read and stored into ``buf``
|
||||||
//| :rtype: int or None (on a non-blocking error)"""
|
//| :rtype: int or None (on a non-blocking error)"""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def readline(self, ) -> Any:
|
//| def readline(self) -> bytes:
|
||||||
//| """Read a line, ending in a newline character.
|
//| """Read a line, ending in a newline character.
|
||||||
//|
|
//|
|
||||||
//| :return: the line read
|
//| :return: the line read
|
||||||
@ -167,7 +167,7 @@ STATIC mp_uint_t bleio_characteristic_buffer_ioctl(mp_obj_t self_in, mp_uint_t r
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
//| in_waiting: Any = ...
|
//| in_waiting: int = ...
|
||||||
//| """The number of bytes in the input buffer, available to be read"""
|
//| """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) {
|
STATIC mp_obj_t bleio_characteristic_buffer_obj_get_in_waiting(mp_obj_t self_in) {
|
||||||
@ -184,7 +184,7 @@ const mp_obj_property_t bleio_characteristic_buffer_in_waiting_obj = {
|
|||||||
(mp_obj_t)&mp_const_none_obj},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| def reset_input_buffer(self, ) -> Any:
|
//| def reset_input_buffer(self) -> None:
|
||||||
//| """Discard any unread characters in the input buffer."""
|
//| """Discard any unread characters in the input buffer."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -196,7 +196,7 @@ STATIC mp_obj_t bleio_characteristic_buffer_obj_reset_input_buffer(mp_obj_t self
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_characteristic_buffer_reset_input_buffer_obj, bleio_characteristic_buffer_obj_reset_input_buffer);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_characteristic_buffer_reset_input_buffer_obj, bleio_characteristic_buffer_obj_reset_input_buffer);
|
||||||
|
|
||||||
//| def deinit(self, ) -> Any:
|
//| def deinit(self) -> None:
|
||||||
//| """Disable permanently."""
|
//| """Disable permanently."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
|
@ -68,13 +68,13 @@ void bleio_connection_ensure_connected(bleio_connection_obj_t *self) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def __init__(self, ):
|
//| def __init__(self) -> None:
|
||||||
//| """Connections cannot be made directly. Instead, to initiate a connection use `Adapter.connect`.
|
//| """Connections cannot be made directly. Instead, to initiate a connection use `Adapter.connect`.
|
||||||
//| Connections may also be made when another device initiates a connection. To use a Connection
|
//| Connections may also be made when another device initiates a connection. To use a Connection
|
||||||
//| created by a peer, read the `Adapter.connections` property.
|
//| created by a peer, read the `Adapter.connections` property.
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def disconnect(self, ) -> Any:
|
//| def disconnect(self) -> Any:
|
||||||
//| ""Disconnects from the remote peripheral. Does nothing if already disconnected."""
|
//| ""Disconnects from the remote peripheral. Does nothing if already disconnected."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -87,7 +87,7 @@ STATIC mp_obj_t bleio_connection_disconnect(mp_obj_t self_in) {
|
|||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_connection_disconnect_obj, bleio_connection_disconnect);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_connection_disconnect_obj, bleio_connection_disconnect);
|
||||||
|
|
||||||
|
|
||||||
//| def pair(self, *, bond: Any = True) -> Any:
|
//| def pair(self, *, bond: bool = True) -> None:
|
||||||
//| """Pair to the peer to improve security."""
|
//| """Pair to the peer to improve security."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -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);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_connection_pair_obj, 1, bleio_connection_pair);
|
||||||
|
|
||||||
//| def discover_remote_services(self, service_uuids_whitelist: iterable = None) -> Any:
|
//| def discover_remote_services(self, service_uuids_whitelist: iterable = None) -> Service:
|
||||||
//| """Do BLE discovery for all services or for the given service UUIDS,
|
//| """Do BLE discovery for all services or for the given service UUIDS,
|
||||||
//| to find their handles and characteristics, and return the discovered services.
|
//| to find their handles and characteristics, and return the discovered services.
|
||||||
//| `Connection.connected` must be True.
|
//| `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);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_connection_discover_remote_services_obj, 1, bleio_connection_discover_remote_services);
|
||||||
|
|
||||||
//| connected: Any = ...
|
//| connected: bool = ...
|
||||||
//| """True if connected to the remote peer."""
|
//| """True if connected to the remote peer."""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t bleio_connection_get_connected(mp_obj_t self_in) {
|
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: Any = ...
|
//| paired: bool = ...
|
||||||
//| """True if paired to the remote peer."""
|
//| """True if paired to the remote peer."""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t bleio_connection_get_paired(mp_obj_t self_in) {
|
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: Any = ...
|
//| connection_interval: float = ...
|
||||||
//| """Time between transmissions in milliseconds. Will be multiple of 1.25ms. Lower numbers
|
//| """Time between transmissions in milliseconds. Will be multiple of 1.25ms. Lower numbers
|
||||||
//| increase speed and decrease latency but increase power consumption.
|
//| 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);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_connection_get_connection_interval_obj, bleio_connection_get_connection_interval);
|
||||||
|
|
||||||
//| attribute: Any = ...
|
//| attribute: int = ...
|
||||||
//| """The maximum number of data bytes that can be sent in a single transmission,
|
//| """The maximum number of data bytes that can be sent in a single transmission,
|
||||||
//| not including overhead bytes.
|
//| not including overhead bytes.
|
||||||
//|
|
//|
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
//| Descriptors are attached to BLE characteristics and provide contextual
|
//| Descriptors are attached to BLE characteristics and provide contextual
|
||||||
//| information about the characteristic."""
|
//| information about the characteristic."""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, ):
|
//| def __init__(self) -> None:
|
||||||
//| """There is no regular constructor for a Descriptor. A new local Descriptor can be created
|
//| """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()`.
|
//| and attached to a Characteristic by calling `add_to_characteristic()`.
|
||||||
//| Remote Descriptor objects are created by `Connection.discover_remote_services()`
|
//| Remote Descriptor objects are created by `Connection.discover_remote_services()`
|
||||||
@ -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_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));
|
STATIC MP_DEFINE_CONST_CLASSMETHOD_OBJ(bleio_descriptor_add_to_characteristic_obj, MP_ROM_PTR(&bleio_descriptor_add_to_characteristic_fun_obj));
|
||||||
|
|
||||||
//| uuid: Any = ...
|
//| uuid: UUID = ...
|
||||||
//| """The descriptor uuid. (read-only)"""
|
//| """The descriptor uuid. (read-only)"""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t bleio_descriptor_get_uuid(mp_obj_t self_in) {
|
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},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| characteristic: Any = ...
|
//| characteristic: Characteristic = ...
|
||||||
//| """The Characteristic this Descriptor is a part of."""
|
//| """The Characteristic this Descriptor is a part of."""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t bleio_descriptor_get_characteristic(mp_obj_t self_in) {
|
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 },
|
(mp_obj_t)&mp_const_none_obj },
|
||||||
};
|
};
|
||||||
|
|
||||||
//| value: Any = ...
|
//| value: WriteableBuffer = ...
|
||||||
//| """The value of this descriptor."""
|
//| """The value of this descriptor."""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t bleio_descriptor_get_value(mp_obj_t self_in) {
|
STATIC mp_obj_t bleio_descriptor_get_value(mp_obj_t self_in) {
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
//| When we're the server, we ignore all connections besides the first to subscribe to
|
//| When we're the server, we ignore all connections besides the first to subscribe to
|
||||||
//| notifications."""
|
//| notifications."""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, characteristic: Characteristic, *, buffer_size: int):
|
//| def __init__(self, characteristic: Characteristic, *, buffer_size: int) -> None:
|
||||||
//| """Monitor the given Characteristic. Each time a new value is written to the Characteristic
|
//| """Monitor the given Characteristic. Each time a new value is written to the Characteristic
|
||||||
//| add the newly-written bytes to a FIFO buffer.
|
//| add the newly-written bytes to a FIFO buffer.
|
||||||
//|
|
//|
|
||||||
@ -93,7 +93,7 @@ STATIC void check_for_deinit(bleio_packet_buffer_obj_t *self) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def readinto(self, buf: Any) -> Any:
|
//| def readinto(self, buf: WriteableBuffer) -> int:
|
||||||
//| """Reads a single BLE packet into the ``buf``. Raises an exception if the next packet is longer
|
//| """Reads a single BLE packet into the ``buf``. Raises an exception if the next packet is longer
|
||||||
//| than the given buffer. Use `packet_size` to read the maximum length of a single packet.
|
//| than the given buffer. Use `packet_size` to read the maximum length of a single packet.
|
||||||
//|
|
//|
|
||||||
@ -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);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_2(bleio_packet_buffer_readinto_obj, bleio_packet_buffer_readinto);
|
||||||
|
|
||||||
//| def write(self, data: Any, *, header: Any = None) -> Any:
|
//| def write(self, data: bytes, *, header: Optional[bytes] = None) -> int:
|
||||||
//| """Writes all bytes from data into the same outgoing packet. The bytes from header are included
|
//| """Writes all bytes from data into the same outgoing packet. The bytes from header are included
|
||||||
//| before data when the pending packet is currently empty.
|
//| before data when the pending packet is currently empty.
|
||||||
//|
|
//|
|
||||||
@ -169,7 +169,7 @@ STATIC mp_obj_t bleio_packet_buffer_write(mp_uint_t n_args, const mp_obj_t *pos_
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_packet_buffer_write_obj, 1, bleio_packet_buffer_write);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_packet_buffer_write_obj, 1, bleio_packet_buffer_write);
|
||||||
|
|
||||||
//| def deinit(self) -> Any:
|
//| def deinit(self) -> None:
|
||||||
//| """Disable permanently."""
|
//| """Disable permanently."""
|
||||||
//| ...
|
//| ...
|
||||||
STATIC mp_obj_t bleio_packet_buffer_deinit(mp_obj_t self_in) {
|
STATIC mp_obj_t bleio_packet_buffer_deinit(mp_obj_t self_in) {
|
||||||
@ -184,7 +184,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_packet_buffer_deinit_obj, bleio_packet_bu
|
|||||||
//| The name `packet_size` is deprecated and
|
//| The name `packet_size` is deprecated and
|
||||||
//| will be removed in CircuitPython 6.0.0."""
|
//| will be removed in CircuitPython 6.0.0."""
|
||||||
//|
|
//|
|
||||||
//| incoming_packet_length: Any = ...
|
//| incoming_packet_length: int = ...
|
||||||
//| """Maximum length in bytes of a packet we are reading."""
|
//| """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) {
|
STATIC mp_obj_t bleio_packet_buffer_get_incoming_packet_length(mp_obj_t self_in) {
|
||||||
|
@ -41,11 +41,11 @@
|
|||||||
//| it has no user-visible constructor."""
|
//| it has no user-visible constructor."""
|
||||||
//|
|
//|
|
||||||
|
|
||||||
//| def __init__(self, ):
|
//| def __init__(self) -> None:
|
||||||
//| """Cannot be instantiated directly. Use `_bleio.Adapter.start_scan`."""
|
//| """Cannot be instantiated directly. Use `_bleio.Adapter.start_scan`."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def matches(self, prefixes: Any, *, all: Any = True) -> Any:
|
//| def matches(self, prefixes: ScanEntry, *, all: bool = True) -> bool:
|
||||||
//| """Returns True if the ScanEntry matches all prefixes when ``all`` is True. This is stricter
|
//| """Returns True if the ScanEntry matches all prefixes when ``all`` is True. This is stricter
|
||||||
//| than the scan filtering which accepts any advertisements that match any of the prefixes
|
//| than the scan filtering which accepts any advertisements that match any of the prefixes
|
||||||
//| where all is False."""
|
//| where all is False."""
|
||||||
@ -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);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_scanentry_matches_obj, 2, bleio_scanentry_matches);
|
||||||
|
|
||||||
//| address: Any = ...
|
//| address: Address = ...
|
||||||
//| """The address of the device (read-only), of type `_bleio.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) {
|
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 },
|
(mp_obj_t)&mp_const_none_obj },
|
||||||
};
|
};
|
||||||
|
|
||||||
//| advertisement_bytes: Any = ...
|
//| advertisement_bytes: bytes = ...
|
||||||
//| """All the advertisement data present in the packet, returned as a ``bytes`` object. (read-only)"""
|
//| """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) {
|
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 },
|
(mp_obj_t)&mp_const_none_obj },
|
||||||
};
|
};
|
||||||
|
|
||||||
//| rssi: Any = ...
|
//| rssi: int = ...
|
||||||
//| """The signal strength of the device at the time of the scan, in integer dBm. (read-only)"""
|
//| """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) {
|
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 },
|
(mp_obj_t)&mp_const_none_obj },
|
||||||
};
|
};
|
||||||
|
|
||||||
//| connectable: Any = ...
|
//| connectable: bool = ...
|
||||||
//| """True if the device can be connected to. (read-only)"""
|
//| """True if the device can be connected to. (read-only)"""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t scanentry_get_connectable(mp_obj_t self_in) {
|
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 },
|
(mp_obj_t)&mp_const_none_obj },
|
||||||
};
|
};
|
||||||
|
|
||||||
//| scan_response: Any = ...
|
//| scan_response: bool = ...
|
||||||
//| """True if the entry was a scan response. (read-only)"""
|
//| """True if the entry was a scan response. (read-only)"""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t scanentry_get_scan_response(mp_obj_t self_in) {
|
STATIC mp_obj_t scanentry_get_scan_response(mp_obj_t self_in) {
|
||||||
|
@ -46,15 +46,15 @@ STATIC mp_obj_t scanresults_iternext(mp_obj_t self_in) {
|
|||||||
return MP_OBJ_STOP_ITERATION;
|
return MP_OBJ_STOP_ITERATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def __init__(self, ):
|
//| def __init__(self) -> None:
|
||||||
//| """Cannot be instantiated directly. Use `_bleio.Adapter.start_scan`."""
|
//| """Cannot be instantiated directly. Use `_bleio.Adapter.start_scan`."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def __iter__(self, ) -> Any:
|
//| def __iter__(self) -> Iterator[ScanEntry]:
|
||||||
//| """Returns itself since it is the iterator."""
|
//| """Returns itself since it is the iterator."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def __next__(self, ) -> Any:
|
//| def __next__(self) -> ScanEntry:
|
||||||
//| """Returns the next `_bleio.ScanEntry`. Blocks if none have been received and scanning is still
|
//| """Returns the next `_bleio.ScanEntry`. Blocks if none have been received and scanning is still
|
||||||
//| active. Raises `StopIteration` if scanning is finished and no other results are available."""
|
//| active. Raises `StopIteration` if scanning is finished and no other results are available."""
|
||||||
//| ...
|
//| ...
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
//| class Service:
|
//| class Service:
|
||||||
//| """Stores information about a BLE service and its characteristics."""
|
//| """Stores information about a BLE service and its characteristics."""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, uuid: UUID, *, secondary: bool = False):
|
//| def __init__(self, uuid: UUID, *, secondary: bool = False) -> None:
|
||||||
//| """Create a new Service identified by the specified UUID. It can be accessed by all
|
//| """Create a new Service identified by the specified UUID. It can be accessed by all
|
||||||
//| connections. This is known as a Service server. Client Service objects are created via
|
//| connections. This is known as a Service server. Client Service objects are created via
|
||||||
//| `Connection.discover_remote_services`.
|
//| `Connection.discover_remote_services`.
|
||||||
@ -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);
|
return MP_OBJ_FROM_PTR(service);
|
||||||
}
|
}
|
||||||
|
|
||||||
//| characteristics: Any = ...
|
//| characteristics: Tuple[Characteristic, ...] = ...
|
||||||
//| """A tuple of :py:class:`Characteristic` designating the characteristics that are offered by
|
//| """A tuple of :py:class:`Characteristic` designating the characteristics that are offered by
|
||||||
//| this service. (read-only)"""
|
//| this service. (read-only)"""
|
||||||
//|
|
//|
|
||||||
@ -92,7 +92,7 @@ const mp_obj_property_t bleio_service_characteristics_obj = {
|
|||||||
(mp_obj_t)&mp_const_none_obj },
|
(mp_obj_t)&mp_const_none_obj },
|
||||||
};
|
};
|
||||||
|
|
||||||
//| remote: Any = ...
|
//| remote: bool = ...
|
||||||
//| """True if this is a service provided by a remote device. (read-only)"""
|
//| """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) {
|
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 },
|
(mp_obj_t)&mp_const_none_obj },
|
||||||
};
|
};
|
||||||
|
|
||||||
//| secondary: Any = ...
|
//| secondary: bool = ...
|
||||||
//| """True if this is a secondary service. (read-only)"""
|
//| """True if this is a secondary service. (read-only)"""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t bleio_service_get_secondary(mp_obj_t self_in) {
|
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 },
|
(mp_obj_t)&mp_const_none_obj },
|
||||||
};
|
};
|
||||||
|
|
||||||
//| uuid: Any = ...
|
//| uuid: Optional[UUID] = ...
|
||||||
//| """The UUID of this service. (read-only)
|
//| """The UUID of this service. (read-only)
|
||||||
//|
|
//|
|
||||||
//| Will be ``None`` if the 128-bit UUID for this service is not known."""
|
//| Will be ``None`` if the 128-bit UUID for this service is not known."""
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
//| class UUID:
|
//| class UUID:
|
||||||
//| """A 16-bit or 128-bit UUID. Can be used for services, characteristics, descriptors and more."""
|
//| """A 16-bit or 128-bit UUID. Can be used for services, characteristics, descriptors and more."""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, value: Any):
|
//| def __init__(self, value: Union[int, ReadableBuffer, str]) -> None:
|
||||||
//| """Create a new UUID or UUID object encapsulating the uuid value.
|
//| """Create a new UUID or UUID object encapsulating the uuid value.
|
||||||
//| The value can be one of:
|
//| The value can be one of:
|
||||||
//|
|
//|
|
||||||
@ -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);
|
return MP_OBJ_FROM_PTR(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
//| uuid16: Any = ...
|
//| uuid16: int = ...
|
||||||
//| """The 16-bit part of the UUID. (read-only)
|
//| """The 16-bit part of the UUID. (read-only)
|
||||||
//|
|
//|
|
||||||
//| :type: int"""
|
//| :type: int"""
|
||||||
@ -139,7 +139,7 @@ const mp_obj_property_t bleio_uuid_uuid16_obj = {
|
|||||||
(mp_obj_t)&mp_const_none_obj},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| uuid128: Any = ...
|
//| uuid128: bytes = ...
|
||||||
//| """The 128-bit value of the UUID
|
//| """The 128-bit value of the UUID
|
||||||
//| Raises AttributeError if this is a 16-bit UUID. (read-only)
|
//| 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},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| size: Any = ...
|
//| size: int = ...
|
||||||
//| """128 if this UUID represents a 128-bit vendor-specific UUID. 16 if this UUID represents a
|
//| """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.
|
//| 16-bit Bluetooth SIG assigned UUID. (read-only) 32-bit UUIDs are not currently supported.
|
||||||
//|
|
//|
|
||||||
@ -186,7 +186,7 @@ const mp_obj_property_t bleio_uuid_size_obj = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//| def pack_into(self, buffer: Any, offset: Any = 0) -> Any:
|
//| def pack_into(self, buffer: WriteableBuffer, offset: int = 0) -> None:
|
||||||
//| """Packs the UUID into the given buffer at the given offset."""
|
//| """Packs the UUID into the given buffer at the given offset."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -248,7 +248,7 @@ STATIC mp_obj_t bleio_uuid_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def __eq__(self, other: Any) -> Any:
|
//| def __eq__(self, other: Any) -> bool:
|
||||||
//| """Two UUID objects are equal if their values match and they are both 128-bit or both 16-bit."""
|
//| """Two UUID objects are equal if their values match and they are both 128-bit or both 16-bit."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
|
@ -59,8 +59,7 @@
|
|||||||
//|
|
//|
|
||||||
|
|
||||||
|
|
||||||
//| class BluetoothError:
|
//| class BluetoothError(Exception):
|
||||||
//| def __init__(self, Exception: Any):
|
|
||||||
//| """Catch all exception for Bluetooth related errors."""
|
//| """Catch all exception for Bluetooth related errors."""
|
||||||
//| ...
|
//| ...
|
||||||
MP_DEFINE_BLEIO_EXCEPTION(BluetoothError, Exception)
|
MP_DEFINE_BLEIO_EXCEPTION(BluetoothError, Exception)
|
||||||
@ -72,8 +71,7 @@ NORETURN void mp_raise_bleio_BluetoothError(const compressed_string_t* fmt, ...)
|
|||||||
va_end(argptr);
|
va_end(argptr);
|
||||||
nlr_raise(exception);
|
nlr_raise(exception);
|
||||||
}
|
}
|
||||||
//| class ConnectionError:
|
//| class ConnectionError(BluetoothError):
|
||||||
//| def __init__(self, BluetoothError: Any):
|
|
||||||
//| """Raised when a connection is unavailable."""
|
//| """Raised when a connection is unavailable."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -86,8 +84,7 @@ NORETURN void mp_raise_bleio_ConnectionError(const compressed_string_t* fmt, ...
|
|||||||
nlr_raise(exception);
|
nlr_raise(exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
//| class RoleError:
|
//| class RoleError(BluetoothError):
|
||||||
//| def __init__(self, BluetoothError: Any):
|
|
||||||
//| """Raised when a resource is used as the mismatched role. For example, if a local CCCD is
|
//| """Raised when a resource is used as the mismatched role. For example, if a local CCCD is
|
||||||
//| attempted to be set but they can only be set when remote."""
|
//| attempted to be set but they can only be set when remote."""
|
||||||
//| ...
|
//| ...
|
||||||
@ -96,8 +93,7 @@ MP_DEFINE_BLEIO_EXCEPTION(RoleError, bleio_BluetoothError)
|
|||||||
NORETURN void mp_raise_bleio_RoleError(const compressed_string_t* msg) {
|
NORETURN void mp_raise_bleio_RoleError(const compressed_string_t* msg) {
|
||||||
mp_raise_msg(&mp_type_bleio_RoleError, msg);
|
mp_raise_msg(&mp_type_bleio_RoleError, msg);
|
||||||
}
|
}
|
||||||
//| class SecurityError:
|
//| class SecurityError(BluetoothError):
|
||||||
//| def __init__(self, BluetoothError: Any):
|
|
||||||
//| """Raised when a security related error occurs."""
|
//| """Raised when a security related error occurs."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
|
@ -58,7 +58,7 @@ STATIC mp_obj_t _register(mp_obj_t self, mp_obj_t o) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(register_obj, _register);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_2(register_obj, _register);
|
||||||
|
|
||||||
//| def flush(self, ) -> Any:
|
//| def flush(self) -> None:
|
||||||
//| """Send any queued drawing commands directly to the hardware.
|
//| """Send any queued drawing commands directly to the hardware.
|
||||||
//|
|
//|
|
||||||
//| :param int width: The width of the grid in tiles, or 1 for sprites."""
|
//| :param int width: The width of the grid in tiles, or 1 for sprites."""
|
||||||
@ -70,7 +70,7 @@ STATIC mp_obj_t _flush(mp_obj_t self) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(flush_obj, _flush);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_1(flush_obj, _flush);
|
||||||
|
|
||||||
//| def cc(self, b: bytes) -> Any:
|
//| def cc(self, b: bytes) -> None:
|
||||||
//| """Append bytes to the command FIFO.
|
//| """Append bytes to the command FIFO.
|
||||||
//|
|
//|
|
||||||
//| :param bytes b: The bytes to add"""
|
//| :param bytes b: The bytes to add"""
|
||||||
@ -86,7 +86,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(cc_obj, _cc);
|
|||||||
|
|
||||||
//{
|
//{
|
||||||
|
|
||||||
//| def AlphaFunc(self, func: int, ref: int) -> Any:
|
//| def AlphaFunc(self, func: int, ref: int) -> None:
|
||||||
//| """Set the alpha test function
|
//| """Set the alpha test function
|
||||||
//|
|
//|
|
||||||
//| :param int func: specifies the test function, one of ``NEVER``, ``LESS``, ``LEQUAL``, ``GREATER``, ``GEQUAL``, ``EQUAL``, ``NOTEQUAL``, or ``ALWAYS``. Range 0-7. The initial value is ALWAYS(7)
|
//| :param int func: specifies the test function, one of ``NEVER``, ``LESS``, ``LEQUAL``, ``GREATER``, ``GEQUAL``, ``EQUAL``, ``NOTEQUAL``, or ``ALWAYS``. Range 0-7. The initial value is ALWAYS(7)
|
||||||
@ -104,7 +104,7 @@ STATIC mp_obj_t _alphafunc(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_3(alphafunc_obj, _alphafunc);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_3(alphafunc_obj, _alphafunc);
|
||||||
|
|
||||||
//| def Begin(self, prim: int) -> Any:
|
//| def Begin(self, prim: int) -> None:
|
||||||
//| """Begin drawing a graphics primitive
|
//| """Begin drawing a graphics primitive
|
||||||
//|
|
//|
|
||||||
//| :param int prim: graphics primitive.
|
//| :param int prim: graphics primitive.
|
||||||
@ -120,7 +120,7 @@ STATIC mp_obj_t _begin(mp_obj_t self, mp_obj_t a0) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(begin_obj, _begin);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_2(begin_obj, _begin);
|
||||||
|
|
||||||
//| def BitmapExtFormat(self, format: int) -> Any:
|
//| def BitmapExtFormat(self, format: int) -> None:
|
||||||
//| """Set the bitmap format
|
//| """Set the bitmap format
|
||||||
//|
|
//|
|
||||||
//| :param int format: bitmap pixel format."""
|
//| :param int format: bitmap pixel format."""
|
||||||
@ -134,7 +134,7 @@ STATIC mp_obj_t _bitmapextformat(mp_obj_t self, mp_obj_t a0) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmapextformat_obj, _bitmapextformat);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmapextformat_obj, _bitmapextformat);
|
||||||
|
|
||||||
//| def BitmapHandle(self, handle: int) -> Any:
|
//| def BitmapHandle(self, handle: int) -> None:
|
||||||
//| """Set the bitmap handle
|
//| """Set the bitmap handle
|
||||||
//|
|
//|
|
||||||
//| :param int handle: bitmap handle. Range 0-31. The initial value is 0
|
//| :param int handle: bitmap handle. Range 0-31. The initial value is 0
|
||||||
@ -150,7 +150,7 @@ STATIC mp_obj_t _bitmaphandle(mp_obj_t self, mp_obj_t a0) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmaphandle_obj, _bitmaphandle);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmaphandle_obj, _bitmaphandle);
|
||||||
|
|
||||||
//| def BitmapLayoutH(self, linestride: int, height: int) -> Any:
|
//| def BitmapLayoutH(self, linestride: int, height: int) -> None:
|
||||||
//| """Set the source bitmap memory format and layout for the current handle. high bits for large bitmaps
|
//| """Set the source bitmap memory format and layout for the current handle. high bits for large bitmaps
|
||||||
//|
|
//|
|
||||||
//| :param int linestride: high part of bitmap line stride, in bytes. Range 0-7
|
//| :param int linestride: high part of bitmap line stride, in bytes. Range 0-7
|
||||||
@ -166,7 +166,7 @@ STATIC mp_obj_t _bitmaplayouth(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaplayouth_obj, _bitmaplayouth);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaplayouth_obj, _bitmaplayouth);
|
||||||
|
|
||||||
//| def BitmapLayout(self, format: int, linestride: int, height: int) -> Any:
|
//| def BitmapLayout(self, format: int, linestride: int, height: int) -> None:
|
||||||
//| """Set the source bitmap memory format and layout for the current handle
|
//| """Set the source bitmap memory format and layout for the current handle
|
||||||
//|
|
//|
|
||||||
//| :param int format: bitmap pixel format, or GLFORMAT to use BITMAP_EXT_FORMAT instead. Range 0-31
|
//| :param int format: bitmap pixel format, or GLFORMAT to use BITMAP_EXT_FORMAT instead. Range 0-31
|
||||||
@ -184,7 +184,7 @@ STATIC mp_obj_t _bitmaplayout(size_t n_args, const mp_obj_t *args) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitmaplayout_obj, 4, 4, _bitmaplayout);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitmaplayout_obj, 4, 4, _bitmaplayout);
|
||||||
|
|
||||||
//| def BitmapSizeH(self, width: int, height: int) -> Any:
|
//| def BitmapSizeH(self, width: int, height: int) -> None:
|
||||||
//| """Set the screen drawing of bitmaps for the current handle. high bits for large bitmaps
|
//| """Set the screen drawing of bitmaps for the current handle. high bits for large bitmaps
|
||||||
//|
|
//|
|
||||||
//| :param int width: high part of drawn bitmap width, in pixels. Range 0-3
|
//| :param int width: high part of drawn bitmap width, in pixels. Range 0-3
|
||||||
@ -200,7 +200,7 @@ STATIC mp_obj_t _bitmapsizeh(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmapsizeh_obj, _bitmapsizeh);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmapsizeh_obj, _bitmapsizeh);
|
||||||
|
|
||||||
//| def BitmapSize(self, filter: int, wrapx: int, wrapy: int, width: int, height: int) -> Any:
|
//| def BitmapSize(self, filter: int, wrapx: int, wrapy: int, width: int, height: int) -> None:
|
||||||
//| """Set the screen drawing of bitmaps for the current handle
|
//| """Set the screen drawing of bitmaps for the current handle
|
||||||
//|
|
//|
|
||||||
//| :param int filter: bitmap filtering mode, one of ``NEAREST`` or ``BILINEAR``. Range 0-1
|
//| :param int filter: bitmap filtering mode, one of ``NEAREST`` or ``BILINEAR``. Range 0-1
|
||||||
@ -222,7 +222,7 @@ STATIC mp_obj_t _bitmapsize(size_t n_args, const mp_obj_t *args) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitmapsize_obj, 6, 6, _bitmapsize);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitmapsize_obj, 6, 6, _bitmapsize);
|
||||||
|
|
||||||
//| def BitmapSource(self, addr: int) -> Any:
|
//| def BitmapSource(self, addr: int) -> None:
|
||||||
//| """Set the source address for bitmap graphics
|
//| """Set the source address for bitmap graphics
|
||||||
//|
|
//|
|
||||||
//| :param int addr: Bitmap start address, pixel-aligned. May be in SRAM or flash. Range 0-16777215"""
|
//| :param int addr: Bitmap start address, pixel-aligned. May be in SRAM or flash. Range 0-16777215"""
|
||||||
@ -236,7 +236,7 @@ STATIC mp_obj_t _bitmapsource(mp_obj_t self, mp_obj_t a0) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmapsource_obj, _bitmapsource);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmapsource_obj, _bitmapsource);
|
||||||
|
|
||||||
//| def BitmapSwizzle(self, r: int, g: int, b: int, a: int) -> Any:
|
//| def BitmapSwizzle(self, r: int, g: int, b: int, a: int) -> None:
|
||||||
//| """Set the source for the r,g,b and a channels of a bitmap
|
//| """Set the source for the r,g,b and a channels of a bitmap
|
||||||
//|
|
//|
|
||||||
//| :param int r: red component source channel. Range 0-7
|
//| :param int r: red component source channel. Range 0-7
|
||||||
@ -256,7 +256,7 @@ STATIC mp_obj_t _bitmapswizzle(size_t n_args, const mp_obj_t *args) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitmapswizzle_obj, 5, 5, _bitmapswizzle);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitmapswizzle_obj, 5, 5, _bitmapswizzle);
|
||||||
|
|
||||||
//| def BitmapTransformA(self, p: Any, v: int) -> Any:
|
//| def BitmapTransformA(self, p: int, v: int) -> None:
|
||||||
//| """Set the :math:`a` component of the bitmap transform matrix
|
//| """Set the :math:`a` component of the bitmap transform matrix
|
||||||
//|
|
//|
|
||||||
//| :param int p: precision control: 0 is 8.8, 1 is 1.15. Range 0-1. The initial value is 0
|
//| :param int p: precision control: 0 is 8.8, 1 is 1.15. Range 0-1. The initial value is 0
|
||||||
@ -276,7 +276,7 @@ STATIC mp_obj_t _bitmaptransforma(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransforma_obj, _bitmaptransforma);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransforma_obj, _bitmaptransforma);
|
||||||
|
|
||||||
//| def BitmapTransformB(self, p: Any, v: int) -> Any:
|
//| def BitmapTransformB(self, p: int, v: int) -> None:
|
||||||
//| """Set the :math:`b` component of the bitmap transform matrix
|
//| """Set the :math:`b` component of the bitmap transform matrix
|
||||||
//|
|
//|
|
||||||
//| :param int p: precision control: 0 is 8.8, 1 is 1.15. Range 0-1. The initial value is 0
|
//| :param int p: precision control: 0 is 8.8, 1 is 1.15. Range 0-1. The initial value is 0
|
||||||
@ -296,7 +296,7 @@ STATIC mp_obj_t _bitmaptransformb(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransformb_obj, _bitmaptransformb);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransformb_obj, _bitmaptransformb);
|
||||||
|
|
||||||
//| def BitmapTransformC(self, v: int) -> Any:
|
//| def BitmapTransformC(self, v: int) -> None:
|
||||||
//| """Set the :math:`c` component of the bitmap transform matrix
|
//| """Set the :math:`c` component of the bitmap transform matrix
|
||||||
//|
|
//|
|
||||||
//| :param int v: The :math:`c` component of the bitmap transform matrix, in signed 15.8 bit fixed-point form. Range 0-16777215. The initial value is 0
|
//| :param int v: The :math:`c` component of the bitmap transform matrix, in signed 15.8 bit fixed-point form. Range 0-16777215. The initial value is 0
|
||||||
@ -312,7 +312,7 @@ STATIC mp_obj_t _bitmaptransformc(mp_obj_t self, mp_obj_t a0) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmaptransformc_obj, _bitmaptransformc);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmaptransformc_obj, _bitmaptransformc);
|
||||||
|
|
||||||
//| def BitmapTransformD(self, p: Any, v: int) -> Any:
|
//| def BitmapTransformD(self, p: int, v: int) -> None:
|
||||||
//| """Set the :math:`d` component of the bitmap transform matrix
|
//| """Set the :math:`d` component of the bitmap transform matrix
|
||||||
//|
|
//|
|
||||||
//| :param int p: precision control: 0 is 8.8, 1 is 1.15. Range 0-1. The initial value is 0
|
//| :param int p: precision control: 0 is 8.8, 1 is 1.15. Range 0-1. The initial value is 0
|
||||||
@ -332,7 +332,7 @@ STATIC mp_obj_t _bitmaptransformd(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransformd_obj, _bitmaptransformd);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransformd_obj, _bitmaptransformd);
|
||||||
|
|
||||||
//| def BitmapTransformE(self, p: Any, v: int) -> Any:
|
//| def BitmapTransformE(self, p: int, v: int) -> None:
|
||||||
//| """Set the :math:`e` component of the bitmap transform matrix
|
//| """Set the :math:`e` component of the bitmap transform matrix
|
||||||
//|
|
//|
|
||||||
//| :param int p: precision control: 0 is 8.8, 1 is 1.15. Range 0-1. The initial value is 0
|
//| :param int p: precision control: 0 is 8.8, 1 is 1.15. Range 0-1. The initial value is 0
|
||||||
@ -352,7 +352,7 @@ STATIC mp_obj_t _bitmaptransforme(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransforme_obj, _bitmaptransforme);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransforme_obj, _bitmaptransforme);
|
||||||
|
|
||||||
//| def BitmapTransformF(self, v: int) -> Any:
|
//| def BitmapTransformF(self, v: int) -> None:
|
||||||
//| """Set the :math:`f` component of the bitmap transform matrix
|
//| """Set the :math:`f` component of the bitmap transform matrix
|
||||||
//|
|
//|
|
||||||
//| :param int v: The :math:`f` component of the bitmap transform matrix, in signed 15.8 bit fixed-point form. Range 0-16777215. The initial value is 0
|
//| :param int v: The :math:`f` component of the bitmap transform matrix, in signed 15.8 bit fixed-point form. Range 0-16777215. The initial value is 0
|
||||||
@ -368,7 +368,7 @@ STATIC mp_obj_t _bitmaptransformf(mp_obj_t self, mp_obj_t a0) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmaptransformf_obj, _bitmaptransformf);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmaptransformf_obj, _bitmaptransformf);
|
||||||
|
|
||||||
//| def BlendFunc(self, src: int, dst: int) -> Any:
|
//| def BlendFunc(self, src: int, dst: int) -> None:
|
||||||
//| """Set pixel arithmetic
|
//| """Set pixel arithmetic
|
||||||
//|
|
//|
|
||||||
//| :param int src: specifies how the source blending factor is computed. One of ``ZERO``, ``ONE``, ``SRC_ALPHA``, ``DST_ALPHA``, ``ONE_MINUS_SRC_ALPHA`` or ``ONE_MINUS_DST_ALPHA``. Range 0-7. The initial value is SRC_ALPHA(2)
|
//| :param int src: specifies how the source blending factor is computed. One of ``ZERO``, ``ONE``, ``SRC_ALPHA``, ``DST_ALPHA``, ``ONE_MINUS_SRC_ALPHA`` or ``ONE_MINUS_DST_ALPHA``. Range 0-7. The initial value is SRC_ALPHA(2)
|
||||||
@ -386,7 +386,7 @@ STATIC mp_obj_t _blendfunc(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_3(blendfunc_obj, _blendfunc);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_3(blendfunc_obj, _blendfunc);
|
||||||
|
|
||||||
//| def Call(self, dest: int) -> Any:
|
//| def Call(self, dest: int) -> None:
|
||||||
//| """Execute a sequence of commands at another location in the display list
|
//| """Execute a sequence of commands at another location in the display list
|
||||||
//|
|
//|
|
||||||
//| :param int dest: display list address. Range 0-65535"""
|
//| :param int dest: display list address. Range 0-65535"""
|
||||||
@ -400,7 +400,7 @@ STATIC mp_obj_t _call(mp_obj_t self, mp_obj_t a0) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(call_obj, _call);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_2(call_obj, _call);
|
||||||
|
|
||||||
//| def Cell(self, cell: int) -> Any:
|
//| def Cell(self, cell: int) -> None:
|
||||||
//| """Set the bitmap cell number for the vertex2f command
|
//| """Set the bitmap cell number for the vertex2f command
|
||||||
//|
|
//|
|
||||||
//| :param int cell: bitmap cell number. Range 0-127. The initial value is 0
|
//| :param int cell: bitmap cell number. Range 0-127. The initial value is 0
|
||||||
@ -416,7 +416,7 @@ STATIC mp_obj_t _cell(mp_obj_t self, mp_obj_t a0) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(cell_obj, _cell);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_2(cell_obj, _cell);
|
||||||
|
|
||||||
//| def ClearColorA(self, alpha: int) -> Any:
|
//| def ClearColorA(self, alpha: int) -> None:
|
||||||
//| """Set clear value for the alpha channel
|
//| """Set clear value for the alpha channel
|
||||||
//|
|
//|
|
||||||
//| :param int alpha: alpha value used when the color buffer is cleared. Range 0-255. The initial value is 0
|
//| :param int alpha: alpha value used when the color buffer is cleared. Range 0-255. The initial value is 0
|
||||||
@ -432,7 +432,7 @@ STATIC mp_obj_t _clearcolora(mp_obj_t self, mp_obj_t a0) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(clearcolora_obj, _clearcolora);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_2(clearcolora_obj, _clearcolora);
|
||||||
|
|
||||||
//| def ClearColorRGB(self, red: int, green: int, blue: int) -> Any:
|
//| def ClearColorRGB(self, red: int, green: int, blue: int) -> None:
|
||||||
//| """Set clear values for red, green and blue channels
|
//| """Set clear values for red, green and blue channels
|
||||||
//|
|
//|
|
||||||
//| :param int red: red value used when the color buffer is cleared. Range 0-255. The initial value is 0
|
//| :param int red: red value used when the color buffer is cleared. Range 0-255. The initial value is 0
|
||||||
@ -452,7 +452,7 @@ STATIC mp_obj_t _clearcolorrgb(size_t n_args, const mp_obj_t *args) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(clearcolorrgb_obj, 4, 4, _clearcolorrgb);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(clearcolorrgb_obj, 4, 4, _clearcolorrgb);
|
||||||
|
|
||||||
//| def Clear(self, c: int, s: int, t: int) -> Any:
|
//| def Clear(self, c: int, s: int, t: int) -> None:
|
||||||
//| """Clear buffers to preset values
|
//| """Clear buffers to preset values
|
||||||
//|
|
//|
|
||||||
//| :param int c: clear color buffer. Range 0-1
|
//| :param int c: clear color buffer. Range 0-1
|
||||||
@ -470,7 +470,7 @@ STATIC mp_obj_t _clear(size_t n_args, const mp_obj_t *args) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(clear_obj, 1, 4, _clear);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(clear_obj, 1, 4, _clear);
|
||||||
|
|
||||||
//| def ClearStencil(self, s: int) -> Any:
|
//| def ClearStencil(self, s: int) -> None:
|
||||||
//| """Set clear value for the stencil buffer
|
//| """Set clear value for the stencil buffer
|
||||||
//|
|
//|
|
||||||
//| :param int s: value used when the stencil buffer is cleared. Range 0-255. The initial value is 0
|
//| :param int s: value used when the stencil buffer is cleared. Range 0-255. The initial value is 0
|
||||||
@ -486,7 +486,7 @@ STATIC mp_obj_t _clearstencil(mp_obj_t self, mp_obj_t a0) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(clearstencil_obj, _clearstencil);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_2(clearstencil_obj, _clearstencil);
|
||||||
|
|
||||||
//| def ClearTag(self, s: int) -> Any:
|
//| def ClearTag(self, s: int) -> None:
|
||||||
//| """Set clear value for the tag buffer
|
//| """Set clear value for the tag buffer
|
||||||
//|
|
//|
|
||||||
//| :param int s: value used when the tag buffer is cleared. Range 0-255. The initial value is 0
|
//| :param int s: value used when the tag buffer is cleared. Range 0-255. The initial value is 0
|
||||||
@ -501,7 +501,7 @@ STATIC mp_obj_t _cleartag(mp_obj_t self, mp_obj_t a0) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(cleartag_obj, _cleartag);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_2(cleartag_obj, _cleartag);
|
||||||
|
|
||||||
//| def ColorA(self, alpha: int) -> Any:
|
//| def ColorA(self, alpha: int) -> None:
|
||||||
//| """Set the current color alpha
|
//| """Set the current color alpha
|
||||||
//|
|
//|
|
||||||
//| :param int alpha: alpha for the current color. Range 0-255. The initial value is 255
|
//| :param int alpha: alpha for the current color. Range 0-255. The initial value is 255
|
||||||
@ -517,7 +517,7 @@ STATIC mp_obj_t _colora(mp_obj_t self, mp_obj_t a0) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(colora_obj, _colora);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_2(colora_obj, _colora);
|
||||||
|
|
||||||
//| def ColorMask(self, r: int, g: int, b: int, a: int) -> Any:
|
//| def ColorMask(self, r: int, g: int, b: int, a: int) -> None:
|
||||||
//| """Enable and disable writing of frame buffer color components
|
//| """Enable and disable writing of frame buffer color components
|
||||||
//|
|
//|
|
||||||
//| :param int r: allow updates to the frame buffer red component. Range 0-1. The initial value is 1
|
//| :param int r: allow updates to the frame buffer red component. Range 0-1. The initial value is 1
|
||||||
@ -539,7 +539,7 @@ STATIC mp_obj_t _colormask(size_t n_args, const mp_obj_t *args) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(colormask_obj, 5, 5, _colormask);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(colormask_obj, 5, 5, _colormask);
|
||||||
|
|
||||||
//| def ColorRGB(self, red: int, green: int, blue: int) -> Any:
|
//| def ColorRGB(self, red: int, green: int, blue: int) -> None:
|
||||||
//| """Set the drawing color
|
//| """Set the drawing color
|
||||||
//|
|
//|
|
||||||
//| :param int red: red value for the current color. Range 0-255. The initial value is 255
|
//| :param int red: red value for the current color. Range 0-255. The initial value is 255
|
||||||
@ -559,9 +559,9 @@ STATIC mp_obj_t _colorrgb(size_t n_args, const mp_obj_t *args) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(colorrgb_obj, 4, 4, _colorrgb);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(colorrgb_obj, 4, 4, _colorrgb);
|
||||||
|
|
||||||
//| def Display(self, ) -> Any: ...
|
//| def Display(self) -> None:
|
||||||
//| """End the display list"""
|
//| """End the display list"""
|
||||||
//|
|
//| ...
|
||||||
|
|
||||||
STATIC mp_obj_t _display(mp_obj_t self) {
|
STATIC mp_obj_t _display(mp_obj_t self) {
|
||||||
|
|
||||||
@ -570,7 +570,7 @@ STATIC mp_obj_t _display(mp_obj_t self) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(display_obj, _display);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_1(display_obj, _display);
|
||||||
|
|
||||||
//| def End(self, ) -> Any:
|
//| def End(self) -> None:
|
||||||
//| """End drawing a graphics primitive
|
//| """End drawing a graphics primitive
|
||||||
//|
|
//|
|
||||||
//| :meth:`Vertex2ii` and :meth:`Vertex2f` calls are ignored until the next :meth:`Begin`."""
|
//| :meth:`Vertex2ii` and :meth:`Vertex2f` calls are ignored until the next :meth:`Begin`."""
|
||||||
@ -584,7 +584,7 @@ STATIC mp_obj_t _end(mp_obj_t self) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(end_obj, _end);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_1(end_obj, _end);
|
||||||
|
|
||||||
//| def Jump(self, dest: int) -> Any:
|
//| def Jump(self, dest: int) -> None:
|
||||||
//| """Execute commands at another location in the display list
|
//| """Execute commands at another location in the display list
|
||||||
//|
|
//|
|
||||||
//| :param int dest: display list address. Range 0-65535"""
|
//| :param int dest: display list address. Range 0-65535"""
|
||||||
@ -598,7 +598,7 @@ STATIC mp_obj_t _jump(mp_obj_t self, mp_obj_t a0) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(jump_obj, _jump);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_2(jump_obj, _jump);
|
||||||
|
|
||||||
//| def LineWidth(self, width: int) -> Any:
|
//| def LineWidth(self, width: int) -> None:
|
||||||
//| """Set the width of rasterized lines
|
//| """Set the width of rasterized lines
|
||||||
//|
|
//|
|
||||||
//| :param int width: line width in :math:`1/16` pixel. Range 0-4095. The initial value is 16
|
//| :param int width: line width in :math:`1/16` pixel. Range 0-4095. The initial value is 16
|
||||||
@ -614,7 +614,7 @@ STATIC mp_obj_t _linewidth(mp_obj_t self, mp_obj_t a0) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(linewidth_obj, _linewidth);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_2(linewidth_obj, _linewidth);
|
||||||
|
|
||||||
//| def Macro(self, m: int) -> Any:
|
//| def Macro(self, m: int) -> None:
|
||||||
//| """Execute a single command from a macro register
|
//| """Execute a single command from a macro register
|
||||||
//|
|
//|
|
||||||
//| :param int m: macro register to read. Range 0-1"""
|
//| :param int m: macro register to read. Range 0-1"""
|
||||||
@ -628,7 +628,7 @@ STATIC mp_obj_t _macro(mp_obj_t self, mp_obj_t a0) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(macro_obj, _macro);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_2(macro_obj, _macro);
|
||||||
|
|
||||||
//| def Nop(self, ) -> Any:
|
//| def Nop(self) -> None:
|
||||||
//| """No operation"""
|
//| """No operation"""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -640,7 +640,7 @@ STATIC mp_obj_t _nop(mp_obj_t self) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(nop_obj, _nop);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_1(nop_obj, _nop);
|
||||||
|
|
||||||
//| def PaletteSource(self, addr: int) -> Any:
|
//| def PaletteSource(self, addr: int) -> None:
|
||||||
//| """Set the base address of the palette
|
//| """Set the base address of the palette
|
||||||
//|
|
//|
|
||||||
//| :param int addr: Address in graphics SRAM, 2-byte aligned. Range 0-4194303. The initial value is 0
|
//| :param int addr: Address in graphics SRAM, 2-byte aligned. Range 0-4194303. The initial value is 0
|
||||||
@ -656,7 +656,7 @@ STATIC mp_obj_t _palettesource(mp_obj_t self, mp_obj_t a0) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(palettesource_obj, _palettesource);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_2(palettesource_obj, _palettesource);
|
||||||
|
|
||||||
//| def PointSize(self, size: int) -> Any:
|
//| def PointSize(self, size: int) -> None:
|
||||||
//| """Set the radius of rasterized points
|
//| """Set the radius of rasterized points
|
||||||
//|
|
//|
|
||||||
//| :param int size: point radius in :math:`1/16` pixel. Range 0-8191. The initial value is 16
|
//| :param int size: point radius in :math:`1/16` pixel. Range 0-8191. The initial value is 16
|
||||||
@ -672,7 +672,7 @@ STATIC mp_obj_t _pointsize(mp_obj_t self, mp_obj_t a0) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(pointsize_obj, _pointsize);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_2(pointsize_obj, _pointsize);
|
||||||
|
|
||||||
//| def RestoreContext(self, ) -> Any:
|
//| def RestoreContext(self) -> None:
|
||||||
//| """Restore the current graphics context from the context stack"""
|
//| """Restore the current graphics context from the context stack"""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -684,7 +684,7 @@ STATIC mp_obj_t _restorecontext(mp_obj_t self) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(restorecontext_obj, _restorecontext);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_1(restorecontext_obj, _restorecontext);
|
||||||
|
|
||||||
//| def Return(self, ) -> Any:
|
//| def Return(self) -> None:
|
||||||
//| """Return from a previous call command"""
|
//| """Return from a previous call command"""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -696,7 +696,7 @@ STATIC mp_obj_t _return(mp_obj_t self) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(return_obj, _return);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_1(return_obj, _return);
|
||||||
|
|
||||||
//| def SaveContext(self, ) -> Any:
|
//| def SaveContext(self) -> None:
|
||||||
//| """Push the current graphics context on the context stack"""
|
//| """Push the current graphics context on the context stack"""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -708,7 +708,7 @@ STATIC mp_obj_t _savecontext(mp_obj_t self) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(savecontext_obj, _savecontext);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_1(savecontext_obj, _savecontext);
|
||||||
|
|
||||||
//| def ScissorSize(self, width: int, height: int) -> Any:
|
//| def ScissorSize(self, width: int, height: int) -> None:
|
||||||
//| """Set the size of the scissor clip rectangle
|
//| """Set the size of the scissor clip rectangle
|
||||||
//|
|
//|
|
||||||
//| :param int width: The width of the scissor clip rectangle, in pixels. Range 0-4095. The initial value is hsize
|
//| :param int width: The width of the scissor clip rectangle, in pixels. Range 0-4095. The initial value is hsize
|
||||||
@ -726,7 +726,7 @@ STATIC mp_obj_t _scissorsize(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_3(scissorsize_obj, _scissorsize);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_3(scissorsize_obj, _scissorsize);
|
||||||
|
|
||||||
//| def ScissorXY(self, x: int, y: int) -> Any:
|
//| def ScissorXY(self, x: int, y: int) -> None:
|
||||||
//| """Set the top left corner of the scissor clip rectangle
|
//| """Set the top left corner of the scissor clip rectangle
|
||||||
//|
|
//|
|
||||||
//| :param int x: The :math:`x` coordinate of the scissor clip rectangle, in pixels. Range 0-2047. The initial value is 0
|
//| :param int x: The :math:`x` coordinate of the scissor clip rectangle, in pixels. Range 0-2047. The initial value is 0
|
||||||
@ -744,7 +744,7 @@ STATIC mp_obj_t _scissorxy(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_3(scissorxy_obj, _scissorxy);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_3(scissorxy_obj, _scissorxy);
|
||||||
|
|
||||||
//| def StencilFunc(self, func: int, ref: int, mask: int) -> Any:
|
//| def StencilFunc(self, func: int, ref: int, mask: int) -> None:
|
||||||
//| """Set function and reference value for stencil testing
|
//| """Set function and reference value for stencil testing
|
||||||
//|
|
//|
|
||||||
//| :param int func: specifies the test function, one of ``NEVER``, ``LESS``, ``LEQUAL``, ``GREATER``, ``GEQUAL``, ``EQUAL``, ``NOTEQUAL``, or ``ALWAYS``. Range 0-7. The initial value is ALWAYS(7)
|
//| :param int func: specifies the test function, one of ``NEVER``, ``LESS``, ``LEQUAL``, ``GREATER``, ``GEQUAL``, ``EQUAL``, ``NOTEQUAL``, or ``ALWAYS``. Range 0-7. The initial value is ALWAYS(7)
|
||||||
@ -764,7 +764,7 @@ STATIC mp_obj_t _stencilfunc(size_t n_args, const mp_obj_t *args) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(stencilfunc_obj, 4, 4, _stencilfunc);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(stencilfunc_obj, 4, 4, _stencilfunc);
|
||||||
|
|
||||||
//| def StencilMask(self, mask: int) -> Any:
|
//| def StencilMask(self, mask: int) -> None:
|
||||||
//| """Control the writing of individual bits in the stencil planes
|
//| """Control the writing of individual bits in the stencil planes
|
||||||
//|
|
//|
|
||||||
//| :param int mask: the mask used to enable writing stencil bits. Range 0-255. The initial value is 255
|
//| :param int mask: the mask used to enable writing stencil bits. Range 0-255. The initial value is 255
|
||||||
@ -780,7 +780,7 @@ STATIC mp_obj_t _stencilmask(mp_obj_t self, mp_obj_t a0) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(stencilmask_obj, _stencilmask);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_2(stencilmask_obj, _stencilmask);
|
||||||
|
|
||||||
//| def StencilOp(self, sfail: int, spass: int) -> Any:
|
//| def StencilOp(self, sfail: int, spass: int) -> None:
|
||||||
//| """Set stencil test actions
|
//| """Set stencil test actions
|
||||||
//|
|
//|
|
||||||
//| :param int sfail: specifies the action to take when the stencil test fails, one of ``KEEP``, ``ZERO``, ``REPLACE``, ``INCR``, ``INCR_WRAP``, ``DECR``, ``DECR_WRAP``, and ``INVERT``. Range 0-7. The initial value is KEEP(1)
|
//| :param int sfail: specifies the action to take when the stencil test fails, one of ``KEEP``, ``ZERO``, ``REPLACE``, ``INCR``, ``INCR_WRAP``, ``DECR``, ``DECR_WRAP``, and ``INVERT``. Range 0-7. The initial value is KEEP(1)
|
||||||
@ -798,7 +798,7 @@ STATIC mp_obj_t _stencilop(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_3(stencilop_obj, _stencilop);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_3(stencilop_obj, _stencilop);
|
||||||
|
|
||||||
//| def TagMask(self, mask: int) -> Any:
|
//| def TagMask(self, mask: int) -> None:
|
||||||
//| """Control the writing of the tag buffer
|
//| """Control the writing of the tag buffer
|
||||||
//|
|
//|
|
||||||
//| :param int mask: allow updates to the tag buffer. Range 0-1. The initial value is 1
|
//| :param int mask: allow updates to the tag buffer. Range 0-1. The initial value is 1
|
||||||
@ -814,7 +814,7 @@ STATIC mp_obj_t _tagmask(mp_obj_t self, mp_obj_t a0) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(tagmask_obj, _tagmask);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_2(tagmask_obj, _tagmask);
|
||||||
|
|
||||||
//| def Tag(self, s: int) -> Any:
|
//| def Tag(self, s: int) -> None:
|
||||||
//| """Set the current tag value
|
//| """Set the current tag value
|
||||||
//|
|
//|
|
||||||
//| :param int s: tag value. Range 0-255. The initial value is 255
|
//| :param int s: tag value. Range 0-255. The initial value is 255
|
||||||
@ -830,7 +830,7 @@ STATIC mp_obj_t _tag(mp_obj_t self, mp_obj_t a0) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(tag_obj, _tag);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_2(tag_obj, _tag);
|
||||||
|
|
||||||
//| def VertexTranslateX(self, x: int) -> Any:
|
//| def VertexTranslateX(self, x: int) -> None:
|
||||||
//| """Set the vertex transformation's x translation component
|
//| """Set the vertex transformation's x translation component
|
||||||
//|
|
//|
|
||||||
//| :param int x: signed x-coordinate in :math:`1/16` pixel. Range 0-131071. The initial value is 0
|
//| :param int x: signed x-coordinate in :math:`1/16` pixel. Range 0-131071. The initial value is 0
|
||||||
@ -846,7 +846,7 @@ STATIC mp_obj_t _vertextranslatex(mp_obj_t self, mp_obj_t a0) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(vertextranslatex_obj, _vertextranslatex);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_2(vertextranslatex_obj, _vertextranslatex);
|
||||||
|
|
||||||
//| def VertexTranslateY(self, y: int) -> Any:
|
//| def VertexTranslateY(self, y: int) -> None:
|
||||||
//| """Set the vertex transformation's y translation component
|
//| """Set the vertex transformation's y translation component
|
||||||
//|
|
//|
|
||||||
//| :param int y: signed y-coordinate in :math:`1/16` pixel. Range 0-131071. The initial value is 0
|
//| :param int y: signed y-coordinate in :math:`1/16` pixel. Range 0-131071. The initial value is 0
|
||||||
@ -863,7 +863,7 @@ STATIC mp_obj_t _vertextranslatey(mp_obj_t self, mp_obj_t a0) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(vertextranslatey_obj, _vertextranslatey);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_2(vertextranslatey_obj, _vertextranslatey);
|
||||||
|
|
||||||
//| def VertexFormat(self, frac: int) -> Any:
|
//| def VertexFormat(self, frac: int) -> None:
|
||||||
//| """Set the precision of vertex2f coordinates
|
//| """Set the precision of vertex2f coordinates
|
||||||
//|
|
//|
|
||||||
//| :param int frac: Number of fractional bits in X,Y coordinates, 0-4. Range 0-7. The initial value is 4
|
//| :param int frac: Number of fractional bits in X,Y coordinates, 0-4. Range 0-7. The initial value is 4
|
||||||
@ -879,7 +879,7 @@ STATIC mp_obj_t _vertexformat(mp_obj_t self, mp_obj_t a0) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(vertexformat_obj, _vertexformat);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_2(vertexformat_obj, _vertexformat);
|
||||||
|
|
||||||
//| def Vertex2ii(self, x: int, y: int, handle: int, cell: int) -> Any:
|
//| def Vertex2ii(self, x: int, y: int, handle: int, cell: int) -> None:
|
||||||
//| """:param int x: x-coordinate in pixels. Range 0-511
|
//| """:param int x: x-coordinate in pixels. Range 0-511
|
||||||
//| :param int y: y-coordinate in pixels. Range 0-511
|
//| :param int y: y-coordinate in pixels. Range 0-511
|
||||||
//| :param int handle: bitmap handle. Range 0-31
|
//| :param int handle: bitmap handle. Range 0-31
|
||||||
@ -954,7 +954,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(vertex2ii_obj, 3, 5, _vertex2ii);
|
|||||||
|
|
||||||
// Hand-written functions {
|
// Hand-written functions {
|
||||||
|
|
||||||
//| def Vertex2f(self, b: Any) -> Any:
|
//| def Vertex2f(self, b: float) -> None:
|
||||||
//| """Draw a point.
|
//| """Draw a point.
|
||||||
//|
|
//|
|
||||||
//| :param float x: pixel x-coordinate
|
//| :param float x: pixel x-coordinate
|
||||||
@ -973,7 +973,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(vertex2f_obj, _vertex2f);
|
|||||||
#define ADD_X(self, x) \
|
#define ADD_X(self, x) \
|
||||||
common_hal__eve_add(EVEHAL(self), sizeof(x), &(x));
|
common_hal__eve_add(EVEHAL(self), sizeof(x), &(x));
|
||||||
|
|
||||||
//| def cmd0(self, n: int) -> Any:
|
//| def cmd0(self, n: int) -> None:
|
||||||
//| """Append the command word n to the FIFO
|
//| """Append the command word n to the FIFO
|
||||||
//|
|
//|
|
||||||
//| :param int n: The command code
|
//| :param int n: The command code
|
||||||
@ -990,7 +990,7 @@ STATIC mp_obj_t _cmd0(mp_obj_t self, mp_obj_t n) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(cmd0_obj, _cmd0);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_2(cmd0_obj, _cmd0);
|
||||||
|
|
||||||
//| def cmd(self, n: int, fmt: str, args: tuple) -> Any:
|
//| def cmd(self, n: int, fmt: str, args: tuple) -> None:
|
||||||
//| """Append a command packet to the FIFO.
|
//| """Append a command packet to the FIFO.
|
||||||
//|
|
//|
|
||||||
//| :param int n: The command code
|
//| :param int n: The command code
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
//| that library."""
|
//| that library."""
|
||||||
//|
|
//|
|
||||||
|
|
||||||
//| def __init__(self, buffer: Any, rows: Any, cols: Any, buttons: Any):
|
//| def __init__(self, buffer: ReadableBuffer, rows: List[DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut], cols: List[DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut], buttons: DigitalInOut) -> None:
|
||||||
//| """Initializes matrix scanning routines.
|
//| """Initializes matrix scanning routines.
|
||||||
//|
|
//|
|
||||||
//| The ``buffer`` is a 64 byte long ``bytearray`` that stores what should
|
//| The ``buffer`` is a 64 byte long ``bytearray`` that stores what should
|
||||||
|
@ -47,7 +47,7 @@ static void parse_byteorder(mp_obj_t byteorder_obj, pixelbuf_byteorder_details_t
|
|||||||
//| class PixelBuf:
|
//| class PixelBuf:
|
||||||
//| """A fast RGB[W] pixel buffer for LED and similar devices."""
|
//| """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""):
|
//| def __init__(self, size: int, *, byteorder: str = "BGR", brightness: float = 0, auto_write: bool = False, header: bytes = b"", trailer: bytes = b"") -> None:
|
||||||
//| """Create a PixelBuf object of the specified size, byteorder, and bits per pixel.
|
//| """Create a PixelBuf object of the specified size, byteorder, and bits per pixel.
|
||||||
//|
|
//|
|
||||||
//| When brightness is less than 1.0, a second buffer will be used to store the color values
|
//| 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: Any = ...
|
//| bpp: int = ...
|
||||||
//| """The number of bytes per pixel in the buffer (read-only)"""
|
//| """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) {
|
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: Any = ...
|
//| brightness: float = ...
|
||||||
//| """Float value between 0 and 1. Output brightness.
|
//| """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
|
//| 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},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| auto_write: Any = ...
|
//| auto_write: bool = ...
|
||||||
//| """Whether to automatically write the pixels after each update."""
|
//| """Whether to automatically write the pixels after each update."""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_auto_write(mp_obj_t self_in) {
|
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},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| byteorder: Any = ...
|
//| byteorder: string = ...
|
||||||
//| """byteorder string for the buffer (read-only)"""
|
//| """byteorder string for the buffer (read-only)"""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_byteorder(mp_obj_t self_in) {
|
STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_byteorder(mp_obj_t self_in) {
|
||||||
@ -245,7 +245,7 @@ STATIC mp_obj_t pixelbuf_pixelbuf_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def show(self, ) -> Any:
|
//| def show(self) -> None:
|
||||||
//| """Transmits the color data to the pixels so that they are shown. This is done automatically
|
//| """Transmits the color data to the pixels so that they are shown. This is done automatically
|
||||||
//| when `auto_write` is True."""
|
//| when `auto_write` is True."""
|
||||||
//| ...
|
//| ...
|
||||||
@ -257,7 +257,7 @@ STATIC mp_obj_t pixelbuf_pixelbuf_show(mp_obj_t self_in) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(pixelbuf_pixelbuf_show_obj, pixelbuf_pixelbuf_show);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_1(pixelbuf_pixelbuf_show_obj, pixelbuf_pixelbuf_show);
|
||||||
|
|
||||||
//| def fill(color: Any) -> Any:
|
//| def fill(color: Union[int, Tuple[int, int, int]]) -> None:
|
||||||
//| """Fills the given pixelbuf with the given color."""
|
//| """Fills the given pixelbuf with the given color."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -269,13 +269,13 @@ STATIC mp_obj_t pixelbuf_pixelbuf_fill(mp_obj_t self_in, mp_obj_t value) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(pixelbuf_pixelbuf_fill_obj, pixelbuf_pixelbuf_fill);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_2(pixelbuf_pixelbuf_fill_obj, pixelbuf_pixelbuf_fill);
|
||||||
|
|
||||||
//| def __getitem__(self, index: Any) -> Any:
|
//| def __getitem__(self, index: int) -> Tuple[int, int, int, Union[int, float]]:
|
||||||
//| """Returns the pixel value at the given index as a tuple of (Red, Green, Blue[, White]) values
|
//| """Returns the pixel value at the given index as a tuple of (Red, Green, Blue[, White]) values
|
||||||
//| between 0 and 255. When in PWM (DotStar) mode, the 4th tuple value is a float of the pixel
|
//| between 0 and 255. When in PWM (DotStar) mode, the 4th tuple value is a float of the pixel
|
||||||
//| intensity from 0-1.0."""
|
//| intensity from 0-1.0."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def __setitem__(self, index: Any, value: Any) -> Any:
|
//| def __setitem__(self, index: int, value: Union[int, Tuple[int, int, int, Union[int, float]]]) -> PixelBuf:
|
||||||
//| """Sets the pixel value at the given index. Value can either be a tuple or integer. Tuples are
|
//| """Sets the pixel value at the given index. Value can either be a tuple or integer. Tuples are
|
||||||
//| The individual (Red, Green, Blue[, White]) values between 0 and 255. If given an integer, the
|
//| The individual (Red, Green, Blue[, White]) values between 0 and 255. If given an integer, the
|
||||||
//| red, green and blue values are packed into the lower three bytes (0xRRGGBB).
|
//| red, green and blue values are packed into the lower three bytes (0xRRGGBB).
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
//| Byteorders are configured with strings, such as "RGB" or "RGBD"."""
|
//| Byteorders are configured with strings, such as "RGB" or "RGBD"."""
|
||||||
// TODO: Pull in docs from pypixelbuf.
|
// TODO: Pull in docs from pypixelbuf.
|
||||||
|
|
||||||
//| def colorwheel(n: int) -> Any:
|
//| def colorwheel(n: int) -> int:
|
||||||
//| """C implementation of the common wheel() function found in many examples.
|
//| """C implementation of the common wheel() function found in many examples.
|
||||||
//| Returns the colorwheel RGB value as an integer value for n (usable in :py:class:`PixelBuf`, neopixel, and dotstar)."""
|
//| Returns the colorwheel RGB value as an integer value for n (usable in :py:class:`PixelBuf`, neopixel, and dotstar)."""
|
||||||
//| ...
|
//| ...
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
//| class Layer:
|
//| class Layer:
|
||||||
//| """Keep information about a single layer of graphics"""
|
//| """Keep information about a single layer of graphics"""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, width: int, height: int, graphic: bytearray, palette: bytearray, grid: bytearray):
|
//| def __init__(self, width: int, height: int, graphic: bytearray, palette: bytearray, grid: bytearray) -> None:
|
||||||
//| """Keep internal information about a layer of graphics (either a
|
//| """Keep internal information about a layer of graphics (either a
|
||||||
//| ``Grid`` or a ``Sprite``) in a format suitable for fast rendering
|
//| ``Grid`` or a ``Sprite``) in a format suitable for fast rendering
|
||||||
//| with the ``render()`` function.
|
//| with the ``render()`` function.
|
||||||
@ -88,7 +88,7 @@ STATIC mp_obj_t layer_make_new(const mp_obj_type_t *type, size_t n_args,
|
|||||||
return MP_OBJ_FROM_PTR(self);
|
return MP_OBJ_FROM_PTR(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def move(self, x: Any, y: Any) -> Any:
|
//| def move(self, x: int, y: int) -> None:
|
||||||
//| """Set the offset of the layer to the specified values."""
|
//| """Set the offset of the layer to the specified values."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -100,7 +100,7 @@ STATIC mp_obj_t layer_move(mp_obj_t self_in, mp_obj_t x_in, mp_obj_t y_in) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_3(layer_move_obj, layer_move);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_3(layer_move_obj, layer_move);
|
||||||
|
|
||||||
//| def frame(self, frame: Any, rotation: Any) -> Any:
|
//| def frame(self, frame: int, rotation: int) -> None:
|
||||||
//| """Set the animation frame of the sprite, and optionally rotation its
|
//| """Set the animation frame of the sprite, and optionally rotation its
|
||||||
//| graphic."""
|
//| graphic."""
|
||||||
//| ...
|
//| ...
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
//| class Text:
|
//| class Text:
|
||||||
//| """Keep information about a single grid of text"""
|
//| """Keep information about a single grid of text"""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, width: int, height: int, font: bytearray, palette: bytearray, chars: bytearray):
|
//| def __init__(self, width: int, height: int, font: bytearray, palette: bytearray, chars: bytearray) -> None:
|
||||||
//| """Keep internal information about a grid of text
|
//| """Keep internal information about a grid of text
|
||||||
//| in a format suitable for fast rendering
|
//| in a format suitable for fast rendering
|
||||||
//| with the ``render()`` function.
|
//| with the ``render()`` function.
|
||||||
@ -82,7 +82,7 @@ STATIC mp_obj_t text_make_new(const mp_obj_type_t *type, size_t n_args,
|
|||||||
return MP_OBJ_FROM_PTR(self);
|
return MP_OBJ_FROM_PTR(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def move(self, x: Any, y: Any) -> Any:
|
//| def move(self, x: int, y: int) -> None:
|
||||||
//| """Set the offset of the text to the specified values."""
|
//| """Set the offset of the text to the specified values."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
//| class AES:
|
//| class AES:
|
||||||
//| """Encrypt and decrypt AES streams"""
|
//| """Encrypt and decrypt AES streams"""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, key, mode=0, iv=None, segment_size=8) -> Any:
|
//| def __init__(self, key: Optional[ReadableBuffer], mode: int=0, iv: ReadableBuffer=None, segment_size: int=8) -> None:
|
||||||
//| """Create a new AES state with the given key.
|
//| """Create a new AES state with the given key.
|
||||||
//|
|
//|
|
||||||
//| :param bytearray key: A 16-, 24-, or 32-byte key
|
//| :param bytearray key: A 16-, 24-, or 32-byte key
|
||||||
@ -152,7 +152,7 @@ STATIC void validate_length(aesio_aes_obj_t *self, size_t src_length,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def encrypt_into(src, dest) -> None:
|
//| def encrypt_into(src: ReadableBuffer, dest: WriteableBuffer) -> None:
|
||||||
//| """Encrypt the buffer from ``src`` into ``dest``.
|
//| """Encrypt the buffer from ``src`` into ``dest``.
|
||||||
//|
|
//|
|
||||||
//| For ECB mode, the buffers must be 16 bytes long. For CBC mode, the
|
//| For ECB mode, the buffers must be 16 bytes long. For CBC mode, the
|
||||||
@ -183,7 +183,7 @@ STATIC mp_obj_t aesio_aes_encrypt_into(mp_obj_t aesio_obj, mp_obj_t src,
|
|||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_3(aesio_aes_encrypt_into_obj,
|
STATIC MP_DEFINE_CONST_FUN_OBJ_3(aesio_aes_encrypt_into_obj,
|
||||||
aesio_aes_encrypt_into);
|
aesio_aes_encrypt_into);
|
||||||
|
|
||||||
//| def decrypt_into(src, dest) -> None:
|
//| def decrypt_into(src: ReadableBuffer, dest: WriteableBuffer) -> None:
|
||||||
//|
|
//|
|
||||||
//| """Decrypt the buffer from ``src`` into ``dest``.
|
//| """Decrypt the buffer from ``src`` into ``dest``.
|
||||||
//| For ECB mode, the buffers must be 16 bytes long. For CBC mode, the
|
//| For ECB mode, the buffers must be 16 bytes long. For CBC mode, the
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
//| val = adc.value"""
|
//| val = adc.value"""
|
||||||
//|
|
//|
|
||||||
|
|
||||||
//| def __init__(self, pin: microcontroller.Pin):
|
//| def __init__(self, pin: microcontroller.Pin) -> None:
|
||||||
//| """Use the AnalogIn on the given pin. The reference voltage varies by
|
//| """Use the AnalogIn on the given pin. The reference voltage varies by
|
||||||
//| platform so use ``reference_voltage`` to read the configured setting.
|
//| platform so use ``reference_voltage`` to read the configured setting.
|
||||||
//|
|
//|
|
||||||
@ -70,7 +70,7 @@ STATIC mp_obj_t analogio_analogin_make_new(const mp_obj_type_t *type,
|
|||||||
return MP_OBJ_FROM_PTR(self);
|
return MP_OBJ_FROM_PTR(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def deinit(self, ) -> Any:
|
//| def deinit(self) -> None:
|
||||||
//| """Turn off the AnalogIn and release the pin for other use."""
|
//| """Turn off the AnalogIn and release the pin for other use."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -86,13 +86,13 @@ STATIC void check_for_deinit(analogio_analogin_obj_t *self) {
|
|||||||
raise_deinited_error();
|
raise_deinited_error();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//| def __enter__(self, ) -> Any:
|
//| def __enter__(self) -> AnalogIn:
|
||||||
//| """No-op used by Context Managers."""
|
//| """No-op used by Context Managers."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
// Provided by context manager helper.
|
// Provided by context manager helper.
|
||||||
|
|
||||||
//| def __exit__(self, ) -> Any:
|
//| def __exit__(self) -> None:
|
||||||
//| """Automatically deinitializes the hardware when exiting a context. See
|
//| """Automatically deinitializes the hardware when exiting a context. See
|
||||||
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
||||||
//| ...
|
//| ...
|
||||||
@ -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__);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(analogio_analogin___exit___obj, 4, 4, analogio_analogin___exit__);
|
||||||
|
|
||||||
//| value: Any = ...
|
//| value: int = ...
|
||||||
//| """The value on the analog pin between 0 and 65535 inclusive (16-bit). (read-only)
|
//| """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
|
//| 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},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| reference_voltage: Any = ...
|
//| reference_voltage: Optional[float] = ...
|
||||||
//| """The maximum voltage measurable (also known as the reference voltage) as a
|
//| """The maximum voltage measurable (also known as the reference voltage) as a
|
||||||
//| `float` in Volts."""
|
//| `float` in Volts."""
|
||||||
//|
|
//|
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
//| dac = analogio.AnalogOut(pin.PA02) # output on pin PA02
|
//| dac = analogio.AnalogOut(pin.PA02) # output on pin PA02
|
||||||
//| dac.value = 32768 # makes PA02 1.65V"""
|
//| dac.value = 32768 # makes PA02 1.65V"""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, pin: microcontroller.Pin):
|
//| def __init__(self, pin: microcontroller.Pin) -> None:
|
||||||
//| """Use the AnalogOut on the given pin.
|
//| """Use the AnalogOut on the given pin.
|
||||||
//|
|
//|
|
||||||
//| :param ~microcontroller.Pin pin: the pin to output to"""
|
//| :param ~microcontroller.Pin pin: the pin to output to"""
|
||||||
@ -66,7 +66,7 @@ STATIC mp_obj_t analogio_analogout_make_new(const mp_obj_type_t *type, mp_uint_t
|
|||||||
return MP_OBJ_FROM_PTR(self);
|
return MP_OBJ_FROM_PTR(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def deinit(self, ) -> Any:
|
//| def deinit(self) -> None:
|
||||||
//| """Turn off the AnalogOut and release the pin for other use."""
|
//| """Turn off the AnalogOut and release the pin for other use."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -79,13 +79,13 @@ STATIC mp_obj_t analogio_analogout_deinit(mp_obj_t self_in) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(analogio_analogout_deinit_obj, analogio_analogout_deinit);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_1(analogio_analogout_deinit_obj, analogio_analogout_deinit);
|
||||||
|
|
||||||
//| def __enter__(self, ) -> Any:
|
//| def __enter__(self) -> AnalogOut:
|
||||||
//| """No-op used by Context Managers."""
|
//| """No-op used by Context Managers."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
// Provided by context manager helper.
|
// Provided by context manager helper.
|
||||||
|
|
||||||
//| def __exit__(self, ) -> Any:
|
//| def __exit__(self) -> None:
|
||||||
//| """Automatically deinitializes the hardware when exiting a context. See
|
//| """Automatically deinitializes the hardware when exiting a context. See
|
||||||
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
||||||
//| ...
|
//| ...
|
||||||
@ -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__);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(analogio_analogout___exit___obj, 4, 4, analogio_analogout___exit__);
|
||||||
|
|
||||||
//| value: Any = ...
|
//| value: int = ...
|
||||||
//| """The value on the analog pin between 0 and 65535 inclusive (16-bit). (write-only)
|
//| """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
|
//| Even if the underlying digital to analog converter (DAC) is lower
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
//| class I2SOut:
|
//| class I2SOut:
|
||||||
//| """Output an I2S audio signal"""
|
//| """Output an I2S audio signal"""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, bit_clock: microcontroller.Pin, word_select: microcontroller.Pin, data: microcontroller.Pin, *, left_justified: bool):
|
//| def __init__(self, bit_clock: microcontroller.Pin, word_select: microcontroller.Pin, data: microcontroller.Pin, *, left_justified: bool) -> None:
|
||||||
//| """Create a I2SOut object associated with the given pins.
|
//| """Create a I2SOut object associated with the given pins.
|
||||||
//|
|
//|
|
||||||
//| :param ~microcontroller.Pin bit_clock: The bit clock (or serial clock) pin
|
//| :param ~microcontroller.Pin bit_clock: The bit clock (or serial clock) pin
|
||||||
@ -112,7 +112,7 @@ STATIC mp_obj_t audiobusio_i2sout_make_new(const mp_obj_type_t *type, size_t n_a
|
|||||||
return MP_OBJ_FROM_PTR(self);
|
return MP_OBJ_FROM_PTR(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def deinit(self, ) -> Any:
|
//| def deinit(self) -> None:
|
||||||
//| """Deinitialises the I2SOut and releases any hardware resources for reuse."""
|
//| """Deinitialises the I2SOut and releases any hardware resources for reuse."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -128,13 +128,13 @@ STATIC void check_for_deinit(audiobusio_i2sout_obj_t *self) {
|
|||||||
raise_deinited_error();
|
raise_deinited_error();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//| def __enter__(self, ) -> Any:
|
//| def __enter__(self) -> I2SOut:
|
||||||
//| """No-op used by Context Managers."""
|
//| """No-op used by Context Managers."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
// Provided by context manager helper.
|
// Provided by context manager helper.
|
||||||
|
|
||||||
//| def __exit__(self, ) -> Any:
|
//| def __exit__(self) -> None:
|
||||||
//| """Automatically deinitializes the hardware when exiting a context. See
|
//| """Automatically deinitializes the hardware when exiting a context. See
|
||||||
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
||||||
//| ...
|
//| ...
|
||||||
@ -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__);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiobusio_i2sout___exit___obj, 4, 4, audiobusio_i2sout_obj___exit__);
|
||||||
|
|
||||||
|
|
||||||
//| def play(self, sample: Any, *, loop: Any = False) -> Any:
|
//| def play(self, sample: Union[audiocore.WaveFile, audiocore.RawSample, audiomixer.Mixer], *, loop: bool = False) -> None:
|
||||||
//| """Plays the sample once when loop=False and continuously when loop=True.
|
//| """Plays the sample once when loop=False and continuously when loop=True.
|
||||||
//| Does not block. Use `playing` to block.
|
//| Does not block. Use `playing` to block.
|
||||||
//|
|
//|
|
||||||
@ -174,7 +174,7 @@ STATIC mp_obj_t audiobusio_i2sout_obj_play(size_t n_args, const mp_obj_t *pos_ar
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_KW(audiobusio_i2sout_play_obj, 1, audiobusio_i2sout_obj_play);
|
MP_DEFINE_CONST_FUN_OBJ_KW(audiobusio_i2sout_play_obj, 1, audiobusio_i2sout_obj_play);
|
||||||
|
|
||||||
//| def stop(self, ) -> Any:
|
//| def stop(self) -> None:
|
||||||
//| """Stops playback."""
|
//| """Stops playback."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -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);
|
MP_DEFINE_CONST_FUN_OBJ_1(audiobusio_i2sout_stop_obj, audiobusio_i2sout_obj_stop);
|
||||||
|
|
||||||
//| playing: Any = ...
|
//| playing: bool = ...
|
||||||
//| """True when the audio sample is being output. (read-only)"""
|
//| """True when the audio sample is being output. (read-only)"""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t audiobusio_i2sout_obj_get_playing(mp_obj_t self_in) {
|
STATIC mp_obj_t audiobusio_i2sout_obj_get_playing(mp_obj_t self_in) {
|
||||||
@ -203,7 +203,7 @@ const mp_obj_property_t audiobusio_i2sout_playing_obj = {
|
|||||||
(mp_obj_t)&mp_const_none_obj},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| def pause(self, ) -> Any:
|
//| def pause(self) -> None:
|
||||||
//| """Stops playback temporarily while remembering the position. Use `resume` to resume playback."""
|
//| """Stops playback temporarily while remembering the position. Use `resume` to resume playback."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -219,7 +219,7 @@ STATIC mp_obj_t audiobusio_i2sout_obj_pause(mp_obj_t self_in) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_1(audiobusio_i2sout_pause_obj, audiobusio_i2sout_obj_pause);
|
MP_DEFINE_CONST_FUN_OBJ_1(audiobusio_i2sout_pause_obj, audiobusio_i2sout_obj_pause);
|
||||||
|
|
||||||
//| def resume(self, ) -> Any:
|
//| def resume(self) -> None:
|
||||||
//| """Resumes sample playback after :py:func:`pause`."""
|
//| """Resumes sample playback after :py:func:`pause`."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -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);
|
MP_DEFINE_CONST_FUN_OBJ_1(audiobusio_i2sout_resume_obj, audiobusio_i2sout_obj_resume);
|
||||||
|
|
||||||
//| paused: Any = ...
|
//| paused: bool = ...
|
||||||
//| """True when playback is paused. (read-only)"""
|
//| """True when playback is paused. (read-only)"""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t audiobusio_i2sout_obj_get_paused(mp_obj_t self_in) {
|
STATIC mp_obj_t audiobusio_i2sout_obj_get_paused(mp_obj_t self_in) {
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
//| class PDMIn:
|
//| class PDMIn:
|
||||||
//| """Record an input PDM audio stream"""
|
//| """Record an input PDM audio stream"""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, clock_pin: microcontroller.Pin, data_pin: microcontroller.Pin, *, sample_rate: int = 16000, bit_depth: int = 8, mono: bool = True, oversample: int = 64, startup_delay: float = 0.11):
|
//| def __init__(self, clock_pin: microcontroller.Pin, data_pin: microcontroller.Pin, *, sample_rate: int = 16000, bit_depth: int = 8, mono: bool = True, oversample: int = 64, startup_delay: float = 0.11) -> None:
|
||||||
//| """Create a PDMIn object associated with the given pins. This allows you to
|
//| """Create a PDMIn object associated with the given pins. This allows you to
|
||||||
//| record audio signals from the given pins. Individual ports may put further
|
//| record audio signals from the given pins. Individual ports may put further
|
||||||
//| restrictions on the recording parameters. The overall sample rate is
|
//| restrictions on the recording parameters. The overall sample rate is
|
||||||
@ -134,7 +134,7 @@ STATIC mp_obj_t audiobusio_pdmin_make_new(const mp_obj_type_t *type, size_t n_ar
|
|||||||
return MP_OBJ_FROM_PTR(self);
|
return MP_OBJ_FROM_PTR(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def deinit(self, ) -> Any:
|
//| def deinit(self) -> None:
|
||||||
//| """Deinitialises the PDMIn and releases any hardware resources for reuse."""
|
//| """Deinitialises the PDMIn and releases any hardware resources for reuse."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -150,13 +150,13 @@ STATIC void check_for_deinit(audiobusio_pdmin_obj_t *self) {
|
|||||||
raise_deinited_error();
|
raise_deinited_error();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//| def __enter__(self, ) -> Any:
|
//| def __enter__(self) -> PDMIn:
|
||||||
//| """No-op used by Context Managers."""
|
//| """No-op used by Context Managers."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
// Provided by context manager helper.
|
// Provided by context manager helper.
|
||||||
|
|
||||||
//| def __exit__(self, ) -> Any:
|
//| def __exit__(self) -> None:
|
||||||
//| """Automatically deinitializes the hardware when exiting a context."""
|
//| """Automatically deinitializes the hardware when exiting a context."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -168,7 +168,7 @@ STATIC mp_obj_t audiobusio_pdmin_obj___exit__(size_t n_args, const mp_obj_t *arg
|
|||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiobusio_pdmin___exit___obj, 4, 4, audiobusio_pdmin_obj___exit__);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiobusio_pdmin___exit___obj, 4, 4, audiobusio_pdmin_obj___exit__);
|
||||||
|
|
||||||
|
|
||||||
//| def record(self, destination: Any, destination_length: Any) -> Any:
|
//| def record(self, destination: WriteableBuffer, destination_length: int) -> None:
|
||||||
//| """Records destination_length bytes of samples to destination. This is
|
//| """Records destination_length bytes of samples to destination. This is
|
||||||
//| blocking.
|
//| blocking.
|
||||||
//|
|
//|
|
||||||
@ -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);
|
MP_DEFINE_CONST_FUN_OBJ_3(audiobusio_pdmin_record_obj, audiobusio_pdmin_obj_record);
|
||||||
|
|
||||||
//| sample_rate: Any = ...
|
//| sample_rate: int = ...
|
||||||
//| """The actual sample_rate of the recording. This may not match the constructed
|
//| """The actual sample_rate of the recording. This may not match the constructed
|
||||||
//| sample rate due to internal clock limitations."""
|
//| sample rate due to internal clock limitations."""
|
||||||
//|
|
//|
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
//| class RawSample:
|
//| class RawSample:
|
||||||
//| """A raw audio sample buffer in memory"""
|
//| """A raw audio sample buffer in memory"""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, buffer: array.array, *, channel_count: int = 1, sample_rate: int = 8000):
|
//| def __init__(self, buffer: array.array, *, channel_count: int = 1, sample_rate: int = 8000) -> None:
|
||||||
//| """Create a RawSample based on the given buffer of signed values. If channel_count is more than
|
//| """Create a RawSample based on the given buffer of signed values. If channel_count is more than
|
||||||
//| 1 then each channel's samples should alternate. In other words, for a two channel buffer, the
|
//| 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
|
//| first sample will be for channel 1, the second sample will be for channel two, the third for
|
||||||
@ -101,7 +101,7 @@ STATIC mp_obj_t audioio_rawsample_make_new(const mp_obj_type_t *type, size_t n_a
|
|||||||
return MP_OBJ_FROM_PTR(self);
|
return MP_OBJ_FROM_PTR(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def deinit(self, ) -> Any:
|
//| def deinit(self) -> None:
|
||||||
//| """Deinitialises the AudioOut and releases any hardware resources for reuse."""
|
//| """Deinitialises the AudioOut and releases any hardware resources for reuse."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -118,13 +118,13 @@ STATIC void check_for_deinit(audioio_rawsample_obj_t *self) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def __enter__(self, ) -> Any:
|
//| def __enter__(self) -> RawSample:
|
||||||
//| """No-op used by Context Managers."""
|
//| """No-op used by Context Managers."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
// Provided by context manager helper.
|
// Provided by context manager helper.
|
||||||
|
|
||||||
//| def __exit__(self, ) -> Any:
|
//| def __exit__(self) -> None:
|
||||||
//| """Automatically deinitializes the hardware when exiting a context. See
|
//| """Automatically deinitializes the hardware when exiting a context. See
|
||||||
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
||||||
//| ...
|
//| ...
|
||||||
@ -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__);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audioio_rawsample___exit___obj, 4, 4, audioio_rawsample_obj___exit__);
|
||||||
|
|
||||||
//| sample_rate: Any = ...
|
//| sample_rate: Optional(int) = ...
|
||||||
//| """32 bit value that dictates how quickly samples are played in Hertz (cycles per second).
|
//| """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
|
//| 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
|
//| sample. This will not change the sample rate of any active playback. Call ``play`` again to
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
//| be 8 bit unsigned or 16 bit signed. If a buffer is provided, it will be used instead of allocating
|
//| be 8 bit unsigned or 16 bit signed. If a buffer is provided, it will be used instead of allocating
|
||||||
//| an internal buffer."""
|
//| an internal buffer."""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, file: typing.BinaryIO, buffer: bytearray):
|
//| def __init__(self, file: typing.BinaryIO, buffer: ReadableBuffer) -> None:
|
||||||
//| """Load a .wav file for playback with `audioio.AudioOut` or `audiobusio.I2SOut`.
|
//| """Load a .wav file for playback with `audioio.AudioOut` or `audiobusio.I2SOut`.
|
||||||
//|
|
//|
|
||||||
//| :param typing.BinaryIO file: Already opened wave file
|
//| :param typing.BinaryIO file: Already opened wave file
|
||||||
@ -91,7 +91,7 @@ STATIC mp_obj_t audioio_wavefile_make_new(const mp_obj_type_t *type, size_t n_ar
|
|||||||
return MP_OBJ_FROM_PTR(self);
|
return MP_OBJ_FROM_PTR(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def deinit(self, ) -> Any:
|
//| def deinit(self) -> None:
|
||||||
//| """Deinitialises the WaveFile and releases all memory resources for reuse."""
|
//| """Deinitialises the WaveFile and releases all memory resources for reuse."""
|
||||||
//| ...
|
//| ...
|
||||||
STATIC mp_obj_t audioio_wavefile_deinit(mp_obj_t self_in) {
|
STATIC mp_obj_t audioio_wavefile_deinit(mp_obj_t self_in) {
|
||||||
@ -107,13 +107,13 @@ STATIC void check_for_deinit(audioio_wavefile_obj_t *self) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def __enter__(self, ) -> Any:
|
//| def __enter__(self) -> WaveFile:
|
||||||
//| """No-op used by Context Managers."""
|
//| """No-op used by Context Managers."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
// Provided by context manager helper.
|
// Provided by context manager helper.
|
||||||
|
|
||||||
//| def __exit__(self, ) -> Any:
|
//| def __exit__(self) -> None:
|
||||||
//| """Automatically deinitializes the hardware when exiting a context. See
|
//| """Automatically deinitializes the hardware when exiting a context. See
|
||||||
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
||||||
//| ...
|
//| ...
|
||||||
@ -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__);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audioio_wavefile___exit___obj, 4, 4, audioio_wavefile_obj___exit__);
|
||||||
|
|
||||||
//| sample_rate: Any = ...
|
//| sample_rate: int = ...
|
||||||
//| """32 bit value that dictates how quickly samples are loaded into the DAC
|
//| """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
|
//| in Hertz (cycles per second). When the sample is looped, this can change
|
||||||
//| the pitch output without changing the underlying sample."""
|
//| 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},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| bits_per_sample: Any = ...
|
//| bits_per_sample: int = ...
|
||||||
//| """Bits per sample. (read only)"""
|
//| """Bits per sample. (read only)"""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t audioio_wavefile_obj_get_bits_per_sample(mp_obj_t self_in) {
|
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,
|
||||||
(mp_obj_t)&mp_const_none_obj},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
//| channel_count: Any = ...
|
//| channel_count: int = ...
|
||||||
//| """Number of audio channels. (read only)"""
|
//| """Number of audio channels. (read only)"""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t audioio_wavefile_obj_get_channel_count(mp_obj_t self_in) {
|
STATIC mp_obj_t audioio_wavefile_obj_get_channel_count(mp_obj_t self_in) {
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
//| class AudioOut:
|
//| class AudioOut:
|
||||||
//| """Output an analog audio signal"""
|
//| """Output an analog audio signal"""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, left_channel: microcontroller.Pin, *, right_channel: microcontroller.Pin = None, quiescent_value: int = 0x8000):
|
//| def __init__(self, left_channel: microcontroller.Pin, *, right_channel: microcontroller.Pin = None, quiescent_value: int = 0x8000) -> None:
|
||||||
//| """Create a AudioOut object associated with the given pin(s). This allows you to
|
//| """Create a AudioOut object associated with the given pin(s). This allows you to
|
||||||
//| play audio signals out on the given pin(s).
|
//| play audio signals out on the given pin(s).
|
||||||
//|
|
//|
|
||||||
@ -111,7 +111,7 @@ STATIC mp_obj_t audioio_audioout_make_new(const mp_obj_type_t *type, size_t n_ar
|
|||||||
return MP_OBJ_FROM_PTR(self);
|
return MP_OBJ_FROM_PTR(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def deinit(self, ) -> Any:
|
//| def deinit(self) -> None:
|
||||||
//| """Deinitialises the AudioOut and releases any hardware resources for reuse."""
|
//| """Deinitialises the AudioOut and releases any hardware resources for reuse."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -127,13 +127,13 @@ STATIC void check_for_deinit(audioio_audioout_obj_t *self) {
|
|||||||
raise_deinited_error();
|
raise_deinited_error();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//| def __enter__(self, ) -> Any:
|
//| def __enter__(self) -> AudioOut:
|
||||||
//| """No-op used by Context Managers."""
|
//| """No-op used by Context Managers."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
// Provided by context manager helper.
|
// Provided by context manager helper.
|
||||||
|
|
||||||
//| def __exit__(self, ) -> Any:
|
//| def __exit__(self) -> None:
|
||||||
//| """Automatically deinitializes the hardware when exiting a context. See
|
//| """Automatically deinitializes the hardware when exiting a context. See
|
||||||
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
||||||
//| ...
|
//| ...
|
||||||
@ -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__);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audioio_audioout___exit___obj, 4, 4, audioio_audioout_obj___exit__);
|
||||||
|
|
||||||
|
|
||||||
//| def play(self, sample: Any, *, loop: Any = False) -> Any:
|
//| def play(self, sample: Union[audiocore.WaveFile, audiocore.RawSample, audiomixer.Mixer], *, loop: bool = False) -> None:
|
||||||
//| """Plays the sample once when loop=False and continuously when loop=True.
|
//| """Plays the sample once when loop=False and continuously when loop=True.
|
||||||
//| Does not block. Use `playing` to block.
|
//| Does not block. Use `playing` to block.
|
||||||
//|
|
//|
|
||||||
@ -175,7 +175,7 @@ STATIC mp_obj_t audioio_audioout_obj_play(size_t n_args, const mp_obj_t *pos_arg
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_KW(audioio_audioout_play_obj, 1, audioio_audioout_obj_play);
|
MP_DEFINE_CONST_FUN_OBJ_KW(audioio_audioout_play_obj, 1, audioio_audioout_obj_play);
|
||||||
|
|
||||||
//| def stop(self, ) -> Any:
|
//| def stop(self) -> None:
|
||||||
//| """Stops playback and resets to the start of the sample."""
|
//| """Stops playback and resets to the start of the sample."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -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);
|
MP_DEFINE_CONST_FUN_OBJ_1(audioio_audioout_stop_obj, audioio_audioout_obj_stop);
|
||||||
|
|
||||||
//| playing: Any = ...
|
//| playing: bool = ...
|
||||||
//| """True when an audio sample is being output even if `paused`. (read-only)"""
|
//| """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) {
|
STATIC mp_obj_t audioio_audioout_obj_get_playing(mp_obj_t self_in) {
|
||||||
@ -204,7 +204,7 @@ const mp_obj_property_t audioio_audioout_playing_obj = {
|
|||||||
(mp_obj_t)&mp_const_none_obj},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| def pause(self, ) -> Any:
|
//| def pause(self) -> None:
|
||||||
//| """Stops playback temporarily while remembering the position. Use `resume` to resume playback."""
|
//| """Stops playback temporarily while remembering the position. Use `resume` to resume playback."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -220,7 +220,7 @@ STATIC mp_obj_t audioio_audioout_obj_pause(mp_obj_t self_in) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_1(audioio_audioout_pause_obj, audioio_audioout_obj_pause);
|
MP_DEFINE_CONST_FUN_OBJ_1(audioio_audioout_pause_obj, audioio_audioout_obj_pause);
|
||||||
|
|
||||||
//| def resume(self, ) -> Any:
|
//| def resume(self) -> None:
|
||||||
//| """Resumes sample playback after :py:func:`pause`."""
|
//| """Resumes sample playback after :py:func:`pause`."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -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);
|
MP_DEFINE_CONST_FUN_OBJ_1(audioio_audioout_resume_obj, audioio_audioout_obj_resume);
|
||||||
|
|
||||||
//| paused: Any = ...
|
//| paused: bool = ...
|
||||||
//| """True when playback is paused. (read-only)"""
|
//| """True when playback is paused. (read-only)"""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t audioio_audioout_obj_get_paused(mp_obj_t self_in) {
|
STATIC mp_obj_t audioio_audioout_obj_get_paused(mp_obj_t self_in) {
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
//| class Mixer:
|
//| class Mixer:
|
||||||
//| """Mixes one or more audio samples together into one sample."""
|
//| """Mixes one or more audio samples together into one sample."""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, voice_count: int = 2, buffer_size: int = 1024, channel_count: int = 2, bits_per_sample: int = 16, samples_signed: bool = True, sample_rate: int = 8000):
|
//| def __init__(self, voice_count: int = 2, buffer_size: int = 1024, channel_count: int = 2, bits_per_sample: int = 16, samples_signed: bool = True, sample_rate: int = 8000) -> None:
|
||||||
//| """Create a Mixer object that can mix multiple channels with the same sample rate.
|
//| """Create a Mixer object that can mix multiple channels with the same sample rate.
|
||||||
//| Samples are accessed and controlled with the mixer's `audiomixer.MixerVoice` objects.
|
//| Samples are accessed and controlled with the mixer's `audiomixer.MixerVoice` objects.
|
||||||
//|
|
//|
|
||||||
@ -121,7 +121,7 @@ STATIC mp_obj_t audiomixer_mixer_make_new(const mp_obj_type_t *type, size_t n_ar
|
|||||||
return MP_OBJ_FROM_PTR(self);
|
return MP_OBJ_FROM_PTR(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def deinit(self, ) -> Any:
|
//| def deinit(self) -> None:
|
||||||
//| """Deinitialises the Mixer and releases any hardware resources for reuse."""
|
//| """Deinitialises the Mixer and releases any hardware resources for reuse."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -138,13 +138,13 @@ STATIC void check_for_deinit(audiomixer_mixer_obj_t *self) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def __enter__(self, ) -> Any:
|
//| def __enter__(self) -> Mixer:
|
||||||
//| """No-op used by Context Managers."""
|
//| """No-op used by Context Managers."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
// Provided by context manager helper.
|
// Provided by context manager helper.
|
||||||
|
|
||||||
//| def __exit__(self, ) -> Any:
|
//| def __exit__(self) -> None:
|
||||||
//| """Automatically deinitializes the hardware when exiting a context. See
|
//| """Automatically deinitializes the hardware when exiting a context. See
|
||||||
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
||||||
//| ...
|
//| ...
|
||||||
@ -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__);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiomixer_mixer___exit___obj, 4, 4, audiomixer_mixer_obj___exit__);
|
||||||
|
|
||||||
//| playing: Any = ...
|
//| playing: bool = ...
|
||||||
//| """True when any voice is being output. (read-only)"""
|
//| """True when any voice is being output. (read-only)"""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t audiomixer_mixer_obj_get_playing(mp_obj_t self_in) {
|
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},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| sample_rate: Any = ...
|
//| sample_rate: int = ...
|
||||||
//| """32 bit value that dictates how quickly samples are played in Hertz (cycles per second)."""
|
//| """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) {
|
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},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| voice: Any = ...
|
//| voice: Tuple[MixerVoice, ...] = ...
|
||||||
//| """A tuple of the mixer's `audiomixer.MixerVoice` object(s).
|
//| """A tuple of the mixer's `audiomixer.MixerVoice` object(s).
|
||||||
//|
|
//|
|
||||||
//| .. code-block:: python
|
//| .. code-block:: python
|
||||||
@ -211,7 +211,7 @@ const mp_obj_property_t audiomixer_mixer_voice_obj = {
|
|||||||
(mp_obj_t)&mp_const_none_obj},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| def play(self, sample: Any, *, voice: Any = 0, loop: Any = False) -> Any:
|
//| def play(self, sample: Union[audiomixer.WaveFile, audiocore.RawSample, audiomixer.Mixer], *, voice: int = 0, loop: bool = False) -> None:
|
||||||
//| """Plays the sample once when loop=False and continuously when loop=True.
|
//| """Plays the sample once when loop=False and continuously when loop=True.
|
||||||
//| Does not block. Use `playing` to block.
|
//| Does not block. Use `playing` to block.
|
||||||
//|
|
//|
|
||||||
@ -244,7 +244,7 @@ STATIC mp_obj_t audiomixer_mixer_obj_play(size_t n_args, const mp_obj_t *pos_arg
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_KW(audiomixer_mixer_play_obj, 1, audiomixer_mixer_obj_play);
|
MP_DEFINE_CONST_FUN_OBJ_KW(audiomixer_mixer_play_obj, 1, audiomixer_mixer_obj_play);
|
||||||
|
|
||||||
//| def stop_voice(self, voice: Any = 0) -> Any:
|
//| def stop_voice(self, voice: int = 0) -> None:
|
||||||
//| """Stops playback of the sample on the given voice."""
|
//| """Stops playback of the sample on the given voice."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
//|
|
//|
|
||||||
//| Used to access and control samples with `audiomixer.Mixer`."""
|
//| Used to access and control samples with `audiomixer.Mixer`."""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, ):
|
//| def __init__(self) -> None:
|
||||||
//| """MixerVoice instance object(s) created by `audiomixer.Mixer`."""
|
//| """MixerVoice instance object(s) created by `audiomixer.Mixer`."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -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);
|
return MP_OBJ_FROM_PTR(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def play(self, sample: Any, *, loop: Any = False) -> Any:
|
//| def play(self, sample: Union[audiocore.WaveFile, Mixer, audiocore.RawSample], *, loop: bool = False) -> None:
|
||||||
//| """Plays the sample once when ``loop=False``, and continuously when ``loop=True``.
|
//| """Plays the sample once when ``loop=False``, and continuously when ``loop=True``.
|
||||||
//| Does not block. Use `playing` to block.
|
//| Does not block. Use `playing` to block.
|
||||||
//|
|
//|
|
||||||
@ -81,7 +81,7 @@ STATIC mp_obj_t audiomixer_mixervoice_obj_play(size_t n_args, const mp_obj_t *po
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_KW(audiomixer_mixervoice_play_obj, 1, audiomixer_mixervoice_obj_play);
|
MP_DEFINE_CONST_FUN_OBJ_KW(audiomixer_mixervoice_play_obj, 1, audiomixer_mixervoice_obj_play);
|
||||||
|
|
||||||
//| def stop(self, ) -> Any:
|
//| def stop(self) -> None:
|
||||||
//| """Stops playback of the sample on this voice."""
|
//| """Stops playback of the sample on this voice."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -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);
|
MP_DEFINE_CONST_FUN_OBJ_KW(audiomixer_mixervoice_stop_obj, 1, audiomixer_mixervoice_obj_stop);
|
||||||
|
|
||||||
//| level: Any = ...
|
//| level: float = ...
|
||||||
//| """The volume level of a voice, as a floating point number between 0 and 1."""
|
//| """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) {
|
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},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| playing: Any = ...
|
//| playing: bool = ...
|
||||||
//| """True when this voice is being output. (read-only)"""
|
//| """True when this voice is being output. (read-only)"""
|
||||||
//|
|
//|
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
//| class MP3:
|
//| class MP3:
|
||||||
//| """Load a mp3 file for audio playback"""
|
//| """Load a mp3 file for audio playback"""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, file: typing.BinaryIO, buffer: bytearray):
|
//| def __init__(self, file: typing.BinaryIO, buffer: WriteableBuffer) -> None:
|
||||||
//|
|
//|
|
||||||
//| """Load a .mp3 file for playback with `audioio.AudioOut` or `audiobusio.I2SOut`.
|
//| """Load a .mp3 file for playback with `audioio.AudioOut` or `audiobusio.I2SOut`.
|
||||||
//|
|
//|
|
||||||
@ -89,7 +89,7 @@ STATIC mp_obj_t audiomp3_mp3file_make_new(const mp_obj_type_t *type, size_t n_ar
|
|||||||
return MP_OBJ_FROM_PTR(self);
|
return MP_OBJ_FROM_PTR(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def deinit(self, ) -> Any:
|
//| def deinit(self) -> None:
|
||||||
//| """Deinitialises the MP3 and releases all memory resources for reuse."""
|
//| """Deinitialises the MP3 and releases all memory resources for reuse."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -106,13 +106,13 @@ STATIC void check_for_deinit(audiomp3_mp3file_obj_t *self) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def __enter__(self, ) -> Any:
|
//| def __enter__(self) -> MP3:
|
||||||
//| """No-op used by Context Managers."""
|
//| """No-op used by Context Managers."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
// Provided by context manager helper.
|
// Provided by context manager helper.
|
||||||
|
|
||||||
//| def __exit__(self, ) -> Any:
|
//| def __exit__(self) -> None:
|
||||||
//| """Automatically deinitializes the hardware when exiting a context. See
|
//| """Automatically deinitializes the hardware when exiting a context. See
|
||||||
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
||||||
//| ...
|
//| ...
|
||||||
@ -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__);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiomp3_mp3file___exit___obj, 4, 4, audiomp3_mp3file_obj___exit__);
|
||||||
|
|
||||||
//| file: Any = ...
|
//| file: file = ...
|
||||||
//| """File to play back."""
|
//| """File to play back."""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t audiomp3_mp3file_obj_get_file(mp_obj_t self_in) {
|
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: Any = ...
|
//| sample_rate: int = ...
|
||||||
//| """32 bit value that dictates how quickly samples are loaded into the DAC
|
//| """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
|
//| in Hertz (cycles per second). When the sample is looped, this can change
|
||||||
//| the pitch output without changing the underlying sample."""
|
//| 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},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| bits_per_sample: Any = ...
|
//| bits_per_sample: int = ...
|
||||||
//| """Bits per sample. (read only)"""
|
//| """Bits per sample. (read only)"""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t audiomp3_mp3file_obj_get_bits_per_sample(mp_obj_t self_in) {
|
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},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| channel_count: Any = ...
|
//| channel_count: int = ...
|
||||||
//| """Number of audio channels. (read only)"""
|
//| """Number of audio channels. (read only)"""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t audiomp3_mp3file_obj_get_channel_count(mp_obj_t self_in) {
|
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},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| rms_level: Any = ...
|
//| rms_level: float = ...
|
||||||
//| """The RMS audio level of a recently played moment of audio. (read only)"""
|
//| """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) {
|
STATIC mp_obj_t audiomp3_mp3file_obj_get_rms_level(mp_obj_t self_in) {
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
//| class PWMAudioOut:
|
//| class PWMAudioOut:
|
||||||
//| """Output an analog audio signal by varying the PWM duty cycle."""
|
//| """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):
|
//| def __init__(self, left_channel: microcontroller.Pin, *, right_channel: microcontroller.Pin = None, quiescent_value: int = 0x8000) -> None:
|
||||||
//| """Create a PWMAudioOut object associated with the given pin(s). This allows you to
|
//| """Create a PWMAudioOut object associated with the given pin(s). This allows you to
|
||||||
//| play audio signals out on the given pin(s). In contrast to mod:`audioio`,
|
//| 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
|
//| the pin(s) specified are digital pins, and are driven with a device-dependent PWM
|
||||||
@ -114,7 +114,7 @@ STATIC mp_obj_t audiopwmio_pwmaudioout_make_new(const mp_obj_type_t *type, size_
|
|||||||
return MP_OBJ_FROM_PTR(self);
|
return MP_OBJ_FROM_PTR(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def deinit(self, ) -> Any:
|
//| def deinit(self) -> None:
|
||||||
//| """Deinitialises the PWMAudioOut and releases any hardware resources for reuse."""
|
//| """Deinitialises the PWMAudioOut and releases any hardware resources for reuse."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -130,13 +130,13 @@ STATIC void check_for_deinit(audiopwmio_pwmaudioout_obj_t *self) {
|
|||||||
raise_deinited_error();
|
raise_deinited_error();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//| def __enter__(self, ) -> Any:
|
//| def __enter__(self) -> PWMAudioOut:
|
||||||
//| """No-op used by Context Managers."""
|
//| """No-op used by Context Managers."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
// Provided by context manager helper.
|
// Provided by context manager helper.
|
||||||
|
|
||||||
//| def __exit__(self, ) -> Any:
|
//| def __exit__(self) -> None:
|
||||||
//| """Automatically deinitializes the hardware when exiting a context. See
|
//| """Automatically deinitializes the hardware when exiting a context. See
|
||||||
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
||||||
//| ...
|
//| ...
|
||||||
@ -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__);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiopwmio_pwmaudioout___exit___obj, 4, 4, audiopwmio_pwmaudioout_obj___exit__);
|
||||||
|
|
||||||
|
|
||||||
//| def play(self, sample: Any, *, loop: Any = False) -> Any:
|
//| def play(self, sample: Union[audiocore.WaveFile, audiocore.RawSample, audiomixer.Mixer], *, loop: bool = False) -> None:
|
||||||
//| """Plays the sample once when loop=False and continuously when loop=True.
|
//| """Plays the sample once when loop=False and continuously when loop=True.
|
||||||
//| Does not block. Use `playing` to block.
|
//| Does not block. Use `playing` to block.
|
||||||
//|
|
//|
|
||||||
@ -177,7 +177,7 @@ STATIC mp_obj_t audiopwmio_pwmaudioout_obj_play(size_t n_args, const mp_obj_t *p
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_KW(audiopwmio_pwmaudioout_play_obj, 1, audiopwmio_pwmaudioout_obj_play);
|
MP_DEFINE_CONST_FUN_OBJ_KW(audiopwmio_pwmaudioout_play_obj, 1, audiopwmio_pwmaudioout_obj_play);
|
||||||
|
|
||||||
//| def stop(self, ) -> Any:
|
//| def stop(self) -> None:
|
||||||
//| """Stops playback and resets to the start of the sample."""
|
//| """Stops playback and resets to the start of the sample."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -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);
|
MP_DEFINE_CONST_FUN_OBJ_1(audiopwmio_pwmaudioout_stop_obj, audiopwmio_pwmaudioout_obj_stop);
|
||||||
|
|
||||||
//| playing: Any = ...
|
//| playing: bool = ...
|
||||||
//| """True when an audio sample is being output even if `paused`. (read-only)"""
|
//| """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) {
|
STATIC mp_obj_t audiopwmio_pwmaudioout_obj_get_playing(mp_obj_t self_in) {
|
||||||
@ -206,7 +206,7 @@ const mp_obj_property_t audiopwmio_pwmaudioout_playing_obj = {
|
|||||||
(mp_obj_t)&mp_const_none_obj},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| def pause(self, ) -> Any:
|
//| def pause(self) -> None:
|
||||||
//| """Stops playback temporarily while remembering the position. Use `resume` to resume playback."""
|
//| """Stops playback temporarily while remembering the position. Use `resume` to resume playback."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -222,7 +222,7 @@ STATIC mp_obj_t audiopwmio_pwmaudioout_obj_pause(mp_obj_t self_in) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_1(audiopwmio_pwmaudioout_pause_obj, audiopwmio_pwmaudioout_obj_pause);
|
MP_DEFINE_CONST_FUN_OBJ_1(audiopwmio_pwmaudioout_pause_obj, audiopwmio_pwmaudioout_obj_pause);
|
||||||
|
|
||||||
//| def resume(self, ) -> Any:
|
//| def resume(self) -> None:
|
||||||
//| """Resumes sample playback after :py:func:`pause`."""
|
//| """Resumes sample playback after :py:func:`pause`."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -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);
|
MP_DEFINE_CONST_FUN_OBJ_1(audiopwmio_pwmaudioout_resume_obj, audiopwmio_pwmaudioout_obj_resume);
|
||||||
|
|
||||||
//| paused: Any = ...
|
//| paused: bool = ...
|
||||||
//| """True when playback is paused. (read-only)"""
|
//| """True when playback is paused. (read-only)"""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t audiopwmio_pwmaudioout_obj_get_paused(mp_obj_t self_in) {
|
STATIC mp_obj_t audiopwmio_pwmaudioout_obj_get_paused(mp_obj_t self_in) {
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
//| class I2C:
|
//| class I2C:
|
||||||
//| """Two wire serial protocol"""
|
//| """Two wire serial protocol"""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, scl: microcontroller.Pin, sda: microcontroller.Pin, *, frequency: int = 400000, timeout: int):
|
//| def __init__(self, scl: microcontroller.Pin, sda: microcontroller.Pin, *, frequency: int = 400000, timeout: int) -> None:
|
||||||
//| """I2C is a two-wire protocol for communicating between devices. At the
|
//| """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
|
//| physical level it consists of 2 wires: SCL and SDA, the clock and data
|
||||||
//| lines respectively.
|
//| lines respectively.
|
||||||
@ -79,7 +79,7 @@ STATIC mp_obj_t bitbangio_i2c_make_new(const mp_obj_type_t *type, size_t n_args,
|
|||||||
return (mp_obj_t)self;
|
return (mp_obj_t)self;
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def deinit(self, ) -> Any:
|
//| def deinit(self) -> None:
|
||||||
//| """Releases control of the underlying hardware so other classes can use it."""
|
//| """Releases control of the underlying hardware so other classes can use it."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -96,13 +96,13 @@ STATIC void check_for_deinit(bitbangio_i2c_obj_t *self) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def __enter__(self, ) -> Any:
|
//| def __enter__(self) -> I2C:
|
||||||
//| """No-op used in Context Managers."""
|
//| """No-op used in Context Managers."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
// Provided by context manager helper.
|
// Provided by context manager helper.
|
||||||
|
|
||||||
//| def __exit__(self, ) -> Any:
|
//| def __exit__(self) -> None:
|
||||||
//| """Automatically deinitializes the hardware on context exit. See
|
//| """Automatically deinitializes the hardware on context exit. See
|
||||||
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
||||||
//| ...
|
//| ...
|
||||||
@ -120,7 +120,7 @@ static void check_lock(bitbangio_i2c_obj_t *self) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def scan(self, ) -> Any:
|
//| def scan(self) -> list:
|
||||||
//| """Scan all I2C addresses between 0x08 and 0x77 inclusive and return a list of
|
//| """Scan all I2C addresses between 0x08 and 0x77 inclusive and return a list of
|
||||||
//| those that respond. A device responds if it pulls the SDA line low after
|
//| those that respond. A device responds if it pulls the SDA line low after
|
||||||
//| its address (including a read bit) is sent on the bus."""
|
//| its address (including a read bit) is sent on the bus."""
|
||||||
@ -142,7 +142,7 @@ STATIC mp_obj_t bitbangio_i2c_scan(mp_obj_t self_in) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_i2c_scan_obj, bitbangio_i2c_scan);
|
MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_i2c_scan_obj, bitbangio_i2c_scan);
|
||||||
|
|
||||||
//| def try_lock(self, ) -> Any:
|
//| def try_lock(self) -> bool:
|
||||||
//| """Attempts to grab the I2C lock. Returns True on success."""
|
//| """Attempts to grab the I2C lock. Returns True on success."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -153,7 +153,7 @@ STATIC mp_obj_t bitbangio_i2c_obj_try_lock(mp_obj_t self_in) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_i2c_try_lock_obj, bitbangio_i2c_obj_try_lock);
|
MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_i2c_try_lock_obj, bitbangio_i2c_obj_try_lock);
|
||||||
|
|
||||||
//| def unlock(self, ) -> Any:
|
//| def unlock(self) -> None:
|
||||||
//| """Releases the I2C lock."""
|
//| """Releases the I2C lock."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -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);
|
MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_i2c_unlock_obj, bitbangio_i2c_obj_unlock);
|
||||||
|
|
||||||
//| def readfrom_into(self, address: int, buffer: bytearray, *, start: int = 0, end: int = None) -> Any:
|
//| def readfrom_into(self, address: int, buffer: WriteableBuffer, *, start: int = 0, end: int = None) -> None:
|
||||||
//| """Read into ``buffer`` from the device selected by ``address``.
|
//| """Read into ``buffer`` from the device selected by ``address``.
|
||||||
//| The number of bytes read will be the length of ``buffer``.
|
//| The number of bytes read will be the length of ``buffer``.
|
||||||
//| At least one byte must be read.
|
//| 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);
|
MP_DEFINE_CONST_FUN_OBJ_KW(bitbangio_i2c_readfrom_into_obj, 3, bitbangio_i2c_readfrom_into);
|
||||||
|
|
||||||
//| def writeto(self, address: int, buffer: bytearray, *, start: int = 0, end: int = None, stop: bool = True) -> Any:
|
//| def writeto(self, address: int, buffer: ReadableBuffer, *, start: int = 0, end: int = None, stop: bool = True) -> None:
|
||||||
//| """Write the bytes from ``buffer`` to the device selected by ``address`` and then transmits a
|
//| """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
|
//| stop bit. Use `writeto_then_readfrom` when needing a write, no stop and repeated start
|
||||||
//| before a read.
|
//| before a read.
|
||||||
@ -277,7 +277,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);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bitbangio_i2c_writeto_obj, 1, bitbangio_i2c_writeto);
|
||||||
|
|
||||||
|
|
||||||
//| def writeto_then_readfrom(self, address: int, out_buffer: bytearray, in_buffer: bytearray, *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> Any:
|
//| 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:
|
||||||
//| """Write the bytes from ``out_buffer`` to the device selected by ``address``, generate no stop
|
//| """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
|
//| 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.
|
//| ``in_buffer`` can be the same buffer because they are used sequentially.
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
//|
|
//|
|
||||||
//| Protocol definition is here: https://www.maximintegrated.com/en/app-notes/index.mvp/id/126"""
|
//| Protocol definition is here: https://www.maximintegrated.com/en/app-notes/index.mvp/id/126"""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, pin: microcontroller.Pin):
|
//| def __init__(self, pin: microcontroller.Pin) -> None:
|
||||||
//|
|
//|
|
||||||
//| """Create a OneWire object associated with the given pin. The object
|
//| """Create a OneWire object associated with the given pin. The object
|
||||||
//| implements the lowest level timing-sensitive bits of the protocol.
|
//| implements the lowest level timing-sensitive bits of the protocol.
|
||||||
@ -78,7 +78,7 @@ STATIC mp_obj_t bitbangio_onewire_make_new(const mp_obj_type_t *type, size_t n_a
|
|||||||
return MP_OBJ_FROM_PTR(self);
|
return MP_OBJ_FROM_PTR(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def deinit(self, ) -> Any:
|
//| def deinit(self) -> None:
|
||||||
//| """Deinitialize the OneWire bus and release any hardware resources for reuse."""
|
//| """Deinitialize the OneWire bus and release any hardware resources for reuse."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -95,13 +95,13 @@ STATIC void check_for_deinit(bitbangio_onewire_obj_t *self) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def __enter__(self, ) -> Any:
|
//| def __enter__(self) -> OneWire:
|
||||||
//| """No-op used by Context Managers."""
|
//| """No-op used by Context Managers."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
// Provided by context manager helper.
|
// Provided by context manager helper.
|
||||||
|
|
||||||
//| def __exit__(self, ) -> Any:
|
//| def __exit__(self) -> None:
|
||||||
//| """Automatically deinitializes the hardware when exiting a context. See
|
//| """Automatically deinitializes the hardware when exiting a context. See
|
||||||
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
||||||
//| ...
|
//| ...
|
||||||
@ -113,7 +113,7 @@ STATIC mp_obj_t bitbangio_onewire_obj___exit__(size_t n_args, const mp_obj_t *ar
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitbangio_onewire___exit___obj, 4, 4, bitbangio_onewire_obj___exit__);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitbangio_onewire___exit___obj, 4, 4, bitbangio_onewire_obj___exit__);
|
||||||
|
|
||||||
//| def reset(self, ) -> Any:
|
//| def reset(self) -> bool:
|
||||||
//| """Reset the OneWire bus"""
|
//| """Reset the OneWire bus"""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -125,7 +125,7 @@ STATIC mp_obj_t bitbangio_onewire_obj_reset(mp_obj_t self_in) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_onewire_reset_obj, bitbangio_onewire_obj_reset);
|
MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_onewire_reset_obj, bitbangio_onewire_obj_reset);
|
||||||
|
|
||||||
//| def read_bit(self, ) -> Any:
|
//| def read_bit(self) -> bool:
|
||||||
//| """Read in a bit
|
//| """Read in a bit
|
||||||
//|
|
//|
|
||||||
//| :returns: bit state read
|
//| :returns: bit state read
|
||||||
@ -140,7 +140,7 @@ STATIC mp_obj_t bitbangio_onewire_obj_read_bit(mp_obj_t self_in) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_onewire_read_bit_obj, bitbangio_onewire_obj_read_bit);
|
MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_onewire_read_bit_obj, bitbangio_onewire_obj_read_bit);
|
||||||
|
|
||||||
//| def write_bit(self, value: Any) -> Any:
|
//| def write_bit(self, value: bool) -> None:
|
||||||
//| """Write out a bit based on value."""
|
//| """Write out a bit based on value."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
//| multiple secondaries can share the `!clock`, `!MOSI` and `!MISO` lines
|
//| multiple secondaries can share the `!clock`, `!MOSI` and `!MISO` lines
|
||||||
//| and therefore the hardware.)"""
|
//| and therefore the hardware.)"""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, clock: microcontroller.Pin, MOSI: microcontroller.Pin = None, MISO: microcontroller.Pin = None):
|
//| def __init__(self, clock: microcontroller.Pin, MOSI: microcontroller.Pin = None, MISO: microcontroller.Pin = None) -> None:
|
||||||
//| """Construct an SPI object on the given pins.
|
//| """Construct an SPI object on the given pins.
|
||||||
//|
|
//|
|
||||||
//| .. seealso:: Using this class directly requires careful lock management.
|
//| .. seealso:: Using this class directly requires careful lock management.
|
||||||
@ -90,7 +90,7 @@ STATIC mp_obj_t bitbangio_spi_make_new(const mp_obj_type_t *type, size_t n_args,
|
|||||||
return (mp_obj_t)self;
|
return (mp_obj_t)self;
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def deinit(self, ) -> Any:
|
//| def deinit(self) -> None:
|
||||||
//| """Turn off the SPI bus."""
|
//| """Turn off the SPI bus."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -107,13 +107,13 @@ STATIC void check_for_deinit(bitbangio_spi_obj_t *self) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def __enter__(self, ) -> Any:
|
//| def __enter__(self) -> SPI:
|
||||||
//| """No-op used by Context Managers."""
|
//| """No-op used by Context Managers."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
// Provided by context manager helper.
|
// Provided by context manager helper.
|
||||||
|
|
||||||
//| def __exit__(self, ) -> Any:
|
//| def __exit__(self) -> None:
|
||||||
//| """Automatically deinitializes the hardware when exiting a context. See
|
//| """Automatically deinitializes the hardware when exiting a context. See
|
||||||
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
||||||
//| ...
|
//| ...
|
||||||
@ -132,7 +132,7 @@ static void check_lock(bitbangio_spi_obj_t *self) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def configure(self, *, baudrate: int = 100000, polarity: int = 0, phase: int = 0, bits: int = 8) -> Any:
|
//| def configure(self, *, baudrate: int = 100000, polarity: int = 0, phase: int = 0, bits: int = 8) -> None:
|
||||||
//| """Configures the SPI bus. Only valid when locked.
|
//| """Configures the SPI bus. Only valid when locked.
|
||||||
//|
|
//|
|
||||||
//| :param int baudrate: the clock rate in Hertz
|
//| :param int baudrate: the clock rate in Hertz
|
||||||
@ -174,7 +174,7 @@ STATIC mp_obj_t bitbangio_spi_configure(size_t n_args, const mp_obj_t *pos_args,
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_KW(bitbangio_spi_configure_obj, 1, bitbangio_spi_configure);
|
MP_DEFINE_CONST_FUN_OBJ_KW(bitbangio_spi_configure_obj, 1, bitbangio_spi_configure);
|
||||||
|
|
||||||
//| def try_lock(self, ) -> Any:
|
//| def try_lock(self) -> bool:
|
||||||
//| """Attempts to grab the SPI lock. Returns True on success.
|
//| """Attempts to grab the SPI lock. Returns True on success.
|
||||||
//|
|
//|
|
||||||
//| :return: True when lock has been grabbed
|
//| :return: True when lock has been grabbed
|
||||||
@ -188,7 +188,7 @@ STATIC mp_obj_t bitbangio_spi_obj_try_lock(mp_obj_t self_in) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_spi_try_lock_obj, bitbangio_spi_obj_try_lock);
|
MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_spi_try_lock_obj, bitbangio_spi_obj_try_lock);
|
||||||
|
|
||||||
//| def unlock(self, ) -> Any:
|
//| def unlock(self) -> None:
|
||||||
//| """Releases the SPI lock."""
|
//| """Releases the SPI lock."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -200,7 +200,7 @@ STATIC mp_obj_t bitbangio_spi_obj_unlock(mp_obj_t self_in) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_spi_unlock_obj, bitbangio_spi_obj_unlock);
|
MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_spi_unlock_obj, bitbangio_spi_obj_unlock);
|
||||||
|
|
||||||
//| def write(self, buf: Any) -> Any:
|
//| def write(self, buf: ReadableBuffer) -> None:
|
||||||
//| """Write the data contained in ``buf``. Requires the SPI being locked.
|
//| """Write the data contained in ``buf``. Requires the SPI being locked.
|
||||||
//| If the buffer is empty, nothing happens."""
|
//| If the buffer is empty, nothing happens."""
|
||||||
//| ...
|
//| ...
|
||||||
@ -224,7 +224,7 @@ STATIC mp_obj_t bitbangio_spi_write(mp_obj_t self_in, mp_obj_t wr_buf) {
|
|||||||
MP_DEFINE_CONST_FUN_OBJ_2(bitbangio_spi_write_obj, bitbangio_spi_write);
|
MP_DEFINE_CONST_FUN_OBJ_2(bitbangio_spi_write_obj, bitbangio_spi_write);
|
||||||
|
|
||||||
|
|
||||||
//| def readinto(self, buf: Any) -> Any:
|
//| def readinto(self, buf: WriteableBuffer) -> None:
|
||||||
//| """Read into the buffer specified by ``buf`` while writing zeroes.
|
//| """Read into the buffer specified by ``buf`` while writing zeroes.
|
||||||
//| Requires the SPI being locked.
|
//| Requires the SPI being locked.
|
||||||
//| If the number of bytes to read is 0, nothing happens."""
|
//| If the number of bytes to read is 0, nothing happens."""
|
||||||
@ -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);
|
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitbangio_spi_readinto_obj, 2, 2, bitbangio_spi_readinto);
|
||||||
|
|
||||||
//| def write_readinto(self, buffer_out: bytearray, buffer_in: bytearray, *, out_start: Any = 0, out_end: int = None, in_start: Any = 0, in_end: int = None) -> Any:
|
//| 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:
|
||||||
//| """Write out the data in ``buffer_out`` while simultaneously reading data into ``buffer_in``.
|
//| """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]``
|
//| The lengths of the slices defined by ``buffer_out[out_start:out_end]`` and ``buffer_in[in_start:in_end]``
|
||||||
//| must be equal.
|
//| must be equal.
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
//| .. warning:: The board module varies by board. The APIs documented here may or may not be
|
//| .. warning:: The board module varies by board. The APIs documented here may or may not be
|
||||||
//| available on a specific board."""
|
//| available on a specific board."""
|
||||||
|
|
||||||
//| def I2C() -> Any:
|
//| def I2C() -> busio.I2C:
|
||||||
//| """Returns the `busio.I2C` object for the board designated SDA and SCL pins. It is a singleton."""
|
//| """Returns the `busio.I2C` object for the board designated SDA and SCL pins. It is a singleton."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -61,7 +61,7 @@ mp_obj_t board_i2c(void) {
|
|||||||
MP_DEFINE_CONST_FUN_OBJ_0(board_i2c_obj, board_i2c);
|
MP_DEFINE_CONST_FUN_OBJ_0(board_i2c_obj, board_i2c);
|
||||||
|
|
||||||
|
|
||||||
//| def SPI() -> Any:
|
//| def SPI() -> busio.SPI:
|
||||||
//| """Returns the `busio.SPI` object for the board designated SCK, MOSI and MISO pins. It is a
|
//| """Returns the `busio.SPI` object for the board designated SCK, MOSI and MISO pins. It is a
|
||||||
//| singleton."""
|
//| singleton."""
|
||||||
//| ...
|
//| ...
|
||||||
@ -85,7 +85,7 @@ mp_obj_t board_spi(void) {
|
|||||||
#endif
|
#endif
|
||||||
MP_DEFINE_CONST_FUN_OBJ_0(board_spi_obj, board_spi);
|
MP_DEFINE_CONST_FUN_OBJ_0(board_spi_obj, board_spi);
|
||||||
|
|
||||||
//| def UART() -> Any:
|
//| def UART() -> busio.UART:
|
||||||
//| """Returns the `busio.UART` object for the board designated TX and RX pins. It is a singleton.
|
//| """Returns the `busio.UART` object for the board designated TX and RX pins. It is a singleton.
|
||||||
//|
|
//|
|
||||||
//| The object created uses the default parameter values for `busio.UART`. If you need to set
|
//| The object created uses the default parameter values for `busio.UART`. If you need to set
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
//| class I2C:
|
//| class I2C:
|
||||||
//| """Two wire serial protocol"""
|
//| """Two wire serial protocol"""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, scl: microcontroller.Pin, sda: microcontroller.Pin, *, frequency: int = 400000, timeout: int = 255):
|
//| 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
|
//| """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
|
//| physical level it consists of 2 wires: SCL and SDA, the clock and data
|
||||||
@ -83,7 +83,7 @@ STATIC mp_obj_t busio_i2c_make_new(const mp_obj_type_t *type, size_t n_args, con
|
|||||||
return (mp_obj_t)self;
|
return (mp_obj_t)self;
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def deinit(self, ) -> Any:
|
//| def deinit(self) -> None:
|
||||||
//| """Releases control of the underlying hardware so other classes can use it."""
|
//| """Releases control of the underlying hardware so other classes can use it."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -100,13 +100,13 @@ STATIC void check_for_deinit(busio_i2c_obj_t *self) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def __enter__(self, ) -> Any:
|
//| def __enter__(self) -> I2C:
|
||||||
//| """No-op used in Context Managers."""
|
//| """No-op used in Context Managers."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
// Provided by context manager helper.
|
// Provided by context manager helper.
|
||||||
|
|
||||||
//| def __exit__(self, ) -> Any:
|
//| def __exit__(self) -> None:
|
||||||
//| """Automatically deinitializes the hardware on context exit. See
|
//| """Automatically deinitializes the hardware on context exit. See
|
||||||
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
||||||
//| ...
|
//| ...
|
||||||
@ -125,7 +125,7 @@ static void check_lock(busio_i2c_obj_t *self) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def scan(self, ) -> Any:
|
//| def scan(self) -> list:
|
||||||
//|
|
//|
|
||||||
//| """Scan all I2C addresses between 0x08 and 0x77 inclusive and return a
|
//| """Scan all I2C addresses between 0x08 and 0x77 inclusive and return a
|
||||||
//| list of those that respond.
|
//| list of those that respond.
|
||||||
@ -150,7 +150,7 @@ STATIC mp_obj_t busio_i2c_scan(mp_obj_t self_in) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_1(busio_i2c_scan_obj, busio_i2c_scan);
|
MP_DEFINE_CONST_FUN_OBJ_1(busio_i2c_scan_obj, busio_i2c_scan);
|
||||||
|
|
||||||
//| def try_lock(self, ) -> Any:
|
//| def try_lock(self) -> bool:
|
||||||
//| """Attempts to grab the I2C lock. Returns True on success.
|
//| """Attempts to grab the I2C lock. Returns True on success.
|
||||||
//|
|
//|
|
||||||
//| :return: True when lock has been grabbed
|
//| :return: True when lock has been grabbed
|
||||||
@ -164,7 +164,7 @@ STATIC mp_obj_t busio_i2c_obj_try_lock(mp_obj_t self_in) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_1(busio_i2c_try_lock_obj, busio_i2c_obj_try_lock);
|
MP_DEFINE_CONST_FUN_OBJ_1(busio_i2c_try_lock_obj, busio_i2c_obj_try_lock);
|
||||||
|
|
||||||
//| def unlock(self, ) -> Any:
|
//| def unlock(self) -> None:
|
||||||
//| """Releases the I2C lock."""
|
//| """Releases the I2C lock."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -176,7 +176,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);
|
MP_DEFINE_CONST_FUN_OBJ_1(busio_i2c_unlock_obj, busio_i2c_obj_unlock);
|
||||||
|
|
||||||
//| def readfrom_into(self, address: int, buffer: bytearray, *, start: int = 0, end: int = None) -> Any:
|
//| def readfrom_into(self, address: int, buffer: WriteableBuffer, *, start: int = 0, end: int = None) -> None:
|
||||||
//| """Read into ``buffer`` from the device selected by ``address``.
|
//| """Read into ``buffer`` from the device selected by ``address``.
|
||||||
//| The number of bytes read will be the length of ``buffer``.
|
//| The number of bytes read will be the length of ``buffer``.
|
||||||
//| At least one byte must be read.
|
//| At least one byte must be read.
|
||||||
@ -228,7 +228,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);
|
MP_DEFINE_CONST_FUN_OBJ_KW(busio_i2c_readfrom_into_obj, 3, busio_i2c_readfrom_into);
|
||||||
|
|
||||||
//| def writeto(self, address: int, buffer: bytearray, *, start: int = 0, end: int = None, stop: bool = True) -> Any:
|
//| def writeto(self, address: int, buffer: ReadableBuffer, *, start: int = 0, end: int = None, stop: bool = True) -> None:
|
||||||
//| """Write the bytes from ``buffer`` to the device selected by ``address``.
|
//| """Write the bytes from ``buffer`` to the device selected by ``address``.
|
||||||
//| Transmits a stop bit when stop is True. Setting stop=False is deprecated and stop will be
|
//| Transmits a stop bit when stop is True. Setting stop=False is deprecated and stop will be
|
||||||
//| removed in CircuitPython 6.x. Use `writeto_then_readfrom` when needing a write, no stop and
|
//| removed in CircuitPython 6.x. Use `writeto_then_readfrom` when needing a write, no stop and
|
||||||
@ -287,7 +287,7 @@ 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);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(busio_i2c_writeto_obj, 1, busio_i2c_writeto);
|
||||||
|
|
||||||
//| def writeto_then_readfrom(self, address: int, out_buffer: bytearray, in_buffer: bytearray, *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> Any:
|
//| def writeto_then_readfrom(self, address: int, out_buffer: ReadableBuffer, in_buffer: WriteableBuffer, *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> None:
|
||||||
//| """Write the bytes from ``out_buffer`` to the device selected by ``address``, generate no stop
|
//| """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
|
//| 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.
|
//| ``in_buffer`` can be the same buffer because they are used sequentially.
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
//| class OneWire:
|
//| class OneWire:
|
||||||
//| """Lowest-level of the Maxim OneWire protocol"""
|
//| """Lowest-level of the Maxim OneWire protocol"""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, pin: microcontroller.Pin):
|
//| def __init__(self, pin: microcontroller.Pin) -> None:
|
||||||
//| """(formerly Dallas Semi) OneWire protocol.
|
//| """(formerly Dallas Semi) OneWire protocol.
|
||||||
//|
|
//|
|
||||||
//| Protocol definition is here: https://www.maximintegrated.com/en/app-notes/index.mvp/id/126
|
//| Protocol definition is here: https://www.maximintegrated.com/en/app-notes/index.mvp/id/126
|
||||||
@ -77,7 +77,7 @@ STATIC mp_obj_t busio_onewire_make_new(const mp_obj_type_t *type, size_t n_args,
|
|||||||
return MP_OBJ_FROM_PTR(self);
|
return MP_OBJ_FROM_PTR(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def deinit(self, ) -> Any:
|
//| def deinit(self) -> None:
|
||||||
//| """Deinitialize the OneWire bus and release any hardware resources for reuse."""
|
//| """Deinitialize the OneWire bus and release any hardware resources for reuse."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -94,13 +94,13 @@ STATIC void check_for_deinit(busio_onewire_obj_t *self) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def __enter__(self, ) -> Any:
|
//| def __enter__(self) -> OneWire:
|
||||||
//| """No-op used by Context Managers."""
|
//| """No-op used by Context Managers."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
// Provided by context manager helper.
|
// Provided by context manager helper.
|
||||||
|
|
||||||
//| def __exit__(self, ) -> Any:
|
//| def __exit__(self) -> None:
|
||||||
//| """Automatically deinitializes the hardware when exiting a context. See
|
//| """Automatically deinitializes the hardware when exiting a context. See
|
||||||
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
||||||
//| ...
|
//| ...
|
||||||
@ -112,7 +112,7 @@ STATIC mp_obj_t busio_onewire_obj___exit__(size_t n_args, const mp_obj_t *args)
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(busio_onewire___exit___obj, 4, 4, busio_onewire_obj___exit__);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(busio_onewire___exit___obj, 4, 4, busio_onewire_obj___exit__);
|
||||||
|
|
||||||
//| def reset(self, ) -> Any:
|
//| def reset(self) -> bool:
|
||||||
//| """Reset the OneWire bus and read presence
|
//| """Reset the OneWire bus and read presence
|
||||||
//|
|
//|
|
||||||
//| :returns: False when at least one device is present
|
//| :returns: False when at least one device is present
|
||||||
@ -127,7 +127,7 @@ STATIC mp_obj_t busio_onewire_obj_reset(mp_obj_t self_in) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_1(busio_onewire_reset_obj, busio_onewire_obj_reset);
|
MP_DEFINE_CONST_FUN_OBJ_1(busio_onewire_reset_obj, busio_onewire_obj_reset);
|
||||||
|
|
||||||
//| def read_bit(self, ) -> Any:
|
//| def read_bit(self) -> bool:
|
||||||
//| """Read in a bit
|
//| """Read in a bit
|
||||||
//|
|
//|
|
||||||
//| :returns: bit state read
|
//| :returns: bit state read
|
||||||
@ -142,7 +142,7 @@ STATIC mp_obj_t busio_onewire_obj_read_bit(mp_obj_t self_in) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_1(busio_onewire_read_bit_obj, busio_onewire_obj_read_bit);
|
MP_DEFINE_CONST_FUN_OBJ_1(busio_onewire_read_bit_obj, busio_onewire_obj_read_bit);
|
||||||
|
|
||||||
//| def write_bit(self, value: Any) -> Any:
|
//| def write_bit(self, value: bool) -> None:
|
||||||
//| """Write out a bit based on value."""
|
//| """Write out a bit based on value."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
//| multiple secondaries can share the `!clock`, `!MOSI` and `!MISO` lines
|
//| multiple secondaries can share the `!clock`, `!MOSI` and `!MISO` lines
|
||||||
//| and therefore the hardware.)"""
|
//| and therefore the hardware.)"""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, clock: microcontroller.Pin, MOSI: microcontroller.Pin = None, MISO: microcontroller.Pin = None):
|
//| def __init__(self, clock: microcontroller.Pin, MOSI: microcontroller.Pin = None, MISO: microcontroller.Pin = None) -> None:
|
||||||
//|
|
//|
|
||||||
//| """Construct an SPI object on the given pins.
|
//| """Construct an SPI object on the given pins.
|
||||||
//|
|
//|
|
||||||
@ -100,7 +100,7 @@ STATIC mp_obj_t busio_spi_make_new(const mp_obj_type_t *type, size_t n_args, con
|
|||||||
return MP_OBJ_FROM_PTR(self);
|
return MP_OBJ_FROM_PTR(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def deinit(self, ) -> Any:
|
//| def deinit(self) -> None:
|
||||||
//| """Turn off the SPI bus."""
|
//| """Turn off the SPI bus."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -111,13 +111,13 @@ STATIC mp_obj_t busio_spi_obj_deinit(mp_obj_t self_in) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_1(busio_spi_deinit_obj, busio_spi_obj_deinit);
|
MP_DEFINE_CONST_FUN_OBJ_1(busio_spi_deinit_obj, busio_spi_obj_deinit);
|
||||||
|
|
||||||
//| def __enter__(self, ) -> Any:
|
//| def __enter__(self) -> SPI:
|
||||||
//| """No-op used by Context Managers.
|
//| """No-op used by Context Managers.
|
||||||
//| Provided by context manager helper."""
|
//| Provided by context manager helper."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
|
|
||||||
//| def __exit__(self, ) -> Any:
|
//| def __exit__(self) -> None:
|
||||||
//| """Automatically deinitializes the hardware when exiting a context. See
|
//| """Automatically deinitializes the hardware when exiting a context. See
|
||||||
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
||||||
//| ...
|
//| ...
|
||||||
@ -142,7 +142,7 @@ STATIC void check_for_deinit(busio_spi_obj_t *self) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def configure(self, *, baudrate: int = 100000, polarity: int = 0, phase: int = 0, bits: int = 8) -> Any:
|
//| def configure(self, *, baudrate: int = 100000, polarity: int = 0, phase: int = 0, bits: int = 8) -> None:
|
||||||
//| """Configures the SPI bus. The SPI object must be locked.
|
//| """Configures the SPI bus. The SPI object must be locked.
|
||||||
//|
|
//|
|
||||||
//| :param int baudrate: the desired clock rate in Hertz. The actual clock rate may be higher or lower
|
//| :param int baudrate: the desired clock rate in Hertz. The actual clock rate may be higher or lower
|
||||||
@ -201,7 +201,7 @@ STATIC mp_obj_t busio_spi_configure(size_t n_args, const mp_obj_t *pos_args, mp_
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_KW(busio_spi_configure_obj, 1, busio_spi_configure);
|
MP_DEFINE_CONST_FUN_OBJ_KW(busio_spi_configure_obj, 1, busio_spi_configure);
|
||||||
|
|
||||||
//| def try_lock(self, ) -> Any:
|
//| def try_lock(self) -> bool:
|
||||||
//| """Attempts to grab the SPI lock. Returns True on success.
|
//| """Attempts to grab the SPI lock. Returns True on success.
|
||||||
//|
|
//|
|
||||||
//| :return: True when lock has been grabbed
|
//| :return: True when lock has been grabbed
|
||||||
@ -215,7 +215,7 @@ STATIC mp_obj_t busio_spi_obj_try_lock(mp_obj_t self_in) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_1(busio_spi_try_lock_obj, busio_spi_obj_try_lock);
|
MP_DEFINE_CONST_FUN_OBJ_1(busio_spi_try_lock_obj, busio_spi_obj_try_lock);
|
||||||
|
|
||||||
//| def unlock(self, ) -> Any:
|
//| def unlock(self) -> None:
|
||||||
//| """Releases the SPI lock."""
|
//| """Releases the SPI lock."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -228,7 +228,7 @@ STATIC mp_obj_t busio_spi_obj_unlock(mp_obj_t self_in) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_1(busio_spi_unlock_obj, busio_spi_obj_unlock);
|
MP_DEFINE_CONST_FUN_OBJ_1(busio_spi_unlock_obj, busio_spi_obj_unlock);
|
||||||
|
|
||||||
//| def write(self, buffer: bytearray, *, start: Any = 0, end: int = None) -> Any:
|
//| def write(self, buffer: ReadableBuffer, *, start: int = 0, end: Optional[int] = None) -> None:
|
||||||
//| """Write the data contained in ``buffer``. The SPI object must be locked.
|
//| """Write the data contained in ``buffer``. The SPI object must be locked.
|
||||||
//| If the buffer is empty, nothing happens.
|
//| If the buffer is empty, nothing happens.
|
||||||
//|
|
//|
|
||||||
@ -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);
|
MP_DEFINE_CONST_FUN_OBJ_KW(busio_spi_write_obj, 2, busio_spi_write);
|
||||||
|
|
||||||
|
|
||||||
//| def readinto(self, buffer: bytearray, *, start: Any = 0, end: int = None, write_value: int = 0) -> Any:
|
//| def readinto(self, buffer: bytearray, *, start: int = 0, end: Optional[int] = None, write_value: int = 0) -> None:
|
||||||
//| """Read into ``buffer`` while writing ``write_value`` for each byte read.
|
//| """Read into ``buffer`` while writing ``write_value`` for each byte read.
|
||||||
//| The SPI object must be locked.
|
//| The SPI object must be locked.
|
||||||
//| If the number of bytes to read is 0, nothing happens.
|
//| If the number of bytes to read is 0, nothing happens.
|
||||||
@ -314,7 +314,7 @@ STATIC mp_obj_t busio_spi_readinto(size_t n_args, const mp_obj_t *pos_args, mp_m
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_KW(busio_spi_readinto_obj, 2, busio_spi_readinto);
|
MP_DEFINE_CONST_FUN_OBJ_KW(busio_spi_readinto_obj, 2, busio_spi_readinto);
|
||||||
|
|
||||||
//| def write_readinto(self, buffer_out: bytearray, buffer_in: bytearray, *, out_start: Any = 0, out_end: int = None, in_start: Any = 0, in_end: int = None) -> Any:
|
//| def write_readinto(self, buffer_out: ReadableBuffer, buffer_in: ReadableBuffer, *, 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``.
|
//| """Write out the data in ``buffer_out`` while simultaneously reading data into ``buffer_in``.
|
||||||
//| The SPI object must be locked.
|
//| The SPI object must be locked.
|
||||||
//| The lengths of the slices defined by ``buffer_out[out_start:out_end]`` and ``buffer_in[in_start:in_end]``
|
//| The lengths of the slices defined by ``buffer_out[out_start:out_end]`` and ``buffer_in[in_start:in_end]``
|
||||||
@ -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);
|
MP_DEFINE_CONST_FUN_OBJ_KW(busio_spi_write_readinto_obj, 2, busio_spi_write_readinto);
|
||||||
|
|
||||||
//| frequency: Any = ...
|
//| frequency: int = ...
|
||||||
//| """The actual SPI bus frequency. This may not match the frequency requested
|
//| """The actual SPI bus frequency. This may not match the frequency requested
|
||||||
//| due to internal limitations."""
|
//| due to internal limitations."""
|
||||||
//|
|
//|
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
|
|
||||||
//| class UART:
|
//| class UART:
|
||||||
//| """A bidirectional serial protocol"""
|
//| """A bidirectional serial protocol"""
|
||||||
//| def __init__(self, tx: microcontroller.Pin, rx: microcontroller.Pin, *, baudrate: int = 9600, bits: int = 8, parity: Parity = None, stop: int = 1, timeout: float = 1, receiver_buffer_size: int = 64):
|
//| 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:
|
||||||
//| """A common bidirectional serial protocol that uses an an agreed upon speed
|
//| """A common bidirectional serial protocol that uses an an agreed upon speed
|
||||||
//| rather than a shared clock line.
|
//| rather than a shared clock line.
|
||||||
//|
|
//|
|
||||||
@ -142,7 +142,7 @@ STATIC mp_obj_t busio_uart_make_new(const mp_obj_type_t *type, size_t n_args, co
|
|||||||
return (mp_obj_t)self;
|
return (mp_obj_t)self;
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def deinit(self, ) -> Any:
|
//| def deinit(self) -> None:
|
||||||
//| """Deinitialises the UART and releases any hardware resources for reuse."""
|
//| """Deinitialises the UART and releases any hardware resources for reuse."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -159,13 +159,13 @@ STATIC void check_for_deinit(busio_uart_obj_t *self) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def __enter__(self, ) -> Any:
|
//| def __enter__(self) -> UART:
|
||||||
//| """No-op used by Context Managers."""
|
//| """No-op used by Context Managers."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
// Provided by context manager helper.
|
// Provided by context manager helper.
|
||||||
|
|
||||||
//| def __exit__(self, ) -> Any:
|
//| def __exit__(self) -> None:
|
||||||
//| """Automatically deinitializes the hardware when exiting a context. See
|
//| """Automatically deinitializes the hardware when exiting a context. See
|
||||||
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
||||||
//| ...
|
//| ...
|
||||||
@ -179,7 +179,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(busio_uart___exit___obj, 4, 4, busio_
|
|||||||
|
|
||||||
// These are standard stream methods. Code is in py/stream.c.
|
// These are standard stream methods. Code is in py/stream.c.
|
||||||
//
|
//
|
||||||
//| def read(self, nbytes: Any = None) -> Any:
|
//| def read(self, nbytes: Optional[int] = None) -> Optional[bytes]:
|
||||||
//| """Read characters. If ``nbytes`` is specified then read at most that many
|
//| """Read characters. If ``nbytes`` is specified then read at most that many
|
||||||
//| bytes. Otherwise, read everything that arrives until the connection
|
//| bytes. Otherwise, read everything that arrives until the connection
|
||||||
//| times out. Providing the number of bytes expected is highly recommended
|
//| times out. Providing the number of bytes expected is highly recommended
|
||||||
@ -190,7 +190,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(busio_uart___exit___obj, 4, 4, busio_
|
|||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
|
|
||||||
//| def readinto(self, buf: Any) -> Any:
|
//| def readinto(self, buf: WriteableBuffer) -> Optional[int]:
|
||||||
//| """Read bytes into the ``buf``. Read at most ``len(buf)`` bytes.
|
//| """Read bytes into the ``buf``. Read at most ``len(buf)`` bytes.
|
||||||
//|
|
//|
|
||||||
//| :return: number of bytes read and stored into ``buf``
|
//| :return: number of bytes read and stored into ``buf``
|
||||||
@ -199,7 +199,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(busio_uart___exit___obj, 4, 4, busio_
|
|||||||
//| *New in CircuitPython 4.0:* No length parameter is permitted."""
|
//| *New in CircuitPython 4.0:* No length parameter is permitted."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def readline(self, ) -> Any:
|
|
||||||
|
//| def readline(self) -> bytes:
|
||||||
//| """Read a line, ending in a newline character, or
|
//| """Read a line, ending in a newline character, or
|
||||||
//| return None if a timeout occurs sooner, or
|
//| return None if a timeout occurs sooner, or
|
||||||
//| return everything readable if no newline is found and timeout=0
|
//| return everything readable if no newline is found and timeout=0
|
||||||
@ -209,7 +210,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(busio_uart___exit___obj, 4, 4, busio_
|
|||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
|
|
||||||
//| def write(self, buf: Any) -> Any:
|
//| def write(self, buf: WriteableBuffer) -> Optional[int]:
|
||||||
//| """Write the buffer of bytes to the bus.
|
//| """Write the buffer of bytes to the bus.
|
||||||
//|
|
//|
|
||||||
//| *New in CircuitPython 4.0:* ``buf`` must be bytes, not a string.
|
//| *New in CircuitPython 4.0:* ``buf`` must be bytes, not a string.
|
||||||
@ -262,7 +263,7 @@ STATIC mp_uint_t busio_uart_ioctl(mp_obj_t self_in, mp_uint_t request, mp_uint_t
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
//| baudrate: Any = ...
|
//| baudrate: int = ...
|
||||||
//| """The current baudrate."""
|
//| """The current baudrate."""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t busio_uart_obj_get_baudrate(mp_obj_t self_in) {
|
STATIC mp_obj_t busio_uart_obj_get_baudrate(mp_obj_t self_in) {
|
||||||
@ -288,7 +289,7 @@ const mp_obj_property_t busio_uart_baudrate_obj = {
|
|||||||
(mp_obj_t)&mp_const_none_obj},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| in_waiting: Any = ...
|
//| in_waiting: int = ...
|
||||||
//| """The number of bytes in the input buffer, available to be read"""
|
//| """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) {
|
STATIC mp_obj_t busio_uart_obj_get_in_waiting(mp_obj_t self_in) {
|
||||||
@ -305,7 +306,7 @@ const mp_obj_property_t busio_uart_in_waiting_obj = {
|
|||||||
(mp_obj_t)&mp_const_none_obj},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| timeout: Any = ...
|
//| timeout: float = ...
|
||||||
//| """The current timeout, in seconds (float)."""
|
//| """The current timeout, in seconds (float)."""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t busio_uart_obj_get_timeout(mp_obj_t self_in) {
|
STATIC mp_obj_t busio_uart_obj_get_timeout(mp_obj_t self_in) {
|
||||||
@ -333,8 +334,9 @@ const mp_obj_property_t busio_uart_timeout_obj = {
|
|||||||
(mp_obj_t)&mp_const_none_obj},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| def reset_input_buffer(self, ) -> Any: ...
|
//| def reset_input_buffer(self) -> None:
|
||||||
//| """Discard any unread characters in the input buffer."""
|
//| """Discard any unread characters in the input buffer."""
|
||||||
|
//| ...
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t busio_uart_obj_reset_input_buffer(mp_obj_t self_in) {
|
STATIC mp_obj_t busio_uart_obj_reset_input_buffer(mp_obj_t self_in) {
|
||||||
busio_uart_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
busio_uart_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||||
@ -347,10 +349,10 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(busio_uart_reset_input_buffer_obj, busio_uart_o
|
|||||||
//| class Parity:
|
//| class Parity:
|
||||||
//| """Enum-like class to define the parity used to verify correct data transfer."""
|
//| """Enum-like class to define the parity used to verify correct data transfer."""
|
||||||
//|
|
//|
|
||||||
//| ODD: Any = ...
|
//| ODD: int = ...
|
||||||
//| """Total number of ones should be odd."""
|
//| """Total number of ones should be odd."""
|
||||||
//|
|
//|
|
||||||
//| EVEN: Any = ...
|
//| EVEN: int = ...
|
||||||
//| """Total number of ones should be even."""
|
//| """Total number of ones should be even."""
|
||||||
//|
|
//|
|
||||||
const mp_obj_type_t busio_uart_parity_type;
|
const mp_obj_type_t busio_uart_parity_type;
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
//| """Counter will keep track of the number of falling edge transistions (pulses) on a
|
//| """Counter will keep track of the number of falling edge transistions (pulses) on a
|
||||||
//| given pin"""
|
//| given pin"""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, pin_a):
|
//| def __init__(self, pin_a: microcontroller.Pin) -> None:
|
||||||
//| """Create a Counter object associated with the given pin. It tracks the number of
|
//| """Create a Counter object associated with the given pin. It tracks the number of
|
||||||
//| falling pulses relative when the object is constructed.
|
//| falling pulses relative when the object is constructed.
|
||||||
//|
|
//|
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
//| a pin, see the :py:class:`analogio.AnalogIn` and
|
//| a pin, see the :py:class:`analogio.AnalogIn` and
|
||||||
//| :py:class:`analogio.AnalogOut` classes."""
|
//| :py:class:`analogio.AnalogOut` classes."""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, pin: microcontroller.Pin):
|
//| def __init__(self, pin: microcontroller.Pin) -> None:
|
||||||
//| """Create a new DigitalInOut object associated with the pin. Defaults to input
|
//| """Create a new DigitalInOut object associated with the pin. Defaults to input
|
||||||
//| with no pull. Use :py:meth:`switch_to_input` and
|
//| with no pull. Use :py:meth:`switch_to_input` and
|
||||||
//| :py:meth:`switch_to_output` to change the direction.
|
//| :py:meth:`switch_to_output` to change the direction.
|
||||||
@ -82,13 +82,13 @@ STATIC mp_obj_t digitalio_digitalinout_obj_deinit(mp_obj_t self_in) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_1(digitalio_digitalinout_deinit_obj, digitalio_digitalinout_obj_deinit);
|
MP_DEFINE_CONST_FUN_OBJ_1(digitalio_digitalinout_deinit_obj, digitalio_digitalinout_obj_deinit);
|
||||||
|
|
||||||
//| def __enter__(self, ) -> DigitalInOut:
|
//| def __enter__(self) -> DigitalInOut:
|
||||||
//| """No-op used by Context Managers."""
|
//| """No-op used by Context Managers."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
// Provided by context manager helper.
|
// Provided by context manager helper.
|
||||||
|
|
||||||
//| def __exit__(self, ) -> None:
|
//| def __exit__(self) -> None:
|
||||||
//| """Automatically deinitializes the hardware when exiting a context. See
|
//| """Automatically deinitializes the hardware when exiting a context. See
|
||||||
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
||||||
//| ...
|
//| ...
|
||||||
|
@ -41,15 +41,15 @@
|
|||||||
//| class Direction:
|
//| class Direction:
|
||||||
//| """Defines the direction of a digital pin"""
|
//| """Defines the direction of a digital pin"""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, ):
|
//| def __init__(self) -> None:
|
||||||
//| """Enum-like class to define which direction the digital values are
|
//| """Enum-like class to define which direction the digital values are
|
||||||
//| going."""
|
//| going."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| INPUT: Any = ...
|
//| INPUT: Direction = ...
|
||||||
//| """Read digital data in"""
|
//| """Read digital data in"""
|
||||||
//|
|
//|
|
||||||
//| OUTPUT: Any = ...
|
//| OUTPUT: Direction = ...
|
||||||
//| """Write digital data out"""
|
//| """Write digital data out"""
|
||||||
//|
|
//|
|
||||||
const mp_obj_type_t digitalio_direction_type;
|
const mp_obj_type_t digitalio_direction_type;
|
||||||
|
@ -29,15 +29,15 @@
|
|||||||
//| class DriveMode:
|
//| class DriveMode:
|
||||||
//| """Defines the drive mode of a digital pin"""
|
//| """Defines the drive mode of a digital pin"""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, ):
|
//| def __init__(self) -> None:
|
||||||
//| """Enum-like class to define the drive mode used when outputting
|
//| """Enum-like class to define the drive mode used when outputting
|
||||||
//| digital values."""
|
//| digital values."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| PUSH_PULL: Any = ...
|
//| PUSH_PULL: DriveMode = ...
|
||||||
//| """Output both high and low digital values"""
|
//| """Output both high and low digital values"""
|
||||||
//|
|
//|
|
||||||
//| OPEN_DRAIN: Any = ...
|
//| OPEN_DRAIN: DriveMode = ...
|
||||||
//| """Output low digital values but go into high z for digital high. This is
|
//| """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."""
|
//| useful for i2c and other protocols that share a digital line."""
|
||||||
//|
|
//|
|
||||||
|
@ -29,16 +29,16 @@
|
|||||||
//| class Pull:
|
//| class Pull:
|
||||||
//| """Defines the pull of a digital input pin"""
|
//| """Defines the pull of a digital input pin"""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, ):
|
//| def __init__(self) -> None:
|
||||||
//| """Enum-like class to define the pull value, if any, used while reading
|
//| """Enum-like class to define the pull value, if any, used while reading
|
||||||
//| digital values in."""
|
//| digital values in."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| UP: Any = ...
|
//| UP: Pull = ...
|
||||||
//| """When the input line isn't being driven the pull up can pull the state
|
//| """When the input line isn't being driven the pull up can pull the state
|
||||||
//| of the line high so it reads as true."""
|
//| of the line high so it reads as true."""
|
||||||
//|
|
//|
|
||||||
//| DOWN: Any = ...
|
//| DOWN: Pull = ...
|
||||||
//| """When the input line isn't being driven the pull down can pull the
|
//| """When the input line isn't being driven the pull down can pull the
|
||||||
//| state of the line low so it reads as false."""
|
//| state of the line low so it reads as false."""
|
||||||
//|
|
//|
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
//| class Bitmap:
|
//| class Bitmap:
|
||||||
//| """Stores values of a certain size in a 2D array"""
|
//| """Stores values of a certain size in a 2D array"""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, width: int, height: int, value_count: int):
|
//| def __init__(self, width: int, height: int, value_count: int) -> None:
|
||||||
//| """Create a Bitmap object with the given fixed size. Each pixel stores a value that is used to
|
//| """Create a Bitmap object with the given fixed size. Each pixel stores a value that is used to
|
||||||
//| index into a corresponding palette. This enables differently colored sprites to share the
|
//| index into a corresponding palette. This enables differently colored sprites to share the
|
||||||
//| underlying Bitmap. value_count is used to minimize the memory used to store the Bitmap.
|
//| underlying Bitmap. value_count is used to minimize the memory used to store the Bitmap.
|
||||||
@ -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);
|
return MP_OBJ_FROM_PTR(self);
|
||||||
}
|
}
|
||||||
//| width: Any = ...
|
//| width: int = ...
|
||||||
//| """Width of the bitmap. (read only)"""
|
//| """Width of the bitmap. (read only)"""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t displayio_bitmap_obj_get_width(mp_obj_t self_in) {
|
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},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| height: Any = ...
|
//| height: int = ...
|
||||||
//| """Height of the bitmap. (read only)"""
|
//| """Height of the bitmap. (read only)"""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t displayio_bitmap_obj_get_height(mp_obj_t self_in) {
|
STATIC mp_obj_t displayio_bitmap_obj_get_height(mp_obj_t self_in) {
|
||||||
@ -109,7 +109,7 @@ const mp_obj_property_t displayio_bitmap_height_obj = {
|
|||||||
(mp_obj_t)&mp_const_none_obj},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| def __getitem__(self, index: Any) -> Any:
|
//| def __getitem__(self, index: Union[Tuple[int, int], int]) -> int:
|
||||||
//| """Returns the value at the given index. The index can either be an x,y tuple or an int equal
|
//| """Returns the value at the given index. The index can either be an x,y tuple or an int equal
|
||||||
//| to ``y * width + x``.
|
//| to ``y * width + x``.
|
||||||
//|
|
//|
|
||||||
@ -118,7 +118,7 @@ const mp_obj_property_t displayio_bitmap_height_obj = {
|
|||||||
//| print(bitmap[0,1])"""
|
//| print(bitmap[0,1])"""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def __setitem__(self, index: Any, value: Any) -> Any:
|
//| def __setitem__(self, index: Union[Tuple[int, int], int], value: int) -> None:
|
||||||
//| """Sets the value at the given index. The index can either be an x,y tuple or an int equal
|
//| """Sets the value at the given index. The index can either be an x,y tuple or an int equal
|
||||||
//| to ``y * width + x``.
|
//| to ``y * width + x``.
|
||||||
//|
|
//|
|
||||||
@ -172,7 +172,7 @@ STATIC mp_obj_t bitmap_subscr(mp_obj_t self_in, mp_obj_t index_obj, mp_obj_t val
|
|||||||
return mp_const_none;
|
return mp_const_none;
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def fill(self, value: Any) -> Any:
|
//| def fill(self, value: int) -> None:
|
||||||
//| """Fills the bitmap with the supplied palette index value."""
|
//| """Fills the bitmap with the supplied palette index value."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
//| class ColorConverter:
|
//| class ColorConverter:
|
||||||
//| """Converts one color format to another."""
|
//| """Converts one color format to another."""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, *, dither: bool = False):
|
//| def __init__(self, *, dither: bool = False) -> None:
|
||||||
//| """Create a ColorConverter object to convert color formats. Only supports RGB888 to RGB565
|
//| """Create a ColorConverter object to convert color formats. Only supports RGB888 to RGB565
|
||||||
//| currently.
|
//| currently.
|
||||||
//| :param bool dither: Adds random noise to dither the output image"""
|
//| :param bool dither: Adds random noise to dither the output image"""
|
||||||
@ -65,7 +65,7 @@ STATIC mp_obj_t displayio_colorconverter_make_new(const mp_obj_type_t *type, siz
|
|||||||
return MP_OBJ_FROM_PTR(self);
|
return MP_OBJ_FROM_PTR(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def convert(self, color: Any) -> Any:
|
//| def convert(self, color: int) -> int:
|
||||||
//| """Converts the given RGB888 color to RGB565"""
|
//| """Converts the given RGB888 color to RGB565"""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -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);
|
MP_DEFINE_CONST_FUN_OBJ_2(displayio_colorconverter_convert_obj, displayio_colorconverter_obj_convert);
|
||||||
|
|
||||||
//| dither: Any = ...
|
//| dither: bool = ...
|
||||||
//| """When true the color converter dithers the output by adding random noise when
|
//| """When true the color converter dithers the output by adding random noise when
|
||||||
//| truncating to display bitdepth"""
|
//| truncating to display bitdepth"""
|
||||||
//|
|
//|
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
//| Most people should not use this class directly. Use a specific display driver instead that will
|
//| Most people should not use this class directly. Use a specific display driver instead that will
|
||||||
//| contain the initialization sequence at minimum."""
|
//| contain the initialization sequence at minimum."""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, display_bus: Any, init_sequence: buffer, *, width: int, height: int, colstart: int = 0, rowstart: int = 0, rotation: int = 0, color_depth: int = 16, grayscale: bool = False, pixels_in_byte_share_row: bool = True, bytes_per_cell: int = 1, reverse_pixels_in_byte: bool = False, set_column_command: int = 0x2a, set_row_command: int = 0x2b, write_ram_command: int = 0x2c, set_vertical_scroll: int = 0, backlight_pin: 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):
|
//| def __init__(self, display_bus: displayio, init_sequence: buffer, *, width: int, height: int, colstart: int = 0, rowstart: int = 0, rotation: int = 0, color_depth: int = 16, grayscale: bool = False, pixels_in_byte_share_row: bool = True, bytes_per_cell: int = 1, reverse_pixels_in_byte: bool = False, set_column_command: int = 0x2a, set_row_command: int = 0x2b, write_ram_command: int = 0x2c, set_vertical_scroll: int = 0, backlight_pin: Optional[microcontroller.Pin] = None, brightness_command: int = None, brightness: bool = 1.0, auto_brightness: bool = False, single_byte_bounds: bool = False, data_as_commands: bool = False, auto_refresh: bool = True, native_frames_per_second: int = 60) -> None:
|
||||||
//| r"""Create a Display object on the given display bus (`displayio.FourWire` or `displayio.ParallelBus`).
|
//| r"""Create a Display object on the given display bus (`displayio.FourWire` or `displayio.ParallelBus`).
|
||||||
//|
|
//|
|
||||||
//| The ``init_sequence`` is bitpacked to minimize the ram impact. Every command begins with a
|
//| The ``init_sequence`` is bitpacked to minimize the ram impact. Every command begins with a
|
||||||
@ -188,7 +188,7 @@ static displayio_display_obj_t* native_display(mp_obj_t display_obj) {
|
|||||||
return MP_OBJ_TO_PTR(native_display);
|
return MP_OBJ_TO_PTR(native_display);
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def show(self, group: Group) -> Any:
|
//| def show(self, group: Group) -> None:
|
||||||
//| """Switches to displaying the given group of layers. When group is None, the default
|
//| """Switches to displaying the given group of layers. When group is None, the default
|
||||||
//| CircuitPython terminal will be shown.
|
//| CircuitPython terminal will be shown.
|
||||||
//|
|
//|
|
||||||
@ -210,7 +210,7 @@ STATIC mp_obj_t displayio_display_obj_show(mp_obj_t self_in, mp_obj_t group_in)
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_2(displayio_display_show_obj, displayio_display_obj_show);
|
MP_DEFINE_CONST_FUN_OBJ_2(displayio_display_show_obj, displayio_display_obj_show);
|
||||||
|
|
||||||
//| def refresh(self, *, target_frames_per_second: int = 60, minimum_frames_per_second: int = 1) -> Any:
|
//| def refresh(self, *, target_frames_per_second: int = 60, minimum_frames_per_second: int = 1) -> bool:
|
||||||
//| """When auto refresh is off, waits for the target frame rate and then refreshes the display,
|
//| """When auto refresh is off, waits for the target frame rate and then refreshes the display,
|
||||||
//| returning True. If the call has taken too long since the last refresh call for the given
|
//| returning True. If the call has taken too long since the last refresh call for the given
|
||||||
//| target frame rate, then the refresh returns False immediately without updating the screen to
|
//| target frame rate, then the refresh returns False immediately without updating the screen to
|
||||||
@ -245,7 +245,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);
|
MP_DEFINE_CONST_FUN_OBJ_KW(displayio_display_refresh_obj, 1, displayio_display_obj_refresh);
|
||||||
|
|
||||||
//| auto_refresh: Any = ...
|
//| auto_refresh: None = ...
|
||||||
//| """True when the display is refreshed automatically."""
|
//| """True when the display is refreshed automatically."""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t displayio_display_obj_get_auto_refresh(mp_obj_t self_in) {
|
STATIC mp_obj_t displayio_display_obj_get_auto_refresh(mp_obj_t self_in) {
|
||||||
@ -270,7 +270,7 @@ const mp_obj_property_t displayio_display_auto_refresh_obj = {
|
|||||||
(mp_obj_t)&mp_const_none_obj},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| brightness: Any = ...
|
//| brightness: float = ...
|
||||||
//| """The brightness of the display as a float. 0.0 is off and 1.0 is full brightness. When
|
//| """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.
|
//| `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."""
|
//| If `brightness` is set, `auto_brightness` will be disabled and will be set to False."""
|
||||||
@ -307,7 +307,7 @@ const mp_obj_property_t displayio_display_brightness_obj = {
|
|||||||
(mp_obj_t)&mp_const_none_obj},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| auto_brightness: Any = ...
|
//| auto_brightness: Optional[bool] = ...
|
||||||
//| """True when the display brightness is adjusted automatically, based on an ambient
|
//| """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,
|
//| 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
|
//| but not actually implement automatic brightness adjustment. `auto_brightness` is set to False
|
||||||
@ -338,7 +338,7 @@ const mp_obj_property_t displayio_display_auto_brightness_obj = {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
//| width: Any = ...
|
//| width: int = ...
|
||||||
//| Gets the width of the board
|
//| Gets the width of the board
|
||||||
//|
|
//|
|
||||||
//|
|
//|
|
||||||
@ -355,7 +355,7 @@ const mp_obj_property_t displayio_display_width_obj = {
|
|||||||
(mp_obj_t)&mp_const_none_obj},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| height: Any = ...
|
//| height: int = ...
|
||||||
//| """Gets the height of the board"""
|
//| """Gets the height of the board"""
|
||||||
//|
|
//|
|
||||||
//|
|
//|
|
||||||
@ -372,7 +372,7 @@ const mp_obj_property_t displayio_display_height_obj = {
|
|||||||
(mp_obj_t)&mp_const_none_obj},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| rotation: Any = ...
|
//| rotation: int = ...
|
||||||
//| """The rotation of the display as an int in degrees."""
|
//| """The rotation of the display as an int in degrees."""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t displayio_display_obj_get_rotation(mp_obj_t self_in) {
|
STATIC mp_obj_t displayio_display_obj_get_rotation(mp_obj_t self_in) {
|
||||||
@ -395,7 +395,7 @@ const mp_obj_property_t displayio_display_rotation_obj = {
|
|||||||
(mp_obj_t)&mp_const_none_obj},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| bus: Any = ...
|
//| bus: Union[ParallelBus, FourWire, I2CDisplay] = ...
|
||||||
//| """The bus being used by the display"""
|
//| """The bus being used by the display"""
|
||||||
//|
|
//|
|
||||||
//|
|
//|
|
||||||
@ -413,7 +413,7 @@ const mp_obj_property_t displayio_display_bus_obj = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//| def fill_row(self, y: int, buffer: bytearray) -> Any:
|
//| def fill_row(self, y: int, buffer: WriteableBuffer) -> bytearray:
|
||||||
//| """Extract the pixels from a single row
|
//| """Extract the pixels from a single row
|
||||||
//|
|
//|
|
||||||
//| :param int y: The top edge of the area
|
//| :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
|
//| Most people should not use this class directly. Use a specific display driver instead that will
|
||||||
//| contain the startup and shutdown sequences at minimum."""
|
//| contain the startup and shutdown sequences at minimum."""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, display_bus: Any, start_sequence: buffer, stop_sequence: buffer, *, width: int, height: int, ram_width: int, ram_height: int, colstart: int = 0, rowstart: int = 0, rotation: int = 0, set_column_window_command: int = None, set_row_window_command: int = None, single_byte_bounds: Any = False, write_black_ram_command: int, black_bits_inverted: bool = False, write_color_ram_command: int = None, color_bits_inverted: bool = False, highlight_color: int = 0x000000, refresh_display_command: int, refresh_time: float = 40, busy_pin: microcontroller.Pin = None, busy_state: bool = True, seconds_per_frame: float = 180, always_toggle_chip_select: bool = False):
|
//| def __init__(self, display_bus: displayio, start_sequence: buffer, stop_sequence: buffer, *, width: int, height: int, ram_width: int, ram_height: int, colstart: int = 0, rowstart: int = 0, rotation: int = 0, set_column_window_command: Optional[int] = None, set_row_window_command: Optional[int] = None, single_byte_bounds: bool = False, write_black_ram_command: int, black_bits_inverted: bool = False, write_color_ram_command: Optional[int] = None, color_bits_inverted: bool = False, highlight_color: int = 0x000000, refresh_display_command: int, refresh_time: float = 40, busy_pin: Optional[microcontroller.Pin] = None, busy_state: bool = True, seconds_per_frame: float = 180, always_toggle_chip_select: bool = False) -> None:
|
||||||
//| """Create a EPaperDisplay object on the given display bus (`displayio.FourWire` or `displayio.ParallelBus`).
|
//| """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
|
//| The ``start_sequence`` and ``stop_sequence`` are bitpacked to minimize the ram impact. Every
|
||||||
@ -168,7 +168,7 @@ static displayio_epaperdisplay_obj_t* native_display(mp_obj_t display_obj) {
|
|||||||
return MP_OBJ_TO_PTR(native_display);
|
return MP_OBJ_TO_PTR(native_display);
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def show(self, group: Group) -> Any:
|
//| def show(self, group: Group) -> None:
|
||||||
//| """Switches to displaying the given group of layers. When group is None, the default
|
//| """Switches to displaying the given group of layers. When group is None, the default
|
||||||
//| CircuitPython terminal will be shown.
|
//| CircuitPython terminal will be shown.
|
||||||
//|
|
//|
|
||||||
@ -190,7 +190,7 @@ STATIC mp_obj_t displayio_epaperdisplay_obj_show(mp_obj_t self_in, mp_obj_t grou
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_2(displayio_epaperdisplay_show_obj, displayio_epaperdisplay_obj_show);
|
MP_DEFINE_CONST_FUN_OBJ_2(displayio_epaperdisplay_show_obj, displayio_epaperdisplay_obj_show);
|
||||||
|
|
||||||
//| def refresh(self, ) -> Any:
|
//| def refresh(self) -> None:
|
||||||
//| """Refreshes the display immediately or raises an exception if too soon. Use
|
//| """Refreshes the display immediately or raises an exception if too soon. Use
|
||||||
//| ``time.sleep(display.time_to_refresh)`` to sleep until a refresh can occur."""
|
//| ``time.sleep(display.time_to_refresh)`` to sleep until a refresh can occur."""
|
||||||
//| ...
|
//| ...
|
||||||
@ -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);
|
MP_DEFINE_CONST_FUN_OBJ_1(displayio_epaperdisplay_refresh_obj, displayio_epaperdisplay_obj_refresh);
|
||||||
|
|
||||||
//| time_to_refresh: Any = ...
|
//| time_to_refresh: float = ...
|
||||||
//| """Time, in fractional seconds, until the ePaper display can be refreshed."""
|
//| """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) {
|
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},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| width: Any = ...
|
//| width: int = ...
|
||||||
//| """Gets the width of the display in pixels"""
|
//| """Gets the width of the display in pixels"""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t displayio_epaperdisplay_obj_get_width(mp_obj_t self_in) {
|
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},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| height: Any = ...
|
//| height: int = ...
|
||||||
//| """Gets the height of the display in pixels"""
|
//| """Gets the height of the display in pixels"""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t displayio_epaperdisplay_obj_get_height(mp_obj_t self_in) {
|
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},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| bus: Any = ...
|
//| bus: displayio = ...
|
||||||
//| """The bus being used by the display"""
|
//| """The bus being used by the display"""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t displayio_epaperdisplay_obj_get_bus(mp_obj_t self_in) {
|
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.
|
//| """Manage updating a display over SPI four wire protocol in the background while Python code runs.
|
||||||
//| It doesn't handle display initialization."""
|
//| It doesn't handle display initialization."""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, spi_bus: busio.SPI, *, command: microcontroller.Pin, chip_select: microcontroller.Pin, reset: microcontroller.Pin = None, baudrate: int = 24000000, polarity: int = 0, phase: int = 0):
|
//| def __init__(self, spi_bus: busio.SPI, *, command: microcontroller.Pin, chip_select: microcontroller.Pin, reset: microcontroller.Pin = None, baudrate: int = 24000000, polarity: int = 0, phase: int = 0) -> None:
|
||||||
//| """Create a FourWire object associated with the given pins.
|
//| """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
|
//| The SPI bus and pins are then in use by the display until `displayio.release_displays()` is
|
||||||
@ -96,7 +96,7 @@ STATIC mp_obj_t displayio_fourwire_make_new(const mp_obj_type_t *type, size_t n_
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def reset(self, ) -> Any:
|
//| def reset(self) -> None:
|
||||||
//| """Performs a hardware reset via the reset pin. Raises an exception if called when no reset pin
|
//| """Performs a hardware reset via the reset pin. Raises an exception if called when no reset pin
|
||||||
//| is available."""
|
//| is available."""
|
||||||
//| ...
|
//| ...
|
||||||
@ -111,7 +111,7 @@ STATIC mp_obj_t displayio_fourwire_obj_reset(mp_obj_t self_in) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_1(displayio_fourwire_reset_obj, displayio_fourwire_obj_reset);
|
MP_DEFINE_CONST_FUN_OBJ_1(displayio_fourwire_reset_obj, displayio_fourwire_obj_reset);
|
||||||
|
|
||||||
//| def send(self, command: Any, data: Any, *, toggle_every_byte: Any = False) -> Any:
|
//| def send(self, command: int, data: FourWire, *, toggle_every_byte: bool = False) -> None:
|
||||||
//| """Sends the given command value followed by the full set of data. Display state, such as
|
//| """Sends the given command value followed by the full set of data. Display state, such as
|
||||||
//| vertical scroll, set via ``send`` may or may not be reset once the code is done."""
|
//| vertical scroll, set via ``send`` may or may not be reset once the code is done."""
|
||||||
//| ...
|
//| ...
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
//| class Group:
|
//| class Group:
|
||||||
//| """Manage a group of sprites and groups and how they are inter-related."""
|
//| """Manage a group of sprites and groups and how they are inter-related."""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, *, max_size: int = 4, scale: int = 1, x: int = 0, y: int = 0):
|
//| def __init__(self, *, max_size: int = 4, scale: int = 1, x: int = 0, y: int = 0) -> None:
|
||||||
//| """Create a Group of a given size and scale. Scale is in one dimension. For example, scale=2
|
//| """Create a Group of a given size and scale. Scale is in one dimension. For example, scale=2
|
||||||
//| leads to a layer's pixel being 2x2 pixels when in the group.
|
//| leads to a layer's pixel being 2x2 pixels when in the group.
|
||||||
//|
|
//|
|
||||||
@ -86,7 +86,7 @@ displayio_group_t* native_group(mp_obj_t group_obj) {
|
|||||||
return MP_OBJ_TO_PTR(native_group);
|
return MP_OBJ_TO_PTR(native_group);
|
||||||
}
|
}
|
||||||
|
|
||||||
//| hidden: Any = ...
|
//| hidden: bool = ...
|
||||||
//| """True when the Group and all of it's layers are not visible. When False, the Group's layers
|
//| """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."""
|
//| 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},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| scale: Any = ...
|
//| scale: int = ...
|
||||||
//| """Scales each pixel within the Group in both directions. For example, when scale=2 each pixel
|
//| """Scales each pixel within the Group in both directions. For example, when scale=2 each pixel
|
||||||
//| will be represented by 2x2 pixels."""
|
//| 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},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| x: Any = ...
|
//| x: int = ...
|
||||||
//| """X position of the Group in the parent."""
|
//| """X position of the Group in the parent."""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t displayio_group_obj_get_x(mp_obj_t self_in) {
|
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},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| y: Any = ...
|
//| y: int = ...
|
||||||
//| """Y position of the Group in the parent."""
|
//| """Y position of the Group in the parent."""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t displayio_group_obj_get_y(mp_obj_t self_in) {
|
STATIC mp_obj_t displayio_group_obj_get_y(mp_obj_t self_in) {
|
||||||
@ -190,7 +190,7 @@ const mp_obj_property_t displayio_group_y_obj = {
|
|||||||
(mp_obj_t)&mp_const_none_obj},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| def append(self, layer: Any) -> Any:
|
//| def append(self, layer: Union[vectorio.Shape, Group, TileGrid]) -> None:
|
||||||
//| """Append a layer to the group. It will be drawn above other layers."""
|
//| """Append a layer to the group. It will be drawn above other layers."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -201,7 +201,7 @@ STATIC mp_obj_t displayio_group_obj_append(mp_obj_t self_in, mp_obj_t layer) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_2(displayio_group_append_obj, displayio_group_obj_append);
|
MP_DEFINE_CONST_FUN_OBJ_2(displayio_group_append_obj, displayio_group_obj_append);
|
||||||
|
|
||||||
//| def insert(self, index: Any, layer: Any) -> Any:
|
//| def insert(self, index: int, layer: Union[vectorio.Shape, Group, TileGrid]) -> None:
|
||||||
//| """Insert a layer into the group."""
|
//| """Insert a layer into the group."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -214,7 +214,7 @@ STATIC mp_obj_t displayio_group_obj_insert(mp_obj_t self_in, mp_obj_t index_obj,
|
|||||||
MP_DEFINE_CONST_FUN_OBJ_3(displayio_group_insert_obj, displayio_group_obj_insert);
|
MP_DEFINE_CONST_FUN_OBJ_3(displayio_group_insert_obj, displayio_group_obj_insert);
|
||||||
|
|
||||||
|
|
||||||
//| def index(self, layer: Any) -> Any:
|
//| def index(self, layer: Union[vectorio.Shape, Group, TileGrid]) -> int:
|
||||||
//| """Returns the index of the first copy of layer. Raises ValueError if not found."""
|
//| """Returns the index of the first copy of layer. Raises ValueError if not found."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -228,7 +228,7 @@ STATIC mp_obj_t displayio_group_obj_index(mp_obj_t self_in, mp_obj_t layer) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_2(displayio_group_index_obj, displayio_group_obj_index);
|
MP_DEFINE_CONST_FUN_OBJ_2(displayio_group_index_obj, displayio_group_obj_index);
|
||||||
|
|
||||||
//| def pop(self, i: Any = -1) -> Any:
|
//| def pop(self, i: int = -1) -> Union[vectorio.Shape, Group, TileGrid]:
|
||||||
//| """Remove the ith item and return it."""
|
//| """Remove the ith item and return it."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -251,7 +251,7 @@ STATIC mp_obj_t displayio_group_obj_pop(size_t n_args, const mp_obj_t *pos_args,
|
|||||||
MP_DEFINE_CONST_FUN_OBJ_KW(displayio_group_pop_obj, 1, displayio_group_obj_pop);
|
MP_DEFINE_CONST_FUN_OBJ_KW(displayio_group_pop_obj, 1, displayio_group_obj_pop);
|
||||||
|
|
||||||
|
|
||||||
//| def remove(self, layer: Any) -> Any:
|
//| def remove(self, layer: Union[vectorio.Shape, Group, TileGrid]) -> None:
|
||||||
//| """Remove the first copy of layer. Raises ValueError if it is not present."""
|
//| """Remove the first copy of layer. Raises ValueError if it is not present."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -264,7 +264,9 @@ STATIC mp_obj_t displayio_group_obj_remove(mp_obj_t self_in, mp_obj_t layer) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_2(displayio_group_remove_obj, displayio_group_obj_remove);
|
MP_DEFINE_CONST_FUN_OBJ_2(displayio_group_remove_obj, displayio_group_obj_remove);
|
||||||
|
|
||||||
//| def __len__(self, ) -> Any:
|
//| def __bool__(self) -> bool: ...
|
||||||
|
//|
|
||||||
|
//| def __len__(self) -> int:
|
||||||
//| """Returns the number of layers in a Group"""
|
//| """Returns the number of layers in a Group"""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -278,7 +280,7 @@ STATIC mp_obj_t group_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def __getitem__(self, index: Any) -> Any:
|
//| def __getitem__(self, index: int) -> Union[vectorio.Shape, Group, TileGrid]:
|
||||||
//| """Returns the value at the given index.
|
//| """Returns the value at the given index.
|
||||||
//|
|
//|
|
||||||
//| This allows you to::
|
//| This allows you to::
|
||||||
@ -286,7 +288,7 @@ STATIC mp_obj_t group_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
|
|||||||
//| print(group[0])"""
|
//| print(group[0])"""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def __setitem__(self, index: Any, value: Any) -> Any:
|
//| def __setitem__(self, index: int, value: Union[vectorio.Shape, Group, TileGrid]) -> None:
|
||||||
//| """Sets the value at the given index.
|
//| """Sets the value at the given index.
|
||||||
//|
|
//|
|
||||||
//| This allows you to::
|
//| This allows you to::
|
||||||
@ -294,7 +296,7 @@ STATIC mp_obj_t group_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
|
|||||||
//| group[0] = sprite"""
|
//| group[0] = sprite"""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def __delitem__(self, index: Any) -> Any:
|
//| def __delitem__(self, index: int) -> None:
|
||||||
//| """Deletes the value at the given index.
|
//| """Deletes the value at the given index.
|
||||||
//|
|
//|
|
||||||
//| This allows you to::
|
//| This allows you to::
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
//| """Manage updating a display over I2C in the background while Python code runs.
|
//| """Manage updating a display over I2C in the background while Python code runs.
|
||||||
//| It doesn't handle display initialization."""
|
//| It doesn't handle display initialization."""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, i2c_bus: busio.I2C, *, device_address: int, reset: microcontroller.Pin = None):
|
//| def __init__(self, i2c_bus: busio.I2C, *, device_address: int, reset: microcontroller.Pin = None) -> None:
|
||||||
//| """Create a I2CDisplay object associated with the given I2C bus and reset pin.
|
//| """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
|
//| The I2C bus and pins are then in use by the display until `displayio.release_displays()` is
|
||||||
@ -76,7 +76,7 @@ STATIC mp_obj_t displayio_i2cdisplay_make_new(const mp_obj_type_t *type, size_t
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def reset(self, ) -> Any:
|
//| def reset(self) -> None:
|
||||||
//| """Performs a hardware reset via the reset pin. Raises an exception if called when no reset pin
|
//| """Performs a hardware reset via the reset pin. Raises an exception if called when no reset pin
|
||||||
//| is available."""
|
//| is available."""
|
||||||
//| ...
|
//| ...
|
||||||
@ -91,7 +91,7 @@ STATIC mp_obj_t displayio_i2cdisplay_obj_reset(mp_obj_t self_in) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_1(displayio_i2cdisplay_reset_obj, displayio_i2cdisplay_obj_reset);
|
MP_DEFINE_CONST_FUN_OBJ_1(displayio_i2cdisplay_reset_obj, displayio_i2cdisplay_obj_reset);
|
||||||
|
|
||||||
//| def send(self, command: Any, data: Any) -> Any:
|
//| def send(self, command: int, data: ReadableBuffer) -> None:
|
||||||
//| """Sends the given command value followed by the full set of data. Display state, such as
|
//| """Sends the given command value followed by the full set of data. Display state, such as
|
||||||
//| vertical scroll, set via ``send`` may or may not be reset once the code is done."""
|
//| vertical scroll, set via ``send`` may or may not be reset once the code is done."""
|
||||||
//| ...
|
//| ...
|
||||||
|
@ -69,7 +69,7 @@
|
|||||||
//| while True:
|
//| while True:
|
||||||
//| pass"""
|
//| pass"""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, file: file):
|
//| def __init__(self, file: file) -> None:
|
||||||
//| """Create an OnDiskBitmap object with the given file.
|
//| """Create an OnDiskBitmap object with the given file.
|
||||||
//|
|
//|
|
||||||
//| :param file file: The open bitmap file"""
|
//| :param file file: The open bitmap file"""
|
||||||
@ -89,7 +89,7 @@ STATIC mp_obj_t displayio_ondiskbitmap_make_new(const mp_obj_type_t *type, size_
|
|||||||
return MP_OBJ_FROM_PTR(self);
|
return MP_OBJ_FROM_PTR(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
//| width: Any = ...
|
//| width: int = ...
|
||||||
//| """Width of the bitmap. (read only)"""
|
//| """Width of the bitmap. (read only)"""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t displayio_ondiskbitmap_obj_get_width(mp_obj_t self_in) {
|
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: Any = ...
|
//| height: int = ...
|
||||||
//| """Height of the bitmap. (read only)"""
|
//| """Height of the bitmap. (read only)"""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t displayio_ondiskbitmap_obj_get_height(mp_obj_t self_in) {
|
STATIC mp_obj_t displayio_ondiskbitmap_obj_get_height(mp_obj_t self_in) {
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
//| """Map a pixel palette_index to a full color. Colors are transformed to the display's format internally to
|
//| """Map a pixel palette_index to a full color. Colors are transformed to the display's format internally to
|
||||||
//| save memory."""
|
//| save memory."""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, color_count: int):
|
//| def __init__(self, color_count: int) -> None:
|
||||||
//| """Create a Palette object to store a set number of colors.
|
//| """Create a Palette object to store a set number of colors.
|
||||||
//|
|
//|
|
||||||
//| :param int color_count: The number of colors in the Palette"""
|
//| :param int color_count: The number of colors in the Palette"""
|
||||||
@ -70,7 +70,9 @@ STATIC mp_obj_t displayio_palette_make_new(const mp_obj_type_t *type, size_t n_a
|
|||||||
return MP_OBJ_FROM_PTR(self);
|
return MP_OBJ_FROM_PTR(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def __len__(self, ) -> Any:
|
//| def __bool__(self) -> bool: ...
|
||||||
|
//|
|
||||||
|
//| def __len__(self) -> int:
|
||||||
//| """Returns the number of colors in a Palette"""
|
//| """Returns the number of colors in a Palette"""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -84,7 +86,7 @@ STATIC mp_obj_t group_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def __setitem__(self, index: Any, value: Any) -> Any:
|
//| def __setitem__(self, index: int, value: Union[int, ReadableBuffer]) -> Optional[int]:
|
||||||
//| r"""Sets the pixel color at the given index. The index should be an integer in the range 0 to color_count-1.
|
//| r"""Sets the pixel color at the given index. The index should be an integer in the range 0 to color_count-1.
|
||||||
//|
|
//|
|
||||||
//| The value argument represents a color, and can be from 0x000000 to 0xFFFFFF (to represent an RGB value).
|
//| The value argument represents a color, and can be from 0x000000 to 0xFFFFFF (to represent an RGB value).
|
||||||
@ -147,7 +149,7 @@ STATIC mp_obj_t palette_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t val
|
|||||||
return mp_const_none;
|
return mp_const_none;
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def make_transparent(self, palette_index: Any) -> Any: ...
|
//| def make_transparent(self, palette_index: int) -> None: ...
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t displayio_palette_obj_make_transparent(mp_obj_t self_in, mp_obj_t palette_index_obj) {
|
STATIC mp_obj_t displayio_palette_obj_make_transparent(mp_obj_t self_in, mp_obj_t palette_index_obj) {
|
||||||
displayio_palette_t *self = MP_OBJ_TO_PTR(self_in);
|
displayio_palette_t *self = MP_OBJ_TO_PTR(self_in);
|
||||||
@ -161,7 +163,7 @@ STATIC mp_obj_t displayio_palette_obj_make_transparent(mp_obj_t self_in, mp_obj_
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_2(displayio_palette_make_transparent_obj, displayio_palette_obj_make_transparent);
|
MP_DEFINE_CONST_FUN_OBJ_2(displayio_palette_make_transparent_obj, displayio_palette_obj_make_transparent);
|
||||||
|
|
||||||
//| def make_opaque(self, palette_index: Any) -> Any: ...
|
//| def make_opaque(self, palette_index: int) -> None: ...
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t displayio_palette_obj_make_opaque(mp_obj_t self_in, mp_obj_t palette_index_obj) {
|
STATIC mp_obj_t displayio_palette_obj_make_opaque(mp_obj_t self_in, mp_obj_t palette_index_obj) {
|
||||||
displayio_palette_t *self = MP_OBJ_TO_PTR(self_in);
|
displayio_palette_t *self = MP_OBJ_TO_PTR(self_in);
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
//| protocol may be refered to as 8080-I Series Parallel Interface in datasheets. It doesn't handle
|
//| protocol may be refered to as 8080-I Series Parallel Interface in datasheets. It doesn't handle
|
||||||
//| display initialization."""
|
//| display initialization."""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, *, data0: microcontroller.Pin, command: microcontroller.Pin, chip_select: microcontroller.Pin, write: microcontroller.Pin, read: microcontroller.Pin, reset: microcontroller.Pin):
|
//| def __init__(self, *, data0: microcontroller.Pin, command: microcontroller.Pin, chip_select: microcontroller.Pin, write: microcontroller.Pin, read: microcontroller.Pin, reset: microcontroller.Pin) -> None:
|
||||||
//| """Create a ParallelBus object associated with the given pins. The bus is inferred from data0
|
//| """Create a ParallelBus object associated with the given pins. The bus is inferred from data0
|
||||||
//| by implying the next 7 additional pins on a given GPIO port.
|
//| by implying the next 7 additional pins on a given GPIO port.
|
||||||
//|
|
//|
|
||||||
@ -86,7 +86,7 @@ STATIC mp_obj_t displayio_parallelbus_make_new(const mp_obj_type_t *type, size_t
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def reset(self, ) -> Any:
|
//| def reset(self) -> None:
|
||||||
//| """Performs a hardware reset via the reset pin. Raises an exception if called when no reset pin
|
//| """Performs a hardware reset via the reset pin. Raises an exception if called when no reset pin
|
||||||
//| is available."""
|
//| is available."""
|
||||||
//| ...
|
//| ...
|
||||||
@ -102,7 +102,7 @@ STATIC mp_obj_t displayio_parallelbus_obj_reset(mp_obj_t self_in) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_1(displayio_parallelbus_reset_obj, displayio_parallelbus_obj_reset);
|
MP_DEFINE_CONST_FUN_OBJ_1(displayio_parallelbus_reset_obj, displayio_parallelbus_obj_reset);
|
||||||
|
|
||||||
//| def send(self, command: Any, data: Any) -> Any:
|
//| def send(self, command: int, data: ReadableBuffer) -> None:
|
||||||
//| """Sends the given command value followed by the full set of data. Display state, such as
|
//| """Sends the given command value followed by the full set of data. Display state, such as
|
||||||
//| vertical scroll, set via ``send`` may or may not be reset once the code is done."""
|
//| vertical scroll, set via ``send`` may or may not be reset once the code is done."""
|
||||||
//| ...
|
//| ...
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
//| class Shape:
|
//| class Shape:
|
||||||
//| """Represents a shape made by defining boundaries that may be mirrored."""
|
//| """Represents a shape made by defining boundaries that may be mirrored."""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, width: int, height: int, *, mirror_x: bool = False, mirror_y: bool = False):
|
//| def __init__(self, width: int, height: int, *, mirror_x: bool = False, mirror_y: bool = False) -> None:
|
||||||
//| """Create a Shape object with the given fixed size. Each pixel is one bit and is stored by the
|
//| """Create a Shape object with the given fixed size. Each pixel is one bit and is stored by the
|
||||||
//| column boundaries of the shape on each row. Each row's boundary defaults to the full row.
|
//| column boundaries of the shape on each row. Each row's boundary defaults to the full row.
|
||||||
//|
|
//|
|
||||||
@ -79,7 +79,7 @@ STATIC mp_obj_t displayio_shape_make_new(const mp_obj_type_t *type, size_t n_arg
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//| def set_boundary(self, y: Any, start_x: Any, end_x: Any) -> Any:
|
//| def set_boundary(self, y: int, start_x: int, end_x: int) -> None:
|
||||||
//| """Loads pre-packed data into the given row."""
|
//| """Loads pre-packed data into the given row."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
//|
|
//|
|
||||||
//| A single tile grid is also known as a Sprite."""
|
//| A single tile grid is also known as a Sprite."""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, bitmap: displayio.Bitmap, *, pixel_shader: displayio.Palette, width: int = 1, height: int = 1, tile_width: int = None, tile_height: int = None, default_tile: int = 0, x: int = 0, y: int = 0):
|
//| def __init__(self, bitmap: displayio.Bitmap, *, pixel_shader: displayio.Palette, width: int = 1, height: int = 1, tile_width: int = None, tile_height: int = None, default_tile: int = 0, x: int = 0, y: int = 0) -> None:
|
||||||
//| """Create a TileGrid object. The bitmap is source for 2d pixels. The pixel_shader is used to
|
//| """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
|
//| 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.
|
//| palette lookup, a gradient, a pattern or a color transformer.
|
||||||
@ -141,7 +141,7 @@ static displayio_tilegrid_t* native_tilegrid(mp_obj_t tilegrid_obj) {
|
|||||||
mp_obj_assert_native_inited(native_tilegrid);
|
mp_obj_assert_native_inited(native_tilegrid);
|
||||||
return MP_OBJ_TO_PTR(native_tilegrid);
|
return MP_OBJ_TO_PTR(native_tilegrid);
|
||||||
}
|
}
|
||||||
//| hidden: Any = ...
|
//| hidden: bool = ...
|
||||||
//| """True when the TileGrid is hidden. This may be False even when a part of a hidden Group."""
|
//| """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) {
|
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},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| x: Any = ...
|
//| x: int = ...
|
||||||
//| """X position of the left edge in the parent."""
|
//| """X position of the left edge in the parent."""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t displayio_tilegrid_obj_get_x(mp_obj_t self_in) {
|
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},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| y: Any = ...
|
//| y: int = ...
|
||||||
//| """Y position of the top edge in the parent."""
|
//| """Y position of the top edge in the parent."""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t displayio_tilegrid_obj_get_y(mp_obj_t self_in) {
|
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},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| flip_x: Any = ...
|
//| flip_x: bool = ...
|
||||||
//| """If true, the left edge rendered will be the right edge of the right-most tile."""
|
//| """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) {
|
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},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| flip_y: Any = ...
|
//| flip_y: bool = ...
|
||||||
//| """If true, the top edge rendered will be the bottom edge of the bottom-most tile."""
|
//| """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) {
|
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: Any = ...
|
//| transpose_xy: bool = ...
|
||||||
//| """If true, the TileGrid's axis will be swapped. When combined with mirroring, any 90 degree
|
//| """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."""
|
//| 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},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| pixel_shader: Any = ...
|
//| pixel_shader: Union[ColorConverter, Palette] = ...
|
||||||
//| """The pixel shader of the tilegrid."""
|
//| """The pixel shader of the tilegrid."""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t displayio_tilegrid_obj_get_pixel_shader(mp_obj_t self_in) {
|
STATIC mp_obj_t displayio_tilegrid_obj_get_pixel_shader(mp_obj_t self_in) {
|
||||||
@ -317,7 +317,7 @@ const mp_obj_property_t displayio_tilegrid_pixel_shader_obj = {
|
|||||||
(mp_obj_t)&mp_const_none_obj},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| def __getitem__(self, index: Any) -> Any:
|
//| def __getitem__(self, index: Union[Tuple[int, int], int]) -> int:
|
||||||
//| """Returns the tile index at the given index. The index can either be an x,y tuple or an int equal
|
//| """Returns the tile index at the given index. The index can either be an x,y tuple or an int equal
|
||||||
//| to ``y * width + x``.
|
//| to ``y * width + x``.
|
||||||
//|
|
//|
|
||||||
@ -326,7 +326,7 @@ const mp_obj_property_t displayio_tilegrid_pixel_shader_obj = {
|
|||||||
//| print(grid[0])"""
|
//| print(grid[0])"""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def __setitem__(self, index: Any, tile_index: Any) -> Any:
|
//| def __setitem__(self, index: Union[Tuple[int, int], int], tile_index: int) -> None:
|
||||||
//| """Sets the tile index at the given index. The index can either be an x,y tuple or an int equal
|
//| """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``.
|
//| to ``y * width + x``.
|
||||||
//|
|
//|
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
//|
|
//|
|
||||||
|
|
||||||
|
|
||||||
//| def release_displays() -> Any:
|
//| def release_displays() -> None:
|
||||||
//| """Releases any actively used displays so their busses and pins can be used again. This will also
|
//| """Releases any actively used displays so their busses and pins can be used again. This will also
|
||||||
//| release the builtin display on boards that have one. You will need to reinitialize it yourself
|
//| release the builtin display on boards that have one. You will need to reinitialize it yourself
|
||||||
//| afterwards. This may take seconds to complete if an active EPaperDisplay is refreshing.
|
//| afterwards. This may take seconds to complete if an active EPaperDisplay is refreshing.
|
||||||
|
@ -39,14 +39,14 @@
|
|||||||
//| class BuiltinFont:
|
//| class BuiltinFont:
|
||||||
//| """A font built into CircuitPython"""
|
//| """A font built into CircuitPython"""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, ):
|
//| def __init__(self) -> None:
|
||||||
//| """Creation not supported. Available fonts are defined when CircuitPython is built. See the
|
//| """Creation not supported. Available fonts are defined when CircuitPython is built. See the
|
||||||
//| `Adafruit_CircuitPython_Bitmap_Font <https://github.com/adafruit/Adafruit_CircuitPython_Bitmap_Font>`_
|
//| `Adafruit_CircuitPython_Bitmap_Font <https://github.com/adafruit/Adafruit_CircuitPython_Bitmap_Font>`_
|
||||||
//| library for dynamically loaded fonts."""
|
//| library for dynamically loaded fonts."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
|
|
||||||
//| bitmap: Any = ...
|
//| bitmap: displayio.Bitmap = ...
|
||||||
//| """Bitmap containing all font glyphs starting with ASCII and followed by unicode. Use
|
//| """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
|
//| `get_glyph` in most cases. This is useful for use with `displayio.TileGrid` and
|
||||||
//| `terminalio.Terminal`."""
|
//| `terminalio.Terminal`."""
|
||||||
@ -64,7 +64,7 @@ const mp_obj_property_t fontio_builtinfont_bitmap_obj = {
|
|||||||
(mp_obj_t)&mp_const_none_obj},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| def get_bounding_box(self, ) -> Any:
|
//| def get_bounding_box(self) -> Tuple[int, int]:
|
||||||
//| """Returns the maximum bounds of all glyphs in the font in a tuple of two values: width, height."""
|
//| """Returns the maximum bounds of all glyphs in the font in a tuple of two values: width, height."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -76,7 +76,7 @@ STATIC mp_obj_t fontio_builtinfont_obj_get_bounding_box(mp_obj_t self_in) {
|
|||||||
MP_DEFINE_CONST_FUN_OBJ_1(fontio_builtinfont_get_bounding_box_obj, fontio_builtinfont_obj_get_bounding_box);
|
MP_DEFINE_CONST_FUN_OBJ_1(fontio_builtinfont_get_bounding_box_obj, fontio_builtinfont_obj_get_bounding_box);
|
||||||
|
|
||||||
|
|
||||||
//| def get_glyph(self, codepoint: Any) -> Any:
|
//| def get_glyph(self, codepoint: int) -> Glyph:
|
||||||
//| """Returns a `fontio.Glyph` for the given codepoint or None if no glyph is available."""
|
//| """Returns a `fontio.Glyph` for the given codepoint or None if no glyph is available."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
//| objects in CircuitPython, Display objects live until `displayio.release_displays()`
|
//| objects in CircuitPython, Display objects live until `displayio.release_displays()`
|
||||||
//| is called. This is done so that CircuitPython can use the display itself."""
|
//| is called. This is done so that CircuitPython can use the display itself."""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, framebuffer: Any, *, rotation: int = 0, auto_refresh: bool = True):
|
//| def __init__(self, framebuffer: rgbmatrix.RGBMatrix, *, rotation: int = 0, auto_refresh: bool = True) -> None:
|
||||||
//| """Create a Display object with the given framebuffer (a buffer, array, ulab.array, etc)
|
//| """Create a Display object with the given framebuffer (a buffer, array, ulab.array, etc)
|
||||||
//|
|
//|
|
||||||
//| :param framebuffer: The framebuffer that the display is connected to
|
//| :param framebuffer: The framebuffer that the display is connected to
|
||||||
@ -94,7 +94,7 @@ static framebufferio_framebufferdisplay_obj_t* native_display(mp_obj_t display_o
|
|||||||
return MP_OBJ_TO_PTR(native_display);
|
return MP_OBJ_TO_PTR(native_display);
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def show(self, group: Group) -> Any:
|
//| def show(self, group: Group) -> None:
|
||||||
//| """Switches to displaying the given group of layers. When group is None, the default
|
//| """Switches to displaying the given group of layers. When group is None, the default
|
||||||
//| CircuitPython terminal will be shown.
|
//| CircuitPython terminal will be shown.
|
||||||
//|
|
//|
|
||||||
@ -116,7 +116,7 @@ STATIC mp_obj_t framebufferio_framebufferdisplay_obj_show(mp_obj_t self_in, mp_o
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_2(framebufferio_framebufferdisplay_show_obj, framebufferio_framebufferdisplay_obj_show);
|
MP_DEFINE_CONST_FUN_OBJ_2(framebufferio_framebufferdisplay_show_obj, framebufferio_framebufferdisplay_obj_show);
|
||||||
|
|
||||||
//| def refresh(self, *, target_frames_per_second: int = 60, minimum_frames_per_second: int = 1) -> Any:
|
//| def refresh(self, *, target_frames_per_second: int = 60, minimum_frames_per_second: int = 1) -> bool:
|
||||||
//| """When auto refresh is off, waits for the target frame rate and then refreshes the display,
|
//| """When auto refresh is off, waits for the target frame rate and then refreshes the display,
|
||||||
//| returning True. If the call has taken too long since the last refresh call for the given
|
//| returning True. If the call has taken too long since the last refresh call for the given
|
||||||
//| target frame rate, then the refresh returns False immediately without updating the screen to
|
//| target frame rate, then the refresh returns False immediately without updating the screen to
|
||||||
@ -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);
|
MP_DEFINE_CONST_FUN_OBJ_KW(framebufferio_framebufferdisplay_refresh_obj, 1, framebufferio_framebufferdisplay_obj_refresh);
|
||||||
|
|
||||||
//| auto_refresh: Any = ...
|
//| auto_refresh: bool = ...
|
||||||
//| """True when the display is refreshed automatically."""
|
//| """True when the display is refreshed automatically."""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_auto_refresh(mp_obj_t self_in) {
|
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},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| brightness: Any = ...
|
//| brightness: float = ...
|
||||||
//| """The brightness of the display as a float. 0.0 is off and 1.0 is full brightness. When
|
//| """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.
|
//| `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."""
|
//| 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},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| auto_brightness: Any = ...
|
//| auto_brightness: bool = ...
|
||||||
//| """True when the display brightness is adjusted automatically, based on an ambient
|
//| """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,
|
//| 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
|
//| 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},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| width: Any = ...
|
//| width: int = ...
|
||||||
//| """Gets the width of the framebuffer"""
|
//| """Gets the width of the framebuffer"""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_width(mp_obj_t self_in) {
|
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},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| height: Any = ...
|
//| height: int = ...
|
||||||
//| """Gets the height of the framebuffer"""
|
//| """Gets the height of the framebuffer"""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_height(mp_obj_t self_in) {
|
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},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| rotation: Any = ...
|
//| rotation: int = ...
|
||||||
//| """The rotation of the display as an int in degrees."""
|
//| """The rotation of the display as an int in degrees."""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_rotation(mp_obj_t self_in) {
|
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},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| framebuffer: Any = ...
|
//| framebuffer: rgbmatrix.RGBMatrix = ...
|
||||||
//| """The framebuffer being used by the display"""
|
//| """The framebuffer being used by the display"""
|
||||||
//|
|
//|
|
||||||
//|
|
//|
|
||||||
@ -317,7 +317,7 @@ const mp_obj_property_t framebufferio_framebufferframebuffer_obj = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//| def fill_row(self, y: int, buffer: bytearray) -> Any:
|
//| def fill_row(self, y: int, buffer: WriteableBuffer) -> displayio:
|
||||||
//| """Extract the pixels from a single row
|
//| """Extract the pixels from a single row
|
||||||
//|
|
//|
|
||||||
//| :param int y: The top edge of the area
|
//| :param int y: The top edge of the area
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
//|
|
//|
|
||||||
//| FrequencyIn will not determine pulse width (use ``PulseIn``)."""
|
//| FrequencyIn will not determine pulse width (use ``PulseIn``)."""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, pin: microcontroller.Pin, capture_period: int = 10):
|
//| def __init__(self, pin: microcontroller.Pin, capture_period: int = 10) -> None:
|
||||||
//| """Create a FrequencyIn object associated with the given pin.
|
//| """Create a FrequencyIn object associated with the given pin.
|
||||||
//|
|
//|
|
||||||
//| :param ~microcontroller.Pin pin: Pin to read frequency from.
|
//| :param ~microcontroller.Pin pin: Pin to read frequency from.
|
||||||
@ -94,7 +94,7 @@ STATIC mp_obj_t frequencyio_frequencyin_make_new(const mp_obj_type_t *type, size
|
|||||||
return MP_OBJ_FROM_PTR(self);
|
return MP_OBJ_FROM_PTR(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def deinit(self, ) -> Any:
|
//| def deinit(self) -> None:
|
||||||
//| """Deinitialises the FrequencyIn and releases any hardware resources for reuse."""
|
//| """Deinitialises the FrequencyIn and releases any hardware resources for reuse."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -111,13 +111,13 @@ STATIC void check_for_deinit(frequencyio_frequencyin_obj_t *self) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def __enter__(self, ) -> Any:
|
//| def __enter__(self) -> FrequencyIn:
|
||||||
//| """No-op used by Context Managers."""
|
//| """No-op used by Context Managers."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
// Provided by context manager helper.
|
// Provided by context manager helper.
|
||||||
|
|
||||||
//| def __exit__(self, ) -> Any:
|
//| def __exit__(self) -> None:
|
||||||
//| """Automatically deinitializes the hardware when exiting a context. See
|
//| """Automatically deinitializes the hardware when exiting a context. See
|
||||||
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
||||||
//| ...
|
//| ...
|
||||||
@ -129,7 +129,7 @@ STATIC mp_obj_t frequencyio_frequencyin_obj___exit__(size_t n_args, const mp_obj
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(frequencyio_frequencyin___exit___obj, 4, 4, frequencyio_frequencyin_obj___exit__);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(frequencyio_frequencyin___exit___obj, 4, 4, frequencyio_frequencyin_obj___exit__);
|
||||||
|
|
||||||
//| def pause(self, ) -> Any:
|
//| def pause(self) -> None:
|
||||||
//| """Pause frequency capture."""
|
//| """Pause frequency capture."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -142,7 +142,7 @@ STATIC mp_obj_t frequencyio_frequencyin_obj_pause(mp_obj_t self_in) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_1(frequencyio_frequencyin_pause_obj, frequencyio_frequencyin_obj_pause);
|
MP_DEFINE_CONST_FUN_OBJ_1(frequencyio_frequencyin_pause_obj, frequencyio_frequencyin_obj_pause);
|
||||||
|
|
||||||
//| def resume(self, ) -> Any:
|
//| def resume(self) -> None:
|
||||||
//| """Resumes frequency capture."""
|
//| """Resumes frequency capture."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -155,7 +155,7 @@ STATIC mp_obj_t frequencyio_frequencyin_obj_resume(mp_obj_t self_in) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_1(frequencyio_frequencyin_resume_obj, frequencyio_frequencyin_obj_resume);
|
MP_DEFINE_CONST_FUN_OBJ_1(frequencyio_frequencyin_resume_obj, frequencyio_frequencyin_obj_resume);
|
||||||
|
|
||||||
//| def clear(self, ) -> Any:
|
//| def clear(self) -> None:
|
||||||
//| """Clears the last detected frequency capture value."""
|
//| """Clears the last detected frequency capture value."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -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);
|
MP_DEFINE_CONST_FUN_OBJ_1(frequencyio_frequencyin_clear_obj, frequencyio_frequencyin_obj_clear);
|
||||||
|
|
||||||
//| capture_period: Any = ...
|
//| capture_period: int = ...
|
||||||
//| """The capture measurement period. Lower incoming frequencies will be measured
|
//| """The capture measurement period. Lower incoming frequencies will be measured
|
||||||
//| more accurately with longer capture periods. Higher frequencies are more
|
//| more accurately with longer capture periods. Higher frequencies are more
|
||||||
//| accurate with shorter capture periods.
|
//| accurate with shorter capture periods.
|
||||||
@ -201,7 +201,7 @@ const mp_obj_property_t frequencyio_frequencyin_capture_period_obj = {
|
|||||||
(mp_obj_t)&mp_const_none_obj},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| def __get__(self, index: Any) -> Any:
|
//| def __get__(self, index: int) -> int:
|
||||||
//| """Returns the value of the last frequency captured."""
|
//| """Returns the value of the last frequency captured."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
|
@ -70,7 +70,7 @@
|
|||||||
//| time.sleep(0.1)"""
|
//| time.sleep(0.1)"""
|
||||||
//|
|
//|
|
||||||
|
|
||||||
//| def __init__(self, b1: Any, b2: Any, b3: Any, b4: Any, b5: Any, b6: Any, b7: Any, b8: Any):
|
//| def __init__(self, b1: DigitalInOut, b2: DigitalInOut, b3: DigitalInOut, b4: DigitalInOut, b5: DigitalInOut, b6: DigitalInOut, b7: DigitalInOut, b8: DigitalInOut) -> None:
|
||||||
//| """Initializes button scanning routines.
|
//| """Initializes button scanning routines.
|
||||||
//|
|
//|
|
||||||
//| The ``b1``-``b8`` parameters are ``DigitalInOut`` objects, which
|
//| The ``b1``-``b8`` parameters are ``DigitalInOut`` objects, which
|
||||||
@ -114,7 +114,7 @@ STATIC mp_obj_t gamepad_make_new(const mp_obj_type_t *type, size_t n_args,
|
|||||||
return MP_OBJ_FROM_PTR(gamepad_singleton);
|
return MP_OBJ_FROM_PTR(gamepad_singleton);
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def get_pressed(self, ) -> Any:
|
//| def get_pressed(self) -> int:
|
||||||
//| """Get the status of buttons pressed since the last call and clear it.
|
//| """Get the status of buttons pressed since the last call and clear it.
|
||||||
//|
|
//|
|
||||||
//| Returns an 8-bit number, with bits that correspond to buttons,
|
//| Returns an 8-bit number, with bits that correspond to buttons,
|
||||||
@ -133,7 +133,7 @@ STATIC mp_obj_t gamepad_get_pressed(mp_obj_t self_in) {
|
|||||||
MP_DEFINE_CONST_FUN_OBJ_1(gamepad_get_pressed_obj, gamepad_get_pressed);
|
MP_DEFINE_CONST_FUN_OBJ_1(gamepad_get_pressed_obj, gamepad_get_pressed);
|
||||||
|
|
||||||
|
|
||||||
//| def deinit(self, ) -> Any:
|
//| def deinit(self) -> None:
|
||||||
//| """Disable button scanning."""
|
//| """Disable button scanning."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
//| class GamePadShift:
|
//| class GamePadShift:
|
||||||
//| """Scan buttons for presses through a shift register"""
|
//| """Scan buttons for presses through a shift register"""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, clock: Any, data: Any, latch: Any):
|
//| def __init__(self, clock: DigitalInOut, data: DigitalInOut, latch: DigitalInOut) -> None:
|
||||||
//| """Initializes button scanning routines.
|
//| """Initializes button scanning routines.
|
||||||
//|
|
//|
|
||||||
//| The ``clock``, ``data`` and ``latch`` parameters are ``DigitalInOut``
|
//| The ``clock``, ``data`` and ``latch`` parameters are ``DigitalInOut``
|
||||||
@ -82,7 +82,7 @@ STATIC mp_obj_t gamepadshift_make_new(const mp_obj_type_t *type, size_t n_args,
|
|||||||
return MP_OBJ_FROM_PTR(gamepad_singleton);
|
return MP_OBJ_FROM_PTR(gamepad_singleton);
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def get_pressed(self, ) -> Any:
|
//| def get_pressed(self) -> int:
|
||||||
//| """Get the status of buttons pressed since the last call and clear it.
|
//| """Get the status of buttons pressed since the last call and clear it.
|
||||||
//|
|
//|
|
||||||
//| Returns an 8-bit number, with bits that correspond to buttons,
|
//| Returns an 8-bit number, with bits that correspond to buttons,
|
||||||
@ -100,7 +100,7 @@ STATIC mp_obj_t gamepadshift_get_pressed(mp_obj_t self_in) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_1(gamepadshift_get_pressed_obj, gamepadshift_get_pressed);
|
MP_DEFINE_CONST_FUN_OBJ_1(gamepadshift_get_pressed_obj, gamepadshift_get_pressed);
|
||||||
|
|
||||||
//| def deinit(self, ) -> Any:
|
//| def deinit(self) -> None:
|
||||||
//| """Disable button scanning."""
|
//| """Disable button scanning."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
//| print("Longitude: {0:.6f} degrees".format(nav.longitude))"""
|
//| print("Longitude: {0:.6f} degrees".format(nav.longitude))"""
|
||||||
//|
|
//|
|
||||||
|
|
||||||
//| def __init__(self, ):
|
//| def __init__(self) -> None:
|
||||||
//| """Turn on the GNSS.
|
//| """Turn on the GNSS.
|
||||||
//|
|
//|
|
||||||
//| :param gnss.SatelliteSystem system: satellite system to use"""
|
//| :param gnss.SatelliteSystem system: satellite system to use"""
|
||||||
@ -68,7 +68,7 @@ STATIC mp_obj_t gnss_make_new(const mp_obj_type_t *type, size_t n_args, const mp
|
|||||||
return MP_OBJ_FROM_PTR(self);
|
return MP_OBJ_FROM_PTR(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def deinit(self, ) -> Any:
|
//| def deinit(self) -> None:
|
||||||
//| """Turn off the GNSS."""
|
//| """Turn off the GNSS."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -85,7 +85,7 @@ STATIC void check_for_deinit(gnss_obj_t *self) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def update(self, ) -> Any:
|
//| def update(self) -> None:
|
||||||
//| """Update GNSS positioning information."""
|
//| """Update GNSS positioning information."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -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);
|
MP_DEFINE_CONST_FUN_OBJ_1(gnss_update_obj, gnss_obj_update);
|
||||||
|
|
||||||
//| latitude: Any = ...
|
//| latitude: float = ...
|
||||||
//| """Latitude of current position in degrees (float)."""
|
//| """Latitude of current position in degrees (float)."""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t gnss_obj_get_latitude(mp_obj_t self_in) {
|
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},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| longitude: Any = ...
|
//| longitude: float = ...
|
||||||
//| """Longitude of current position in degrees (float)."""
|
//| """Longitude of current position in degrees (float)."""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t gnss_obj_get_longitude(mp_obj_t self_in) {
|
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},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| altitude: Any = ...
|
//| altitude: float = ...
|
||||||
//| """Altitude of current position in meters (float)."""
|
//| """Altitude of current position in meters (float)."""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t gnss_obj_get_altitude(mp_obj_t self_in) {
|
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},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| timestamp: Any = ...
|
//| timestamp: time.struct_time = ...
|
||||||
//| """Time when the position data was updated."""
|
//| """Time when the position data was updated."""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t gnss_obj_get_timestamp(mp_obj_t self_in) {
|
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},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| fix: Any = ...
|
//| fix: gnss.PositionFix = ...
|
||||||
//| """Fix mode."""
|
//| """Fix mode."""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t gnss_obj_get_fix(mp_obj_t self_in) {
|
STATIC mp_obj_t gnss_obj_get_fix(mp_obj_t self_in) {
|
||||||
|
@ -7,20 +7,20 @@
|
|||||||
//| class PositionFix:
|
//| class PositionFix:
|
||||||
//| """Position fix mode"""
|
//| """Position fix mode"""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, ):
|
//| def __init__(self) -> None:
|
||||||
//| """Enum-like class to define the position fix mode."""
|
//| """Enum-like class to define the position fix mode."""
|
||||||
//|
|
//|
|
||||||
//| INVALID: Any = ...
|
//| INVALID: PositionFix = ...
|
||||||
//| """No measurement.
|
//| """No measurement.
|
||||||
//|
|
//|
|
||||||
//| :type gnss.PositionFix:"""
|
//| :type PositionFix:"""
|
||||||
//|
|
//|
|
||||||
//| FIX_2D: Any = ...
|
//| FIX_2D: PositionFix = ...
|
||||||
//| """2D fix.
|
//| """2D fix.
|
||||||
//|
|
//|
|
||||||
//| :type gnss.PositionFix:"""
|
//| :type PositionFix:"""
|
||||||
//|
|
//|
|
||||||
//| FIX_3D: Any = ...
|
//| FIX_3D: PositionFix = ...
|
||||||
//| """3D fix.
|
//| """3D fix.
|
||||||
//|
|
//|
|
||||||
//| :type gnss.PositionFix:"""
|
//| :type gnss.PositionFix:"""
|
||||||
|
@ -7,30 +7,30 @@
|
|||||||
//| class SatelliteSystem:
|
//| class SatelliteSystem:
|
||||||
//| """Satellite system type"""
|
//| """Satellite system type"""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, ):
|
//| def __init__(self) -> None:
|
||||||
//| """Enum-like class to define the satellite system type."""
|
//| """Enum-like class to define the satellite system type."""
|
||||||
//|
|
//|
|
||||||
//| GPS: Any = ...
|
//| GPS: SatelliteSystem = ...
|
||||||
//| """Global Positioning System.
|
//| """Global Positioning System.
|
||||||
//|
|
//|
|
||||||
//| :type gnss.SatelliteSystem:"""
|
//| :type gnss.SatelliteSystem:"""
|
||||||
//|
|
//|
|
||||||
//| GLONASS: Any = ...
|
//| GLONASS: SatelliteSystem = ...
|
||||||
//| """GLObal NAvigation Satellite System.
|
//| """GLObal NAvigation Satellite System.
|
||||||
//|
|
//|
|
||||||
//| :type gnss.SatelliteSystem:"""
|
//| :type gnss.SatelliteSystem:"""
|
||||||
//|
|
//|
|
||||||
//| SBAS: Any = ...
|
//| SBAS: SatelliteSystem = ...
|
||||||
//| """Satellite Based Augmentation System.
|
//| """Satellite Based Augmentation System.
|
||||||
//|
|
//|
|
||||||
//| :type gnss.SatelliteSystem:"""
|
//| :type gnss.SatelliteSystem:"""
|
||||||
//|
|
//|
|
||||||
//| QZSS_L1CA: Any = ...
|
//| QZSS_L1CA: SatelliteSystem = ...
|
||||||
//| """Quasi-Zenith Satellite System L1C/A.
|
//| """Quasi-Zenith Satellite System L1C/A.
|
||||||
//|
|
//|
|
||||||
//| :type gnss.SatelliteSystem:"""
|
//| :type gnss.SatelliteSystem:"""
|
||||||
//|
|
//|
|
||||||
//| QZSS_L1S: Any = ...
|
//| QZSS_L1S: SatelliteSystem = ...
|
||||||
//| """Quasi-Zenith Satellite System L1S.
|
//| """Quasi-Zenith Satellite System L1S.
|
||||||
//|
|
//|
|
||||||
//| :type gnss.SatelliteSystem:"""
|
//| :type gnss.SatelliteSystem:"""
|
||||||
|
@ -52,7 +52,7 @@ STATIC mp_obj_t mp_obj_new_i2cperipheral_i2c_peripheral_request(i2cperipheral_i2
|
|||||||
//| class I2CPeripheral:
|
//| class I2CPeripheral:
|
||||||
//| """Two wire serial protocol peripheral"""
|
//| """Two wire serial protocol peripheral"""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, scl: microcontroller.Pin, sda: microcontroller.Pin, addresses: tuple, smbus: bool = False):
|
//| def __init__(self, scl: microcontroller.Pin, sda: microcontroller.Pin, addresses: tuple, smbus: bool = False) -> None:
|
||||||
//| """I2C is a two-wire protocol for communicating between devices.
|
//| """I2C is a two-wire protocol for communicating between devices.
|
||||||
//| This implements the peripheral (sensor, secondary) side.
|
//| This implements the peripheral (sensor, secondary) side.
|
||||||
//|
|
//|
|
||||||
@ -102,7 +102,7 @@ STATIC mp_obj_t i2cperipheral_i2c_peripheral_make_new(const mp_obj_type_t *type,
|
|||||||
return (mp_obj_t)self;
|
return (mp_obj_t)self;
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def deinit(self, ) -> Any:
|
//| def deinit(self) -> None:
|
||||||
//| """Releases control of the underlying hardware so other classes can use it."""
|
//| """Releases control of the underlying hardware so other classes can use it."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -114,13 +114,13 @@ STATIC mp_obj_t i2cperipheral_i2c_peripheral_obj_deinit(mp_obj_t self_in) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_1(i2cperipheral_i2c_peripheral_deinit_obj, i2cperipheral_i2c_peripheral_obj_deinit);
|
MP_DEFINE_CONST_FUN_OBJ_1(i2cperipheral_i2c_peripheral_deinit_obj, i2cperipheral_i2c_peripheral_obj_deinit);
|
||||||
|
|
||||||
//| def __enter__(self, ) -> Any:
|
//| def __enter__(self) -> I2CPeripheral:
|
||||||
//| """No-op used in Context Managers."""
|
//| """No-op used in Context Managers."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
// Provided by context manager helper.
|
// Provided by context manager helper.
|
||||||
|
|
||||||
//| def __exit__(self, ) -> Any:
|
//| def __exit__(self) -> None:
|
||||||
//| """Automatically deinitializes the hardware on context exit. See
|
//| """Automatically deinitializes the hardware on context exit. See
|
||||||
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
||||||
//| ...
|
//| ...
|
||||||
@ -133,7 +133,7 @@ STATIC mp_obj_t i2cperipheral_i2c_peripheral_obj___exit__(size_t n_args, const m
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(i2cperipheral_i2c_peripheral___exit___obj, 4, 4, i2cperipheral_i2c_peripheral_obj___exit__);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(i2cperipheral_i2c_peripheral___exit___obj, 4, 4, i2cperipheral_i2c_peripheral_obj___exit__);
|
||||||
|
|
||||||
//| def request(self, timeout: float = -1) -> Any:
|
//| def request(self, timeout: float = -1) -> I2CPeripheralRequest:
|
||||||
//| """Wait for an I2C request.
|
//| """Wait for an I2C request.
|
||||||
//|
|
//|
|
||||||
//| :param float timeout: Timeout in seconds. Zero means wait forever, a negative value means check once
|
//| :param float timeout: Timeout in seconds. Zero means wait forever, a negative value means check once
|
||||||
@ -227,7 +227,7 @@ const mp_obj_type_t i2cperipheral_i2c_peripheral_type = {
|
|||||||
|
|
||||||
//| class I2CPeripheralRequest:
|
//| class I2CPeripheralRequest:
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, peripheral: i2cperipheral.I2CPeripheral, address: int, is_read: bool, is_restart: bool):
|
//| def __init__(self, peripheral: i2cperipheral.I2CPeripheral, address: int, is_read: bool, is_restart: bool) -> None:
|
||||||
//| """Information about an I2C transfer request
|
//| """Information about an I2C transfer request
|
||||||
//| This cannot be instantiated directly, but is returned by :py:meth:`I2CPeripheral.request`.
|
//| This cannot be instantiated directly, but is returned by :py:meth:`I2CPeripheral.request`.
|
||||||
//|
|
//|
|
||||||
@ -241,13 +241,13 @@ STATIC mp_obj_t i2cperipheral_i2c_peripheral_request_make_new(const mp_obj_type_
|
|||||||
return mp_obj_new_i2cperipheral_i2c_peripheral_request(args[0], mp_obj_get_int(args[1]), mp_obj_is_true(args[2]), mp_obj_is_true(args[3]));
|
return mp_obj_new_i2cperipheral_i2c_peripheral_request(args[0], mp_obj_get_int(args[1]), mp_obj_is_true(args[2]), mp_obj_is_true(args[3]));
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def __enter__(self, ) -> Any:
|
//| def __enter__(self) -> I2CPeripheralRequest:
|
||||||
//| """No-op used in Context Managers."""
|
//| """No-op used in Context Managers."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
// Provided by context manager helper.
|
// Provided by context manager helper.
|
||||||
|
|
||||||
//| def __exit__(self, ) -> Any:
|
//| def __exit__(self) -> None:
|
||||||
//| """Close the request."""
|
//| """Close the request."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -383,7 +383,7 @@ STATIC mp_obj_t i2cperipheral_i2c_peripheral_request_write(mp_obj_t self_in, mp_
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(i2cperipheral_i2c_peripheral_request_write_obj, i2cperipheral_i2c_peripheral_request_write);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_2(i2cperipheral_i2c_peripheral_request_write_obj, i2cperipheral_i2c_peripheral_request_write);
|
||||||
|
|
||||||
//| def ack(self, ack: bool = True) -> Any:
|
//| def ack(self, ack: bool = True) -> None:
|
||||||
//| """Acknowledge or Not Acknowledge last byte received.
|
//| """Acknowledge or Not Acknowledge last byte received.
|
||||||
//| Use together with :py:meth:`I2CPeripheralRequest.read` ack=False.
|
//| Use together with :py:meth:`I2CPeripheralRequest.read` ack=False.
|
||||||
//|
|
//|
|
||||||
|
@ -79,108 +79,108 @@ STATIC NORETURN void math_error(void) {
|
|||||||
#define log2(x) (log(x) * 1.442695040888963407354163704)
|
#define log2(x) (log(x) * 1.442695040888963407354163704)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//| e: Any = ...
|
//| e: float = ...
|
||||||
//| """base of the natural logarithm"""
|
//| """base of the natural logarithm"""
|
||||||
//|
|
//|
|
||||||
//| pi: Any = ...
|
//| pi: float = ...
|
||||||
//| """the ratio of a circle's circumference to its diameter"""
|
//| """the ratio of a circle's circumference to its diameter"""
|
||||||
//|
|
//|
|
||||||
|
|
||||||
//| def acos(x: Any) -> Any:
|
//| def acos(x: float) -> float:
|
||||||
//| """Return the inverse cosine of ``x``."""
|
//| """Return the inverse cosine of ``x``."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def asin(x: Any) -> Any:
|
//| def asin(x: float) -> float:
|
||||||
//| """Return the inverse sine of ``x``."""
|
//| """Return the inverse sine of ``x``."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def atan(x: Any) -> Any:
|
//| def atan(x: float) -> float:
|
||||||
//| """Return the inverse tangent of ``x``."""
|
//| """Return the inverse tangent of ``x``."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def atan2(y: Any, x: Any) -> Any:
|
//| def atan2(y: float, x: float) -> float:
|
||||||
//| """Return the principal value of the inverse tangent of ``y/x``."""
|
//| """Return the principal value of the inverse tangent of ``y/x``."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def ceil(x: Any) -> Any:
|
//| def ceil(x: float) -> int:
|
||||||
//| """Return an integer, being ``x`` rounded towards positive infinity."""
|
//| """Return an integer, being ``x`` rounded towards positive infinity."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def copysign(x: Any, y: Any) -> Any:
|
//| def copysign(x: float, y: float) -> float:
|
||||||
//| """Return ``x`` with the sign of ``y``."""
|
//| """Return ``x`` with the sign of ``y``."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def cos(x: Any) -> Any:
|
//| def cos(x: float) -> float:
|
||||||
//| """Return the cosine of ``x``."""
|
//| """Return the cosine of ``x``."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def degrees(x: Any) -> Any:
|
//| def degrees(x: float) -> float:
|
||||||
//| """Return radians ``x`` converted to degrees."""
|
//| """Return radians ``x`` converted to degrees."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def exp(x: Any) -> Any:
|
//| def exp(x: float) -> float:
|
||||||
//| """Return the exponential of ``x``."""
|
//| """Return the exponential of ``x``."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def fabs(x: Any) -> Any:
|
//| def fabs(x: float) -> float:
|
||||||
//| """Return the absolute value of ``x``."""
|
//| """Return the absolute value of ``x``."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def floor(x: Any) -> Any:
|
//| def floor(x: float) -> float:
|
||||||
//| """Return an integer, being ``x`` rounded towards negative infinity."""
|
//| """Return an integer, being ``x`` rounded towards negative infinity."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def fmod(x: Any, y: Any) -> Any:
|
//| def fmod(x: float, y: float) -> int:
|
||||||
//| """Return the remainder of ``x/y``."""
|
//| """Return the remainder of ``x/y``."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def frexp(x: Any) -> Any:
|
//| def frexp(x: float) -> Tuple[int, int]:
|
||||||
//| """Decomposes a floating-point number into its mantissa and exponent.
|
//| """Decomposes a floating-point number into its mantissa and exponent.
|
||||||
//| The returned value is the tuple ``(m, e)`` such that ``x == m * 2**e``
|
//| The returned value is the tuple ``(m, e)`` such that ``x == m * 2**e``
|
||||||
//| exactly. If ``x == 0`` then the function returns ``(0.0, 0)``, otherwise
|
//| exactly. If ``x == 0`` then the function returns ``(0.0, 0)``, otherwise
|
||||||
//| the relation ``0.5 <= abs(m) < 1`` holds."""
|
//| the relation ``0.5 <= abs(m) < 1`` holds."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def isfinite(x: Any) -> Any:
|
//| def isfinite(x: float) -> bool:
|
||||||
//| """Return ``True`` if ``x`` is finite."""
|
//| """Return ``True`` if ``x`` is finite."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def isinf(x: Any) -> Any:
|
//| def isinf(x: float) -> bool:
|
||||||
//| """Return ``True`` if ``x`` is infinite."""
|
//| """Return ``True`` if ``x`` is infinite."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def isnan(x: Any) -> Any:
|
//| def isnan(x: float) -> bool:
|
||||||
//| """Return ``True`` if ``x`` is not-a-number"""
|
//| """Return ``True`` if ``x`` is not-a-number"""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def ldexp(x: Any, exp: Any) -> Any:
|
//| def ldexp(x: float, exp: float) -> float:
|
||||||
//| """Return ``x * (2**exp)``."""
|
//| """Return ``x * (2**exp)``."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def modf(x: Any) -> Any:
|
//| def modf(x: float) -> Tuple[float, float]:
|
||||||
//| """Return a tuple of two floats, being the fractional and integral parts of
|
//| """Return a tuple of two floats, being the fractional and integral parts of
|
||||||
//| ``x``. Both return values have the same sign as ``x``."""
|
//| ``x``. Both return values have the same sign as ``x``."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def pow(x: Any, y: Any) -> Any:
|
//| def pow(x: float, y: float) -> float:
|
||||||
//| """Returns ``x`` to the power of ``y``."""
|
//| """Returns ``x`` to the power of ``y``."""
|
||||||
//|
|
//|
|
||||||
//| def radians(x: Any) -> Any:
|
//| def radians(x: float) -> float:
|
||||||
//| """Return degrees ``x`` converted to radians."""
|
//| """Return degrees ``x`` converted to radians."""
|
||||||
//|
|
//|
|
||||||
//| def sin(x: Any) -> Any:
|
//| def sin(x: float) -> float:
|
||||||
//| """Return the sine of ``x``."""
|
//| """Return the sine of ``x``."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def sqrt(x: Any) -> Any:
|
//| def sqrt(x: float) -> float:
|
||||||
//| """Returns the square root of ``x``."""
|
//| """Returns the square root of ``x``."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def tan(x: Any) -> Any:
|
//| def tan(x: float) -> float:
|
||||||
//| """Return the tangent of ``x``."""
|
//| """Return the tangent of ``x``."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def trunc(x: Any) -> Any:
|
//| def trunc(x: float) -> int:
|
||||||
//| """Return an integer, being ``x`` rounded towards 0."""
|
//| """Return an integer, being ``x`` rounded towards 0."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -190,55 +190,55 @@ MATH_FUN_2(pow, pow)
|
|||||||
|
|
||||||
MATH_FUN_1(exp, exp)
|
MATH_FUN_1(exp, exp)
|
||||||
#if MICROPY_PY_MATH_SPECIAL_FUNCTIONS
|
#if MICROPY_PY_MATH_SPECIAL_FUNCTIONS
|
||||||
//| def expm1(x):
|
//| def expm1(x: float) -> float:
|
||||||
//| """Return ``exp(x) - 1``."""
|
//| """Return ``exp(x) - 1``."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
MATH_FUN_1(expm1, expm1)
|
MATH_FUN_1(expm1, expm1)
|
||||||
|
|
||||||
//| def log2(x):
|
//| def log2(x: float) -> float:
|
||||||
//| """Return the base-2 logarithm of ``x``."""
|
//| """Return the base-2 logarithm of ``x``."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
MATH_FUN_1_ERRCOND(log2, log2, (x <= (mp_float_t)0.0))
|
MATH_FUN_1_ERRCOND(log2, log2, (x <= (mp_float_t)0.0))
|
||||||
|
|
||||||
//| def log10(x):
|
//| def log10(x: float) -> float:
|
||||||
//| """Return the base-10 logarithm of ``x``."""
|
//| """Return the base-10 logarithm of ``x``."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
MATH_FUN_1_ERRCOND(log10, log10, (x <= (mp_float_t)0.0))
|
MATH_FUN_1_ERRCOND(log10, log10, (x <= (mp_float_t)0.0))
|
||||||
|
|
||||||
//| def cosh(x):
|
//| def cosh(x: float) -> float:
|
||||||
//| """Return the hyperbolic cosine of ``x``."""
|
//| """Return the hyperbolic cosine of ``x``."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
MATH_FUN_1(cosh, cosh)
|
MATH_FUN_1(cosh, cosh)
|
||||||
|
|
||||||
//| def sinh(x):
|
//| def sinh(x: float) -> float:
|
||||||
//| """Return the hyperbolic sine of ``x``."""
|
//| """Return the hyperbolic sine of ``x``."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
MATH_FUN_1(sinh, sinh)
|
MATH_FUN_1(sinh, sinh)
|
||||||
|
|
||||||
//| def tanh(x):
|
//| def tanh(x: float) -> float:
|
||||||
//| """Return the hyperbolic tangent of ``x``."""
|
//| """Return the hyperbolic tangent of ``x``."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
MATH_FUN_1(tanh, tanh)
|
MATH_FUN_1(tanh, tanh)
|
||||||
|
|
||||||
//| def acosh(x):
|
//| def acosh(x: float) -> float:
|
||||||
//| """Return the inverse hyperbolic cosine of ``x``."""
|
//| """Return the inverse hyperbolic cosine of ``x``."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
MATH_FUN_1(acosh, acosh)
|
MATH_FUN_1(acosh, acosh)
|
||||||
|
|
||||||
//| def asinh(x):
|
//| def asinh(x: float) -> float:
|
||||||
//| """Return the inverse hyperbolic sine of ``x``."""
|
//| """Return the inverse hyperbolic sine of ``x``."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
MATH_FUN_1(asinh, asinh)
|
MATH_FUN_1(asinh, asinh)
|
||||||
|
|
||||||
//| def atanh(x):
|
//| def atanh(x: float) -> float:
|
||||||
//| """Return the inverse hyperbolic tangent of ``x``."""
|
//| """Return the inverse hyperbolic tangent of ``x``."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -280,25 +280,25 @@ MATH_FUN_1_TO_INT(trunc, trunc)
|
|||||||
MATH_FUN_2(ldexp, ldexp)
|
MATH_FUN_2(ldexp, ldexp)
|
||||||
#if MICROPY_PY_MATH_SPECIAL_FUNCTIONS
|
#if MICROPY_PY_MATH_SPECIAL_FUNCTIONS
|
||||||
|
|
||||||
//| def erf(x):
|
//| def erf(x: float) -> float:
|
||||||
//| """Return the error function of ``x``."""
|
//| """Return the error function of ``x``."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
MATH_FUN_1(erf, erf)
|
MATH_FUN_1(erf, erf)
|
||||||
|
|
||||||
//| def erfc(x):
|
//| def erfc(x: float) -> float:
|
||||||
//| """Return the complementary error function of ``x``."""
|
//| """Return the complementary error function of ``x``."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
MATH_FUN_1(erfc, erfc)
|
MATH_FUN_1(erfc, erfc)
|
||||||
|
|
||||||
//| def gamma(x):
|
//| def gamma(x: float) -> float:
|
||||||
//| """Return the gamma function of ``x``."""
|
//| """Return the gamma function of ``x``."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
MATH_FUN_1(gamma, tgamma)
|
MATH_FUN_1(gamma, tgamma)
|
||||||
|
|
||||||
//| def lgamma(x):
|
//| def lgamma(x: float) -> float:
|
||||||
//| """Return the natural logarithm of the gamma function of ``x``."""
|
//| """Return the natural logarithm of the gamma function of ``x``."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
//| class Pin:
|
//| class Pin:
|
||||||
//| """Identifies an IO pin on the microcontroller."""
|
//| """Identifies an IO pin on the microcontroller."""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, ):
|
//| def __init__(self) -> None:
|
||||||
//| """Identifies an IO pin on the microcontroller. They are fixed by the
|
//| """Identifies an IO pin on the microcontroller. They are fixed by the
|
||||||
//| hardware so they cannot be constructed on demand. Instead, use
|
//| hardware so they cannot be constructed on demand. Instead, use
|
||||||
//| `board` or `microcontroller.pin` to reference the desired pin."""
|
//| `board` or `microcontroller.pin` to reference the desired pin."""
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
//| print(microcontroller.cpu.temperature)"""
|
//| print(microcontroller.cpu.temperature)"""
|
||||||
//|
|
//|
|
||||||
|
|
||||||
//| def __init__(self, ):
|
//| def __init__(self) -> None:
|
||||||
//| """You cannot create an instance of `microcontroller.Processor`.
|
//| """You cannot create an instance of `microcontroller.Processor`.
|
||||||
//| Use `microcontroller.cpu` to access the sole instance available."""
|
//| Use `microcontroller.cpu` to access the sole instance available."""
|
||||||
//| ...
|
//| ...
|
||||||
@ -67,7 +67,7 @@ const mp_obj_property_t mcu_processor_frequency_obj = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| temperature: Any = ...
|
//| temperature: Optional[float] = ...
|
||||||
//| """The on-chip temperature, in Celsius, as a float. (read-only)
|
//| """The on-chip temperature, in Celsius, as a float. (read-only)
|
||||||
//|
|
//|
|
||||||
//| Is `None` if the temperature is not available."""
|
//| Is `None` if the temperature is not available."""
|
||||||
@ -87,7 +87,7 @@ const mp_obj_property_t mcu_processor_temperature_obj = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| uid: Any = ...
|
//| uid: bytearray = ...
|
||||||
//| """The unique id (aka serial number) of the chip as a `bytearray`. (read-only)"""
|
//| """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) {
|
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: Any = ...
|
//| voltage: Optional[float] = ...
|
||||||
//| """The input voltage to the microcontroller, as a float. (read-only)
|
//| """The input voltage to the microcontroller, as a float. (read-only)
|
||||||
//|
|
//|
|
||||||
//| Is `None` if the voltage is not available."""
|
//| Is `None` if the voltage is not available."""
|
||||||
|
@ -29,22 +29,22 @@
|
|||||||
//| class RunMode:
|
//| class RunMode:
|
||||||
//| """run state of the microcontroller"""
|
//| """run state of the microcontroller"""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, ):
|
//| def __init__(self) -> None:
|
||||||
//| """Enum-like class to define the run mode of the microcontroller and
|
//| """Enum-like class to define the run mode of the microcontroller and
|
||||||
//| CircuitPython."""
|
//| CircuitPython."""
|
||||||
//|
|
//|
|
||||||
//| NORMAL: Any = ...
|
//| NORMAL: RunMode = ...
|
||||||
//| """Run CircuitPython as normal.
|
//| """Run CircuitPython as normal.
|
||||||
//|
|
//|
|
||||||
//| :type microcontroller.RunMode:"""
|
//| :type microcontroller.RunMode:"""
|
||||||
//|
|
//|
|
||||||
//| SAFE_MODE: Any = ...
|
//| SAFE_MODE: RunMode = ...
|
||||||
//| """Run CircuitPython in safe mode. User code will not be run and the
|
//| """Run CircuitPython in safe mode. User code will not be run and the
|
||||||
//| file system will be writeable over USB.
|
//| file system will be writeable over USB.
|
||||||
//|
|
//|
|
||||||
//| :type microcontroller.RunMode:"""
|
//| :type microcontroller.RunMode:"""
|
||||||
//|
|
//|
|
||||||
//| BOOTLOADER: Any = ...
|
//| BOOTLOADER: RunMode = ...
|
||||||
//| """Run the bootloader.
|
//| """Run the bootloader.
|
||||||
//|
|
//|
|
||||||
//| :type microcontroller.RunMode:"""
|
//| :type microcontroller.RunMode:"""
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
//| This object is the sole instance of `microcontroller.Processor`."""
|
//| This object is the sole instance of `microcontroller.Processor`."""
|
||||||
//|
|
//|
|
||||||
|
|
||||||
//| def delay_us(delay: Any) -> Any:
|
//| def delay_us(delay: int) -> None:
|
||||||
//| """Dedicated delay method used for very short delays. **Do not** do long delays
|
//| """Dedicated delay method used for very short delays. **Do not** do long delays
|
||||||
//| because this stops all other functions from completing. Think of this as an empty
|
//| because this stops all other functions from completing. Think of this as an empty
|
||||||
//| ``while`` loop that runs for the specified ``(delay)`` time. If you have other
|
//| ``while`` loop that runs for the specified ``(delay)`` time. If you have other
|
||||||
@ -72,7 +72,7 @@ STATIC mp_obj_t mcu_delay_us(mp_obj_t delay_obj) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(mcu_delay_us_obj, mcu_delay_us);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_1(mcu_delay_us_obj, mcu_delay_us);
|
||||||
|
|
||||||
//| def disable_interrupts() -> Any:
|
//| def disable_interrupts() -> None:
|
||||||
//| """Disable all interrupts. Be very careful, this can stall everything."""
|
//| """Disable all interrupts. Be very careful, this can stall everything."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -82,7 +82,7 @@ STATIC mp_obj_t mcu_disable_interrupts(void) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_0(mcu_disable_interrupts_obj, mcu_disable_interrupts);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_0(mcu_disable_interrupts_obj, mcu_disable_interrupts);
|
||||||
|
|
||||||
//| def enable_interrupts() -> Any:
|
//| def enable_interrupts() -> None:
|
||||||
//| """Enable the interrupts that were enabled at the last disable."""
|
//| """Enable the interrupts that were enabled at the last disable."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -92,7 +92,7 @@ STATIC mp_obj_t mcu_enable_interrupts(void) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_0(mcu_enable_interrupts_obj, mcu_enable_interrupts);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_0(mcu_enable_interrupts_obj, mcu_enable_interrupts);
|
||||||
|
|
||||||
//| def on_next_reset(run_mode: microcontroller.RunMode) -> Any:
|
//| def on_next_reset(run_mode: microcontroller.RunMode) -> None:
|
||||||
//| """Configure the run mode used the next time the microcontroller is reset but
|
//| """Configure the run mode used the next time the microcontroller is reset but
|
||||||
//| not powered down.
|
//| not powered down.
|
||||||
//|
|
//|
|
||||||
@ -117,7 +117,7 @@ STATIC mp_obj_t mcu_on_next_reset(mp_obj_t run_mode_obj) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(mcu_on_next_reset_obj, mcu_on_next_reset);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_1(mcu_on_next_reset_obj, mcu_on_next_reset);
|
||||||
|
|
||||||
//| def reset() -> Any:
|
//| def reset() -> None:
|
||||||
//| """Reset the microcontroller. After reset, the microcontroller will enter the
|
//| """Reset the microcontroller. After reset, the microcontroller will enter the
|
||||||
//| run mode last set by `on_next_reset`.
|
//| run mode last set by `on_next_reset`.
|
||||||
//|
|
//|
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
//| serial connection and the optional secondary connection."""
|
//| serial connection and the optional secondary connection."""
|
||||||
//|
|
//|
|
||||||
|
|
||||||
//| def get_secondary_terminal() -> Any:
|
//| def get_secondary_terminal() -> secondary_terminal:
|
||||||
//| """Returns the current secondary terminal."""
|
//| """Returns the current secondary terminal."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -46,7 +46,7 @@ STATIC mp_obj_t multiterminal_obj_get_secondary_terminal() {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_0(multiterminal_get_secondary_terminal_obj, multiterminal_obj_get_secondary_terminal);
|
MP_DEFINE_CONST_FUN_OBJ_0(multiterminal_get_secondary_terminal_obj, multiterminal_obj_get_secondary_terminal);
|
||||||
|
|
||||||
//| def set_secondary_terminal(stream: stream) -> Any:
|
//| def set_secondary_terminal(stream: stream) -> None:
|
||||||
//| """Read additional input from the given stream and write out back to it.
|
//| """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
|
//| This doesn't replace the core stream (usually UART or native USB) but is
|
||||||
//| mixed in instead.
|
//| mixed in instead.
|
||||||
@ -68,7 +68,7 @@ STATIC mp_obj_t multiterminal_obj_set_secondary_terminal(mp_obj_t secondary_term
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_1(multiterminal_set_secondary_terminal_obj, multiterminal_obj_set_secondary_terminal);
|
MP_DEFINE_CONST_FUN_OBJ_1(multiterminal_set_secondary_terminal_obj, multiterminal_obj_set_secondary_terminal);
|
||||||
|
|
||||||
//| def clear_secondary_terminal() -> Any:
|
//| def clear_secondary_terminal() -> None:
|
||||||
//| """Clears the secondary terminal."""
|
//| """Clears the secondary terminal."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -78,7 +78,7 @@ STATIC mp_obj_t multiterminal_obj_clear_secondary_terminal() {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_0(multiterminal_clear_secondary_terminal_obj, multiterminal_obj_clear_secondary_terminal);
|
MP_DEFINE_CONST_FUN_OBJ_0(multiterminal_clear_secondary_terminal_obj, multiterminal_obj_clear_secondary_terminal);
|
||||||
|
|
||||||
//| def schedule_secondary_terminal_read(socket: Any) -> Any:
|
//| def schedule_secondary_terminal_read(socket: secondary_terminal) -> None:
|
||||||
//| """In cases where the underlying OS is doing task scheduling, this notifies
|
//| """In cases where the underlying OS is doing task scheduling, this notifies
|
||||||
//| the OS when more data is available on the socket to read. This is useful
|
//| the OS when more data is available on the socket to read. This is useful
|
||||||
//| as a callback for lwip sockets."""
|
//| as a callback for lwip sockets."""
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
//| It is used by the 'socket' module to look up a suitable
|
//| It is used by the 'socket' module to look up a suitable
|
||||||
//| NIC when a socket is created."""
|
//| NIC when a socket is created."""
|
||||||
//|
|
//|
|
||||||
//| def route() -> Any:
|
//| def route() -> list:
|
||||||
//| """Returns a list of all configured NICs."""
|
//| """Returns a list of all configured NICs."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
|
@ -44,12 +44,14 @@
|
|||||||
//| microcontroller.nvm[0:3] = b\"\xcc\x10\x00\""""
|
//| microcontroller.nvm[0:3] = b\"\xcc\x10\x00\""""
|
||||||
//|
|
//|
|
||||||
|
|
||||||
//| def __init__(self, ):
|
//| def __init__(self) -> None:
|
||||||
//| """Not currently dynamically supported. Access the sole instance through `microcontroller.nvm`."""
|
//| """Not currently dynamically supported. Access the sole instance through `microcontroller.nvm`."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
|
|
||||||
//| def __len__(self, ) -> Any:
|
//| def __bool__(self) -> bool: ...
|
||||||
|
//|
|
||||||
|
//| def __len__(self) -> int:
|
||||||
//| """Return the length. This is used by (`len`)"""
|
//| """Return the length. This is used by (`len`)"""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
//| other way around."""
|
//| other way around."""
|
||||||
//|
|
//|
|
||||||
|
|
||||||
//| def uname() -> Any:
|
//| def uname() -> tuple:
|
||||||
//| """Returns a named tuple of operating specific and CircuitPython port
|
//| """Returns a named tuple of operating specific and CircuitPython port
|
||||||
//| specific information."""
|
//| specific information."""
|
||||||
//| ...
|
//| ...
|
||||||
@ -54,7 +54,7 @@ STATIC mp_obj_t os_uname(void) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_0(os_uname_obj, os_uname);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_0(os_uname_obj, os_uname);
|
||||||
|
|
||||||
//| def chdir(path: Any) -> Any:
|
//| def chdir(path: string) -> None:
|
||||||
//| """Change current directory."""
|
//| """Change current directory."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -65,7 +65,7 @@ mp_obj_t os_chdir(mp_obj_t path_in) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_1(os_chdir_obj, os_chdir);
|
MP_DEFINE_CONST_FUN_OBJ_1(os_chdir_obj, os_chdir);
|
||||||
|
|
||||||
//| def getcwd() -> Any:
|
//| def getcwd() -> string:
|
||||||
//| """Get the current directory."""
|
//| """Get the current directory."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -74,7 +74,7 @@ mp_obj_t os_getcwd(void) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_0(os_getcwd_obj, os_getcwd);
|
MP_DEFINE_CONST_FUN_OBJ_0(os_getcwd_obj, os_getcwd);
|
||||||
|
|
||||||
//| def listdir(dir: Any) -> Any:
|
//| def listdir(dir: string) -> string:
|
||||||
//| """With no argument, list the current directory. Otherwise list the given directory."""
|
//| """With no argument, list the current directory. Otherwise list the given directory."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -89,7 +89,7 @@ mp_obj_t os_listdir(size_t n_args, const mp_obj_t *args) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(os_listdir_obj, 0, 1, os_listdir);
|
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(os_listdir_obj, 0, 1, os_listdir);
|
||||||
|
|
||||||
//| def mkdir(path: Any) -> Any:
|
//| def mkdir(path: string) -> None:
|
||||||
//| """Create a new directory."""
|
//| """Create a new directory."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -100,7 +100,7 @@ mp_obj_t os_mkdir(mp_obj_t path_in) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_1(os_mkdir_obj, os_mkdir);
|
MP_DEFINE_CONST_FUN_OBJ_1(os_mkdir_obj, os_mkdir);
|
||||||
|
|
||||||
//| def remove(path: Any) -> Any:
|
//| def remove(path: string) -> None:
|
||||||
//| """Remove a file."""
|
//| """Remove a file."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -111,7 +111,7 @@ mp_obj_t os_remove(mp_obj_t path_in) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_1(os_remove_obj, os_remove);
|
MP_DEFINE_CONST_FUN_OBJ_1(os_remove_obj, os_remove);
|
||||||
|
|
||||||
//| def rmdir(path: Any) -> Any:
|
//| def rmdir(path: string) -> None:
|
||||||
//| """Remove a directory."""
|
//| """Remove a directory."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -123,7 +123,7 @@ mp_obj_t os_rename(mp_obj_t old_path_in, mp_obj_t new_path_in) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_2(os_rename_obj, os_rename);
|
MP_DEFINE_CONST_FUN_OBJ_2(os_rename_obj, os_rename);
|
||||||
|
|
||||||
//| def rename(old_path: Any, new_path: Any) -> Any:
|
//| def rename(old_path: string, new_path: string) -> string:
|
||||||
//| """Rename a file."""
|
//| """Rename a file."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -134,7 +134,7 @@ mp_obj_t os_rmdir(mp_obj_t path_in) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_1(os_rmdir_obj, os_rmdir);
|
MP_DEFINE_CONST_FUN_OBJ_1(os_rmdir_obj, os_rmdir);
|
||||||
|
|
||||||
//| def stat(path: Any) -> Any:
|
//| def stat(path: string) -> string:
|
||||||
//| """Get the status of a file or directory.
|
//| """Get the status of a file or directory.
|
||||||
//|
|
//|
|
||||||
//| .. note:: On builds without long integers, the number of seconds
|
//| .. note:: On builds without long integers, the number of seconds
|
||||||
@ -149,7 +149,7 @@ mp_obj_t os_stat(mp_obj_t path_in) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_1(os_stat_obj, os_stat);
|
MP_DEFINE_CONST_FUN_OBJ_1(os_stat_obj, os_stat);
|
||||||
|
|
||||||
//| def statvfs(path: Any) -> Any:
|
//| def statvfs(path: string) -> Tuple[string, string, string, string, string, string, string, string, string, string]:
|
||||||
//| """Get the status of a fileystem.
|
//| """Get the status of a fileystem.
|
||||||
//|
|
//|
|
||||||
//| Returns a tuple with the filesystem information in the following order:
|
//| Returns a tuple with the filesystem information in the following order:
|
||||||
@ -176,7 +176,7 @@ mp_obj_t os_statvfs(mp_obj_t path_in) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_1(os_statvfs_obj, os_statvfs);
|
MP_DEFINE_CONST_FUN_OBJ_1(os_statvfs_obj, os_statvfs);
|
||||||
|
|
||||||
//| def sync() -> Any:
|
//| def sync() -> None:
|
||||||
//| """Sync all filesystems."""
|
//| """Sync all filesystems."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -189,7 +189,7 @@ STATIC mp_obj_t os_sync(void) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_0(os_sync_obj, os_sync);
|
MP_DEFINE_CONST_FUN_OBJ_0(os_sync_obj, os_sync);
|
||||||
|
|
||||||
//| def urandom(size: Any) -> Any:
|
//| def urandom(size: int) -> string:
|
||||||
//| """Returns a string of *size* random bytes based on a hardware True Random
|
//| """Returns a string of *size* random bytes based on a hardware True Random
|
||||||
//| Number Generator. When not available, it will raise a NotImplementedError."""
|
//| Number Generator. When not available, it will raise a NotImplementedError."""
|
||||||
//| ...
|
//| ...
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
//| level converters must be used to connect the I/O lines to pins
|
//| level converters must be used to connect the I/O lines to pins
|
||||||
//| of 3.3V boards."""
|
//| of 3.3V boards."""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, data_pin: microcontroller.Pin, clock_pin: microcontroller.Pin):
|
//| def __init__(self, data_pin: microcontroller.Pin, clock_pin: microcontroller.Pin) -> None:
|
||||||
//| """Create a Ps2 object associated with the given pins.
|
//| """Create a Ps2 object associated with the given pins.
|
||||||
//|
|
//|
|
||||||
//| :param ~microcontroller.Pin data_pin: Pin tied to data wire.
|
//| :param ~microcontroller.Pin data_pin: Pin tied to data wire.
|
||||||
@ -87,7 +87,7 @@ STATIC mp_obj_t ps2io_ps2_make_new(const mp_obj_type_t *type, size_t n_args, con
|
|||||||
return MP_OBJ_FROM_PTR(self);
|
return MP_OBJ_FROM_PTR(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def deinit(self, ) -> Any:
|
//| def deinit(self) -> None:
|
||||||
//| """Deinitialises the Ps2 and releases any hardware resources for reuse."""
|
//| """Deinitialises the Ps2 and releases any hardware resources for reuse."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -104,13 +104,13 @@ STATIC void check_for_deinit(ps2io_ps2_obj_t *self) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def __enter__(self, ) -> Any:
|
//| def __enter__(self) -> Ps2:
|
||||||
//| """No-op used by Context Managers."""
|
//| """No-op used by Context Managers."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
// Provided by context manager helper.
|
// Provided by context manager helper.
|
||||||
|
|
||||||
//| def __exit__(self, ) -> Any:
|
//| def __exit__(self) -> None:
|
||||||
//| """Automatically deinitializes the hardware when exiting a context. See
|
//| """Automatically deinitializes the hardware when exiting a context. See
|
||||||
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
||||||
//| ...
|
//| ...
|
||||||
@ -122,7 +122,7 @@ STATIC mp_obj_t ps2io_ps2_obj___exit__(size_t n_args, const mp_obj_t *args) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(ps2io_ps2___exit___obj, 4, 4, ps2io_ps2_obj___exit__);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(ps2io_ps2___exit___obj, 4, 4, ps2io_ps2_obj___exit__);
|
||||||
|
|
||||||
//| def popleft(self, ) -> Any:
|
//| def popleft(self) -> int:
|
||||||
//| """Removes and returns the oldest received byte. When buffer
|
//| """Removes and returns the oldest received byte. When buffer
|
||||||
//| is empty, raises an IndexError exception."""
|
//| is empty, raises an IndexError exception."""
|
||||||
//| ...
|
//| ...
|
||||||
@ -139,7 +139,7 @@ STATIC mp_obj_t ps2io_ps2_obj_popleft(mp_obj_t self_in) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_1(ps2io_ps2_popleft_obj, ps2io_ps2_obj_popleft);
|
MP_DEFINE_CONST_FUN_OBJ_1(ps2io_ps2_popleft_obj, ps2io_ps2_obj_popleft);
|
||||||
|
|
||||||
//| def sendcmd(self, byte: int) -> Any:
|
//| def sendcmd(self, byte: int) -> int:
|
||||||
//| """Sends a command byte to PS/2. Returns the response byte, typically
|
//| """Sends a command byte to PS/2. Returns the response byte, typically
|
||||||
//| the general ack value (0xFA). Some commands return additional data
|
//| the general ack value (0xFA). Some commands return additional data
|
||||||
//| which is available through :py:func:`popleft()`.
|
//| which is available through :py:func:`popleft()`.
|
||||||
@ -164,7 +164,7 @@ STATIC mp_obj_t ps2io_ps2_obj_sendcmd(mp_obj_t self_in, mp_obj_t ob) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_2(ps2io_ps2_sendcmd_obj, ps2io_ps2_obj_sendcmd);
|
MP_DEFINE_CONST_FUN_OBJ_2(ps2io_ps2_sendcmd_obj, ps2io_ps2_obj_sendcmd);
|
||||||
|
|
||||||
//| def clear_errors(self, ) -> Any:
|
//| def clear_errors(self) -> None:
|
||||||
//| """Returns and clears a bitmap with latest recorded communication errors.
|
//| """Returns and clears a bitmap with latest recorded communication errors.
|
||||||
//|
|
//|
|
||||||
//| Reception errors (arise asynchronously, as data is received):
|
//| Reception errors (arise asynchronously, as data is received):
|
||||||
@ -202,7 +202,9 @@ STATIC mp_obj_t ps2io_ps2_obj_clear_errors(mp_obj_t self_in) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_1(ps2io_ps2_clear_errors_obj, ps2io_ps2_obj_clear_errors);
|
MP_DEFINE_CONST_FUN_OBJ_1(ps2io_ps2_clear_errors_obj, ps2io_ps2_obj_clear_errors);
|
||||||
|
|
||||||
//| def __len__(self, ) -> Any:
|
//| def __bool__(self) -> bool: ...
|
||||||
|
//|
|
||||||
|
//| def __len__(self) -> int:
|
||||||
//| """Returns the number of received bytes in buffer, available
|
//| """Returns the number of received bytes in buffer, available
|
||||||
//| to :py:func:`popleft()`."""
|
//| to :py:func:`popleft()`."""
|
||||||
//| ...
|
//| ...
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
//| class PWMOut:
|
//| class PWMOut:
|
||||||
//| """Output a Pulse Width Modulated signal on a given pin."""
|
//| """Output a Pulse Width Modulated signal on a given pin."""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, pin: microcontroller.Pin, *, duty_cycle: int = 0, frequency: int = 500, variable_frequency: bool = False):
|
//| def __init__(self, pin: microcontroller.Pin, *, duty_cycle: int = 0, frequency: int = 500, variable_frequency: bool = False) -> None:
|
||||||
//| """Create a PWM object associated with the given pin. This allows you to
|
//| """Create a PWM object associated with the given pin. This allows you to
|
||||||
//| write PWM signals out on the given pin. Frequency is fixed after init
|
//| write PWM signals out on the given pin. Frequency is fixed after init
|
||||||
//| unless ``variable_frequency`` is True.
|
//| unless ``variable_frequency`` is True.
|
||||||
@ -115,7 +115,7 @@ STATIC mp_obj_t pulseio_pwmout_make_new(const mp_obj_type_t *type, size_t n_args
|
|||||||
return MP_OBJ_FROM_PTR(self);
|
return MP_OBJ_FROM_PTR(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def deinit(self, ) -> Any:
|
//| def deinit(self) -> None:
|
||||||
//| """Deinitialises the PWMOut and releases any hardware resources for reuse."""
|
//| """Deinitialises the PWMOut and releases any hardware resources for reuse."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -132,13 +132,13 @@ STATIC void check_for_deinit(pulseio_pwmout_obj_t *self) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def __enter__(self, ) -> Any:
|
//| def __enter__(self) -> PWMOut:
|
||||||
//| """No-op used by Context Managers."""
|
//| """No-op used by Context Managers."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
// Provided by context manager helper.
|
// Provided by context manager helper.
|
||||||
|
|
||||||
//| def __exit__(self, ) -> Any:
|
//| def __exit__(self) -> None:
|
||||||
//| """Automatically deinitializes the hardware when exiting a context. See
|
//| """Automatically deinitializes the hardware when exiting a context. See
|
||||||
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
||||||
//| ...
|
//| ...
|
||||||
@ -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__);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pulseio_pwmout___exit___obj, 4, 4, pulseio_pwmout_obj___exit__);
|
||||||
|
|
||||||
//| duty_cycle: Any = ...
|
//| duty_cycle: int = ...
|
||||||
//| """16 bit value that dictates how much of one cycle is high (1) versus low
|
//| """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
|
//| (0). 0xffff will always be high, 0 will always be low and 0x7fff will
|
||||||
//| be half high and then half low.
|
//| 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},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| frequency: Any = ...
|
//| frequency: int = ...
|
||||||
//| """32 bit value that dictates the PWM frequency in Hertz (cycles per
|
//| """32 bit value that dictates the PWM frequency in Hertz (cycles per
|
||||||
//| second). Only writeable when constructed with ``variable_frequency=True``.
|
//| second). Only writeable when constructed with ``variable_frequency=True``.
|
||||||
//|
|
//|
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
//| and low cost temperature sensors (DHT). The pulsed signal consists of timed active and
|
//| and low cost temperature sensors (DHT). The pulsed signal consists of timed active and
|
||||||
//| idle periods. Unlike PWM, there is no set duration for active and idle pairs."""
|
//| idle periods. Unlike PWM, there is no set duration for active and idle pairs."""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, pin: microcontroller.Pin, maxlen: int = 2, *, idle_state: bool = False):
|
//| def __init__(self, pin: microcontroller.Pin, maxlen: int = 2, *, idle_state: bool = False) -> None:
|
||||||
//| """Create a PulseIn object associated with the given pin. The object acts as
|
//| """Create a PulseIn object associated with the given pin. The object acts as
|
||||||
//| a read-only sequence of pulse lengths with a given max length. When it is
|
//| a read-only sequence of pulse lengths with a given max length. When it is
|
||||||
//| active, new pulse lengths are added to the end of the list. When there is
|
//| active, new pulse lengths are added to the end of the list. When there is
|
||||||
@ -96,7 +96,7 @@ STATIC mp_obj_t pulseio_pulsein_make_new(const mp_obj_type_t *type, size_t n_arg
|
|||||||
return MP_OBJ_FROM_PTR(self);
|
return MP_OBJ_FROM_PTR(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def deinit(self, ) -> Any:
|
//| def deinit(self) -> None:
|
||||||
//| """Deinitialises the PulseIn and releases any hardware resources for reuse."""
|
//| """Deinitialises the PulseIn and releases any hardware resources for reuse."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -113,13 +113,13 @@ STATIC void check_for_deinit(pulseio_pulsein_obj_t *self) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def __enter__(self, ) -> Any:
|
//| def __enter__(self) -> PulseIn:
|
||||||
//| """No-op used by Context Managers."""
|
//| """No-op used by Context Managers."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
// Provided by context manager helper.
|
// Provided by context manager helper.
|
||||||
|
|
||||||
//| def __exit__(self, ) -> Any:
|
//| def __exit__(self) -> None:
|
||||||
//| """Automatically deinitializes the hardware when exiting a context. See
|
//| """Automatically deinitializes the hardware when exiting a context. See
|
||||||
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
||||||
//| ...
|
//| ...
|
||||||
@ -131,7 +131,7 @@ STATIC mp_obj_t pulseio_pulsein_obj___exit__(size_t n_args, const mp_obj_t *args
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pulseio_pulsein___exit___obj, 4, 4, pulseio_pulsein_obj___exit__);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pulseio_pulsein___exit___obj, 4, 4, pulseio_pulsein_obj___exit__);
|
||||||
|
|
||||||
//| def pause(self, ) -> Any:
|
//| def pause(self) -> None:
|
||||||
//| """Pause pulse capture"""
|
//| """Pause pulse capture"""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -144,7 +144,7 @@ STATIC mp_obj_t pulseio_pulsein_obj_pause(mp_obj_t self_in) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_1(pulseio_pulsein_pause_obj, pulseio_pulsein_obj_pause);
|
MP_DEFINE_CONST_FUN_OBJ_1(pulseio_pulsein_pause_obj, pulseio_pulsein_obj_pause);
|
||||||
|
|
||||||
//| def resume(self, trigger_duration: int = 0) -> Any:
|
//| def resume(self, trigger_duration: int = 0) -> None:
|
||||||
//| """Resumes pulse capture after an optional trigger pulse.
|
//| """Resumes pulse capture after an optional trigger pulse.
|
||||||
//|
|
//|
|
||||||
//| .. warning:: Using trigger pulse with a device that drives both high and
|
//| .. warning:: Using trigger pulse with a device that drives both high and
|
||||||
@ -171,7 +171,7 @@ STATIC mp_obj_t pulseio_pulsein_obj_resume(size_t n_args, const mp_obj_t *pos_ar
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_KW(pulseio_pulsein_resume_obj, 1, pulseio_pulsein_obj_resume);
|
MP_DEFINE_CONST_FUN_OBJ_KW(pulseio_pulsein_resume_obj, 1, pulseio_pulsein_obj_resume);
|
||||||
|
|
||||||
//| def clear(self, ) -> Any:
|
//| def clear(self) -> None:
|
||||||
//| """Clears all captured pulses"""
|
//| """Clears all captured pulses"""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -184,7 +184,7 @@ STATIC mp_obj_t pulseio_pulsein_obj_clear(mp_obj_t self_in) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_1(pulseio_pulsein_clear_obj, pulseio_pulsein_obj_clear);
|
MP_DEFINE_CONST_FUN_OBJ_1(pulseio_pulsein_clear_obj, pulseio_pulsein_obj_clear);
|
||||||
|
|
||||||
//| def popleft(self, ) -> Any:
|
//| def popleft(self) -> int:
|
||||||
//| """Removes and returns the oldest read pulse."""
|
//| """Removes and returns the oldest read pulse."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -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);
|
MP_DEFINE_CONST_FUN_OBJ_1(pulseio_pulsein_popleft_obj, pulseio_pulsein_obj_popleft);
|
||||||
|
|
||||||
//| maxlen: Any = ...
|
//| maxlen: int = ...
|
||||||
//| """The maximum length of the PulseIn. When len() is equal to maxlen,
|
//| """The maximum length of the PulseIn. When len() is equal to maxlen,
|
||||||
//| it is unclear which pulses are active and which are idle."""
|
//| 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},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| paused: Any = ...
|
//| paused: bool = ...
|
||||||
//| """True when pulse capture is paused as a result of :py:func:`pause` or an error during capture
|
//| """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."""
|
//| such as a signal that is too fast."""
|
||||||
//|
|
//|
|
||||||
@ -234,7 +234,9 @@ const mp_obj_property_t pulseio_pulsein_paused_obj = {
|
|||||||
(mp_obj_t)&mp_const_none_obj},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| def __len__(self, ) -> Any:
|
//| def __bool__(self) -> bool: ...
|
||||||
|
//|
|
||||||
|
//| def __len__(self) -> int:
|
||||||
//| """Returns the current pulse length
|
//| """Returns the current pulse length
|
||||||
//|
|
//|
|
||||||
//| This allows you to::
|
//| This allows you to::
|
||||||
@ -254,7 +256,7 @@ STATIC mp_obj_t pulsein_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def __getitem__(self, index: Any) -> Any:
|
//| def __getitem__(self, index: int) -> Optional[int]:
|
||||||
//| """Returns the value at the given index or values in slice.
|
//| """Returns the value at the given index or values in slice.
|
||||||
//|
|
//|
|
||||||
//| This allows you to::
|
//| This allows you to::
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
//| pulsed signal consists of timed on and off periods. Unlike PWM, there is no set duration
|
//| pulsed signal consists of timed on and off periods. Unlike PWM, there is no set duration
|
||||||
//| for on and off pairs."""
|
//| for on and off pairs."""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, carrier: pulseio.PWMOut):
|
//| def __init__(self, carrier: pulseio.PWMOut) -> None:
|
||||||
//| """Create a PulseOut object associated with the given PWMout object.
|
//| """Create a PulseOut object associated with the given PWMout object.
|
||||||
//|
|
//|
|
||||||
//| :param ~pulseio.PWMOut carrier: PWMOut that is set to output on the desired pin.
|
//| :param ~pulseio.PWMOut carrier: PWMOut that is set to output on the desired pin.
|
||||||
@ -81,7 +81,7 @@ STATIC mp_obj_t pulseio_pulseout_make_new(const mp_obj_type_t *type, size_t n_ar
|
|||||||
return MP_OBJ_FROM_PTR(self);
|
return MP_OBJ_FROM_PTR(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def deinit(self, ) -> Any:
|
//| def deinit(self) -> None:
|
||||||
//| """Deinitialises the PulseOut and releases any hardware resources for reuse."""
|
//| """Deinitialises the PulseOut and releases any hardware resources for reuse."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -92,13 +92,13 @@ STATIC mp_obj_t pulseio_pulseout_deinit(mp_obj_t self_in) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(pulseio_pulseout_deinit_obj, pulseio_pulseout_deinit);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_1(pulseio_pulseout_deinit_obj, pulseio_pulseout_deinit);
|
||||||
|
|
||||||
//| def __enter__(self, ) -> Any:
|
//| def __enter__(self) -> PulseOut:
|
||||||
//| """No-op used by Context Managers."""
|
//| """No-op used by Context Managers."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
// Provided by context manager helper.
|
// Provided by context manager helper.
|
||||||
|
|
||||||
//| def __exit__(self, ) -> Any:
|
//| def __exit__(self) -> None:
|
||||||
//| """Automatically deinitializes the hardware when exiting a context. See
|
//| """Automatically deinitializes the hardware when exiting a context. See
|
||||||
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
||||||
//| ...
|
//| ...
|
||||||
@ -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__);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pulseio_pulseout___exit___obj, 4, 4, pulseio_pulseout_obj___exit__);
|
||||||
|
|
||||||
//| def send(self, pulses: array.array) -> Any:
|
//| def send(self, pulses: array.array) -> None:
|
||||||
//| """Pulse alternating on and off durations in microseconds starting with on.
|
//| """Pulse alternating on and off durations in microseconds starting with on.
|
||||||
//| ``pulses`` must be an `array.array` with data type 'H' for unsigned
|
//| ``pulses`` must be an `array.array` with data type 'H' for unsigned
|
||||||
//| halfword (two bytes).
|
//| halfword (two bytes).
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
//| bytes from `os.urandom` directly for true randomness."""
|
//| bytes from `os.urandom` directly for true randomness."""
|
||||||
//|
|
//|
|
||||||
|
|
||||||
//| def seed(seed: Any) -> Any:
|
//| def seed(seed: int) -> None:
|
||||||
//| """Sets the starting seed of the random number generation. Further calls to
|
//| """Sets the starting seed of the random number generation. Further calls to
|
||||||
//| `random` will return deterministic results afterwards."""
|
//| `random` will return deterministic results afterwards."""
|
||||||
//| ...
|
//| ...
|
||||||
@ -59,7 +59,7 @@ STATIC mp_obj_t random_seed(mp_obj_t seed_in) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(random_seed_obj, random_seed);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_1(random_seed_obj, random_seed);
|
||||||
|
|
||||||
//| def getrandbits(k: Any) -> Any:
|
//| def getrandbits(k: int) -> int:
|
||||||
//| """Returns an integer with *k* random bits."""
|
//| """Returns an integer with *k* random bits."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -72,7 +72,7 @@ STATIC mp_obj_t random_getrandbits(mp_obj_t num_in) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(random_getrandbits_obj, random_getrandbits);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_1(random_getrandbits_obj, random_getrandbits);
|
||||||
|
|
||||||
//| def randrange(stop: Any) -> Any:
|
//| def randrange(stop: Tuple[int, int, int]) -> int:
|
||||||
//| """Returns a randomly selected integer from ``range(start, stop, step)``."""
|
//| """Returns a randomly selected integer from ``range(start, stop, step)``."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -114,7 +114,7 @@ STATIC mp_obj_t random_randrange(size_t n_args, const mp_obj_t *args) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(random_randrange_obj, 1, 3, random_randrange);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(random_randrange_obj, 1, 3, random_randrange);
|
||||||
|
|
||||||
//| def randint(a: Any, b: Any) -> Any:
|
//| def randint(a: int, b: int) -> int:
|
||||||
//| """Returns a randomly selected integer between a and b inclusive. Equivalent
|
//| """Returns a randomly selected integer between a and b inclusive. Equivalent
|
||||||
//| to ``randrange(a, b + 1, 1)``"""
|
//| to ``randrange(a, b + 1, 1)``"""
|
||||||
//| ...
|
//| ...
|
||||||
@ -129,7 +129,7 @@ STATIC mp_obj_t random_randint(mp_obj_t a_in, mp_obj_t b_in) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(random_randint_obj, random_randint);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_2(random_randint_obj, random_randint);
|
||||||
|
|
||||||
//| def choice(seq: Any) -> Any:
|
//| def choice(seq: list) -> Any:
|
||||||
//| """Returns a randomly selected element from the given sequence. Raises
|
//| """Returns a randomly selected element from the given sequence. Raises
|
||||||
//| IndexError when the sequence is empty."""
|
//| IndexError when the sequence is empty."""
|
||||||
//| ...
|
//| ...
|
||||||
@ -143,7 +143,7 @@ STATIC mp_obj_t random_choice(mp_obj_t seq) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(random_choice_obj, random_choice);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_1(random_choice_obj, random_choice);
|
||||||
|
|
||||||
//| def random() -> Any:
|
//| def random() -> float:
|
||||||
//| """Returns a random float between 0 and 1.0."""
|
//| """Returns a random float between 0 and 1.0."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -152,7 +152,7 @@ STATIC mp_obj_t random_random(void) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_0(random_random_obj, random_random);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_0(random_random_obj, random_random);
|
||||||
|
|
||||||
//| def uniform(a: Any, b: Any) -> Any:
|
//| def uniform(a: float, b: float) -> float:
|
||||||
//| """Returns a random float between a and b. It may or may not be inclusive
|
//| """Returns a random float between a and b. It may or may not be inclusive
|
||||||
//| depending on float rounding."""
|
//| depending on float rounding."""
|
||||||
//| ...
|
//| ...
|
||||||
|
@ -128,7 +128,7 @@ STATIC void preflight_pins_or_throw(uint8_t clock_pin, uint8_t *rgb_pins, uint8_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def __init__(self, *, width: Any, bit_depth: Any, rgb_pins: Any, addr_pins: Any, clock_pin: Any, latch_pin: Any, output_enable_pin: Any, doublebuffer: Any = True, framebuffer: Any = None, height: Any = 0):
|
//| def __init__(self, *, width: int, bit_depth: List[digitalio.DigitalInOut], rgb_pins: List[digitalio.DigitalInOut], addr_pins: List[digitalio.DigitalInOut], clock_pin: digitalio.DigitalInOut, latch_pin: digitalio.DigitalInOut, output_enable_pin: digitalio.DigitalInOut, doublebuffer: bool = True, framebuffer: Optional[WriteableBuffer] = None, height: int = 0) -> None:
|
||||||
//| """Create a RGBMatrix object with the given attributes. The height of
|
//| """Create a RGBMatrix object with the given attributes. The height of
|
||||||
//| the display is determined by the number of rgb and address pins:
|
//| the display is determined by the number of rgb and address pins:
|
||||||
//| len(rgb_pins) // 3 * 2 ** len(address_pins). With 6 RGB pins and 4
|
//| len(rgb_pins) // 3 * 2 ** len(address_pins). With 6 RGB pins and 4
|
||||||
@ -237,7 +237,7 @@ STATIC mp_obj_t rgbmatrix_rgbmatrix_make_new(const mp_obj_type_t *type, size_t n
|
|||||||
return MP_OBJ_FROM_PTR(self);
|
return MP_OBJ_FROM_PTR(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def deinit(self, ) -> Any:
|
//| def deinit(self) -> None:
|
||||||
//| """Free the resources (pins, timers, etc.) associated with this
|
//| """Free the resources (pins, timers, etc.) associated with this
|
||||||
//| rgbmatrix instance. After deinitialization, no further operations
|
//| rgbmatrix instance. After deinitialization, no further operations
|
||||||
//| may be performed."""
|
//| may be performed."""
|
||||||
@ -257,7 +257,7 @@ static void check_for_deinit(rgbmatrix_rgbmatrix_obj_t *self) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//| brightness: Any = ...
|
//| brightness: float = ...
|
||||||
//| """In the current implementation, 0.0 turns the display off entirely
|
//| """In the current implementation, 0.0 turns the display off entirely
|
||||||
//| and any other value up to 1.0 turns the display on fully."""
|
//| and any other value up to 1.0 turns the display on fully."""
|
||||||
//|
|
//|
|
||||||
@ -288,9 +288,10 @@ const mp_obj_property_t rgbmatrix_rgbmatrix_brightness_obj = {
|
|||||||
(mp_obj_t)&mp_const_none_obj},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| def refresh(self) -> Any: ...
|
//| def refresh(self) -> None:
|
||||||
//| """Transmits the color data in the buffer to the pixels so that
|
//| """Transmits the color data in the buffer to the pixels so that
|
||||||
//| they are shown."""
|
//| they are shown."""
|
||||||
|
//| ...
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t rgbmatrix_rgbmatrix_refresh(mp_obj_t self_in) {
|
STATIC mp_obj_t rgbmatrix_rgbmatrix_refresh(mp_obj_t self_in) {
|
||||||
rgbmatrix_rgbmatrix_obj_t *self = (rgbmatrix_rgbmatrix_obj_t*)self_in;
|
rgbmatrix_rgbmatrix_obj_t *self = (rgbmatrix_rgbmatrix_obj_t*)self_in;
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
//| class IncrementalEncoder:
|
//| class IncrementalEncoder:
|
||||||
//| """IncrementalEncoder determines the relative rotational position based on two series of pulses."""
|
//| """IncrementalEncoder determines the relative rotational position based on two series of pulses."""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, pin_a: microcontroller.Pin, pin_b: microcontroller.Pin):
|
//| def __init__(self, pin_a: microcontroller.Pin, pin_b: microcontroller.Pin) -> None:
|
||||||
//| """Create an IncrementalEncoder object associated with the given pins. It tracks the positional
|
//| """Create an IncrementalEncoder object associated with the given pins. It tracks the positional
|
||||||
//| state of an incremental rotary encoder (also known as a quadrature encoder.) Position is
|
//| state of an incremental rotary encoder (also known as a quadrature encoder.) Position is
|
||||||
//| relative to the position when the object is contructed.
|
//| relative to the position when the object is contructed.
|
||||||
@ -80,7 +80,7 @@ STATIC mp_obj_t rotaryio_incrementalencoder_make_new(const mp_obj_type_t *type,
|
|||||||
return MP_OBJ_FROM_PTR(self);
|
return MP_OBJ_FROM_PTR(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def deinit(self, ) -> Any:
|
//| def deinit(self) -> None:
|
||||||
//| """Deinitializes the IncrementalEncoder and releases any hardware resources for reuse."""
|
//| """Deinitializes the IncrementalEncoder and releases any hardware resources for reuse."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -97,13 +97,13 @@ STATIC void check_for_deinit(rotaryio_incrementalencoder_obj_t *self) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def __enter__(self, ) -> Any:
|
//| def __enter__(self) -> IncrementalEncoder:
|
||||||
//| """No-op used by Context Managers."""
|
//| """No-op used by Context Managers."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
// Provided by context manager helper.
|
// Provided by context manager helper.
|
||||||
|
|
||||||
//| def __exit__(self, ) -> Any:
|
//| def __exit__(self) -> None:
|
||||||
//| """Automatically deinitializes the hardware when exiting a context. See
|
//| """Automatically deinitializes the hardware when exiting a context. See
|
||||||
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
||||||
//| ...
|
//| ...
|
||||||
@ -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__);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(rotaryio_incrementalencoder___exit___obj, 4, 4, rotaryio_incrementalencoder_obj___exit__);
|
||||||
|
|
||||||
|
|
||||||
//| position: Any = ...
|
//| position: int = ...
|
||||||
//| """The current position in terms of pulses. The number of pulses per rotation is defined by the
|
//| """The current position in terms of pulses. The number of pulses per rotation is defined by the
|
||||||
//| specific hardware."""
|
//| specific hardware."""
|
||||||
//|
|
//|
|
||||||
|
@ -41,7 +41,7 @@ const rtc_rtc_obj_t rtc_rtc_obj = {{&rtc_rtc_type}};
|
|||||||
//| class RTC:
|
//| class RTC:
|
||||||
//| """Real Time Clock"""
|
//| """Real Time Clock"""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, ):
|
//| def __init__(self) -> None:
|
||||||
//| """This class represents the onboard Real Time Clock. It is a singleton and will always return the same instance."""
|
//| """This class represents the onboard Real Time Clock. It is a singleton and will always return the same instance."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
|
@ -50,7 +50,7 @@ mp_obj_t rtc_get_time_source_time(void) {
|
|||||||
return struct_time_from_tm(&tm);
|
return struct_time_from_tm(&tm);
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def set_time_source(rtc: Any) -> Any:
|
//| def set_time_source(rtc: RTC) -> None:
|
||||||
//| """Sets the RTC time source used by :func:`time.localtime`.
|
//| """Sets the RTC time source used by :func:`time.localtime`.
|
||||||
//| The default is :class:`rtc.RTC`, but it's useful to use this to override the
|
//| The default is :class:`rtc.RTC`, but it's useful to use this to override the
|
||||||
//| time source for testing purposes. For example::
|
//| time source for testing purposes. For example::
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
//| `busio.SPI`, not `bitbangio.SPI`. Usually an SDCard object is used
|
//| `busio.SPI`, not `bitbangio.SPI`. Usually an SDCard object is used
|
||||||
//| with ``storage.VfsFat`` to allow file I/O to an SD card."""
|
//| with ``storage.VfsFat`` to allow file I/O to an SD card."""
|
||||||
//|
|
//|
|
||||||
//| def __init__(bus:busio.SPI, cs=digitalio.DigitalInOut, baudrate=8000000):
|
//| def __init__(bus:busio.SPI, cs: digitalio.DigitalInOut=digitalio.DigitalInOut, baudrate: int=8000000) -> None:
|
||||||
//| """Construct an SPI SD Card object with the given properties
|
//| """Construct an SPI SD Card object with the given properties
|
||||||
//|
|
//|
|
||||||
//| :param busio.SPI spi: The SPI bus
|
//| :param busio.SPI spi: The SPI bus
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
//| 25MHz. Usually an SDCard object is used with ``storage.VfsFat``
|
//| 25MHz. Usually an SDCard object is used with ``storage.VfsFat``
|
||||||
//| to allow file I/O to an SD card."""
|
//| to allow file I/O to an SD card."""
|
||||||
//|
|
//|
|
||||||
//| def __init__(*, clock: digitalio.DigitalInOut, command: digitalio.DigitalInOut, data: List[digitalio.DigitalInOut], frequency: int):
|
//| def __init__(*, clock: digitalio.DigitalInOut, command: digitalio.DigitalInOut, data: List[digitalio.DigitalInOut], frequency: int) -> None:
|
||||||
//| """Construct an SDIO SD Card object with the given properties
|
//| """Construct an SDIO SD Card object with the given properties
|
||||||
//|
|
//|
|
||||||
//| :param ~microcontroller.Pin clock: the pin to use for the clock.
|
//| :param ~microcontroller.Pin clock: the pin to use for the clock.
|
||||||
@ -109,7 +109,7 @@ STATIC void check_for_deinit(sdioio_sdcard_obj_t *self) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def configure(*, frequency=0, width=0) -> None:
|
//| def configure(*, frequency: int=0, width: int=0) -> None:
|
||||||
//| """Configures the SDIO bus.
|
//| """Configures the SDIO bus.
|
||||||
//|
|
//|
|
||||||
//| :param int frequency: the desired clock rate in Hertz. The actual clock rate may be higher or lower due to the granularity of available clock settings. Check the `frequency` attribute for the actual clock rate.
|
//| :param int frequency: the desired clock rate in Hertz. The actual clock rate may be higher or lower due to the granularity of available clock settings. Check the `frequency` attribute for the actual clock rate.
|
||||||
@ -255,13 +255,13 @@ STATIC mp_obj_t sdioio_sdcard_obj_deinit(mp_obj_t self_in) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_1(sdioio_sdcard_deinit_obj, sdioio_sdcard_obj_deinit);
|
MP_DEFINE_CONST_FUN_OBJ_1(sdioio_sdcard_deinit_obj, sdioio_sdcard_obj_deinit);
|
||||||
|
|
||||||
//| def __enter__(self, ) -> Any:
|
//| def __enter__(self) -> SDCard:
|
||||||
//| """No-op used by Context Managers.
|
//| """No-op used by Context Managers.
|
||||||
//| Provided by context manager helper."""
|
//| Provided by context manager helper."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
|
|
||||||
//| def __exit__(self, ) -> Any:
|
//| def __exit__(self) -> None:
|
||||||
//| """Automatically deinitializes the hardware when exiting a context. See
|
//| """Automatically deinitializes the hardware when exiting a context. See
|
||||||
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
||||||
//| ...
|
//| ...
|
||||||
|
@ -49,7 +49,7 @@ STATIC const mp_obj_type_t socket_type;
|
|||||||
|
|
||||||
//| class socket:
|
//| class socket:
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, family: int, type: int, proto: int):
|
//| def __init__(self, family: int, type: int, proto: int) -> None:
|
||||||
//| """Create a new socket
|
//| """Create a new socket
|
||||||
//|
|
//|
|
||||||
//| :param ~int family: AF_INET or AF_INET6
|
//| :param ~int family: AF_INET or AF_INET6
|
||||||
@ -96,7 +96,7 @@ STATIC void socket_select_nic(mod_network_socket_obj_t *self, const byte *ip) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def bind(self, address: tuple) -> Any:
|
//| def bind(self, address: tuple) -> None:
|
||||||
//| """Bind a socket to an address
|
//| """Bind a socket to an address
|
||||||
//|
|
//|
|
||||||
//| :param ~tuple address: tuple of (remote_address, remote_port)"""
|
//| :param ~tuple address: tuple of (remote_address, remote_port)"""
|
||||||
@ -123,7 +123,7 @@ STATIC mp_obj_t socket_bind(mp_obj_t self_in, mp_obj_t addr_in) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_bind_obj, socket_bind);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_bind_obj, socket_bind);
|
||||||
|
|
||||||
//| def listen(self, backlog: int) -> Any:
|
//| def listen(self, backlog: int) -> None:
|
||||||
//| """Set socket to listen for incoming connections
|
//| """Set socket to listen for incoming connections
|
||||||
//|
|
//|
|
||||||
//| :param ~int backlog: length of backlog queue for waiting connetions"""
|
//| :param ~int backlog: length of backlog queue for waiting connetions"""
|
||||||
@ -148,7 +148,7 @@ STATIC mp_obj_t socket_listen(mp_obj_t self_in, mp_obj_t backlog) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_listen_obj, socket_listen);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_listen_obj, socket_listen);
|
||||||
|
|
||||||
//| def accept(self, ) -> Any:
|
//| def accept(self) -> tuple:
|
||||||
//| """Accept a connection on a listening socket of type SOCK_STREAM,
|
//| """Accept a connection on a listening socket of type SOCK_STREAM,
|
||||||
//| creating a new socket of type SOCK_STREAM.
|
//| creating a new socket of type SOCK_STREAM.
|
||||||
//| Returns a tuple of (new_socket, remote_address)"""
|
//| Returns a tuple of (new_socket, remote_address)"""
|
||||||
@ -185,7 +185,7 @@ STATIC mp_obj_t socket_accept(mp_obj_t self_in) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(socket_accept_obj, socket_accept);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_1(socket_accept_obj, socket_accept);
|
||||||
|
|
||||||
//| def connect(self, address: tuple) -> Any:
|
//| def connect(self, address: tuple) -> None:
|
||||||
//| """Connect a socket to a remote address
|
//| """Connect a socket to a remote address
|
||||||
//|
|
//|
|
||||||
//| :param ~tuple address: tuple of (remote_address, remote_port)"""
|
//| :param ~tuple address: tuple of (remote_address, remote_port)"""
|
||||||
@ -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);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_connect_obj, socket_connect);
|
||||||
|
|
||||||
//| def send(self, bytes: bytes) -> Any:
|
//| def send(self, bytes: bytes) -> int:
|
||||||
//| """Send some bytes to the connected remote address.
|
//| """Send some bytes to the connected remote address.
|
||||||
//| Suits sockets of type SOCK_STREAM
|
//| Suits sockets of type SOCK_STREAM
|
||||||
//|
|
//|
|
||||||
@ -249,7 +249,7 @@ STATIC mp_int_t _socket_recv_into(mod_network_socket_obj_t *sock, byte *buf, mp_
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//| def recv_into(self, buffer: bytearray, bufsize: int) -> Any:
|
//| def recv_into(self, buffer: WriteableBuffer, bufsize: int) -> int:
|
||||||
//| """Reads some bytes from the connected remote address, writing
|
//| """Reads some bytes from the connected remote address, writing
|
||||||
//| into the provided buffer. If bufsize <= len(buffer) is given,
|
//| into the provided buffer. If bufsize <= len(buffer) is given,
|
||||||
//| a maximum of bufsize bytes will be read into the buffer. If no
|
//| a maximum of bufsize bytes will be read into the buffer. If no
|
||||||
@ -285,7 +285,7 @@ STATIC mp_obj_t socket_recv_into(size_t n_args, const mp_obj_t *args) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_recv_into_obj, 2, 3, socket_recv_into);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_recv_into_obj, 2, 3, socket_recv_into);
|
||||||
|
|
||||||
//| def recv(self, bufsize: int) -> Any:
|
//| def recv(self, bufsize: int) -> bytes:
|
||||||
//| """Reads some bytes from the connected remote address.
|
//| """Reads some bytes from the connected remote address.
|
||||||
//| Suits sockets of type SOCK_STREAM
|
//| Suits sockets of type SOCK_STREAM
|
||||||
//| Returns a bytes() of length <= bufsize
|
//| Returns a bytes() of length <= bufsize
|
||||||
@ -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);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_recv_obj, socket_recv);
|
||||||
|
|
||||||
//| def sendto(self, bytes: bytes, address: tuple) -> Any:
|
//| def sendto(self, bytes: bytes, address: tuple) -> int:
|
||||||
//| """Send some bytes to a specific address.
|
//| """Send some bytes to a specific address.
|
||||||
//| Suits sockets of type SOCK_DGRAM
|
//| Suits sockets of type SOCK_DGRAM
|
||||||
//|
|
//|
|
||||||
@ -346,7 +346,7 @@ STATIC mp_obj_t socket_sendto(mp_obj_t self_in, mp_obj_t data_in, mp_obj_t addr_
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_3(socket_sendto_obj, socket_sendto);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_3(socket_sendto_obj, socket_sendto);
|
||||||
|
|
||||||
//| def recvfrom(self, bufsize: int) -> Any:
|
//| def recvfrom(self, bufsize: int) -> Tuple[bytes, tuple]:
|
||||||
//| """Reads some bytes from the connected remote address.
|
//| """Reads some bytes from the connected remote address.
|
||||||
//| Suits sockets of type SOCK_STREAM
|
//| Suits sockets of type SOCK_STREAM
|
||||||
//|
|
//|
|
||||||
@ -385,7 +385,7 @@ STATIC mp_obj_t socket_recvfrom(mp_obj_t self_in, mp_obj_t len_in) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_recvfrom_obj, socket_recvfrom);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_recvfrom_obj, socket_recvfrom);
|
||||||
|
|
||||||
//| def setsockopt(self, level: Any, optname: Any, value: Any) -> Any:
|
//| def setsockopt(self, level: int, optname: int, value: int) -> None:
|
||||||
//| """Sets socket options"""
|
//| """Sets socket options"""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -419,7 +419,7 @@ STATIC mp_obj_t socket_setsockopt(size_t n_args, const mp_obj_t *args) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_setsockopt_obj, 4, 4, socket_setsockopt);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_setsockopt_obj, 4, 4, socket_setsockopt);
|
||||||
|
|
||||||
//| def settimeout(self, value: int) -> Any:
|
//| def settimeout(self, value: int) -> None:
|
||||||
//| """Set the timeout value for this socket.
|
//| """Set the timeout value for this socket.
|
||||||
//|
|
//|
|
||||||
//| :param ~int value: timeout in seconds. 0 means non-blocking. None means block indefinitely."""
|
//| :param ~int value: timeout in seconds. 0 means non-blocking. None means block indefinitely."""
|
||||||
@ -450,7 +450,7 @@ STATIC mp_obj_t socket_settimeout(mp_obj_t self_in, mp_obj_t timeout_in) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_settimeout_obj, socket_settimeout);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_settimeout_obj, socket_settimeout);
|
||||||
|
|
||||||
//| def setblocking(self, flag: bool) -> Any:
|
//| def setblocking(self, flag: bool) -> Optional[int]:
|
||||||
//| """Set the blocking behaviour of this socket.
|
//| """Set the blocking behaviour of this socket.
|
||||||
//|
|
//|
|
||||||
//| :param ~bool flag: False means non-blocking, True means block indefinitely."""
|
//| :param ~bool flag: False means non-blocking, True means block indefinitely."""
|
||||||
@ -512,7 +512,7 @@ STATIC const mp_obj_type_t socket_type = {
|
|||||||
.locals_dict = (mp_obj_dict_t*)&socket_locals_dict,
|
.locals_dict = (mp_obj_dict_t*)&socket_locals_dict,
|
||||||
};
|
};
|
||||||
|
|
||||||
//| def getaddrinfo(host: Any, port: Any) -> Any:
|
//| def getaddrinfo(host: string, port: string) -> tuple:
|
||||||
//| """Gets the address information for a hostname and port
|
//| """Gets the address information for a hostname and port
|
||||||
//|
|
//|
|
||||||
//| Returns the appropriate family, socket type, socket protocol and
|
//| Returns the appropriate family, socket type, socket protocol and
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
//| directly."""
|
//| directly."""
|
||||||
//|
|
//|
|
||||||
|
|
||||||
//| def mount(filesystem: Any, mount_path: Any, *, readonly: bool = False) -> Any:
|
//| def mount(filesystem: VfsFat, mount_path: string, *, readonly: bool = False) -> None:
|
||||||
//| """Mounts the given filesystem object at the given path.
|
//| """Mounts the given filesystem object at the given path.
|
||||||
//|
|
//|
|
||||||
//| This is the CircuitPython analog to the UNIX ``mount`` command.
|
//| This is the CircuitPython analog to the UNIX ``mount`` command.
|
||||||
@ -80,7 +80,7 @@ mp_obj_t storage_mount(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_arg
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_KW(storage_mount_obj, 2, storage_mount);
|
MP_DEFINE_CONST_FUN_OBJ_KW(storage_mount_obj, 2, storage_mount);
|
||||||
|
|
||||||
//| def umount(mount: Any) -> Any:
|
//| def umount(mount: Union[string, VfsFat]) -> None:
|
||||||
//| """Unmounts the given filesystem object or if *mount* is a path, then unmount
|
//| """Unmounts the given filesystem object or if *mount* is a path, then unmount
|
||||||
//| the filesystem mounted at that location.
|
//| the filesystem mounted at that location.
|
||||||
//|
|
//|
|
||||||
@ -98,7 +98,7 @@ mp_obj_t storage_umount(mp_obj_t mnt_in) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_1(storage_umount_obj, storage_umount);
|
MP_DEFINE_CONST_FUN_OBJ_1(storage_umount_obj, storage_umount);
|
||||||
|
|
||||||
//| def remount(mount_path: Any, readonly: bool = False, *, disable_concurrent_write_protection: bool = False) -> Any:
|
//| def remount(mount_path: string, readonly: bool = False, *, disable_concurrent_write_protection: bool = False) -> None:
|
||||||
//| """Remounts the given path with new parameters.
|
//| """Remounts the given path with new parameters.
|
||||||
//|
|
//|
|
||||||
//| :param bool readonly: True when the filesystem should be readonly to CircuitPython.
|
//| :param bool readonly: True when the filesystem should be readonly to CircuitPython.
|
||||||
@ -128,7 +128,7 @@ mp_obj_t storage_remount(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_a
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_KW(storage_remount_obj, 1, storage_remount);
|
MP_DEFINE_CONST_FUN_OBJ_KW(storage_remount_obj, 1, storage_remount);
|
||||||
|
|
||||||
//| def getmount(mount_path: Any) -> Any:
|
//| def getmount(mount_path: string) -> VfsFat:
|
||||||
//| """Retrieves the mount object associated with the mount path"""
|
//| """Retrieves the mount object associated with the mount path"""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -137,7 +137,7 @@ mp_obj_t storage_getmount(const mp_obj_t mnt_in) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_1(storage_getmount_obj, storage_getmount);
|
MP_DEFINE_CONST_FUN_OBJ_1(storage_getmount_obj, storage_getmount);
|
||||||
|
|
||||||
//| def erase_filesystem() -> Any:
|
//| def erase_filesystem() -> None:
|
||||||
//| """Erase and re-create the ``CIRCUITPY`` filesystem.
|
//| """Erase and re-create the ``CIRCUITPY`` filesystem.
|
||||||
//|
|
//|
|
||||||
//| On boards that present USB-visible ``CIRCUITPY`` drive (e.g., SAMD21 and SAMD51),
|
//| On boards that present USB-visible ``CIRCUITPY`` drive (e.g., SAMD21 and SAMD51),
|
||||||
@ -168,51 +168,51 @@ STATIC const mp_rom_map_elem_t storage_module_globals_table[] = {
|
|||||||
{ MP_ROM_QSTR(MP_QSTR_erase_filesystem), MP_ROM_PTR(&storage_erase_filesystem_obj) },
|
{ MP_ROM_QSTR(MP_QSTR_erase_filesystem), MP_ROM_PTR(&storage_erase_filesystem_obj) },
|
||||||
|
|
||||||
//| class VfsFat:
|
//| class VfsFat:
|
||||||
//| def __init__(self, block_device: Any):
|
//| def __init__(self, block_device: string) -> None:
|
||||||
//| """Create a new VfsFat filesystem around the given block device.
|
//| """Create a new VfsFat filesystem around the given block device.
|
||||||
//|
|
//|
|
||||||
//| :param block_device: Block device the the filesystem lives on"""
|
//| :param block_device: Block device the the filesystem lives on"""
|
||||||
//|
|
//|
|
||||||
//| label: Any = ...
|
//| label: string = ...
|
||||||
//| """The filesystem label, up to 11 case-insensitive bytes. Note that
|
//| """The filesystem label, up to 11 case-insensitive bytes. Note that
|
||||||
//| this property can only be set when the device is writable by the
|
//| this property can only be set when the device is writable by the
|
||||||
//| microcontroller."""
|
//| microcontroller."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def mkfs(self) -> Any:
|
//| def mkfs(self) -> None:
|
||||||
//| """Format the block device, deleting any data that may have been there"""
|
//| """Format the block device, deleting any data that may have been there"""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def open(self, path: Any, mode: Any) -> Any:
|
//| def open(self, path: string, mode: string) -> None:
|
||||||
//| """Like builtin ``open()``"""
|
//| """Like builtin ``open()``"""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def ilistdir(self, path: Any) -> Any:
|
//| def ilistdir(self, path: string) -> iterator:
|
||||||
//| """Return an iterator whose values describe files and folders within
|
//| """Return an iterator whose values describe files and folders within
|
||||||
//| ``path``"""
|
//| ``path``"""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def mkdir(self, path: Any) -> Any:
|
//| def mkdir(self, path: string) -> None:
|
||||||
//| """Like `os.mkdir`"""
|
//| """Like `os.mkdir`"""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def rmdir(self, path: Any) -> Any:
|
//| def rmdir(self, path: string) -> None:
|
||||||
//| """Like `os.rmdir`"""
|
//| """Like `os.rmdir`"""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def stat(self, path: Any) -> Any:
|
//| def stat(self, path: string) -> string:
|
||||||
//| """Like `os.stat`"""
|
//| """Like `os.stat`"""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def statvfs(self, path: Any) -> Any:
|
//| def statvfs(self, path: string) -> Tuple[string, string, string, string, string, string, string, string, string, string]:
|
||||||
//| """Like `os.statvfs`"""
|
//| """Like `os.statvfs`"""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def mount(self, readonly: Any, mkfs: Any) -> Any:
|
//| def mount(self, readonly: bool, mkfs: VfsFat) -> None:
|
||||||
//| """Don't call this directly, call `storage.mount`."""
|
//| """Don't call this directly, call `storage.mount`."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def umount(self) -> Any:
|
//| def umount(self) -> None:
|
||||||
//| """Don't call this directly, call `storage.umount`."""
|
//| """Don't call this directly, call `storage.umount`."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
|
@ -62,7 +62,7 @@ STATIC mp_obj_t struct_calcsize(mp_obj_t fmt_in) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_1(struct_calcsize_obj, struct_calcsize);
|
MP_DEFINE_CONST_FUN_OBJ_1(struct_calcsize_obj, struct_calcsize);
|
||||||
|
|
||||||
//| def pack(fmt: Any, *values: Any) -> Any:
|
//| def pack(fmt: string, *values: ReadableBuffer) -> bytes:
|
||||||
//| """Pack the values according to the format string fmt.
|
//| """Pack the values according to the format string fmt.
|
||||||
//| The return value is a bytes object encoding the values."""
|
//| The return value is a bytes object encoding the values."""
|
||||||
//| ...
|
//| ...
|
||||||
@ -80,7 +80,7 @@ STATIC mp_obj_t struct_pack(size_t n_args, const mp_obj_t *args) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(struct_pack_obj, 1, MP_OBJ_FUN_ARGS_MAX, struct_pack);
|
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(struct_pack_obj, 1, MP_OBJ_FUN_ARGS_MAX, struct_pack);
|
||||||
|
|
||||||
//| def pack_into(fmt: Any, buffer: Any, offset: Any, *values: Any) -> Any:
|
//| def pack_into(fmt: string, buffer: WriteableBuffer, offset: int, *values: readableBuffer) -> None:
|
||||||
//| """Pack the values according to the format string fmt into a buffer
|
//| """Pack the values according to the format string fmt into a buffer
|
||||||
//| starting at offset. offset may be negative to count from the end of buffer."""
|
//| starting at offset. offset may be negative to count from the end of buffer."""
|
||||||
//| ...
|
//| ...
|
||||||
@ -106,7 +106,7 @@ STATIC mp_obj_t struct_pack_into(size_t n_args, const mp_obj_t *args) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(struct_pack_into_obj, 3, MP_OBJ_FUN_ARGS_MAX, struct_pack_into);
|
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(struct_pack_into_obj, 3, MP_OBJ_FUN_ARGS_MAX, struct_pack_into);
|
||||||
|
|
||||||
//| def unpack(fmt: Any, data: Any) -> Any:
|
//| def unpack(fmt: string, data: ReadableBuffer) -> tuple:
|
||||||
//| """Unpack from the data according to the format string fmt. The return value
|
//| """Unpack from the data according to the format string fmt. The return value
|
||||||
//| is a tuple of the unpacked values. The buffer size must match the size
|
//| is a tuple of the unpacked values. The buffer size must match the size
|
||||||
//| required by the format."""
|
//| required by the format."""
|
||||||
@ -124,7 +124,7 @@ STATIC mp_obj_t struct_unpack(size_t n_args, const mp_obj_t *args) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(struct_unpack_obj, 2, 3, struct_unpack);
|
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(struct_unpack_obj, 2, 3, struct_unpack);
|
||||||
|
|
||||||
//| def unpack_from(fmt: Any, data: Any, offset: Any = 0) -> Any:
|
//| def unpack_from(fmt: string, data: ReadableBuffer, offset: int = 0) -> tuple:
|
||||||
//| """Unpack from the data starting at offset according to the format string fmt.
|
//| """Unpack from the data starting at offset according to the format string fmt.
|
||||||
//| offset may be negative to count from the end of buffer. The return value is
|
//| offset may be negative to count from the end of buffer. The return value is
|
||||||
//| a tuple of the unpacked values. The buffer size must be at least as big
|
//| a tuple of the unpacked values. The buffer size must be at least as big
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
//| print("Hello World!")"""
|
//| print("Hello World!")"""
|
||||||
//|
|
//|
|
||||||
|
|
||||||
//| def __init__(self, ):
|
//| def __init__(self) -> None:
|
||||||
//| """You cannot create an instance of `supervisor.Runtime`.
|
//| """You cannot create an instance of `supervisor.Runtime`.
|
||||||
//| Use `supervisor.runtime` to access the sole instance available."""
|
//| Use `supervisor.runtime` to access the sole instance available."""
|
||||||
//| ...
|
//| ...
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
//| class Terminal:
|
//| class Terminal:
|
||||||
//| """Display a character stream with a TileGrid"""
|
//| """Display a character stream with a TileGrid"""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, tilegrid: Any, font: Any):
|
//| def __init__(self, tilegrid: bitmap, font: fontio.BuiltinFont) -> None:
|
||||||
//| """Terminal manages tile indices and cursor position based on VT100 commands. The font should be
|
//| """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."""
|
//| a `fontio.BuiltinFont` and the TileGrid's bitmap should match the font's bitmap."""
|
||||||
//| ...
|
//| ...
|
||||||
@ -72,7 +72,7 @@ STATIC mp_obj_t terminalio_terminal_make_new(const mp_obj_type_t *type, size_t n
|
|||||||
|
|
||||||
// These are standard stream methods. Code is in py/stream.c.
|
// These are standard stream methods. Code is in py/stream.c.
|
||||||
//
|
//
|
||||||
//| def write(self, buf: Any) -> Any:
|
//| def write(self, buf: ReadableBuffer) -> Optional[int]:
|
||||||
//| """Write the buffer of bytes to the bus.
|
//| """Write the buffer of bytes to the bus.
|
||||||
//|
|
//|
|
||||||
//| :return: the number of bytes written
|
//| :return: the number of bytes written
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
//| written in MicroPython will work in CPython but not necessarily the other
|
//| written in MicroPython will work in CPython but not necessarily the other
|
||||||
//| way around."""
|
//| way around."""
|
||||||
//|
|
//|
|
||||||
//| def monotonic() -> Any:
|
//| def monotonic() -> float:
|
||||||
//| """Returns an always increasing value of time with an unknown reference
|
//| """Returns an always increasing value of time with an unknown reference
|
||||||
//| point. Only use it to compare against other values from `monotonic`.
|
//| point. Only use it to compare against other values from `monotonic`.
|
||||||
//|
|
//|
|
||||||
@ -57,7 +57,7 @@ STATIC mp_obj_t time_monotonic(void) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_0(time_monotonic_obj, time_monotonic);
|
MP_DEFINE_CONST_FUN_OBJ_0(time_monotonic_obj, time_monotonic);
|
||||||
|
|
||||||
//| def sleep(seconds: float) -> Any:
|
//| def sleep(seconds: float) -> None:
|
||||||
//| """Sleep for a given number of seconds.
|
//| """Sleep for a given number of seconds.
|
||||||
//|
|
//|
|
||||||
//| :param float seconds: the time to sleep in fractional seconds"""
|
//| :param float seconds: the time to sleep in fractional seconds"""
|
||||||
@ -93,7 +93,7 @@ mp_obj_t struct_time_make_new(const mp_obj_type_t *type, size_t n_args, const mp
|
|||||||
}
|
}
|
||||||
|
|
||||||
//| class struct_time:
|
//| class struct_time:
|
||||||
//| def __init__(self, time_tuple: Any):
|
//| def __init__(self, time_tuple: tuple) -> None:
|
||||||
//| """Structure used to capture a date and time. Note that it takes a tuple!
|
//| """Structure used to capture a date and time. Note that it takes a tuple!
|
||||||
//|
|
//|
|
||||||
//| :param tuple time_tuple: Tuple of time info: ``(tm_year, tm_mon, tm_mday, tm_hour, tm_min, tm_sec, tm_wday, tm_yday, tm_isdst)``
|
//| :param tuple time_tuple: Tuple of time info: ``(tm_year, tm_mon, tm_mday, tm_hour, tm_min, tm_sec, tm_wday, tm_yday, tm_isdst)``
|
||||||
@ -198,7 +198,7 @@ mp_obj_t MP_WEAK rtc_get_time_source_time(void) {
|
|||||||
mp_raise_RuntimeError(translate("RTC is not supported on this board"));
|
mp_raise_RuntimeError(translate("RTC is not supported on this board"));
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def time() -> Any:
|
//| def time() -> int:
|
||||||
//| """Return the current time in seconds since since Jan 1, 1970.
|
//| """Return the current time in seconds since since Jan 1, 1970.
|
||||||
//|
|
//|
|
||||||
//| :return: the current time
|
//| :return: the current time
|
||||||
@ -214,7 +214,7 @@ STATIC mp_obj_t time_time(void) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_0(time_time_obj, time_time);
|
MP_DEFINE_CONST_FUN_OBJ_0(time_time_obj, time_time);
|
||||||
|
|
||||||
//| def monotonic_ns() -> Any:
|
//| def monotonic_ns() -> int:
|
||||||
//| """Return the time of the specified clock clk_id in nanoseconds.
|
//| """Return the time of the specified clock clk_id in nanoseconds.
|
||||||
//|
|
//|
|
||||||
//| :return: the current time
|
//| :return: the current time
|
||||||
@ -227,7 +227,7 @@ STATIC mp_obj_t time_monotonic_ns(void) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_0(time_monotonic_ns_obj, time_monotonic_ns);
|
MP_DEFINE_CONST_FUN_OBJ_0(time_monotonic_ns_obj, time_monotonic_ns);
|
||||||
|
|
||||||
//| def localtime(secs: Any) -> Any:
|
//| def localtime(secs: int) -> struct_time:
|
||||||
//| """Convert a time expressed in seconds since Jan 1, 1970 to a struct_time in
|
//| """Convert a time expressed in seconds since Jan 1, 1970 to a struct_time in
|
||||||
//| local time. If secs is not provided or None, the current time as returned
|
//| local time. If secs is not provided or None, the current time as returned
|
||||||
//| by time() is used.
|
//| by time() is used.
|
||||||
@ -260,7 +260,7 @@ STATIC mp_obj_t time_localtime(size_t n_args, const mp_obj_t *args) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(time_localtime_obj, 0, 1, time_localtime);
|
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(time_localtime_obj, 0, 1, time_localtime);
|
||||||
|
|
||||||
//| def mktime(t: Any) -> Any:
|
//| def mktime(t: struct_time) -> int:
|
||||||
//| """This is the inverse function of localtime(). Its argument is the
|
//| """This is the inverse function of localtime(). Its argument is the
|
||||||
//| struct_time or full 9-tuple (since the dst flag is needed; use -1 as the
|
//| struct_time or full 9-tuple (since the dst flag is needed; use -1 as the
|
||||||
//| dst flag if it is unknown) which expresses the time in local time, not UTC.
|
//| dst flag if it is unknown) which expresses the time in local time, not UTC.
|
||||||
|
@ -52,7 +52,7 @@
|
|||||||
//| print("touched!")"""
|
//| print("touched!")"""
|
||||||
//|
|
//|
|
||||||
|
|
||||||
//| def __init__(self, pin: microcontroller.Pin):
|
//| def __init__(self, pin: microcontroller.Pin) -> None:
|
||||||
//| """Use the TouchIn on the given pin.
|
//| """Use the TouchIn on the given pin.
|
||||||
//|
|
//|
|
||||||
//| :param ~microcontroller.Pin pin: the pin to read from"""
|
//| :param ~microcontroller.Pin pin: the pin to read from"""
|
||||||
@ -73,7 +73,7 @@ STATIC mp_obj_t touchio_touchin_make_new(const mp_obj_type_t *type,
|
|||||||
return (mp_obj_t) self;
|
return (mp_obj_t) self;
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def deinit(self, ) -> Any:
|
//| def deinit(self) -> None:
|
||||||
//| """Deinitialises the TouchIn and releases any hardware resources for reuse."""
|
//| """Deinitialises the TouchIn and releases any hardware resources for reuse."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -90,13 +90,13 @@ STATIC void check_for_deinit(touchio_touchin_obj_t *self) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def __enter__(self, ) -> Any:
|
//| def __enter__(self) -> TouchIn:
|
||||||
//| """No-op used by Context Managers."""
|
//| """No-op used by Context Managers."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
// Provided by context manager helper.
|
// Provided by context manager helper.
|
||||||
|
|
||||||
//| def __exit__(self, ) -> Any:
|
//| def __exit__(self) -> None:
|
||||||
//| """Automatically deinitializes the hardware when exiting a context. See
|
//| """Automatically deinitializes the hardware when exiting a context. See
|
||||||
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
||||||
//| ...
|
//| ...
|
||||||
@ -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__);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(touchio_touchin___exit___obj, 4, 4, touchio_touchin_obj___exit__);
|
||||||
|
|
||||||
//| value: Any = ...
|
//| value: bool = ...
|
||||||
//| """Whether the touch pad is being touched or not. (read-only)
|
//| """Whether the touch pad is being touched or not. (read-only)
|
||||||
//|
|
//|
|
||||||
//| True when `raw_value` > `threshold`."""
|
//| True when `raw_value` > `threshold`."""
|
||||||
@ -128,7 +128,7 @@ const mp_obj_property_t touchio_touchin_value_obj = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//| raw_value: Any = ...
|
//| raw_value: int = ...
|
||||||
//| """The raw touch measurement as an `int`. (read-only)"""
|
//| """The raw touch measurement as an `int`. (read-only)"""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t touchio_touchin_obj_get_raw_value(mp_obj_t self_in) {
|
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: Any = ...
|
//| threshold: Optional[int] = ...
|
||||||
//| """Minimum `raw_value` needed to detect a touch (and for `value` to be `True`).
|
//| """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,
|
//| When the **TouchIn** object is created, an initial `raw_value` is read from the pin,
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
//| """Heap size analysis"""
|
//| """Heap size analysis"""
|
||||||
//|
|
//|
|
||||||
|
|
||||||
//| def info(object: Any) -> Any:
|
//| def info(object: Any) -> int:
|
||||||
//| """Prints memory debugging info for the given object and returns the
|
//| """Prints memory debugging info for the given object and returns the
|
||||||
//| estimated size."""
|
//| estimated size."""
|
||||||
//| ...
|
//| ...
|
||||||
|
@ -17,7 +17,7 @@ https://docs.scipy.org/doc/numpy/index.html"""
|
|||||||
|
|
||||||
class array:
|
class array:
|
||||||
"""1- and 2- dimensional array"""
|
"""1- and 2- dimensional array"""
|
||||||
def __init__(self, values, *, dtype=float):
|
def __init__(self, values, *, dtype=float) -> None:
|
||||||
""":param sequence values: Sequence giving the initial content of the array.
|
""":param sequence values: Sequence giving the initial content of the array.
|
||||||
:param dtype: The type of array values, ``int8``, ``uint8``, ``int16``, ``uint16``, or ``float``
|
:param dtype: The type of array values, ``int8``, ``uint8``, ``int16``, ``uint16``, or ``float``
|
||||||
|
|
||||||
|
@ -39,11 +39,11 @@
|
|||||||
//| mouse.send_report()"""
|
//| mouse.send_report()"""
|
||||||
//|
|
//|
|
||||||
|
|
||||||
//| def __init__(self, ):
|
//| def __init__(self) -> None:
|
||||||
//| """Not currently dynamically supported."""
|
//| """Not currently dynamically supported."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def send_report(self, buf: Any) -> Any:
|
//| def send_report(self, buf: ReadableBuffer) -> None:
|
||||||
//| """Send a HID report."""
|
//| """Send a HID report."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -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);
|
MP_DEFINE_CONST_FUN_OBJ_2(usb_hid_device_send_report_obj, usb_hid_device_send_report);
|
||||||
|
|
||||||
//| usage_page: Any = ...
|
//| usage_page: int = ...
|
||||||
//| """The usage page of the device as an `int`. Can be thought of a category. (read-only)"""
|
//| """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) {
|
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},
|
(mp_obj_t)&mp_const_none_obj},
|
||||||
};
|
};
|
||||||
|
|
||||||
//| usage: Any = ...
|
//| usage: int = ...
|
||||||
//| """The functionality of the device as an int. (read-only)
|
//| """The functionality of the device as an int. (read-only)
|
||||||
//|
|
//|
|
||||||
//| For example, Keyboard is 0x06 within the generic desktop usage page 0x01.
|
//| For example, Keyboard is 0x06 within the generic desktop usage page 0x01.
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
//| class PortIn:
|
//| class PortIn:
|
||||||
//| """Receives midi commands over USB"""
|
//| """Receives midi commands over USB"""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self):
|
//| def __init__(self) -> None:
|
||||||
//| """You cannot create an instance of `usb_midi.PortIn`.
|
//| """You cannot create an instance of `usb_midi.PortIn`.
|
||||||
//|
|
//|
|
||||||
//| PortIn objects are constructed for every corresponding entry in the USB
|
//| PortIn objects are constructed for every corresponding entry in the USB
|
||||||
@ -48,7 +48,7 @@
|
|||||||
|
|
||||||
// These are standard stream methods. Code is in py/stream.c.
|
// These are standard stream methods. Code is in py/stream.c.
|
||||||
//
|
//
|
||||||
//| def read(self, nbytes: Any = None) -> Any:
|
//| def read(self, nbytes: int = None) -> Optional[bytes]:
|
||||||
//| """Read characters. If ``nbytes`` is specified then read at most that many
|
//| """Read characters. If ``nbytes`` is specified then read at most that many
|
||||||
//| bytes. Otherwise, read everything that arrives until the connection
|
//| bytes. Otherwise, read everything that arrives until the connection
|
||||||
//| times out. Providing the number of bytes expected is highly recommended
|
//| times out. Providing the number of bytes expected is highly recommended
|
||||||
@ -58,7 +58,7 @@
|
|||||||
//| :rtype: bytes or None"""
|
//| :rtype: bytes or None"""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def readinto(self, buf: Any, nbytes: Any = None) -> Any:
|
//| def readinto(self, buf: WriteableBuffer, nbytes: Optional[int] = None) -> Optional[bytes]:
|
||||||
//| """Read bytes into the ``buf``. If ``nbytes`` is specified then read at most
|
//| """Read bytes into the ``buf``. If ``nbytes`` is specified then read at most
|
||||||
//| that many bytes. Otherwise, read at most ``len(buf)`` bytes.
|
//| that many bytes. Otherwise, read at most ``len(buf)`` bytes.
|
||||||
//|
|
//|
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
//| class PortOut:
|
//| class PortOut:
|
||||||
//| """Sends midi messages to a computer over USB"""
|
//| """Sends midi messages to a computer over USB"""
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, ):
|
//| def __init__(self) -> None:
|
||||||
//| """You cannot create an instance of `usb_midi.PortOut`.
|
//| """You cannot create an instance of `usb_midi.PortOut`.
|
||||||
//|
|
//|
|
||||||
//| PortOut objects are constructed for every corresponding entry in the USB
|
//| PortOut objects are constructed for every corresponding entry in the USB
|
||||||
@ -47,7 +47,7 @@
|
|||||||
|
|
||||||
// These are standard stream methods. Code is in py/stream.c.
|
// These are standard stream methods. Code is in py/stream.c.
|
||||||
//
|
//
|
||||||
//| def write(self, buf: Any) -> Any:
|
//| def write(self, buf: ReadableBuffer) -> Optional[int]:
|
||||||
//| """Write the buffer of bytes to the bus.
|
//| """Write the buffer of bytes to the bus.
|
||||||
//|
|
//|
|
||||||
//| :return: the number of bytes written
|
//| :return: the number of bytes written
|
||||||
|
@ -60,7 +60,7 @@ STATIC mp_obj_t stack_size(void) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_0(stack_size_obj, stack_size);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_0(stack_size_obj, stack_size);
|
||||||
|
|
||||||
//| def stack_usage() -> Any:
|
//| def stack_usage() -> int:
|
||||||
//| """Return how much stack is currently in use.
|
//| """Return how much stack is currently in use.
|
||||||
//| Same as micropython.stack_use(); duplicated here for convenience."""
|
//| Same as micropython.stack_use(); duplicated here for convenience."""
|
||||||
//| ...
|
//| ...
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
//| class Circle:
|
//| class Circle:
|
||||||
//|
|
//|
|
||||||
//| def __init__(self, radius: int):
|
//| def __init__(self, radius: int) -> None:
|
||||||
//| """Circle is positioned on screen by its center point.
|
//| """Circle is positioned on screen by its center point.
|
||||||
//|
|
//|
|
||||||
//| :param radius: The radius of the circle in pixels"""
|
//| :param radius: The radius of the circle in pixels"""
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user