Tweak black_bindings

Originally, black_bindings found each contiguous "//|" block and sent
it to black independently. This was slower than it needed to be.

Instead, swap the comment prefix: when running black, take off
"//|" prefixes and put "##|" prefixes on all un-prefixed lines.
Then, after black is run, do the opposite operation

This more than doubles the overall speed of "pre-commit run --all",
from 3m20s to 55s CPU time on my local machine (32.5s to under 10s
"elapsed" time)

It also causes a small amount of churn in the bindings, because
black now sees enough context to know whether one 'def' follows another
or ends the 'def's in a 'class'. In the latter case, it adds an extra
newline, which becomes a "//|" line.

I'm less sure why a trailing comma was omitted before down in
rp2pio/StateMachine.c but let's roll with it.
This commit is contained in:
Jeff Epler 2022-09-29 19:22:32 -05:00
parent fcf7cfe838
commit 907c5d387f
No known key found for this signature in database
GPG Key ID: D5BF15AB975AB4DE
185 changed files with 427 additions and 37 deletions

View File

@ -35,6 +35,7 @@
//|
//| They are fixed by the hardware so they cannot be constructed on demand. Instead, use
//| ``samd.clock`` to reference the desired clock."""
//|
STATIC void samd_clock_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
samd_clock_obj_t *self = MP_OBJ_TO_PTR(self_in);
@ -92,6 +93,7 @@ MP_PROPERTY_GETTER(samd_clock_frequency_obj,
//| calibration: int
//| """Clock calibration. Not all clocks can be calibrated."""
//|
STATIC mp_obj_t samd_clock_get_calibration(mp_obj_t self_in) {
samd_clock_obj_t *self = MP_OBJ_TO_PTR(self_in);
return mp_obj_new_int_from_uint(clock_get_calibration(self->type, self->index));

View File

@ -98,6 +98,7 @@ MP_PROPERTY_GETTER(videocore_framebuffer_width_obj,
//| height: int
//| """The height of the display, in pixels"""
//|
STATIC mp_obj_t videocore_framebuffer_get_height(mp_obj_t self_in) {
videocore_framebuffer_obj_t *self = (videocore_framebuffer_obj_t *)self_in;
check_for_deinit(self);

View File

@ -928,6 +928,7 @@ MP_PROPERTY_GETTER(esp32_camera_camera_grab_mode_obj,
//| framebuffer_count: int
//| """True if double buffering is used"""
//|
STATIC mp_obj_t esp32_camera_camera_get_framebuffer_count(const mp_obj_t self_in) {
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
check_for_deinit(self);

View File

@ -54,6 +54,7 @@
//|
//| LATEST: GrabMode
//| """Except when 1 frame buffer is used, queue will always contain the last ``fb_count`` frames"""
//|
MAKE_ENUM_VALUE(esp32_camera_grab_mode_type, grab_mode, WHEN_EMPTY, CAMERA_GRAB_WHEN_EMPTY);
MAKE_ENUM_VALUE(esp32_camera_grab_mode_type, grab_mode, LATEST, CAMERA_GRAB_LATEST);
@ -82,6 +83,7 @@ camera_grab_mode_t validate_grab_mode(mp_obj_t obj, qstr arg_name) {
//|
//| JPEG: PixelFormat
//| """A compressed format"""
//|
MAKE_ENUM_VALUE(esp32_camera_pixel_format_type, pixel_format, RGB565, PIXFORMAT_RGB565);
MAKE_ENUM_VALUE(esp32_camera_pixel_format_type, pixel_format, GRAYSCALE, PIXFORMAT_GRAYSCALE);
@ -169,6 +171,7 @@ pixformat_t validate_pixel_format(mp_obj_t obj, qstr arg_name) {
//|
//| QSXGA: FrameSize
//| """2560x1920"""
//|
MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, R96X96, FRAMESIZE_96X96);
MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, R240X240, FRAMESIZE_240X240);
@ -237,6 +240,7 @@ framesize_t validate_frame_size(mp_obj_t obj, qstr arg_name) {
//| GAIN_32X: GainCeiling
//| GAIN_64X: GainCeiling
//| GAIN_128X: GainCeiling
//|
MAKE_ENUM_VALUE(esp32_camera_gain_ceiling_type, gain_ceiling, GAIN_2X, GAINCEILING_2X);
MAKE_ENUM_VALUE(esp32_camera_gain_ceiling_type, gain_ceiling, GAIN_4X, GAINCEILING_4X);

View File

@ -41,6 +41,7 @@
//| def heap_caps_get_total_size() -> int:
//| """Return the total size of the ESP-IDF, which includes the CircuitPython heap."""
//| ...
//|
STATIC mp_obj_t espidf_heap_caps_get_total_size(void) {
return MP_OBJ_NEW_SMALL_INT(heap_caps_get_total_size(MALLOC_CAP_8BIT));
@ -50,6 +51,7 @@ MP_DEFINE_CONST_FUN_OBJ_0(espidf_heap_caps_get_total_size_obj, espidf_heap_caps_
//| def heap_caps_get_free_size() -> int:
//| """Return total free memory in the ESP-IDF heap."""
//| ...
//|
STATIC mp_obj_t espidf_heap_caps_get_free_size(void) {
return MP_OBJ_NEW_SMALL_INT(heap_caps_get_free_size(MALLOC_CAP_8BIT));
@ -59,6 +61,7 @@ MP_DEFINE_CONST_FUN_OBJ_0(espidf_heap_caps_get_free_size_obj, espidf_heap_caps_g
//| def heap_caps_get_largest_free_block() -> int:
//| """Return the size of largest free memory block in the ESP-IDF heap."""
//| ...
//|
STATIC mp_obj_t espidf_heap_caps_get_largest_free_block(void) {
return MP_OBJ_NEW_SMALL_INT(heap_caps_get_largest_free_block(MALLOC_CAP_8BIT));
@ -70,6 +73,7 @@ MP_DEFINE_CONST_FUN_OBJ_0(espidf_heap_caps_get_largest_free_block_obj, espidf_he
//|
//| This is necessary when upgrading from CircuitPython 6.3.0 or earlier to CircuitPython 7.0.0, because the
//| layout of data in nvs has changed. The old data will be lost when you perform this operation."""
//|
STATIC mp_obj_t espidf_erase_nvs(void) {
ESP_ERROR_CHECK(nvs_flash_deinit());
ESP_ERROR_CHECK(nvs_flash_erase());
@ -105,6 +109,7 @@ const mp_obj_type_t mp_type_espidf_IDFError = {
//| """Raised when an ESP IDF memory allocation fails."""
//|
//| ...
//|
NORETURN void mp_raise_espidf_MemoryError(void) {
nlr_raise(mp_obj_new_exception(&mp_type_espidf_MemoryError));
}
@ -120,6 +125,7 @@ const mp_obj_type_t mp_type_espidf_MemoryError = {
//| def get_total_psram() -> int:
//| """Returns the number of bytes of psram detected, or 0 if psram is not present or not configured"""
//|
STATIC mp_obj_t espidf_get_total_psram(void) {
return MP_OBJ_NEW_SMALL_INT(common_hal_espidf_get_total_psram());
}
@ -127,6 +133,7 @@ MP_DEFINE_CONST_FUN_OBJ_0(espidf_get_total_psram_obj, espidf_get_total_psram);
//| def get_reserved_psram() -> int:
//| """Returns number of bytes of psram reserved for use by esp-idf, either a board-specific default value or the value defined in ``/.env``."""
//|
STATIC mp_obj_t espidf_get_reserved_psram(void) {
return MP_OBJ_NEW_SMALL_INT(common_hal_espidf_get_reserved_psram());
}

View File

@ -38,6 +38,7 @@
//| Cannot be constructed at runtime, but may be the type of a pin object
//| in :py:mod:`board`. A `CywPin` can be used as a DigitalInOut, but not with other
//| peripherals such as `PWMOut`."""
//|
const mp_obj_type_t cyw43_pin_type = {
{ &mp_type_type },
.flags = MP_TYPE_FLAG_EXTENDED,
@ -57,6 +58,7 @@ const mp_obj_type_t cyw43_pin_type = {
//| Besides this value, there appears to be no other public documentation
//| of the values that can be used.
//| """
//|
STATIC mp_obj_t cyw43_set_power_management(const mp_obj_t value_in) {
mp_int_t value = mp_obj_get_int(value_in);
cyw43_wifi_pm(&cyw43_state, value);

View File

@ -359,7 +359,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(rp2pio_statemachine_stop_obj, rp2pio_statemachine_stop
//| *,
//| start: int = 0,
//| end: Optional[int] = None,
//| swap: bool = False
//| swap: bool = False,
//| ) -> None:
//| """Write the data contained in ``buffer`` to the state machine. If the buffer is empty, nothing happens.
//|
@ -419,7 +419,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(rp2pio_statemachine_write_obj, 2, rp2pio_statemachine
//| once: Optional[ReadableBuffer] = None,
//| *,
//| loop: Optional[ReadableBuffer] = None,
//| swap: bool = False
//| swap: bool = False,
//| ) -> None:
//| """Write data to the TX fifo in the background, with optional looping.
//|
@ -564,7 +564,7 @@ const mp_obj_property_t rp2pio_statemachine_pending_obj = {
//| *,
//| start: int = 0,
//| end: Optional[int] = None,
//| swap: bool = False
//| swap: bool = False,
//| ) -> None:
//| """Read into ``buffer``. If the number of bytes to read is 0, nothing happens. The buffer
//| includes any data added to the fifo even if it was added before this was called.
@ -628,7 +628,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(rp2pio_statemachine_readinto_obj, 2, rp2pio_statemach
//| out_start: int = 0,
//| out_end: Optional[int] = None,
//| in_start: int = 0,
//| in_end: Optional[int] = None
//| in_end: Optional[int] = None,
//| ) -> None:
//| """Write out the data in ``buffer_out`` while simultaneously reading data into ``buffer_in``.
//| The lengths of the slices defined by ``buffer_out[out_start:out_end]`` and ``buffer_in[in_start:in_end]``
@ -788,6 +788,7 @@ MP_PROPERTY_GETTER(rp2pio_statemachine_rxstall_obj,
//| in_waiting: int
//| """The number of words available to readinto"""
//|
STATIC mp_obj_t rp2pio_statemachine_obj_get_in_waiting(mp_obj_t self_in) {
rp2pio_statemachine_obj_t *self = MP_OBJ_TO_PTR(self_in);

View File

@ -42,6 +42,7 @@
//| def pins_are_sequential(pins: List[microcontroller.Pin]) -> bool:
//| """Return True if the pins have sequential GPIO numbers, False otherwise"""
//| ...
//|
STATIC mp_obj_t rp2pio_pins_are_sequential(const mp_obj_t pins) {
size_t len;
mp_obj_t *items;

View File

@ -62,6 +62,7 @@
//| The Adapter can do both parts of this process: it can scan for other device
//| advertisements and it can advertise its own data. Furthermore, Adapters can accept incoming
//| connections and also initiate connections."""
//|
//| def __init__(
//| self, *, uart: busio.UART, rts: digitalio.DigitalInOut, cts: digitalio.DigitalInOut
@ -435,6 +436,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_adapter_connect_obj, 1, bleio_adapter_co
//| def erase_bonding(self) -> None:
//| """Erase all bonding information stored in flash memory."""
//| ...
//|
STATIC mp_obj_t bleio_adapter_erase_bonding(mp_obj_t self_in) {
bleio_adapter_obj_t *self = MP_OBJ_TO_PTR(self_in);

View File

@ -36,6 +36,7 @@
//| class Address:
//| """Encapsulates the address of a BLE device."""
//|
//| def __init__(self, address: ReadableBuffer, address_type: int) -> None:
//| """Create a new Address object encapsulating the address value.
@ -185,6 +186,7 @@ STATIC void bleio_address_print(const mp_print_t *print, mp_obj_t self_in, mp_pr
//|
//| RANDOM_PRIVATE_NON_RESOLVABLE: int
//| """A randomly generated address that changes on every connection."""
//|
STATIC const mp_rom_map_elem_t bleio_address_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_address_bytes), MP_ROM_PTR(&bleio_address_address_bytes_obj) },
{ MP_ROM_QSTR(MP_QSTR_type), MP_ROM_PTR(&bleio_address_type_obj) },

View File

@ -62,6 +62,7 @@ STATIC const mp_rom_map_elem_t bleio_attribute_locals_dict_table[] = {
//|
//| SIGNED_WITH_MITM: int
//| """security_mode: authenticated data signing, without man-in-the-middle protection"""
//|
{ MP_ROM_QSTR(MP_QSTR_NO_ACCESS), MP_ROM_INT(SECURITY_MODE_NO_ACCESS) },
{ MP_ROM_QSTR(MP_QSTR_OPEN), MP_ROM_INT(SECURITY_MODE_OPEN) },
{ MP_ROM_QSTR(MP_QSTR_ENCRYPT_NO_MITM), MP_ROM_INT(SECURITY_MODE_ENC_NO_MITM) },

View File

@ -301,6 +301,7 @@ STATIC const mp_rom_map_elem_t bleio_characteristic_locals_dict_table[] = {
//|
//| WRITE_NO_RESPONSE: int
//| """property: clients may write this characteristic; no response will be sent back"""
//|
{ MP_ROM_QSTR(MP_QSTR_BROADCAST), MP_ROM_INT(CHAR_PROP_BROADCAST) },
{ MP_ROM_QSTR(MP_QSTR_INDICATE), MP_ROM_INT(CHAR_PROP_INDICATE) },
{ MP_ROM_QSTR(MP_QSTR_NOTIFY), MP_ROM_INT(CHAR_PROP_NOTIFY) },

View File

@ -181,6 +181,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_characteristic_buffer_reset_input_buffer_
//| def deinit(self) -> None:
//| """Disable permanently."""
//| ...
//|
STATIC mp_obj_t bleio_characteristic_buffer_deinit(mp_obj_t self_in) {
bleio_characteristic_buffer_obj_t *self = MP_OBJ_TO_PTR(self_in);
common_hal_bleio_characteristic_buffer_deinit(self);

View File

@ -59,6 +59,7 @@
//| raise Exception("'InterestingPeripheral' not found")
//|
//| connection = _bleio.adapter.connect(my_entry.address, timeout=10)"""
//|
void bleio_connection_ensure_connected(bleio_connection_obj_t *self) {
if (!common_hal_bleio_connection_get_connected(self)) {
@ -199,6 +200,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_connection_get_connection_interval_obj, b
//| which must be sent in a single packet.
//| But for a regular characteristic read or write, may be sent in multiple packets,
//| so this limit does not apply."""
//|
STATIC mp_obj_t bleio_connection_get_max_packet_length(mp_obj_t self_in) {
bleio_connection_obj_t *self = MP_OBJ_TO_PTR(self_in);

View File

@ -166,6 +166,7 @@ MP_PROPERTY_GETTER(bleio_descriptor_characteristic_obj,
//| value: bytearray
//| """The value of this descriptor."""
//|
STATIC mp_obj_t bleio_descriptor_get_value(mp_obj_t self_in) {
bleio_descriptor_obj_t *self = MP_OBJ_TO_PTR(self_in);

View File

@ -201,6 +201,7 @@ MP_PROPERTY_GETTER(bleio_packet_buffer_incoming_packet_length_obj,
//| outgoing_packet_length: int
//| """Maximum length in bytes of a packet we are writing."""
//|
STATIC mp_obj_t bleio_packet_buffer_get_outgoing_packet_length(mp_obj_t self_in) {
bleio_packet_buffer_obj_t *self = MP_OBJ_TO_PTR(self_in);

View File

@ -39,6 +39,7 @@
//| """Encapsulates information about a device that was received during scanning. It can be
//| advertisement or scan response data. This object may only be created by a `_bleio.ScanResults`:
//| it has no user-visible constructor."""
//|
//| def __init__(self) -> None:
//| """Cannot be instantiated directly. Use `_bleio.Adapter.start_scan`."""
@ -114,6 +115,7 @@ MP_PROPERTY_GETTER(bleio_scanentry_connectable_obj,
//| scan_response: bool
//| """True if the entry was a scan response. (read-only)"""
//|
STATIC mp_obj_t scanentry_get_scan_response(mp_obj_t self_in) {
bleio_scanentry_obj_t *self = MP_OBJ_TO_PTR(self_in);
return mp_obj_new_bool(common_hal_bleio_scanentry_get_scan_response(self));

View File

@ -35,6 +35,7 @@
//| class ScanResults:
//| """Iterates over advertising data received while scanning. This object is always created
//| by a `_bleio.Adapter`: it has no user-visible constructor."""
//|
STATIC mp_obj_t scanresults_iternext(mp_obj_t self_in) {
mp_check_self(mp_obj_is_type(self_in, &bleio_scanresults_type));
bleio_scanresults_obj_t *self = MP_OBJ_TO_PTR(self_in);
@ -55,6 +56,7 @@ STATIC mp_obj_t scanresults_iternext(mp_obj_t self_in) {
//| """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."""
//| ...
//|
const mp_obj_type_t bleio_scanresults_type = {
{ &mp_type_type },

View File

@ -109,6 +109,7 @@ MP_PROPERTY_GETTER(bleio_service_secondary_obj,
//| """The UUID of this service. (read-only)
//|
//| Will be ``None`` if the 128-bit UUID for this service is not known."""
//|
STATIC mp_obj_t bleio_service_get_uuid(mp_obj_t self_in) {
bleio_service_obj_t *self = MP_OBJ_TO_PTR(self_in);

View File

@ -234,6 +234,7 @@ STATIC mp_obj_t bleio_uuid_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
//| def __eq__(self, other: object) -> bool:
//| """Two UUID objects are equal if their values match and they are both 128-bit or both 16-bit."""
//| ...
//|
STATIC mp_obj_t bleio_uuid_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
switch (op) {
// Two UUID's are equal if their uuid16 values match or their uuid128 values match.

View File

@ -63,6 +63,7 @@
//| """Catchall exception for Bluetooth related errors."""
//|
//| ...
//|
MP_DEFINE_BLEIO_EXCEPTION(BluetoothError, Exception)
NORETURN void mp_raise_bleio_BluetoothError(const compressed_string_t *fmt, ...) {
va_list argptr;
@ -77,6 +78,7 @@ NORETURN void mp_raise_bleio_BluetoothError(const compressed_string_t *fmt, ...)
//| attempted to be set but they can only be set when remote."""
//|
//| ...
//|
MP_DEFINE_BLEIO_EXCEPTION(RoleError, bleio_BluetoothError)
NORETURN void mp_raise_bleio_RoleError(const compressed_string_t *msg) {
mp_raise_msg(&mp_type_bleio_RoleError, msg);
@ -86,6 +88,7 @@ NORETURN void mp_raise_bleio_RoleError(const compressed_string_t *msg) {
//| """Raised when a security related error occurs."""
//|
//| ...
//|
MP_DEFINE_BLEIO_EXCEPTION(SecurityError, bleio_BluetoothError)
NORETURN void mp_raise_bleio_SecurityError(const compressed_string_t *fmt, ...) {
va_list argptr;
@ -115,6 +118,7 @@ STATIC mp_obj_dict_t bleio_module_globals;
//| """Set the adapter to use for BLE, such as when using an HCI adapter.
//| Raises `NotImplementedError` when the adapter is a singleton and cannot be set."""
//| ...
//|
mp_obj_t bleio_set_adapter(mp_obj_t adapter_obj) {
#if CIRCUITPY_BLEIO_HCI
if (adapter_obj != mp_const_none && !mp_obj_is_type(adapter_obj, &bleio_adapter_type)) {

View File

@ -956,6 +956,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(cmd0_obj, _cmd0);
//| This method is used by the ``eve`` module to efficiently add
//| commands to the FIFO."""
//| ...
//|
STATIC mp_obj_t _cmd(size_t n_args, const mp_obj_t *args) {
mp_obj_t self = args[0];
mp_obj_t num = args[1];

View File

@ -61,6 +61,7 @@
//| is connected to the common side of all buttons (the other sides of the
//| buttons are connected to rows of the matrix)."""
//| ...
//|
STATIC mp_obj_t pewpew_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
enum { ARG_buffer, ARG_rows, ARG_cols, ARG_buttons };
static const mp_arg_t allowed_args[] = {

View File

@ -109,6 +109,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(layer_move_obj, layer_move);
//| """Set the animation frame of the sprite, and optionally rotation its
//| graphic."""
//| ...
//|
STATIC mp_obj_t layer_frame(mp_obj_t self_in, mp_obj_t frame_in,
mp_obj_t rotation_in) {
layer_obj_t *self = MP_OBJ_TO_PTR(self_in);

View File

@ -91,6 +91,7 @@ STATIC mp_obj_t text_make_new(const mp_obj_type_t *type, size_t n_args,
//| def move(self, x: int, y: int) -> None:
//| """Set the offset of the text to the specified values."""
//| ...
//|
STATIC mp_obj_t text_move(mp_obj_t self_in, mp_obj_t x_in, mp_obj_t y_in) {
text_obj_t *self = MP_OBJ_TO_PTR(self_in);
self->x = mp_obj_get_int(x_in);

View File

@ -69,6 +69,7 @@
//|
//| This function is intended for internal use in the ``stage`` library
//| and all the necessary checks are performed there."""
//|
STATIC mp_obj_t stage_render(size_t n_args, const mp_obj_t *args) {
uint16_t x0 = mp_obj_get_int(args[0]);
uint16_t y0 = mp_obj_get_int(args[1]);

View File

@ -231,6 +231,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(adafruit_bus_device_i2cdevice_write_obj, 1, adafruit_
//| :param int in_end: end of ``in_buffer slice``; if not specified, use ``len(in_buffer)``
//| """
//| ...
//|
STATIC mp_obj_t adafruit_bus_device_i2cdevice_write_then_readinto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_out_buffer, ARG_in_buffer, ARG_out_start, ARG_out_end, ARG_in_start, ARG_in_end };
static const mp_arg_t allowed_args[] = {

View File

@ -127,6 +127,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(adafruit_bus_device_spidevice___enter___obj, ad
//| """Ends a SPI transaction by deasserting chip select. See
//| :ref:`lifetime-and-contextmanagers` for more info."""
//| ...
//|
STATIC mp_obj_t adafruit_bus_device_spidevice_obj___exit__(size_t n_args, const mp_obj_t *args) {
common_hal_adafruit_bus_device_spidevice_exit(MP_OBJ_TO_PTR(args[0]));
return mp_const_none;

View File

@ -296,6 +296,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(pixelbuf_pixelbuf_fill_obj, pixelbuf_pixelbuf_f
//| For RGBW byteorders, if given only RGB values either as an int or as a tuple, the white value
//| is used instead when the red, green, and blue values are the same."""
//| ...
//|
STATIC mp_obj_t pixelbuf_pixelbuf_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t value) {
if (value == MP_OBJ_NULL) {
// delete item

View File

@ -193,6 +193,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(aesio_aes_encrypt_into_obj,
//| buffers must be a multiple of 16 bytes, and must be equal length. For
//| CTX mode, there are no restrictions."""
//| ...
//|
STATIC mp_obj_t aesio_aes_decrypt_into(mp_obj_t aesio_obj, mp_obj_t src,
mp_obj_t dest) {
if (!mp_obj_is_type(aesio_obj, &aesio_aes_type)) {

View File

@ -48,6 +48,7 @@
//| alarm.sleep_memory[0] = True
//| alarm.sleep_memory[1] = 12
//| """
//|
//| def __init__(self) -> None:
//| """Not used. Access the sole instance through `alarm.sleep_memory`."""
@ -90,6 +91,7 @@ STATIC MP_DEFINE_CONST_DICT(alarm_sleep_memory_locals_dict, alarm_sleep_memory_l
//| def __setitem__(self, index: int, value: int) -> None:
//| """Set the value at the given index."""
//| ...
//|
STATIC mp_obj_t alarm_sleep_memory_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t value) {
if (value == MP_OBJ_NULL) {
// delete item

View File

@ -99,6 +99,7 @@ STATIC void validate_objs_are_alarms(size_t n_args, const mp_obj_t *objs) {
//| it may be necessary to disconnect from the host.
//| """
//| ...
//|
STATIC mp_obj_t alarm_light_sleep_until_alarms(size_t n_args, const mp_obj_t *args) {
if (n_args == 0) {
return mp_const_none;
@ -172,6 +173,7 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(alarm_light_sleep_until_alarms_obj, 1, MP_OB
//| alarm.exit_and_deep_sleep_until_alarms(time_alarm, pin_alarm)
//| """
//| ...
//|
STATIC mp_obj_t alarm_exit_and_deep_sleep_until_alarms(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_preserve_dios };
static const mp_arg_t allowed_args[] = {

View File

@ -102,6 +102,7 @@ MP_PROPERTY_GETTER(alarm_pin_pinalarm_pin_obj,
//| value: bool
//| """The value on which to trigger."""
//|
STATIC mp_obj_t alarm_pin_pinalarm_obj_get_value(mp_obj_t self_in) {
alarm_pin_pinalarm_obj_t *self = MP_OBJ_TO_PTR(self_in);
return mp_obj_new_bool(common_hal_alarm_pin_pinalarm_get_value(self));

View File

@ -117,6 +117,7 @@ STATIC mp_obj_t alarm_time_timealarm_make_new(const mp_obj_type_t *type,
//| The time may be given as ``epoch_time`` in the constructor, but it is returned
//| by this property only as a `time.monotonic()` time.
//| """
//|
STATIC mp_obj_t alarm_time_timealarm_obj_get_monotonic_time(mp_obj_t self_in) {
alarm_time_timealarm_obj_t *self = MP_OBJ_TO_PTR(self_in);
return mp_obj_new_float(common_hal_alarm_time_timealarm_get_monotonic_time(self));

View File

@ -63,6 +63,7 @@ STATIC mp_obj_t alarm_touch_touchalarm_make_new(const mp_obj_type_t *type,
//| pin: microcontroller.Pin
//| """The trigger pin."""
//|
STATIC mp_obj_t alarm_touch_touchalarm_obj_get_pin(mp_obj_t self_in) {
alarm_touch_touchalarm_obj_t *self = MP_OBJ_TO_PTR(self_in);
return MP_OBJ_FROM_PTR(self->pin);

View File

@ -58,6 +58,7 @@
//| (TODO) The reference voltage varies by platform so use
//| ``reference_voltage`` to read the configured setting.
//| (TODO) Provide mechanism to read CPU Temperature."""
//|
//| def __init__(
//| self, pin: microcontroller.Pin, buffer: WriteableBuffer, *, sample_rate: int = 500000
@ -155,6 +156,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(analogbufio_bufferedin___exit___obj,
//| def read(self) -> None:
//| """Fills the provided buffer with ADC voltage values."""
//| ...
//|
STATIC mp_obj_t analogbufio_bufferedin_obj_read(mp_obj_t self_in) {
analogbufio_bufferedin_obj_t *self = MP_OBJ_TO_PTR(self_in);
check_for_deinit(self);

View File

@ -46,6 +46,7 @@
//|
//| adc = analogio.AnalogIn(A1)
//| val = adc.value"""
//|
//| def __init__(self, pin: microcontroller.Pin) -> None:
//| """Use the AnalogIn on the given pin. The reference voltage varies by
@ -118,6 +119,7 @@ MP_PROPERTY_GETTER(analogio_analogin_value_obj,
//| """The maximum voltage measurable (also known as the reference voltage) as a
//| `float` in Volts. Note the ADC value may not scale to the actual voltage linearly
//| at ends of the analog range."""
//|
STATIC mp_obj_t analogio_analogin_obj_get_reference_voltage(mp_obj_t self_in) {
analogio_analogin_obj_t *self = MP_OBJ_TO_PTR(self_in);
check_for_deinit(self);

View File

@ -98,6 +98,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(analogio_analogout___exit___obj, 4, 4
//|
//| Even if the underlying digital to analog converter (DAC) is lower
//| resolution, the value is 16-bit."""
//|
STATIC mp_obj_t analogio_analogout_obj_set_value(mp_obj_t self_in, mp_obj_t value) {
analogio_analogout_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (common_hal_analogio_analogout_deinited(self)) {

View File

@ -57,6 +57,7 @@
//|
//| """
//| ...
//|
STATIC mp_obj_t atexit_register(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
shared_module_atexit_register(pos_args[0], (n_args - 1), ((n_args > 1) ? &pos_args[1] : NULL), kw_args);
return pos_args[0];
@ -72,6 +73,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(atexit_register_obj, 1, atexit_register);
//|
//| """
//| ...
//|
STATIC mp_obj_t atexit_unregister(const mp_obj_t self_in) {
shared_module_atexit_unregister(&self_in);
return mp_const_none;

View File

@ -238,6 +238,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(audiobusio_i2sout_resume_obj, audiobusio_i2sout_obj_re
//| paused: bool
//| """True when playback is paused. (read-only)"""
//|
STATIC mp_obj_t audiobusio_i2sout_obj_get_paused(mp_obj_t self_in) {
audiobusio_i2sout_obj_t *self = MP_OBJ_TO_PTR(self_in);
check_for_deinit(self);

View File

@ -220,6 +220,7 @@ MP_DEFINE_CONST_FUN_OBJ_3(audiobusio_pdmin_record_obj, audiobusio_pdmin_obj_reco
//| sample_rate: int
//| """The actual sample_rate of the recording. This may not match the constructed
//| sample rate due to internal clock limitations."""
//|
STATIC mp_obj_t audiobusio_pdmin_obj_get_sample_rate(mp_obj_t self_in) {
audiobusio_pdmin_obj_t *self = MP_OBJ_TO_PTR(self_in);
check_for_deinit(self);

View File

@ -135,6 +135,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audioio_rawsample___exit___obj, 4, 4,
//| 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
//| change it."""
//|
STATIC mp_obj_t audioio_rawsample_obj_get_sample_rate(mp_obj_t self_in) {
audioio_rawsample_obj_t *self = MP_OBJ_TO_PTR(self_in);
check_for_deinit(self);

View File

@ -165,6 +165,7 @@ MP_PROPERTY_GETTER(audioio_wavefile_bits_per_sample_obj,
(mp_obj_t)&audioio_wavefile_get_bits_per_sample_obj);
//| channel_count: int
//| """Number of audio channels. (read only)"""
//|
STATIC mp_obj_t audioio_wavefile_obj_get_channel_count(mp_obj_t self_in) {
audioio_wavefile_obj_t *self = MP_OBJ_TO_PTR(self_in);
check_for_deinit(self);

View File

@ -231,6 +231,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(audioio_audioout_resume_obj, audioio_audioout_obj_resu
//| paused: bool
//| """True when playback is paused. (read-only)"""
//|
STATIC mp_obj_t audioio_audioout_obj_get_paused(mp_obj_t self_in) {
audioio_audioout_obj_t *self = MP_OBJ_TO_PTR(self_in);
check_for_deinit(self);

View File

@ -228,6 +228,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(audiomixer_mixer_play_obj, 1, audiomixer_mixer_obj_pl
//| def stop_voice(self, voice: int = 0) -> None:
//| """Stops playback of the sample on the given voice."""
//| ...
//|
STATIC mp_obj_t audiomixer_mixer_obj_stop_voice(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_voice };
static const mp_arg_t allowed_args[] = {

View File

@ -132,6 +132,7 @@ MP_PROPERTY_GETSET(audiomixer_mixervoice_level_obj,
//| playing: bool
//| """True when this voice is being output. (read-only)"""
//|
STATIC mp_obj_t audiomixer_mixervoice_obj_get_playing(mp_obj_t self_in) {
audiomixer_mixervoice_obj_t *self = MP_OBJ_TO_PTR(self_in);

View File

@ -248,6 +248,7 @@ MP_PROPERTY_GETTER(audiomp3_mp3file_rms_level_obj,
//| samples_decoded: int
//| """The number of audio samples decoded from the current file. (read only)"""
//|
STATIC mp_obj_t audiomp3_mp3file_obj_get_samples_decoded(mp_obj_t self_in) {
audiomp3_mp3file_obj_t *self = MP_OBJ_TO_PTR(self_in);
check_for_deinit(self);

View File

@ -233,6 +233,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(audiopwmio_pwmaudioout_resume_obj, audiopwmio_pwmaudio
//| paused: bool
//| """True when playback is paused. (read-only)"""
//|
STATIC mp_obj_t audiopwmio_pwmaudioout_obj_get_paused(mp_obj_t self_in) {
audiopwmio_pwmaudioout_obj_t *self = MP_OBJ_TO_PTR(self_in);
check_for_deinit(self);

View File

@ -310,6 +310,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bitbangio_i2c_writeto_obj, 1, bitbangio_i2c_wr
//| :param int in_end: end of ``in_buffer slice``; if not specified, use ``len(in_buffer)``
//| """
//| ...
//|
STATIC mp_obj_t bitbangio_i2c_writeto_then_readfrom(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_address, ARG_out_buffer, ARG_in_buffer, ARG_out_start, ARG_out_end, ARG_in_start, ARG_in_end };
static const mp_arg_t allowed_args[] = {

View File

@ -317,6 +317,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(bitbangio_spi_readinto_obj, 1, bitbangio_spi_readinto
//| :param int in_end: end of ``in_buffer slice``; if not specified, use ``len(in_buffer)``
//| """
//| ...
//|
STATIC mp_obj_t bitbangio_spi_write_readinto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_out_buffer, ARG_in_buffer, ARG_out_start, ARG_out_end, ARG_in_start, ARG_in_end };
static const mp_arg_t allowed_args[] = {

View File

@ -173,6 +173,7 @@ STATIC void validate_clip_region(displayio_bitmap_t *bitmap, mp_obj_t clip0_tupl
//| :param int skip_index: Bitmap palette index in the source that will not be copied,
//| set to None to copy all pixels"""
//| ...
//|
STATIC mp_obj_t bitmaptools_obj_rotozoom(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum {ARG_dest_bitmap, ARG_source_bitmap,
ARG_ox, ARG_oy, ARG_dest_clip0, ARG_dest_clip1,
@ -295,6 +296,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(bitmaptools_rotozoom_obj, 0, bitmaptools_obj_rotozoom
//|
//| For the L8 colorspace, the bitmaps must have a bits-per-value of 8.
//| For the RGB colorspaces, they must have a bits-per-value of 16."""
//|
STATIC mp_obj_t bitmaptools_alphablend(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum {ARG_dest_bitmap, ARG_source_bitmap_1, ARG_source_bitmap_2, ARG_colorspace, ARG_factor_1, ARG_factor_2};
@ -369,6 +371,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(bitmaptools_alphablend_obj, 0, bitmaptools_alphablend
//| :param int value: Bitmap palette index that will be written into the rectangular
//| fill region in the destination bitmap"""
//| ...
//|
STATIC mp_obj_t bitmaptools_obj_fill_region(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum {ARG_dest_bitmap, ARG_x1, ARG_y1, ARG_x2, ARG_y2, ARG_value};
@ -422,6 +425,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(bitmaptools_fill_region_obj, 0, bitmaptools_obj_fill_
//| :param int replaced_color_value: Bitmap palette index that will filled with the
//| value color in the enclosed area in the destination bitmap"""
//| ...
//|
STATIC mp_obj_t bitmaptools_obj_boundary_fill(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum {ARG_dest_bitmap, ARG_x, ARG_y, ARG_fill_color_value, ARG_replaced_color_value};
@ -481,6 +485,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(bitmaptools_boundary_fill_obj, 0, bitmaptools_obj_bou
//| :param int value: Bitmap palette index that will be written into the
//| line in the destination bitmap"""
//| ...
//|
STATIC mp_obj_t bitmaptools_obj_draw_line(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum {ARG_dest_bitmap, ARG_x1, ARG_y1, ARG_x2, ARG_y2, ARG_value};
@ -560,6 +565,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(bitmaptools_draw_line_obj, 0, bitmaptools_obj_draw_li
//| set to None to copy all pixels
//| """
//| ...
//|
STATIC mp_obj_t bitmaptools_arrayblit(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_bitmap, ARG_data, ARG_x1, ARG_y1, ARG_x2, ARG_y2, ARG_skip_index };
static const mp_arg_t allowed_args[] = {
@ -632,6 +638,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(bitmaptools_arrayblit_obj, 0, bitmaptools_arrayblit);
//| :param bool reverse_rows: Reverse the direction of the row loading (required for some bitmap images).
//| """
//| ...
//|
STATIC mp_obj_t bitmaptools_readinto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_bitmap, ARG_file, ARG_bits_per_pixel, ARG_element_size, ARG_reverse_pixels_in_element, ARG_swap_bytes_in_element, ARG_reverse_rows };
@ -693,6 +700,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(bitmaptools_readinto_obj, 0, bitmaptools_readinto);
//|
//| FloydStenberg: "DitherAlgorithm"
//| """The Floyd-Stenberg dither"""
//|
MAKE_ENUM_VALUE(bitmaptools_dither_algorithm_type, dither_algorithm, Atkinson, DITHER_ALGORITHM_ATKINSON);
MAKE_ENUM_VALUE(bitmaptools_dither_algorithm_type, dither_algorithm, FloydStenberg, DITHER_ALGORITHM_FLOYD_STENBERG);
@ -720,6 +728,7 @@ MAKE_ENUM_TYPE(bitmaptools, DitherAlgorithm, bitmaptools_dither_algorithm);
//| :param algorithm: The dither algorithm to use, one of the `DitherAlgorithm` values.
//| """
//| ...
//|
STATIC mp_obj_t bitmaptools_dither(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_dest_bitmap, ARG_source_bitmap, ARG_source_colorspace, ARG_algorithm };
static const mp_arg_t allowed_args[] = {

View File

@ -53,6 +53,7 @@
//|
//| Returns the output buffer."""
//| ...
//|
STATIC mp_obj_t bit_transpose(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_input, ARG_output, ARG_width };

View File

@ -63,6 +63,7 @@
//| """Returns the `busio.I2C` object for the board's designated I2C bus(es).
//| The object created is a singleton, and uses the default parameter values for `busio.I2C`."""
//| ...
//|
#if CIRCUITPY_BOARD_I2C
STATIC mp_obj_t board_i2c_0(void) {
return common_hal_board_create_i2c(0);
@ -79,6 +80,7 @@ MP_DEFINE_CONST_FUN_OBJ_0(board_i2c_obj, board_i2c_0);
//| """Returns the `busio.SPI` object for the board's designated SPI bus(es).
//| The object created is a singleton, and uses the default parameter values for `busio.SPI`."""
//| ...
//|
#if CIRCUITPY_BOARD_SPI
STATIC mp_obj_t board_spi_0(void) {
return common_hal_board_create_spi(0);
@ -95,6 +97,7 @@ MP_DEFINE_CONST_FUN_OBJ_0(board_spi_obj, board_spi_0);
//| """Returns the `busio.UART` object for the board's designated UART bus(es).
//| The object created is a singleton, and uses the default parameter values for `busio.UART`."""
//| ...
//|
#if CIRCUITPY_BOARD_UART
STATIC mp_obj_t board_uart_0(void) {
return common_hal_board_create_uart(0);

View File

@ -311,6 +311,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(busio_i2c_writeto_obj, 1, busio_i2c_writeto);
//| :param int in_end: end of ``in_buffer slice``; if not specified, use ``len(in_buffer)``
//| """
//| ...
//|
STATIC mp_obj_t busio_i2c_writeto_then_readfrom(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_address, ARG_out_buffer, ARG_in_buffer, ARG_out_start, ARG_out_end, ARG_in_start, ARG_in_end };
static const mp_arg_t allowed_args[] = {

View File

@ -421,6 +421,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(busio_spi_write_readinto_obj, 1, busio_spi_write_read
//| frequency: int
//| """The actual SPI bus frequency. This may not match the frequency requested
//| due to internal limitations."""
//|
STATIC mp_obj_t busio_spi_obj_get_frequency(mp_obj_t self_in) {
busio_spi_obj_t *self = MP_OBJ_TO_PTR(self_in);

View File

@ -353,6 +353,7 @@ MP_PROPERTY_GETSET(busio_uart_timeout_obj,
//| def reset_input_buffer(self) -> None:
//| """Discard any unread characters in the input buffer."""
//| ...
//|
STATIC mp_obj_t busio_uart_obj_reset_input_buffer(mp_obj_t self_in) {
busio_uart_obj_t *self = native_uart(self_in);
check_for_deinit(self);
@ -370,6 +371,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(busio_uart_reset_input_buffer_obj, busio_uart_o
//|
//| EVEN: int
//| """Total number of ones should be even."""
//|
const mp_obj_type_t busio_uart_parity_type;
const busio_uart_parity_obj_t busio_uart_parity_odd_obj = {

View File

@ -55,6 +55,7 @@
//| size = cam.take_picture(buffer, width=1920, height=1080, format=camera.ImageFormat.JPG)
//| file.write(buffer, size)
//| file.close()"""
//|
//| def __init__(self) -> None:
//| """Initialize camera."""
@ -92,6 +93,7 @@ STATIC void check_for_deinit(camera_obj_t *self) {
//| :return: the number of bytes written into buf
//| :rtype: int"""
//| ...
//|
STATIC mp_obj_t camera_obj_take_picture(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_buffer, ARG_width, ARG_height, ARG_format };
static const mp_arg_t allowed_args[] = {

View File

@ -36,6 +36,7 @@
//|
//| RGB565: ImageFormat
//| """RGB565 format."""
//|
const camera_imageformat_obj_t camera_imageformat_jpg_obj = {
{ &camera_imageformat_type },

View File

@ -323,6 +323,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(canio_can_enter_obj, canio_can_enter);
//| ) -> None:
//| """Calls deinit()"""
//| ...
//|
STATIC mp_obj_t canio_can_exit(size_t num_args, const mp_obj_t args[]) {
canio_can_obj_t *self = MP_OBJ_TO_PTR(args[0]);
common_hal_canio_can_deinit(self);

View File

@ -41,6 +41,7 @@
//| the `in_waiting` method to check for an available message, a
//| listener can be used as an iterable, yielding messages until no
//| message arrives within ``self.timeout`` seconds."""
//|
//| def receive(self) -> Optional[Union[RemoteTransmissionRequest, Message]]:
//| """Reads a message, after waiting up to ``self.timeout`` seconds
@ -133,6 +134,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(canio_listener_exit_obj, 4, 4, canio_
//| timeout: float
//|
STATIC mp_obj_t canio_listener_timeout_get(mp_obj_t self_in) {
canio_listener_obj_t *self = MP_OBJ_TO_PTR(self_in);
common_hal_canio_listener_check_for_deinit(self);

View File

@ -96,6 +96,7 @@ MP_PROPERTY_GETTER(canio_match_mask_obj,
//| extended: bool
//| """True to match extended ids, False to match standard ides"""
//|
STATIC mp_obj_t canio_match_extended_get(mp_obj_t self_in) {
canio_match_obj_t *self = self_in;

View File

@ -111,6 +111,7 @@ MP_PROPERTY_GETSET(canio_message_data_obj,
//| extended: bool
//| """True if the message's id is an extended id"""
//|
STATIC mp_obj_t canio_message_extended_get(const mp_obj_t self_in) {
canio_message_obj_t *self = self_in;
return mp_obj_new_bool(common_hal_canio_message_get_extended(self));

View File

@ -106,6 +106,7 @@ MP_PROPERTY_GETSET(canio_remote_transmission_request_extended_obj,
//| length: int
//| """The length of the requested message."""
//|
STATIC mp_obj_t canio_remote_transmission_request_length_get(const mp_obj_t self_in) {
canio_remote_transmission_request_obj_t *self = self_in;
return MP_OBJ_NEW_SMALL_INT(common_hal_canio_remote_transmission_request_get_length(self));

View File

@ -96,6 +96,7 @@ MAKE_ENUM_VALUE(canio_bus_state_type, bus_state, BUS_OFF, BUS_STATE_OFF);
//| """The bus has turned off due to the number of errors that have
//| occurred recently. It must be restarted before it will send or receive
//| packets. This device will neither send or acknowledge packets on the bus."""
//|
MAKE_ENUM_MAP(canio_bus_state) {
MAKE_ENUM_MAP_ENTRY(bus_state, ERROR_ACTIVE),
MAKE_ENUM_MAP_ENTRY(bus_state, ERROR_PASSIVE),

View File

@ -120,6 +120,7 @@ MP_PROPERTY_GETSET(countio_counter_count_obj,
//| def reset(self) -> None:
//| """Resets the count back to 0."""
//|
STATIC mp_obj_t countio_counter_reset(mp_obj_t self_in) {
countio_counter_obj_t *self = MP_OBJ_TO_PTR(self_in);
check_for_deinit(self);

View File

@ -48,6 +48,7 @@ MAKE_ENUM_VALUE(countio_edge_type, edge, RISE_AND_FALL, EDGE_RISE_AND_FALL);
//|
//| RISE_AND_FALL: Edge
//| """Count the rising and falling edges."""
//|
MAKE_ENUM_MAP(countio_edge) {
MAKE_ENUM_MAP_ENTRY(edge, RISE),
MAKE_ENUM_MAP_ENTRY(edge, FALL),

View File

@ -310,6 +310,7 @@ MP_PROPERTY_GETSET(digitalio_digitalio_drive_mode_obj,
//| - `None`
//|
//| :raises AttributeError: if `direction` is :py:data:`~digitalio.Direction.OUTPUT`."""
//|
STATIC mp_obj_t digitalio_digitalinout_obj_get_pull(mp_obj_t self_in) {
digitalio_digitalinout_obj_t *self = MP_OBJ_TO_PTR(self_in);
check_for_deinit(self);

View File

@ -50,6 +50,7 @@
//|
//| OUTPUT: Direction
//| """Write digital data out"""
//|
const mp_obj_type_t digitalio_direction_type;
const digitalio_direction_obj_t digitalio_direction_input_obj = {

View File

@ -39,6 +39,7 @@
//| OPEN_DRAIN: DriveMode
//| """Output low digital values but go into high z for digital high. This is
//| useful for i2c and other protocols that share a digital line."""
//|
const mp_obj_type_t digitalio_drive_mode_type;
const digitalio_drive_mode_obj_t digitalio_drive_mode_push_pull_obj = {

View File

@ -42,6 +42,7 @@
//| DOWN: Pull
//| """When the input line isn't being driven the pull down can pull the
//| state of the line low so it reads as false."""
//|
const mp_obj_type_t digitalio_pull_type;
const digitalio_pull_obj_t digitalio_pull_up_obj = {

View File

@ -318,6 +318,7 @@ MP_DEFINE_CONST_FUN_OBJ_2(displayio_bitmap_fill_obj, displayio_bitmap_obj_fill);
//| notified of the "dirty rectangle" that encloses all modified
//| pixels."""
//| ...
//|
STATIC mp_obj_t displayio_bitmap_obj_dirty(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
displayio_bitmap_t *self = MP_OBJ_TO_PTR(pos_args[0]);
enum { ARG_x1, ARG_y1, ARG_x2, ARG_y2 };

View File

@ -121,6 +121,7 @@ MP_DEFINE_CONST_FUN_OBJ_2(displayio_colorconverter_make_transparent_obj, display
//| """Make the ColorConverter be opaque and have no transparent pixels.
//|
//| :param int color: [IGNORED] Use any value"""
//|
STATIC mp_obj_t displayio_colorconverter_make_opaque(mp_obj_t self_in, mp_obj_t transparent_color_obj) {
displayio_colorconverter_t *self = MP_OBJ_TO_PTR(self_in);

View File

@ -58,6 +58,7 @@ MAKE_ENUM_VALUE(displayio_colorspace_type, displayio_colorspace, L8, DISPLAYIO_C
//|
//| RGB555_SWAPPED: Colorspace
//| """The swapped 15-bit colorspace. First, the high and low 8 bits of the number are swapped, then they are interpreted as for RGB555"""
//|
MAKE_ENUM_MAP(displayio_colorspace) {
MAKE_ENUM_MAP_ENTRY(displayio_colorspace, RGB888),
MAKE_ENUM_MAP_ENTRY(displayio_colorspace, RGB565),

View File

@ -433,6 +433,7 @@ MP_PROPERTY_GETTER(displayio_display_root_group_obj,
//| :param int y: The top edge of the area
//| :param ~circuitpython_typing.WriteableBuffer buffer: The buffer in which to place the pixel data"""
//| ...
//|
STATIC mp_obj_t displayio_display_obj_fill_row(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_y, ARG_buffer };
static const mp_arg_t allowed_args[] = {

View File

@ -339,6 +339,7 @@ MP_PROPERTY_GETSET(displayio_epaperdisplay_rotation_obj,
//| bus: _DisplayBus
//| """The bus being used by the display"""
//|
STATIC mp_obj_t displayio_epaperdisplay_obj_get_bus(mp_obj_t self_in) {
displayio_epaperdisplay_obj_t *self = native_display(self_in);
return common_hal_displayio_epaperdisplay_get_bus(self);

View File

@ -126,6 +126,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(displayio_fourwire_reset_obj, displayio_fourwire_obj_r
//| """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."""
//| ...
//|
STATIC mp_obj_t displayio_fourwire_obj_send(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_command, ARG_data, ARG_toggle_every_byte };
static const mp_arg_t allowed_args[] = {

View File

@ -315,6 +315,7 @@ STATIC mp_obj_t group_subscr(mp_obj_t self_in, mp_obj_t index_obj, mp_obj_t valu
//| def sort(self, key: function, reverse: bool) -> None:
//| """Sort the members of the group."""
//| ...
//|
STATIC mp_obj_t displayio_group_obj_sort(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
displayio_group_t *self = native_group(pos_args[0]);
mp_obj_t *args = m_new(mp_obj_t, n_args);

View File

@ -100,6 +100,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(displayio_i2cdisplay_reset_obj, displayio_i2cdisplay_o
//| """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."""
//| ...
//|
STATIC mp_obj_t displayio_i2cdisplay_obj_send(mp_obj_t self, mp_obj_t command_obj, mp_obj_t data_obj) {
mp_int_t command_int = mp_obj_get_int(command_obj);
mp_arg_validate_int_range(command_int, 0, 255, MP_QSTR_command);

View File

@ -126,6 +126,7 @@ MP_PROPERTY_GETTER(displayio_ondiskbitmap_height_obj,
//| """The image's pixel_shader. The type depends on the underlying
//| bitmap's structure. The pixel shader can be modified (e.g., to set the
//| transparent pixel or, for palette shaded images, to update the palette.)"""
//|
STATIC mp_obj_t displayio_ondiskbitmap_obj_get_pixel_shader(mp_obj_t self_in) {
displayio_ondiskbitmap_t *self = MP_OBJ_TO_PTR(self_in);
return common_hal_displayio_ondiskbitmap_get_pixel_shader(self);

View File

@ -173,6 +173,7 @@ MP_DEFINE_CONST_FUN_OBJ_2(displayio_palette_make_opaque_obj, displayio_palette_o
//| def is_transparent(self, palette_index: int) -> bool:
//| """Returns `True` if the palette index is transparent. Returns `False` if opaque."""
//| ...
//|
STATIC mp_obj_t displayio_palette_obj_is_transparent(mp_obj_t self_in, mp_obj_t palette_index_obj) {
displayio_palette_t *self = MP_OBJ_TO_PTR(self_in);

View File

@ -77,6 +77,7 @@ STATIC mp_obj_t displayio_shape_make_new(const mp_obj_type_t *type, size_t n_arg
//| def set_boundary(self, y: int, start_x: int, end_x: int) -> None:
//| """Loads pre-packed data into the given row."""
//| ...
//|
STATIC mp_obj_t displayio_shape_obj_set_boundary(size_t n_args, const mp_obj_t *args) {
(void)n_args;
displayio_shape_t *self = MP_OBJ_TO_PTR(args[0]);

View File

@ -446,6 +446,7 @@ MP_PROPERTY_GETSET(displayio_tilegrid_bitmap_obj,
//|
//| grid[0,0] = 10"""
//| ...
//|
STATIC mp_obj_t tilegrid_subscr(mp_obj_t self_in, mp_obj_t index_obj, mp_obj_t value_obj) {
displayio_tilegrid_t *self = native_tilegrid(self_in);

View File

@ -57,6 +57,7 @@
//| """
//| import paralleldisplay
//|
//| def release_displays() -> None:
//| """Releases any actively used displays so their busses and pins can be used again. This will also
@ -66,6 +67,7 @@
//| Use this once in your code.py if you initialize a display. Place it right before the
//| initialization so the display is active as long as possible."""
//| ...
//|
STATIC mp_obj_t displayio_release_displays(void) {
common_hal_displayio_release_displays();
return mp_const_none;

View File

@ -62,6 +62,7 @@
//| """
//|
//| import typing
//|
//| def get_key(dotenv_path: str, key_to_get: str) -> Optional[str]:
//| """Get the value for the given key from the given .env file. If the key occurs multiple
@ -69,6 +70,7 @@
//|
//| Returns None if the key isn't found or doesn't have a value."""
//| ...
//|
STATIC mp_obj_t _dotenv_get_key(mp_obj_t path_in, mp_obj_t key_to_get_in) {
return common_hal_dotenv_get_key(mp_obj_str_get_str(path_in),
mp_obj_str_get_str(key_to_get_in));
@ -81,6 +83,7 @@ MP_DEFINE_CONST_FUN_OBJ_2(dotenv_get_key_obj, _dotenv_get_key);
//|
//| Present in CircuitPython so CPython-compatible code can use it without error."""
//| ...
//|
STATIC mp_obj_t dotenv_load_dotenv(void) {
return mp_const_none;
}

View File

@ -62,6 +62,7 @@
//| in small chunks.
//| """
//| ...
//|
STATIC mp_obj_t dualbank_flash(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_buffer, ARG_offset };
static const mp_arg_t allowed_args[] = {
@ -91,6 +92,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(dualbank_flash_obj, 0, dualbank_flash);
//| just switched over to.
//| """
//| ...
//|
STATIC mp_obj_t dualbank_switch(void) {
common_hal_dualbank_switch();
return mp_const_none;

View File

@ -50,6 +50,7 @@
//| :return: The actual number of bytes of read
//| """
//| ...
//|
STATIC mp_obj_t floppyio_flux_readinto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_buffer, ARG_data, ARG_index };
static const mp_arg_t allowed_args[] = {
@ -86,6 +87,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(floppyio_flux_readinto_obj, 0, floppyio_flux_readinto
//| :return: The actual number of sectors read
//| """
//| ...
//|
STATIC mp_obj_t floppyio_mfm_readinto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_buffer, ARG_data, ARG_index };
static const mp_arg_t allowed_args[] = {

View File

@ -53,6 +53,7 @@
//|
//| If the code point is not present in the font, `None` is returned."""
//| pass
//|
//| class BuiltinFont:
//| """A font built into CircuitPython"""
@ -90,6 +91,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(fontio_builtinfont_get_bounding_box_obj, fontio_builti
//| def get_glyph(self, codepoint: int) -> Glyph:
//| """Returns a `fontio.Glyph` for the given codepoint or None if no glyph is available."""
//| ...
//|
STATIC mp_obj_t fontio_builtinfont_obj_get_glyph(mp_obj_t self_in, mp_obj_t codepoint_obj) {
fontio_builtinfont_t *self = MP_OBJ_TO_PTR(self_in);

View File

@ -53,6 +53,7 @@
//| :param shift_x: the x difference to the next glyph
//| :param shift_y: the y difference to the next glyph"""
//| ...
//|
const mp_obj_namedtuple_type_t fontio_glyph_type = {
.base = {
.base = {

View File

@ -321,6 +321,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(framebufferio_framebufferdisplay_fill_row_obj, 1, fra
//| root_group: displayio.Group
//| """The root group on the display."""
//|
STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_root_group(mp_obj_t self_in) {
framebufferio_framebufferdisplay_obj_t *self = native_display(self_in);
return common_hal_framebufferio_framebufferdisplay_get_root_group(self);

View File

@ -192,6 +192,7 @@ MP_PROPERTY_GETSET(frequencyio_frequencyin_capture_period_obj,
//| def __get__(self, index: int) -> int:
//| """Returns the value of the last frequency captured."""
//| ...
//|
STATIC mp_obj_t frequencyio_frequencyin_obj_get_value(mp_obj_t self_in) {
frequencyio_frequencyin_obj_t *self = MP_OBJ_TO_PTR(self_in);
check_for_deinit(self);

View File

@ -43,6 +43,7 @@
//|
//| """
//| ...
//|
STATIC mp_obj_t getpass_getpass(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_prompt, ARG_stream };
static const mp_arg_t allowed_args[] = {

View File

@ -122,6 +122,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(gifio_gifwriter_deinit_obj, gifio_gifwriter_deinit);
//| :param delay: The frame delay in seconds. The GIF format rounds this to the nearest 1/100 second, and the largest permitted value is 655 seconds.
//| """
//| ...
//|
static mp_obj_t gifio_gifwriter_add_frame(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_bitmap, ARG_delay };
static const mp_arg_t allowed_args[] = {

View File

@ -29,6 +29,7 @@
//| continue
//| print("Latitude: {0:.6f} degrees".format(nav.latitude))
//| print("Longitude: {0:.6f} degrees".format(nav.longitude))"""
//|
//| def __init__(self, system: Union[SatelliteSystem, List[SatelliteSystem]]) -> None:
//| """Turn on the GNSS.
@ -146,6 +147,7 @@ MP_PROPERTY_GETTER(gnss_timestamp_obj,
//| fix: PositionFix
//| """Fix mode."""
//|
STATIC mp_obj_t gnss_obj_get_fix(mp_obj_t self_in) {
gnss_obj_t *self = MP_OBJ_TO_PTR(self_in);
check_for_deinit(self);

View File

@ -17,6 +17,7 @@
//|
//| FIX_3D: PositionFix
//| """3D fix."""
//|
const mp_obj_type_t gnss_positionfix_type;
const gnss_positionfix_obj_t gnss_positionfix_invalid_obj = {

View File

@ -23,6 +23,7 @@
//|
//| QZSS_L1S: SatelliteSystem
//| """Quasi-Zenith Satellite System L1S."""
//|
const mp_obj_type_t gnss_satellitesystem_type;
const gnss_satellitesystem_obj_t gnss_satellitesystem_gps_obj = {

View File

@ -34,6 +34,7 @@
//| class Hash:
//| """In progress hash algorithm. This object is always created by a `hashlib.new()`. It has no
//| user-visible constructor."""
//|
//| digest_size: int
//| """Digest size in bytes"""
@ -65,6 +66,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(hashlib_hash_update_obj, hashlib_hash_update);
//| def digest(self) -> bytes:
//| """Returns the current digest as bytes() with a length of `hashlib.Hash.digest_size`."""
//| ...
//|
STATIC mp_obj_t hashlib_hash_digest(mp_obj_t self_in) {
mp_check_self(mp_obj_is_type(self_in, &hashlib_hash_type));
hashlib_hash_obj_t *self = MP_OBJ_TO_PTR(self_in);

View File

@ -45,6 +45,7 @@
//| :return: a hash object for the given algorithm
//| :rtype: hashlib.Hash"""
//| ...
//|
STATIC mp_obj_t hashlib_new(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_name, ARG_data };
static const mp_arg_t allowed_args[] = {

View File

@ -136,6 +136,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(i2ctarget_i2c_target___exit___obj, 4,
//| :param float timeout: Timeout in seconds. Zero means wait forever, a negative value means check once
//| :return: I2CTargetRequest or None if timeout=-1 and there's no request
//| :rtype: ~i2ctarget.I2CTargetRequest"""
//|
STATIC mp_obj_t i2ctarget_i2c_target_request(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
mp_check_self(mp_obj_is_type(pos_args[0], &i2ctarget_i2c_target_type));
i2ctarget_i2c_target_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
@ -378,6 +379,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(i2ctarget_i2c_target_request_write_obj, i2ctarg
//|
//| :param ack: Whether to send an ACK or NACK"""
//| ...
//|
STATIC mp_obj_t i2ctarget_i2c_target_request_ack(uint n_args, const mp_obj_t *args) {
mp_check_self(mp_obj_is_type(args[0], &i2ctarget_i2c_target_request_type));
i2ctarget_i2c_target_request_obj_t *self = MP_OBJ_TO_PTR(args[0]);

View File

@ -166,6 +166,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(imagecapture_parallelimagecapture_deinit_obj, i
//| """Automatically deinitializes the hardware on context exit. See
//| :ref:`lifetime-and-contextmanagers` for more info."""
//| ...
//|
STATIC mp_obj_t imagecapture_parallelimagecapture___exit__(size_t n_args, const mp_obj_t *args) {
(void)n_args;
common_hal_imagecapture_parallelimagecapture_deinit(args[0]);

View File

@ -37,6 +37,7 @@
//| class IPv4Address:
//| """Encapsulates an IPv4 address."""
//|
//| def __init__(self, address: Union[int, str, bytes]) -> None:
//| """Create a new IPv4Address object encapsulating the address value.
@ -141,6 +142,7 @@ STATIC mp_obj_t ipaddress_ipv4address_binary_op(mp_binary_op_t op, mp_obj_t lhs_
//| def __hash__(self) -> int:
//| """Returns a hash for the IPv4Address data."""
//| ...
//|
STATIC mp_obj_t ipaddress_ipv4address_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
switch (op) {
// Two Addresses are equal if their address bytes and address_type are equal

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