From a6585c7cb7534c8f0f53095b02c43fd41e4d3a42 Mon Sep 17 00:00:00 2001 From: anecdata <16617689+anecdata@users.noreply.github.com> Date: Tue, 8 Feb 2022 23:25:07 -0600 Subject: [PATCH 01/52] Espressif ESP32-S3 DevKitC-1-N32R8 --- .../espressif_esp32s3_devkitc_1_n32r8/board.c | 48 ++++++++++++++++++ .../mpconfigboard.h | 41 ++++++++++++++++ .../mpconfigboard.mk | 17 +++++++ .../espressif_esp32s3_devkitc_1_n32r8/pins.c | 49 +++++++++++++++++++ .../sdkconfig | 34 +++++++++++++ .../esp-idf-config/partitions-32MB.csv | 10 ++++ .../esp-idf-config/sdkconfig-32MB.defaults | 19 +++++++ 7 files changed, 218 insertions(+) create mode 100644 ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/board.c create mode 100644 ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.h create mode 100644 ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.mk create mode 100644 ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/pins.c create mode 100644 ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/sdkconfig create mode 100644 ports/espressif/esp-idf-config/partitions-32MB.csv create mode 100644 ports/espressif/esp-idf-config/sdkconfig-32MB.defaults diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/board.c b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/board.c new file mode 100644 index 0000000000..ff9418ec86 --- /dev/null +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/board.c @@ -0,0 +1,48 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" +#include "mpconfigboard.h" +#include "shared-bindings/microcontroller/Pin.h" + +void board_init(void) { + // Debug UART + #ifdef DEBUG + common_hal_never_reset_pin(&pin_GPIO43); + common_hal_never_reset_pin(&pin_GPIO44); + #endif +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { + +} + +void board_deinit(void) { +} diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.h b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.h new file mode 100644 index 0000000000..454203f41f --- /dev/null +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.h @@ -0,0 +1,41 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +// Micropython setup + +#define MICROPY_HW_BOARD_NAME "ESP32-S3-DevKitC-1-N32R8" +#define MICROPY_HW_MCU_NAME "ESP32S3" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO48) + +#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO44) +#define DEFAULT_UART_BUS_TX (&pin_GPIO43) + +#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") + +#define AUTORESET_DELAY_MS 500 diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.mk new file mode 100644 index 0000000000..1b1ab8742e --- /dev/null +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.mk @@ -0,0 +1,17 @@ +USB_VID = 0x303A +USB_PID = 0x7003 +USB_PRODUCT = "ESP32-S3-DevKitC-1-N32R8" +USB_MANUFACTURER = "Espressif" + +IDF_TARGET = esp32s3 + +INTERNAL_FLASH_FILESYSTEM = 1 +LONGINT_IMPL = MPZ + +# The default queue depth of 16 overflows on release builds, +# so increase it to 32. +CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 + +CIRCUITPY_ESP_FLASH_MODE=dio +CIRCUITPY_ESP_FLASH_FREQ=80m +CIRCUITPY_ESP_FLASH_SIZE=32MB diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/pins.c b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/pins.c new file mode 100644 index 0000000000..919deca8b4 --- /dev/null +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/pins.c @@ -0,0 +1,49 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_IO17), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_IO35), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_IO37), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_IO38), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_IO39), MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_IO40), MP_ROM_PTR(&pin_GPIO40) }, + { MP_ROM_QSTR(MP_QSTR_IO41), MP_ROM_PTR(&pin_GPIO41) }, + { MP_ROM_QSTR(MP_QSTR_IO42), MP_ROM_PTR(&pin_GPIO42) }, + { MP_ROM_QSTR(MP_QSTR_IO43), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_IO44), MP_ROM_PTR(&pin_GPIO44) }, + { MP_ROM_QSTR(MP_QSTR_IO45), MP_ROM_PTR(&pin_GPIO45) }, + { MP_ROM_QSTR(MP_QSTR_IO46), MP_ROM_PTR(&pin_GPIO46) }, + { MP_ROM_QSTR(MP_QSTR_IO47), MP_ROM_PTR(&pin_GPIO47) }, + { MP_ROM_QSTR(MP_QSTR_IO48), MP_ROM_PTR(&pin_GPIO48) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO48) }, + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) }, + + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/sdkconfig b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/sdkconfig new file mode 100644 index 0000000000..f508f4a67c --- /dev/null +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/sdkconfig @@ -0,0 +1,34 @@ +CONFIG_ESP32S3_SPIRAM_SUPPORT=y +# +# SPI RAM config +# +# CONFIG_SPIRAM_MODE_QUAD is not set +CONFIG_SPIRAM_MODE_OCT=y +# CONFIG_SPIRAM_TYPE_AUTO is not set +CONFIG_SPIRAM_TYPE_ESPPSRAM64=y +CONFIG_SPIRAM_SIZE=8388608 +# end of SPI RAM config + +CONFIG_DEFAULT_PSRAM_CLK_IO=30 +# +# PSRAM Clock and CS IO for ESP32S3 +# +CONFIG_DEFAULT_PSRAM_CS_IO=26 +# end of PSRAM Clock and CS IO for ESP32S3 + +# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set +# CONFIG_SPIRAM_RODATA is not set +CONFIG_SPIRAM_SPEED_80M=y +# CONFIG_SPIRAM_SPEED_40M is not set +CONFIG_SPIRAM=y +CONFIG_SPIRAM_BOOT_INIT=y +# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set +CONFIG_SPIRAM_USE_MEMMAP=y +# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +# CONFIG_SPIRAM_USE_MALLOC is not set +CONFIG_SPIRAM_MEMTEST=y +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" +# end of LWIP diff --git a/ports/espressif/esp-idf-config/partitions-32MB.csv b/ports/espressif/esp-idf-config/partitions-32MB.csv new file mode 100644 index 0000000000..34772c8034 --- /dev/null +++ b/ports/espressif/esp-idf-config/partitions-32MB.csv @@ -0,0 +1,10 @@ +# ESP-IDF Partition Table +# Name, Type, SubType, Offset, Size, Flags +# bootloader.bin,, 0x1000, 32K +# partition table,, 0x8000, 4K +nvs, data, nvs, 0x9000, 20K, +otadata, data, ota, 0xe000, 8K, +ota_0, 0, ota_0, 0x10000, 2048K, +ota_1, 0, ota_1, 0x210000, 2048K, +uf2, app, factory,0x410000, 256K, +user_fs, data, fat, 0x450000, 28362K, diff --git a/ports/espressif/esp-idf-config/sdkconfig-32MB.defaults b/ports/espressif/esp-idf-config/sdkconfig-32MB.defaults new file mode 100644 index 0000000000..bbdd32afb8 --- /dev/null +++ b/ports/espressif/esp-idf-config/sdkconfig-32MB.defaults @@ -0,0 +1,19 @@ +# +# Serial flasher config +# +# CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_2MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_4MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_8MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_16MB is not set +CONFIG_ESPTOOLPY_FLASHSIZE_32MB=y +CONFIG_ESPTOOLPY_FLASHSIZE="32MB" +CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y +# end of Serial flasher config + +CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="esp-idf-config/partitions-32MB.csv" +# +# Partition Table +# +CONFIG_PARTITION_TABLE_FILENAME="esp-idf-config/partitions-32MB.csv" +# end of Partition Table From 4f2f489df4bd06b9ed90e355acd7bf332f61523b Mon Sep 17 00:00:00 2001 From: MicroDev <70126934+MicroDev1@users.noreply.github.com> Date: Fri, 18 Nov 2022 09:54:40 +0530 Subject: [PATCH 02/52] ignore espressif_esp32s3_devkitc_1_n32r8 in vid:pid check --- tools/ci_check_duplicate_usb_vid_pid.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/ci_check_duplicate_usb_vid_pid.py b/tools/ci_check_duplicate_usb_vid_pid.py index 4e5c48c90d..4d9a0b162e 100644 --- a/tools/ci_check_duplicate_usb_vid_pid.py +++ b/tools/ci_check_duplicate_usb_vid_pid.py @@ -54,6 +54,7 @@ DEFAULT_CLUSTERLIST = { "espressif_esp32s3_devkitc_1_n8", "espressif_esp32s3_devkitc_1_n8r2", "espressif_esp32s3_devkitc_1_n8r8", + "espressif_esp32s3_devkitc_1_n32r8", ], "0x303A:0x7009": [ "espressif_esp32s2_devkitc_1_n4", From 2bb12293f8bf7b23da425ee6959dba93a2208b02 Mon Sep 17 00:00:00 2001 From: MicroDev <70126934+MicroDev1@users.noreply.github.com> Date: Sat, 21 Jan 2023 16:02:59 +0530 Subject: [PATCH 03/52] add ulp fsm --- ports/espressif/bindings/espulp/ULP.c | 38 ++++++++++++-- ports/espressif/bindings/espulp/ULP.h | 3 +- ports/espressif/bindings/espulp/ULPAlarm.c | 18 +++++-- ports/espressif/bindings/espulp/ULPArch.c | 51 +++++++++++++++++++ ports/espressif/bindings/espulp/ULPArch.h | 40 +++++++++++++++ ports/espressif/bindings/espulp/__init__.c | 3 ++ ports/espressif/common-hal/espulp/ULP.c | 47 ++++++++++++++--- ports/espressif/common-hal/espulp/ULP.h | 2 + ports/espressif/common-hal/espulp/ULPAlarm.c | 30 ++++++++--- ports/espressif/common-hal/espulp/ULPAlarm.h | 3 ++ .../esp-idf-config/sdkconfig-esp32.defaults | 4 +- ports/espressif/mpconfigport.mk | 8 +-- 12 files changed, 217 insertions(+), 30 deletions(-) create mode 100644 ports/espressif/bindings/espulp/ULPArch.c create mode 100644 ports/espressif/bindings/espulp/ULPArch.h diff --git a/ports/espressif/bindings/espulp/ULP.c b/ports/espressif/bindings/espulp/ULP.c index 201226d93f..3506a3067b 100644 --- a/ports/espressif/bindings/espulp/ULP.c +++ b/ports/espressif/bindings/espulp/ULP.c @@ -28,19 +28,35 @@ #include "shared-bindings/util.h" #include "bindings/espulp/ULP.h" +#include "py/enum.h" #include "py/runtime.h" +#include "py/objproperty.h" //| class ULP: -//| def __init__(self): +//| def __init__(self, arch: ULPArch = ULPArch.FSM): //| """The ultra-low-power processor. //| //| Raises an exception if another ULP has been instantiated. This -//| ensures that is is only used by one piece of code at a time.""" +//| ensures that is is only used by one piece of code at a time. +//| +//| :param ULPArch arch: The ulp arch""" //| ... STATIC mp_obj_t espulp_ulp_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { + enum { ARG_arch }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_arch, MP_ARG_OBJ, {.u_obj = (void *)&ulparch_FSM_obj} }, + }; + + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + const espulp_ulparch_t arch = cp_enum_value(&espulp_ulparch_type, args[ARG_arch].u_obj, MP_QSTR_arch); + espulp_ulp_obj_t *self = m_new_obj(espulp_ulp_obj_t); self->base.type = &espulp_ulp_type; - common_hal_espulp_ulp_construct(self); + + common_hal_espulp_ulp_construct(self, arch); + return MP_OBJ_FROM_PTR(self); } @@ -124,7 +140,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(espulp_ulp_run_obj, 2, espulp_ulp_run); //| def halt(self) -> None: //| """Halts the running program and releases the pins given in `run()`.""" //| ... -//| STATIC mp_obj_t espulp_ulp_halt(mp_obj_t self_in) { espulp_ulp_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -134,12 +149,27 @@ STATIC mp_obj_t espulp_ulp_halt(mp_obj_t self_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(espulp_ulp_halt_obj, espulp_ulp_halt); +//| arch: ULPArch +//| """The ulp arch. (read-only)""" +//| +STATIC mp_obj_t espulp_ulp_get_arch(mp_obj_t self_in) { + espulp_ulp_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + + return cp_enum_find(&espulp_ulparch_type, self->arch); +} +MP_DEFINE_CONST_FUN_OBJ_1(espulp_ulp_get_arch_obj, espulp_ulp_get_arch); + +MP_PROPERTY_GETTER(espulp_ulp_arch_obj, + (mp_obj_t)&espulp_ulp_get_arch_obj); + STATIC const mp_rom_map_elem_t espulp_ulp_locals_table[] = { { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&espulp_ulp_deinit_obj) }, { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&mp_identity_obj) }, { MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&espulp_ulp___exit___obj) }, { MP_ROM_QSTR(MP_QSTR_run), MP_ROM_PTR(&espulp_ulp_run_obj) }, { MP_ROM_QSTR(MP_QSTR_halt), MP_ROM_PTR(&espulp_ulp_halt_obj) }, + { MP_ROM_QSTR(MP_QSTR_arch), MP_ROM_PTR(&espulp_ulp_arch_obj) }, }; STATIC MP_DEFINE_CONST_DICT(espulp_ulp_locals_dict, espulp_ulp_locals_table); diff --git a/ports/espressif/bindings/espulp/ULP.h b/ports/espressif/bindings/espulp/ULP.h index 9f9c3ecf7f..f06f783902 100644 --- a/ports/espressif/bindings/espulp/ULP.h +++ b/ports/espressif/bindings/espulp/ULP.h @@ -29,10 +29,9 @@ #include "py/obj.h" #include "common-hal/espulp/ULP.h" - extern const mp_obj_type_t espulp_ulp_type; -void common_hal_espulp_ulp_construct(espulp_ulp_obj_t *self); +void common_hal_espulp_ulp_construct(espulp_ulp_obj_t *self, espulp_ulparch_t arch); bool common_hal_espulp_ulp_deinited(espulp_ulp_obj_t *self); void common_hal_espulp_ulp_deinit(espulp_ulp_obj_t *self); diff --git a/ports/espressif/bindings/espulp/ULPAlarm.c b/ports/espressif/bindings/espulp/ULPAlarm.c index e77fe7f834..921c23d4f5 100644 --- a/ports/espressif/bindings/espulp/ULPAlarm.c +++ b/ports/espressif/bindings/espulp/ULPAlarm.c @@ -25,27 +25,35 @@ */ #include "bindings/espulp/ULPAlarm.h" +#include "bindings/espulp/ULPArch.h" #include "py/runtime.h" //| class ULPAlarm: //| """Trigger an alarm when the ULP requests wake-up.""" //| -//| def __init__(self) -> None: +//| def __init__(self, ulp: ULP) -> None: //| """Create an alarm that will be triggered when the ULP requests wake-up. //| //| The alarm is not active until it is passed to an `alarm`-enabling function, such as //| `alarm.light_sleep_until_alarms()` or `alarm.exit_and_deep_sleep_until_alarms()`. //| -//| """ +//| :param ULP ulp: The ulp instance""" //| ... //| -STATIC mp_obj_t espulp_ulpalarm_make_new(const mp_obj_type_t *type, - size_t n_args, size_t n_kw, const mp_obj_t *all_args) { +STATIC mp_obj_t espulp_ulpalarm_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { + enum { ARG_ulp }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_ulp, MP_ARG_REQUIRED | MP_ARG_OBJ }, + }; + + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); espulp_ulpalarm_obj_t *self = m_new_obj(espulp_ulpalarm_obj_t); self->base.type = &espulp_ulpalarm_type; - common_hal_espulp_ulpalarm_construct(self); + self->ulp = mp_arg_validate_type(args[ARG_ulp].u_obj, &espulp_ulp_type, MP_QSTR_ulp); + return MP_OBJ_FROM_PTR(self); } diff --git a/ports/espressif/bindings/espulp/ULPArch.c b/ports/espressif/bindings/espulp/ULPArch.c new file mode 100644 index 0000000000..01f61458c1 --- /dev/null +++ b/ports/espressif/bindings/espulp/ULPArch.c @@ -0,0 +1,51 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2023 MicroDev + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "py/enum.h" + +#include "bindings/espulp/ULPArch.h" + +MAKE_ENUM_VALUE(espulp_ulparch_type, ulparch, FSM, FSM); +MAKE_ENUM_VALUE(espulp_ulparch_type, ulparch, RISCV, RISCV); + +//| class ULPArch: +//| """The ULP architectures available.""" +//| +//| FSM: ULPArch +//| """The ULP Finite State Machine.""" +//| +//| RISCV: ULPArch +//| """The ULP RISC-V Coprocessor.""" +//| +MAKE_ENUM_MAP(espulp_ulparch) { + MAKE_ENUM_MAP_ENTRY(ulparch, FSM), + MAKE_ENUM_MAP_ENTRY(ulparch, RISCV), +}; +STATIC MP_DEFINE_CONST_DICT(espulp_ulparch_locals_dict, espulp_ulparch_locals_table); + +MAKE_PRINTER(espulp, espulp_ulparch); + +MAKE_ENUM_TYPE(espulp, ULPArch, espulp_ulparch); diff --git a/ports/espressif/bindings/espulp/ULPArch.h b/ports/espressif/bindings/espulp/ULPArch.h new file mode 100644 index 0000000000..1b1e8a1331 --- /dev/null +++ b/ports/espressif/bindings/espulp/ULPArch.h @@ -0,0 +1,40 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2023 MicroDev + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_BINDINGS_ESPULP_ULPARCH_H +#define MICROPY_INCLUDED_BINDINGS_ESPULP_ULPARCH_H + +#include "py/enum.h" + +typedef enum { + FSM, + RISCV +} espulp_ulparch_t; + +extern const mp_obj_type_t espulp_ulparch_type; +extern const cp_enum_obj_t ulparch_FSM_obj; + +#endif // MICROPY_INCLUDED_BINDINGS_ESPULP_ULPARCH_H diff --git a/ports/espressif/bindings/espulp/__init__.c b/ports/espressif/bindings/espulp/__init__.c index b51cbebf5e..ff6d727ec5 100644 --- a/ports/espressif/bindings/espulp/__init__.c +++ b/ports/espressif/bindings/espulp/__init__.c @@ -25,9 +25,11 @@ */ #include "shared-bindings/util.h" + #include "bindings/espulp/__init__.h" #include "bindings/espulp/ULP.h" #include "bindings/espulp/ULPAlarm.h" +#include "bindings/espulp/ULPArch.h" #include "py/runtime.h" @@ -80,6 +82,7 @@ STATIC const mp_rom_map_elem_t espulp_module_globals_table[] = { // module classes { MP_ROM_QSTR(MP_QSTR_ULP), MP_OBJ_FROM_PTR(&espulp_ulp_type) }, { MP_ROM_QSTR(MP_QSTR_ULPAlarm), MP_OBJ_FROM_PTR(&espulp_ulpalarm_type) }, + { MP_ROM_QSTR(MP_QSTR_ULPArch), MP_ROM_PTR(&espulp_ulparch_type) }, }; STATIC MP_DEFINE_CONST_DICT(espulp_module_globals, espulp_module_globals_table); diff --git a/ports/espressif/common-hal/espulp/ULP.c b/ports/espressif/common-hal/espulp/ULP.c index 4d30a94dfc..c2dfdb038b 100644 --- a/ports/espressif/common-hal/espulp/ULP.c +++ b/ports/espressif/common-hal/espulp/ULP.c @@ -31,7 +31,10 @@ #include "shared-bindings/microcontroller/Pin.h" -#if defined(CONFIG_IDF_TARGET_ESP32S2) +#if defined(CONFIG_IDF_TARGET_ESP32) +#include "esp32/ulp.h" +#define ULP_COPROC_RESERVE_MEM (CONFIG_ESP32_ULP_COPROC_RESERVE_MEM) +#elif defined(CONFIG_IDF_TARGET_ESP32S2) #include "esp32s2/ulp.h" #include "esp32s2/ulp_riscv.h" #define ULP_COPROC_RESERVE_MEM (CONFIG_ESP32S2_ULP_COPROC_RESERVE_MEM) @@ -56,7 +59,14 @@ void common_hal_espulp_ulp_run(espulp_ulp_obj_t *self, uint32_t *program, size_t if (length > ULP_COPROC_RESERVE_MEM) { mp_raise_ValueError(translate("Program too long")); } - if (GET_PERI_REG_MASK(RTC_CNTL_ULP_CP_TIMER_REG, RTC_CNTL_ULP_CP_SLP_TIMER_EN)) { + + if ( + #ifdef CONFIG_IDF_TARGET_ESP32 + GET_PERI_REG_MASK(RTC_CNTL_STATE0_REG, RTC_CNTL_ULP_CP_SLP_TIMER_EN) + #else + GET_PERI_REG_MASK(RTC_CNTL_ULP_CP_TIMER_REG, RTC_CNTL_ULP_CP_SLP_TIMER_EN) + #endif + ) { mp_raise_RuntimeError(translate("Already running")); } @@ -78,13 +88,29 @@ void common_hal_espulp_ulp_run(espulp_ulp_obj_t *self, uint32_t *program, size_t } pins_used = pin_mask; - - ulp_riscv_load_binary((const uint8_t *)program, length); ulp_set_wakeup_period(0, 20000); - ulp_riscv_run(); + + switch (self->arch) { + case FSM: + ulp_load_binary(0, (const uint8_t *)program, length); + ulp_run(0); + break; + case RISCV: + #ifndef CONFIG_IDF_TARGET_ESP32 + ulp_riscv_load_binary((const uint8_t *)program, length); + ulp_riscv_run(); + break; + #endif + default: + mp_raise_NotImplementedError(NULL); + break; + } } void common_hal_espulp_ulp_halt(espulp_ulp_obj_t *self) { + #ifdef CONFIG_IDF_TARGET_ESP32 + mp_raise_NotImplementedError(NULL); + #else // To-do idf v5.0: use following functions // ulp_riscv_timer_stop(); // ulp_riscv_halt(); @@ -97,6 +123,7 @@ void common_hal_espulp_ulp_halt(espulp_ulp_obj_t *self) { // resets the processor SET_PERI_REG_MASK(RTC_CNTL_COCPU_CTRL_REG, RTC_CNTL_COCPU_SHUT_RESET_EN); + #endif // Release pins we were using. for (uint8_t i = 0; i < 32; i++) { @@ -106,13 +133,21 @@ void common_hal_espulp_ulp_halt(espulp_ulp_obj_t *self) { } } -void common_hal_espulp_ulp_construct(espulp_ulp_obj_t *self) { +void common_hal_espulp_ulp_construct(espulp_ulp_obj_t *self, espulp_ulparch_t arch) { // Use a static variable to track ULP in use so that subsequent code runs can // use a running ULP. This is only to prevent multiple portions of user code // from using the ULP concurrently. if (ulp_used) { mp_raise_ValueError_varg(translate("%q in use"), MP_QSTR_ULP); } + + #ifdef CONFIG_IDF_TARGET_ESP32 + if (self->arch == RISCV) { + mp_raise_NotImplementedError(NULL); + } + #endif + + self->arch = arch; self->inited = true; } diff --git a/ports/espressif/common-hal/espulp/ULP.h b/ports/espressif/common-hal/espulp/ULP.h index f73b21d123..42081411f0 100644 --- a/ports/espressif/common-hal/espulp/ULP.h +++ b/ports/espressif/common-hal/espulp/ULP.h @@ -27,8 +27,10 @@ #pragma once #include "py/obj.h" +#include "bindings/espulp/ULPArch.h" typedef struct { mp_obj_base_t base; + espulp_ulparch_t arch; bool inited; } espulp_ulp_obj_t; diff --git a/ports/espressif/common-hal/espulp/ULPAlarm.c b/ports/espressif/common-hal/espulp/ULPAlarm.c index ec1fb8bc45..e209325d68 100644 --- a/ports/espressif/common-hal/espulp/ULPAlarm.c +++ b/ports/espressif/common-hal/espulp/ULPAlarm.c @@ -37,10 +37,6 @@ static volatile bool woke_up = false; static bool alarm_set = false; -void common_hal_espulp_ulpalarm_construct(espulp_ulpalarm_obj_t *self) { - -} - mp_obj_t espulp_ulpalarm_find_triggered_alarm(const size_t n_alarms, const mp_obj_t *alarms) { for (size_t i = 0; i < n_alarms; i++) { if (mp_obj_is_type(alarms[i], &espulp_ulpalarm_type)) { @@ -52,7 +48,6 @@ mp_obj_t espulp_ulpalarm_find_triggered_alarm(const size_t n_alarms, const mp_ob mp_obj_t espulp_ulpalarm_record_wake_alarm(void) { espulp_ulpalarm_obj_t *const alarm = &alarm_wake_alarm.ulp_alarm; - alarm->base.type = &espulp_ulpalarm_type; return alarm; } @@ -81,8 +76,25 @@ void espulp_ulpalarm_set_alarm(const bool deep_sleep, const size_t n_alarms, con } // enable ulp interrupt - rtc_isr_register(&ulp_interrupt, NULL, RTC_CNTL_COCPU_INT_ST); - REG_SET_BIT(RTC_CNTL_INT_ENA_REG, RTC_CNTL_COCPU_INT_ENA); + switch (alarm->ulp->arch) { + case FSM: + #ifdef CONFIG_IDF_TARGET_ESP32 + rtc_isr_register(&ulp_interrupt, NULL, RTC_CNTL_ULP_CP_INT_RAW); + #else + rtc_isr_register(&ulp_interrupt, NULL, RTC_CNTL_ULP_CP_INT_ST); + #endif + REG_SET_BIT(RTC_CNTL_INT_ENA_REG, RTC_CNTL_ULP_CP_INT_ENA); + break; + case RISCV: + #ifndef CONFIG_IDF_TARGET_ESP32 + rtc_isr_register(&ulp_interrupt, NULL, RTC_CNTL_COCPU_INT_ST); + REG_SET_BIT(RTC_CNTL_INT_ENA_REG, RTC_CNTL_COCPU_INT_ENA); + break; + #endif + default: + mp_raise_NotImplementedError(NULL); + break; + } alarm_set = true; } @@ -91,9 +103,13 @@ void espulp_ulpalarm_prepare_for_deep_sleep(void) { if (!alarm_set) { return; } + // disable ulp interrupt rtc_isr_deregister(&ulp_interrupt, NULL); + REG_CLR_BIT(RTC_CNTL_INT_ENA_REG, RTC_CNTL_ULP_CP_INT_ENA); + #ifndef CONFIG_IDF_TARGET_ESP32 REG_CLR_BIT(RTC_CNTL_INT_ENA_REG, RTC_CNTL_COCPU_INT_ENA); + #endif // enable ulp wakeup esp_sleep_enable_ulp_wakeup(); diff --git a/ports/espressif/common-hal/espulp/ULPAlarm.h b/ports/espressif/common-hal/espulp/ULPAlarm.h index 5d2610c6a3..99d21180fd 100644 --- a/ports/espressif/common-hal/espulp/ULPAlarm.h +++ b/ports/espressif/common-hal/espulp/ULPAlarm.h @@ -29,8 +29,11 @@ #include "py/obj.h" #include "py/runtime.h" +#include "bindings/espulp/ULP.h" + typedef struct { mp_obj_base_t base; + espulp_ulp_obj_t *ulp; } espulp_ulpalarm_obj_t; mp_obj_t espulp_ulpalarm_find_triggered_alarm(const size_t n_alarms, const mp_obj_t *alarms); diff --git a/ports/espressif/esp-idf-config/sdkconfig-esp32.defaults b/ports/espressif/esp-idf-config/sdkconfig-esp32.defaults index 483e0f9b87..b6c5a938b1 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-esp32.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-esp32.defaults @@ -313,8 +313,8 @@ CONFIG_SPIRAM_SPIWP_SD3_PIN=7 # CONFIG_ESP32_TRAX is not set CONFIG_ESP32_TRACEMEM_RESERVE_DRAM=0x0 -# CONFIG_ESP32_ULP_COPROC_ENABLED is not set -CONFIG_ESP32_ULP_COPROC_RESERVE_MEM=0 +CONFIG_ESP32_ULP_COPROC_ENABLED=y +CONFIG_ESP32_ULP_COPROC_RESERVE_MEM=4080 CONFIG_ESP32_DEBUG_OCDAWARE=y CONFIG_ESP32_BROWNOUT_DET=y CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_0=y diff --git a/ports/espressif/mpconfigport.mk b/ports/espressif/mpconfigport.mk index c5c73c77bd..b7b991eb40 100644 --- a/ports/espressif/mpconfigport.mk +++ b/ports/espressif/mpconfigport.mk @@ -26,11 +26,13 @@ CIRCUITPY_COUNTIO ?= 1 CIRCUITPY_DUALBANK ?= 1 CIRCUITPY_ESP32_CAMERA ?= 1 CIRCUITPY_ESPIDF ?= 1 +CIRCUITPY_ESPULP ?= 1 CIRCUITPY_FRAMEBUFFERIO ?= 1 CIRCUITPY_FREQUENCYIO ?= 1 CIRCUITPY_HASHLIB ?= 1 CIRCUITPY_I2CTARGET ?= 1 CIRCUITPY_IMAGECAPTURE = 0 +CIRCUITPY_MEMORYMAP ?= 1 CIRCUITPY_NVM ?= 1 CIRCUITPY_PS2IO ?= 1 CIRCUITPY_RGBMATRIX ?= 1 @@ -54,7 +56,9 @@ CIRCUITPY_ALARM = 0 CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_COUNTIO = 0 CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPULP = 0 CIRCUITPY_FREQUENCYIO = 0 +CIRCUITPY_MEMORYMAP = 0 CIRCUITPY_PARALLELDISPLAY = 0 CIRCUITPY_ROTARYIO = 0 CIRCUITPY_TOUCHIO ?= 1 @@ -65,14 +69,10 @@ CIRCUITPY_USB = 0 else ifeq ($(IDF_TARGET),esp32s2) # Modules CIRCUITPY_BLEIO = 0 -CIRCUITPY_ESPULP = 1 -CIRCUITPY_MEMORYMAP = 1 else ifeq ($(IDF_TARGET),esp32s3) # Modules CIRCUITPY_PARALLELDISPLAY = 0 -CIRCUITPY_ESPULP = 1 -CIRCUITPY_MEMORYMAP = 1 endif # No room for dualbank on boards with 2MB flash From e018c6d0227bcabea4ce25bf018417bc5369f93c Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 23 Jan 2023 13:13:27 -0600 Subject: [PATCH 04/52] Update PID to match internal list --- .../adafruit_feather_esp32s2_reverse_tft/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/mpconfigboard.mk b/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/mpconfigboard.mk index 6f6b949d13..920b748e3d 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/mpconfigboard.mk @@ -1,5 +1,5 @@ USB_VID = 0x239A -USB_PID = 0x8128 +USB_PID = 0x80EE USB_PRODUCT = "Feather ESP32-S2 Reverse TFT" USB_MANUFACTURER = "Adafruit" From ace20625641ccb471f7424857f35844d07c501b7 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 25 Jan 2023 15:10:06 -0600 Subject: [PATCH 05/52] remove board that will not be manufactured --- .../board.c | 108 ------------------ .../mpconfigboard.h | 44 ------- .../mpconfigboard.mk | 15 --- .../pins.c | 75 ------------ .../sdkconfig | 6 - 5 files changed, 248 deletions(-) delete mode 100644 ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/board.c delete mode 100644 ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h delete mode 100644 ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.mk delete mode 100644 ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/pins.c delete mode 100644 ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/sdkconfig diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/board.c b/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/board.c deleted file mode 100644 index e0edec2fa2..0000000000 --- a/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/board.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/busio/SPI.h" -#include "shared-bindings/displayio/FourWire.h" -#include "shared-bindings/microcontroller/Pin.h" -#include "shared-module/displayio/__init__.h" -#include "shared-module/displayio/mipi_constants.h" - -/* -displayio_fourwire_obj_t board_display_obj; - -#define DELAY 0x80 - -uint8_t display_init_sequence[] = { - 0x01, 0 | DELAY, 150, // SWRESET - 0x11, 0 | DELAY, 255, // SLPOUT - 0x36, 1, 0x00, // _MADCTL bottom to top refresh in vsync aligned order. - 0x3a, 1, 0x55, // COLMOD - 16bit color - 0x21, 0 | DELAY, 10, // _INVON - 0x13, 0 | DELAY, 10, // _NORON - 0x29, 0 | DELAY, 255, // _DISPON -}; - -*/ - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ - - /* - busio_spi_obj_t* spi = &displays[0].fourwire_bus.inline_bus; - common_hal_busio_spi_construct(spi, &pin_GPIO36, &pin_GPIO35, NULL); - common_hal_busio_spi_never_reset(spi); - - displayio_fourwire_obj_t* bus = &displays[0].fourwire_bus; - bus->base.type = &displayio_fourwire_type; - common_hal_displayio_fourwire_construct(bus, - spi, - &pin_GPIO40, // TFT_DC Command or data - &pin_GPIO42, // TFT_CS Chip select - &pin_GPIO41, // TFT_RST Reset - 4000000, // Baudrate - 0, // Polarity - 0); // Phase - - displayio_display_obj_t* display = &displays[0].display; - display->base.type = &displayio_display_type; - common_hal_displayio_display_construct(display, - bus, - 240, // Width (after rotation) - 135, // Height (after rotation) - 0, // column start - 0, // row start - 0, // rotation - 16, // Color depth - false, // Grayscale - false, // Pixels in a byte share a row. Only used for depth < 8 - 1, // bytes per cell. Only valid for depths < 8 - false, // reverse_pixels_in_byte. Only valid for depths < 8 - true, // reverse_pixels_in_word - MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command - MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command - MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command - display_init_sequence, - sizeof(display_init_sequence), - &pin_GPIO7, // backlight pin - NO_BRIGHTNESS_COMMAND, - 1.0f, // brightness - false, // single_byte_bounds - false, // data_as_commands - true, // auto_refresh - 60, // native_frames_per_second - true, // backlight_on_high - false, // not SH1107 - 50000); // backlight pwm frequency - */ -} - -// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h b/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h deleted file mode 100644 index b4034568c0..0000000000 --- a/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2019 Scott Shawcroft for Adafruit Industries - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -// Micropython setup - -#define MICROPY_HW_BOARD_NAME "Feather ESP32S2 without PSRAM" -#define MICROPY_HW_MCU_NAME "ESP32S2" - -#define MICROPY_HW_NEOPIXEL (&pin_GPIO33) -#define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO21) - -#define MICROPY_HW_LED_STATUS (&pin_GPIO13) - -#define DEFAULT_I2C_BUS_SCL (&pin_GPIO4) -#define DEFAULT_I2C_BUS_SDA (&pin_GPIO3) - -#define DEFAULT_SPI_BUS_SCK (&pin_GPIO36) -#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO35) -#define DEFAULT_SPI_BUS_MISO (&pin_GPIO37) - -#define DOUBLE_TAP_PIN (&pin_GPIO34) diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.mk b/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.mk deleted file mode 100644 index b07161cee3..0000000000 --- a/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.mk +++ /dev/null @@ -1,15 +0,0 @@ -USB_VID = 0x239A -USB_PID = 0x80EE -USB_PRODUCT = "Feather ESP32S2 TFT no PSRAM" -USB_MANUFACTURER = "Adafruit" - -IDF_TARGET = esp32s2 - -CIRCUITPY_ESP_FLASH_MODE = dio -CIRCUITPY_ESP_FLASH_FREQ = 40m -CIRCUITPY_ESP_FLASH_SIZE = 4MB - -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Requests -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Register -CIRCUITPY_ESP32_CAMERA = 0 diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/pins.c b/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/pins.c deleted file mode 100644 index 54b9051d73..0000000000 --- a/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/pins.c +++ /dev/null @@ -1,75 +0,0 @@ -#include "shared-bindings/board/__init__.h" - -#include "shared-module/displayio/__init__.h" - -STATIC const mp_rom_map_elem_t board_module_globals_table[] = { - CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS - - { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO0) }, - - { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO3) }, - { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO3) }, - - { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO4) }, - { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO4) }, - - { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) }, - { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO6) }, - - { MP_ROM_QSTR(MP_QSTR_TFT_BACKLIGHT), MP_ROM_PTR(&pin_GPIO7) }, - - { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO8) }, - { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO8) }, - - { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO9) }, - { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO10) }, - { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO11) }, - { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO12) }, - - { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO13) }, - { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO13) }, - { MP_ROM_QSTR(MP_QSTR_L), MP_ROM_PTR(&pin_GPIO13) }, - - { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO14) }, - { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO14) }, - - { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO15) }, - { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO15) }, - - { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO16) }, - { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO16) }, - - { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_GPIO17) }, - { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO17) }, - - { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_GPIO18) }, - { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO18) }, - - { MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_GPIO21) }, - { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO33) }, - - { MP_ROM_QSTR(MP_QSTR_D35), MP_ROM_PTR(&pin_GPIO35) }, - { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO35) }, - - { MP_ROM_QSTR(MP_QSTR_D36), MP_ROM_PTR(&pin_GPIO36) }, - { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO36) }, - - { MP_ROM_QSTR(MP_QSTR_D37), MP_ROM_PTR(&pin_GPIO37) }, - { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO37) }, - - { MP_ROM_QSTR(MP_QSTR_D38), MP_ROM_PTR(&pin_GPIO38) }, - { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO38) }, - - { MP_ROM_QSTR(MP_QSTR_D39), MP_ROM_PTR(&pin_GPIO39) }, - { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO39) }, - - { MP_ROM_QSTR(MP_QSTR_TFT_DC), MP_ROM_PTR(&pin_GPIO40) }, - { MP_ROM_QSTR(MP_QSTR_TFT_RESET), MP_ROM_PTR(&pin_GPIO41) }, - { MP_ROM_QSTR(MP_QSTR_TFT_CS), MP_ROM_PTR(&pin_GPIO42) }, - - { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, - { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, - - // { MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display)} -}; -MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/sdkconfig b/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/sdkconfig deleted file mode 100644 index 5b9c86dcc3..0000000000 --- a/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/sdkconfig +++ /dev/null @@ -1,6 +0,0 @@ -# CONFIG_ESP32S2_SPIRAM_SUPPORT is not set -# -# LWIP -# -CONFIG_LWIP_LOCAL_HOSTNAME="espressif" -# end of LWIP From 90e8f9d4a8d75f99bcd6151151e6181cba51cce6 Mon Sep 17 00:00:00 2001 From: MicroDev <70126934+MicroDev1@users.noreply.github.com> Date: Fri, 18 Nov 2022 09:55:44 +0530 Subject: [PATCH 06/52] fix espressif 32MB partition table --- .../esp-idf-config/partitions-32MB.csv | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/ports/espressif/esp-idf-config/partitions-32MB.csv b/ports/espressif/esp-idf-config/partitions-32MB.csv index 34772c8034..42c4084f6c 100644 --- a/ports/espressif/esp-idf-config/partitions-32MB.csv +++ b/ports/espressif/esp-idf-config/partitions-32MB.csv @@ -1,10 +1,9 @@ -# ESP-IDF Partition Table -# Name, Type, SubType, Offset, Size, Flags -# bootloader.bin,, 0x1000, 32K -# partition table,, 0x8000, 4K -nvs, data, nvs, 0x9000, 20K, -otadata, data, ota, 0xe000, 8K, -ota_0, 0, ota_0, 0x10000, 2048K, -ota_1, 0, ota_1, 0x210000, 2048K, -uf2, app, factory,0x410000, 256K, -user_fs, data, fat, 0x450000, 28362K, +# Name, Type, SubType, Offset, Size +# bootloader, app, boot, 0x1000/0x0, 28/32K +# partition_table, data, table, 0x8000, 4K +nvs, data, nvs, 0x9000, 20K +otadata, data, ota, 0xe000, 8K +ota_0, app, ota_0, 0x10000, 2048K +ota_1, app, ota_1, 0x210000, 2048K +uf2, app, factory, 0x410000, 256K +user_fs, data, fat, 0x450000, 28352K From e5cfab060de201800b55f4bcda58bbc51bbbcf2a Mon Sep 17 00:00:00 2001 From: MicroDev <70126934+MicroDev1@users.noreply.github.com> Date: Thu, 26 Jan 2023 11:20:18 +0530 Subject: [PATCH 07/52] remove redundant config messages --- .../espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.h | 2 -- .../espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.mk | 9 +-------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.h b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.h index 454203f41f..26410bb210 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.h +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.h @@ -36,6 +36,4 @@ #define DEFAULT_UART_BUS_RX (&pin_GPIO44) #define DEFAULT_UART_BUS_TX (&pin_GPIO43) -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - #define AUTORESET_DELAY_MS 500 diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.mk index 1b1ab8742e..96ef4e45c9 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.mk @@ -5,13 +5,6 @@ USB_MANUFACTURER = "Espressif" IDF_TARGET = esp32s3 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=dio +CIRCUITPY_ESP_FLASH_MODE=qio CIRCUITPY_ESP_FLASH_FREQ=80m CIRCUITPY_ESP_FLASH_SIZE=32MB From bfb77d05444e68462caaa38fb6f72b223799870a Mon Sep 17 00:00:00 2001 From: MicroDev <70126934+MicroDev1@users.noreply.github.com> Date: Thu, 26 Jan 2023 13:01:14 +0530 Subject: [PATCH 08/52] move `ULPArch` to `Architecture` --- .../espulp/{ULPArch.c => Architecture.c} | 24 ++++++++--------- .../espulp/{ULPArch.h => Architecture.h} | 12 ++++----- ports/espressif/bindings/espulp/ULP.c | 26 +++++++++---------- ports/espressif/bindings/espulp/ULP.h | 2 +- ports/espressif/bindings/espulp/ULPAlarm.c | 7 +++-- ports/espressif/bindings/espulp/ULPAlarm.h | 2 +- ports/espressif/bindings/espulp/__init__.c | 4 +-- ports/espressif/common-hal/espulp/ULP.c | 2 +- ports/espressif/common-hal/espulp/ULP.h | 4 +-- ports/espressif/common-hal/espulp/ULPAlarm.c | 4 +++ 10 files changed, 47 insertions(+), 40 deletions(-) rename ports/espressif/bindings/espulp/{ULPArch.c => Architecture.c} (70%) rename ports/espressif/bindings/espulp/{ULPArch.h => Architecture.h} (81%) diff --git a/ports/espressif/bindings/espulp/ULPArch.c b/ports/espressif/bindings/espulp/Architecture.c similarity index 70% rename from ports/espressif/bindings/espulp/ULPArch.c rename to ports/espressif/bindings/espulp/Architecture.c index 01f61458c1..d87691716c 100644 --- a/ports/espressif/bindings/espulp/ULPArch.c +++ b/ports/espressif/bindings/espulp/Architecture.c @@ -26,26 +26,26 @@ #include "py/enum.h" -#include "bindings/espulp/ULPArch.h" +#include "bindings/espulp/Architecture.h" -MAKE_ENUM_VALUE(espulp_ulparch_type, ulparch, FSM, FSM); -MAKE_ENUM_VALUE(espulp_ulparch_type, ulparch, RISCV, RISCV); +MAKE_ENUM_VALUE(espulp_architecture_type, architecture, FSM, FSM); +MAKE_ENUM_VALUE(espulp_architecture_type, architecture, RISCV, RISCV); -//| class ULPArch: +//| class Architecture: //| """The ULP architectures available.""" //| -//| FSM: ULPArch +//| FSM: Architecture //| """The ULP Finite State Machine.""" //| -//| RISCV: ULPArch +//| RISCV: Architecture //| """The ULP RISC-V Coprocessor.""" //| -MAKE_ENUM_MAP(espulp_ulparch) { - MAKE_ENUM_MAP_ENTRY(ulparch, FSM), - MAKE_ENUM_MAP_ENTRY(ulparch, RISCV), +MAKE_ENUM_MAP(espulp_architecture) { + MAKE_ENUM_MAP_ENTRY(architecture, FSM), + MAKE_ENUM_MAP_ENTRY(architecture, RISCV), }; -STATIC MP_DEFINE_CONST_DICT(espulp_ulparch_locals_dict, espulp_ulparch_locals_table); +STATIC MP_DEFINE_CONST_DICT(espulp_architecture_locals_dict, espulp_architecture_locals_table); -MAKE_PRINTER(espulp, espulp_ulparch); +MAKE_PRINTER(espulp, espulp_architecture); -MAKE_ENUM_TYPE(espulp, ULPArch, espulp_ulparch); +MAKE_ENUM_TYPE(espulp, Architecture, espulp_architecture); diff --git a/ports/espressif/bindings/espulp/ULPArch.h b/ports/espressif/bindings/espulp/Architecture.h similarity index 81% rename from ports/espressif/bindings/espulp/ULPArch.h rename to ports/espressif/bindings/espulp/Architecture.h index 1b1e8a1331..54c0677f05 100644 --- a/ports/espressif/bindings/espulp/ULPArch.h +++ b/ports/espressif/bindings/espulp/Architecture.h @@ -24,17 +24,17 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_BINDINGS_ESPULP_ULPARCH_H -#define MICROPY_INCLUDED_BINDINGS_ESPULP_ULPARCH_H +#ifndef MICROPY_INCLUDED_BINDINGS_ESPULP_ARCHITECTURE_H +#define MICROPY_INCLUDED_BINDINGS_ESPULP_ARCHITECTURE_H #include "py/enum.h" typedef enum { FSM, RISCV -} espulp_ulparch_t; +} espulp_architecture_t; -extern const mp_obj_type_t espulp_ulparch_type; -extern const cp_enum_obj_t ulparch_FSM_obj; +extern const mp_obj_type_t espulp_architecture_type; +extern const cp_enum_obj_t architecture_FSM_obj; -#endif // MICROPY_INCLUDED_BINDINGS_ESPULP_ULPARCH_H +#endif // MICROPY_INCLUDED_BINDINGS_ESPULP_ARCHITECTURE_H diff --git a/ports/espressif/bindings/espulp/ULP.c b/ports/espressif/bindings/espulp/ULP.c index 3506a3067b..c9666fb143 100644 --- a/ports/espressif/bindings/espulp/ULP.c +++ b/ports/espressif/bindings/espulp/ULP.c @@ -33,24 +33,24 @@ #include "py/objproperty.h" //| class ULP: -//| def __init__(self, arch: ULPArch = ULPArch.FSM): +//| def __init__(self, arch: Architecture = Architecture.FSM): //| """The ultra-low-power processor. //| //| Raises an exception if another ULP has been instantiated. This //| ensures that is is only used by one piece of code at a time. //| -//| :param ULPArch arch: The ulp arch""" +//| :param Architecture arch: The ulp arch""" //| ... STATIC mp_obj_t espulp_ulp_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_arch }; static const mp_arg_t allowed_args[] = { - { MP_QSTR_arch, MP_ARG_OBJ, {.u_obj = (void *)&ulparch_FSM_obj} }, + { MP_QSTR_arch, MP_ARG_OBJ, {.u_obj = (void *)&architecture_FSM_obj} }, }; mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - const espulp_ulparch_t arch = cp_enum_value(&espulp_ulparch_type, args[ARG_arch].u_obj, MP_QSTR_arch); + const espulp_architecture_t arch = cp_enum_value(&espulp_architecture_type, args[ARG_arch].u_obj, MP_QSTR_arch); espulp_ulp_obj_t *self = m_new_obj(espulp_ulp_obj_t); self->base.type = &espulp_ulp_type; @@ -149,14 +149,14 @@ STATIC mp_obj_t espulp_ulp_halt(mp_obj_t self_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(espulp_ulp_halt_obj, espulp_ulp_halt); -//| arch: ULPArch -//| """The ulp arch. (read-only)""" +//| arch: Architecture +//| """The ulp architecture. (read-only)""" //| STATIC mp_obj_t espulp_ulp_get_arch(mp_obj_t self_in) { espulp_ulp_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); - return cp_enum_find(&espulp_ulparch_type, self->arch); + return cp_enum_find(&espulp_architecture_type, self->arch); } MP_DEFINE_CONST_FUN_OBJ_1(espulp_ulp_get_arch_obj, espulp_ulp_get_arch); @@ -164,12 +164,12 @@ MP_PROPERTY_GETTER(espulp_ulp_arch_obj, (mp_obj_t)&espulp_ulp_get_arch_obj); STATIC const mp_rom_map_elem_t espulp_ulp_locals_table[] = { - { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&espulp_ulp_deinit_obj) }, - { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&mp_identity_obj) }, - { MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&espulp_ulp___exit___obj) }, - { MP_ROM_QSTR(MP_QSTR_run), MP_ROM_PTR(&espulp_ulp_run_obj) }, - { MP_ROM_QSTR(MP_QSTR_halt), MP_ROM_PTR(&espulp_ulp_halt_obj) }, - { MP_ROM_QSTR(MP_QSTR_arch), MP_ROM_PTR(&espulp_ulp_arch_obj) }, + { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&espulp_ulp_deinit_obj) }, + { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&mp_identity_obj) }, + { MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&espulp_ulp___exit___obj) }, + { MP_ROM_QSTR(MP_QSTR_run), MP_ROM_PTR(&espulp_ulp_run_obj) }, + { MP_ROM_QSTR(MP_QSTR_halt), MP_ROM_PTR(&espulp_ulp_halt_obj) }, + { MP_ROM_QSTR(MP_QSTR_arch), MP_ROM_PTR(&espulp_ulp_arch_obj) }, }; STATIC MP_DEFINE_CONST_DICT(espulp_ulp_locals_dict, espulp_ulp_locals_table); diff --git a/ports/espressif/bindings/espulp/ULP.h b/ports/espressif/bindings/espulp/ULP.h index f06f783902..490cbef1ca 100644 --- a/ports/espressif/bindings/espulp/ULP.h +++ b/ports/espressif/bindings/espulp/ULP.h @@ -31,7 +31,7 @@ extern const mp_obj_type_t espulp_ulp_type; -void common_hal_espulp_ulp_construct(espulp_ulp_obj_t *self, espulp_ulparch_t arch); +void common_hal_espulp_ulp_construct(espulp_ulp_obj_t *self, espulp_architecture_t arch); bool common_hal_espulp_ulp_deinited(espulp_ulp_obj_t *self); void common_hal_espulp_ulp_deinit(espulp_ulp_obj_t *self); diff --git a/ports/espressif/bindings/espulp/ULPAlarm.c b/ports/espressif/bindings/espulp/ULPAlarm.c index 921c23d4f5..6efd1c98ef 100644 --- a/ports/espressif/bindings/espulp/ULPAlarm.c +++ b/ports/espressif/bindings/espulp/ULPAlarm.c @@ -25,9 +25,9 @@ */ #include "bindings/espulp/ULPAlarm.h" -#include "bindings/espulp/ULPArch.h" #include "py/runtime.h" +#include "py/objproperty.h" //| class ULPAlarm: //| """Trigger an alarm when the ULP requests wake-up.""" @@ -52,7 +52,10 @@ STATIC mp_obj_t espulp_ulpalarm_make_new(const mp_obj_type_t *type, size_t n_arg espulp_ulpalarm_obj_t *self = m_new_obj(espulp_ulpalarm_obj_t); self->base.type = &espulp_ulpalarm_type; - self->ulp = mp_arg_validate_type(args[ARG_ulp].u_obj, &espulp_ulp_type, MP_QSTR_ulp); + + espulp_ulp_obj_t *ulp = mp_arg_validate_type(args[ARG_ulp].u_obj, &espulp_ulp_type, MP_QSTR_ulp); + + common_hal_espulp_ulpalarm_construct(self, ulp); return MP_OBJ_FROM_PTR(self); } diff --git a/ports/espressif/bindings/espulp/ULPAlarm.h b/ports/espressif/bindings/espulp/ULPAlarm.h index 75e96c0a45..f2b2e69bba 100644 --- a/ports/espressif/bindings/espulp/ULPAlarm.h +++ b/ports/espressif/bindings/espulp/ULPAlarm.h @@ -30,4 +30,4 @@ extern const mp_obj_type_t espulp_ulpalarm_type; -void common_hal_espulp_ulpalarm_construct(espulp_ulpalarm_obj_t *self); +void common_hal_espulp_ulpalarm_construct(espulp_ulpalarm_obj_t *self, espulp_ulp_obj_t *ulp); diff --git a/ports/espressif/bindings/espulp/__init__.c b/ports/espressif/bindings/espulp/__init__.c index ff6d727ec5..f2b688dda4 100644 --- a/ports/espressif/bindings/espulp/__init__.c +++ b/ports/espressif/bindings/espulp/__init__.c @@ -29,7 +29,7 @@ #include "bindings/espulp/__init__.h" #include "bindings/espulp/ULP.h" #include "bindings/espulp/ULPAlarm.h" -#include "bindings/espulp/ULPArch.h" +#include "bindings/espulp/Architecture.h" #include "py/runtime.h" @@ -82,7 +82,7 @@ STATIC const mp_rom_map_elem_t espulp_module_globals_table[] = { // module classes { MP_ROM_QSTR(MP_QSTR_ULP), MP_OBJ_FROM_PTR(&espulp_ulp_type) }, { MP_ROM_QSTR(MP_QSTR_ULPAlarm), MP_OBJ_FROM_PTR(&espulp_ulpalarm_type) }, - { MP_ROM_QSTR(MP_QSTR_ULPArch), MP_ROM_PTR(&espulp_ulparch_type) }, + { MP_ROM_QSTR(MP_QSTR_Architecture), MP_ROM_PTR(&espulp_architecture_type) }, }; STATIC MP_DEFINE_CONST_DICT(espulp_module_globals, espulp_module_globals_table); diff --git a/ports/espressif/common-hal/espulp/ULP.c b/ports/espressif/common-hal/espulp/ULP.c index c2dfdb038b..3350f6d45c 100644 --- a/ports/espressif/common-hal/espulp/ULP.c +++ b/ports/espressif/common-hal/espulp/ULP.c @@ -133,7 +133,7 @@ void common_hal_espulp_ulp_halt(espulp_ulp_obj_t *self) { } } -void common_hal_espulp_ulp_construct(espulp_ulp_obj_t *self, espulp_ulparch_t arch) { +void common_hal_espulp_ulp_construct(espulp_ulp_obj_t *self, espulp_architecture_t arch) { // Use a static variable to track ULP in use so that subsequent code runs can // use a running ULP. This is only to prevent multiple portions of user code // from using the ULP concurrently. diff --git a/ports/espressif/common-hal/espulp/ULP.h b/ports/espressif/common-hal/espulp/ULP.h index 42081411f0..360dd0c9fd 100644 --- a/ports/espressif/common-hal/espulp/ULP.h +++ b/ports/espressif/common-hal/espulp/ULP.h @@ -27,10 +27,10 @@ #pragma once #include "py/obj.h" -#include "bindings/espulp/ULPArch.h" +#include "bindings/espulp/Architecture.h" typedef struct { mp_obj_base_t base; - espulp_ulparch_t arch; + espulp_architecture_t arch; bool inited; } espulp_ulp_obj_t; diff --git a/ports/espressif/common-hal/espulp/ULPAlarm.c b/ports/espressif/common-hal/espulp/ULPAlarm.c index e209325d68..3717d2ab71 100644 --- a/ports/espressif/common-hal/espulp/ULPAlarm.c +++ b/ports/espressif/common-hal/espulp/ULPAlarm.c @@ -37,6 +37,10 @@ static volatile bool woke_up = false; static bool alarm_set = false; +void common_hal_espulp_ulpalarm_construct(espulp_ulpalarm_obj_t *self, espulp_ulp_obj_t *ulp) { + self->ulp = ulp; +} + mp_obj_t espulp_ulpalarm_find_triggered_alarm(const size_t n_alarms, const mp_obj_t *alarms) { for (size_t i = 0; i < n_alarms; i++) { if (mp_obj_is_type(alarms[i], &espulp_ulpalarm_type)) { From 842d7087987c1280d8d1ac3cf673f90d2b459909 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 26 Jan 2023 20:18:22 -0500 Subject: [PATCH 09/52] update frozen libraries --- frozen/Adafruit_CircuitPython_APDS9960 | 2 +- frozen/Adafruit_CircuitPython_BLE | 2 +- frozen/Adafruit_CircuitPython_DRV2605 | 2 +- frozen/Adafruit_CircuitPython_DS3231 | 2 +- frozen/Adafruit_CircuitPython_Display_Shapes | 2 +- frozen/Adafruit_CircuitPython_Display_Text | 2 +- frozen/Adafruit_CircuitPython_IRRemote | 2 +- frozen/Adafruit_CircuitPython_IS31FL3731 | 2 +- frozen/Adafruit_CircuitPython_LC709203F | 2 +- frozen/Adafruit_CircuitPython_LIS3DH | 2 +- frozen/Adafruit_CircuitPython_LSM6DS | 2 +- frozen/Adafruit_CircuitPython_MIDI | 2 +- frozen/Adafruit_CircuitPython_Motor | 2 +- frozen/Adafruit_CircuitPython_NeoPixel | 2 +- frozen/Adafruit_CircuitPython_PortalBase | 2 +- frozen/Adafruit_CircuitPython_ProgressBar | 2 +- frozen/Adafruit_CircuitPython_RFM9x | 2 +- frozen/Adafruit_CircuitPython_Register | 2 +- frozen/Adafruit_CircuitPython_Requests | 2 +- frozen/Adafruit_CircuitPython_SD | 2 +- frozen/Adafruit_CircuitPython_ST7789 | 2 +- frozen/Adafruit_CircuitPython_SimpleIO | 2 +- frozen/Adafruit_CircuitPython_Ticks | 2 +- frozen/Adafruit_CircuitPython_UC8151D | 2 +- frozen/Adafruit_CircuitPython_asyncio | 2 +- frozen/Adafruit_CircuitPython_seesaw | 2 +- 26 files changed, 26 insertions(+), 26 deletions(-) diff --git a/frozen/Adafruit_CircuitPython_APDS9960 b/frozen/Adafruit_CircuitPython_APDS9960 index ba05423ed9..9ddd596505 160000 --- a/frozen/Adafruit_CircuitPython_APDS9960 +++ b/frozen/Adafruit_CircuitPython_APDS9960 @@ -1 +1 @@ -Subproject commit ba05423ed9aae09ce293603b519a4ac644ef0dab +Subproject commit 9ddd59650598b7a0641d70aabcc8aab71799cb93 diff --git a/frozen/Adafruit_CircuitPython_BLE b/frozen/Adafruit_CircuitPython_BLE index 4fd499e397..e07e1853d7 160000 --- a/frozen/Adafruit_CircuitPython_BLE +++ b/frozen/Adafruit_CircuitPython_BLE @@ -1 +1 @@ -Subproject commit 4fd499e39720f8ce970cceeb97c2a85c485f7335 +Subproject commit e07e1853d7e995b9797a064c098bccc5c384632e diff --git a/frozen/Adafruit_CircuitPython_DRV2605 b/frozen/Adafruit_CircuitPython_DRV2605 index 4a4619a524..ab0ffa938d 160000 --- a/frozen/Adafruit_CircuitPython_DRV2605 +++ b/frozen/Adafruit_CircuitPython_DRV2605 @@ -1 +1 @@ -Subproject commit 4a4619a524918f2705c05ca4959385937afa9a7c +Subproject commit ab0ffa938dfa7eb1fd7260353a7a4e28f55e537a diff --git a/frozen/Adafruit_CircuitPython_DS3231 b/frozen/Adafruit_CircuitPython_DS3231 index 726270f510..e6a9a0140e 160000 --- a/frozen/Adafruit_CircuitPython_DS3231 +++ b/frozen/Adafruit_CircuitPython_DS3231 @@ -1 +1 @@ -Subproject commit 726270f5103d9d94810eb8b52041b7521afafc5c +Subproject commit e6a9a0140ed44ef5f15d8040fce35b5319c1f216 diff --git a/frozen/Adafruit_CircuitPython_Display_Shapes b/frozen/Adafruit_CircuitPython_Display_Shapes index 656be4d791..cf2b173d0f 160000 --- a/frozen/Adafruit_CircuitPython_Display_Shapes +++ b/frozen/Adafruit_CircuitPython_Display_Shapes @@ -1 +1 @@ -Subproject commit 656be4d79196b5f25ab9ebca731d448c5b3bdc17 +Subproject commit cf2b173d0fc3ac2cd961754c6adf8f614a1c7c39 diff --git a/frozen/Adafruit_CircuitPython_Display_Text b/frozen/Adafruit_CircuitPython_Display_Text index 6cf9f3cf32..1590d81f7d 160000 --- a/frozen/Adafruit_CircuitPython_Display_Text +++ b/frozen/Adafruit_CircuitPython_Display_Text @@ -1 +1 @@ -Subproject commit 6cf9f3cf32e0c176c861de6356813ea4d08034d6 +Subproject commit 1590d81f7d1474b25aed6a0cb793c7e6dc7634ec diff --git a/frozen/Adafruit_CircuitPython_IRRemote b/frozen/Adafruit_CircuitPython_IRRemote index 992b601e24..340c62ef6c 160000 --- a/frozen/Adafruit_CircuitPython_IRRemote +++ b/frozen/Adafruit_CircuitPython_IRRemote @@ -1 +1 @@ -Subproject commit 992b601e2469f30e95ec35c9859b4aa2cd917504 +Subproject commit 340c62ef6ce867b3924d166afc3d2a171680f799 diff --git a/frozen/Adafruit_CircuitPython_IS31FL3731 b/frozen/Adafruit_CircuitPython_IS31FL3731 index 794488d1de..8e0f081a0f 160000 --- a/frozen/Adafruit_CircuitPython_IS31FL3731 +++ b/frozen/Adafruit_CircuitPython_IS31FL3731 @@ -1 +1 @@ -Subproject commit 794488d1de3d17d1a08887c4a651cfac2c5a1524 +Subproject commit 8e0f081a0fcc94053b8ef480a916b10855a3c0d5 diff --git a/frozen/Adafruit_CircuitPython_LC709203F b/frozen/Adafruit_CircuitPython_LC709203F index 1919916dcf..38bd02f014 160000 --- a/frozen/Adafruit_CircuitPython_LC709203F +++ b/frozen/Adafruit_CircuitPython_LC709203F @@ -1 +1 @@ -Subproject commit 1919916dcf57e0879832b9c274c5fb77712d7775 +Subproject commit 38bd02f014403954ab52154e3877e502d83862dc diff --git a/frozen/Adafruit_CircuitPython_LIS3DH b/frozen/Adafruit_CircuitPython_LIS3DH index 5b4703428f..61ca58788a 160000 --- a/frozen/Adafruit_CircuitPython_LIS3DH +++ b/frozen/Adafruit_CircuitPython_LIS3DH @@ -1 +1 @@ -Subproject commit 5b4703428fc299ac268d08350c885122b2af1e75 +Subproject commit 61ca58788aabd53558e10c32064a1304aa7454f2 diff --git a/frozen/Adafruit_CircuitPython_LSM6DS b/frozen/Adafruit_CircuitPython_LSM6DS index c8e82b96c6..d689ca77c6 160000 --- a/frozen/Adafruit_CircuitPython_LSM6DS +++ b/frozen/Adafruit_CircuitPython_LSM6DS @@ -1 +1 @@ -Subproject commit c8e82b96c68041a11a52f3053d0d2733ae2d1a49 +Subproject commit d689ca77c67806484037e00110c669cf55846b6e diff --git a/frozen/Adafruit_CircuitPython_MIDI b/frozen/Adafruit_CircuitPython_MIDI index b6891e7341..e38bf1f9cf 160000 --- a/frozen/Adafruit_CircuitPython_MIDI +++ b/frozen/Adafruit_CircuitPython_MIDI @@ -1 +1 @@ -Subproject commit b6891e734183f978e7b3d0a363140e98635c0a04 +Subproject commit e38bf1f9cf1e8faeb7d15a1d10674fb2c0a81e72 diff --git a/frozen/Adafruit_CircuitPython_Motor b/frozen/Adafruit_CircuitPython_Motor index 31c819f377..f26bead58d 160000 --- a/frozen/Adafruit_CircuitPython_Motor +++ b/frozen/Adafruit_CircuitPython_Motor @@ -1 +1 @@ -Subproject commit 31c819f377cf71f61cfb84eae159f1f948980db7 +Subproject commit f26bead58d3c4036eced586d275396816e92e80a diff --git a/frozen/Adafruit_CircuitPython_NeoPixel b/frozen/Adafruit_CircuitPython_NeoPixel index 1064fdee5a..9516aa97e9 160000 --- a/frozen/Adafruit_CircuitPython_NeoPixel +++ b/frozen/Adafruit_CircuitPython_NeoPixel @@ -1 +1 @@ -Subproject commit 1064fdee5a1421f528af452be5e45ae95ef2b89a +Subproject commit 9516aa97e9216eac2b229fbb7dac34fa60c347c4 diff --git a/frozen/Adafruit_CircuitPython_PortalBase b/frozen/Adafruit_CircuitPython_PortalBase index 7eeea1aaf6..759c5c3488 160000 --- a/frozen/Adafruit_CircuitPython_PortalBase +++ b/frozen/Adafruit_CircuitPython_PortalBase @@ -1 +1 @@ -Subproject commit 7eeea1aaf6bb5fa0deb080a1dc1aa3cd103f9aad +Subproject commit 759c5c348878932adc5fcc9e4f3b3f570b43e17f diff --git a/frozen/Adafruit_CircuitPython_ProgressBar b/frozen/Adafruit_CircuitPython_ProgressBar index cad34af526..74a1c26110 160000 --- a/frozen/Adafruit_CircuitPython_ProgressBar +++ b/frozen/Adafruit_CircuitPython_ProgressBar @@ -1 +1 @@ -Subproject commit cad34af5267aca3665fdaf1ea5a0eee921d13f06 +Subproject commit 74a1c261103cda43172053ff2370777255b9bf8d diff --git a/frozen/Adafruit_CircuitPython_RFM9x b/frozen/Adafruit_CircuitPython_RFM9x index df4c73a5e7..c46c59e300 160000 --- a/frozen/Adafruit_CircuitPython_RFM9x +++ b/frozen/Adafruit_CircuitPython_RFM9x @@ -1 +1 @@ -Subproject commit df4c73a5e719f17fae0309e811ff17627cd0f268 +Subproject commit c46c59e3004817c708c78c59d247b02161c6bf06 diff --git a/frozen/Adafruit_CircuitPython_Register b/frozen/Adafruit_CircuitPython_Register index f611d5e31c..46a49205f3 160000 --- a/frozen/Adafruit_CircuitPython_Register +++ b/frozen/Adafruit_CircuitPython_Register @@ -1 +1 @@ -Subproject commit f611d5e31c9735a3c3ac43185e35dcd5f659e3aa +Subproject commit 46a49205f3f14546273dd1267e66cad82f03986c diff --git a/frozen/Adafruit_CircuitPython_Requests b/frozen/Adafruit_CircuitPython_Requests index 317f4bdb79..203d0b1489 160000 --- a/frozen/Adafruit_CircuitPython_Requests +++ b/frozen/Adafruit_CircuitPython_Requests @@ -1 +1 @@ -Subproject commit 317f4bdb799afa59b164def4ea0610f57db9922e +Subproject commit 203d0b1489cb90a39f8a780570287f1a5bd610a0 diff --git a/frozen/Adafruit_CircuitPython_SD b/frozen/Adafruit_CircuitPython_SD index bb2fc8c157..eb17bffa75 160000 --- a/frozen/Adafruit_CircuitPython_SD +++ b/frozen/Adafruit_CircuitPython_SD @@ -1 +1 @@ -Subproject commit bb2fc8c157ee44869cde4cbc1ab20e6f31ac727f +Subproject commit eb17bffa757dc8c0a53fe9e61c45246c06418099 diff --git a/frozen/Adafruit_CircuitPython_ST7789 b/frozen/Adafruit_CircuitPython_ST7789 index 9ff56ce53f..e23c487145 160000 --- a/frozen/Adafruit_CircuitPython_ST7789 +++ b/frozen/Adafruit_CircuitPython_ST7789 @@ -1 +1 @@ -Subproject commit 9ff56ce53f05e23ff678965ba54af89b24b1199a +Subproject commit e23c4871456cdf0ef1bfb59d1c2f6e38b7b640ee diff --git a/frozen/Adafruit_CircuitPython_SimpleIO b/frozen/Adafruit_CircuitPython_SimpleIO index 0a8fcbfc92..eac33b430b 160000 --- a/frozen/Adafruit_CircuitPython_SimpleIO +++ b/frozen/Adafruit_CircuitPython_SimpleIO @@ -1 +1 @@ -Subproject commit 0a8fcbfc92060eb298ea52d5e88587b37347a0be +Subproject commit eac33b430b0cbe1f6f583000f6b29f75bfe8507e diff --git a/frozen/Adafruit_CircuitPython_Ticks b/frozen/Adafruit_CircuitPython_Ticks index 7832bbb544..2634ca0163 160000 --- a/frozen/Adafruit_CircuitPython_Ticks +++ b/frozen/Adafruit_CircuitPython_Ticks @@ -1 +1 @@ -Subproject commit 7832bbb5449d55d8c7b731e4ff7490b801e94a9e +Subproject commit 2634ca0163020bebec300fcca6e0b5afcdc655b8 diff --git a/frozen/Adafruit_CircuitPython_UC8151D b/frozen/Adafruit_CircuitPython_UC8151D index 565fed5151..b6d9f852f5 160000 --- a/frozen/Adafruit_CircuitPython_UC8151D +++ b/frozen/Adafruit_CircuitPython_UC8151D @@ -1 +1 @@ -Subproject commit 565fed515138f962c4bcce0ee756d32e708a151a +Subproject commit b6d9f852f50b489615f3f357f9758d0073335334 diff --git a/frozen/Adafruit_CircuitPython_asyncio b/frozen/Adafruit_CircuitPython_asyncio index fbdb77d712..596cc896e5 160000 --- a/frozen/Adafruit_CircuitPython_asyncio +++ b/frozen/Adafruit_CircuitPython_asyncio @@ -1 +1 @@ -Subproject commit fbdb77d7127e7d6a8d3574440b0f790c94a28cf8 +Subproject commit 596cc896e5c8815caa2a6f405560833193848149 diff --git a/frozen/Adafruit_CircuitPython_seesaw b/frozen/Adafruit_CircuitPython_seesaw index 6234787515..d4ff0388f3 160000 --- a/frozen/Adafruit_CircuitPython_seesaw +++ b/frozen/Adafruit_CircuitPython_seesaw @@ -1 +1 @@ -Subproject commit 6234787515e2f0ece40b6408722ff0b42824038e +Subproject commit d4ff0388f3e3af2745864f2c3e5926f500673a40 From cda56892630b1be86a7bca43bc6e308c579bb14e Mon Sep 17 00:00:00 2001 From: MicroDev <70126934+MicroDev1@users.noreply.github.com> Date: Fri, 27 Jan 2023 21:58:37 +0530 Subject: [PATCH 10/52] move `esp32_camera` to `espcamera` --- locale/circuitpython.pot | 9 +- ports/espressif/CMakeLists.txt | 2 +- ports/espressif/Makefile | 10 +- .../espressif/bindings/esp32_camera/Camera.c | 1001 ----------------- ports/espressif/bindings/espcamera/Camera.c | 1001 +++++++++++++++++ .../{esp32_camera => espcamera}/Camera.h | 38 +- .../{esp32_camera => espcamera}/__init__.c | 136 +-- .../{esp32_camera => espcamera}/__init__.h | 8 +- .../mpconfigboard.mk | 2 +- .../mpconfigboard.mk | 2 +- .../mpconfigboard.mk | 2 +- .../mpconfigboard.mk | 2 +- .../boards/adafruit_funhouse/mpconfigboard.mk | 2 +- .../mpconfigboard.mk | 2 +- .../mpconfigboard.mk | 2 +- .../crcibernetica-ideaboard/mpconfigboard.mk | 2 +- .../doit_esp32_devkit_v1/mpconfigboard.mk | 2 +- .../electroniccats_bastwifi/mpconfigboard.mk | 2 +- .../mpconfigboard.mk | 2 +- .../espressif_esp32s3_box/mpconfigboard.mk | 2 +- .../mpconfigboard.mk | 2 +- .../mpconfigboard.mk | 2 +- .../mpconfigboard.mk | 2 +- .../mpconfigboard.mk | 2 +- .../espressif_saola_1_wroom/mpconfigboard.mk | 2 +- .../franzininho_wifi_wroom/mpconfigboard.mk | 2 +- .../gravitech_cucumber_m/mpconfigboard.mk | 2 +- .../gravitech_cucumber_ms/mpconfigboard.mk | 2 +- .../mpconfigboard.mk | 2 +- .../boards/lolin_s3/mpconfigboard.mk | 2 +- .../boards/m5stack_atom_echo/mpconfigboard.mk | 2 +- .../boards/m5stack_atom_lite/mpconfigboard.mk | 2 +- .../m5stack_atom_matrix/mpconfigboard.mk | 2 +- .../boards/m5stack_atom_u/mpconfigboard.mk | 2 +- .../m5stack_core_basic/mpconfigboard.mk | 2 +- .../boards/m5stack_core_fire/mpconfigboard.mk | 2 +- .../boards/m5stack_stick_c/mpconfigboard.mk | 2 +- .../boards/maker_badge/mpconfigboard.mk | 2 +- .../boards/mixgo_ce_serial/mpconfigboard.mk | 4 +- .../boards/mixgo_ce_udisk/mpconfigboard.mk | 4 +- .../morpheans_morphesp-240/mpconfigboard.mk | 2 +- .../mpconfigboard.mk | 2 +- .../mpconfigboard.mk | 2 +- .../smartbeedesigns_bee_s3/mpconfigboard.mk | 2 +- .../mpconfigboard.mk | 2 +- .../{esp32_camera => espcamera}/Camera.c | 52 +- .../{esp32_camera => espcamera}/Camera.h | 4 +- ports/espressif/mpconfigport.mk | 8 +- ports/espressif/supervisor/port.c | 4 +- py/circuitpy_mpconfig.mk | 9 +- shared-bindings/imagecapture/__init__.c | 2 +- 51 files changed, 1181 insertions(+), 1181 deletions(-) delete mode 100644 ports/espressif/bindings/esp32_camera/Camera.c create mode 100644 ports/espressif/bindings/espcamera/Camera.c rename ports/espressif/bindings/{esp32_camera => espcamera}/Camera.h (72%) rename ports/espressif/bindings/{esp32_camera => espcamera}/__init__.c (53%) rename ports/espressif/bindings/{esp32_camera => espcamera}/__init__.h (88%) rename ports/espressif/common-hal/{esp32_camera => espcamera}/Camera.c (83%) rename ports/espressif/common-hal/{esp32_camera => espcamera}/Camera.h (96%) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index b98bddec50..b2c7155f18 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -663,6 +663,7 @@ msgstr "" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h msgid "Button A was pressed at start up.\n" msgstr "" @@ -2947,9 +2948,9 @@ msgstr "" msgid "error = 0x%08lX" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" @@ -3326,7 +3327,7 @@ msgstr "" msgid "invalid micropython decorator" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "" @@ -3583,7 +3584,7 @@ msgstr "" msgid "no response from SD card" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c +#: ports/espressif/common-hal/espcamera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "" diff --git a/ports/espressif/CMakeLists.txt b/ports/espressif/CMakeLists.txt index ea4de9f343..ce2935a502 100644 --- a/ports/espressif/CMakeLists.txt +++ b/ports/espressif/CMakeLists.txt @@ -8,7 +8,7 @@ set(ENV{IDF_PATH} ${CMAKE_SOURCE_DIR}/esp-idf) # can build. set(COMPONENTS esptool_py soc driver log main esp-tls mbedtls mdns esp_event esp_adc_cal esp_netif esp_wifi lwip ulp wpa_supplicant freertos bt usb) -if("${CIRCUITPY_ESP32_CAMERA}") +if("${CIRCUITPY_ESPCAMERA}") message("Including esp32-camera") set(EXTRA_COMPONENT_DIRS "esp32-camera") list(APPEND COMPONENTS "esp32-camera") diff --git a/ports/espressif/Makefile b/ports/espressif/Makefile index ddfcaeeb6e..1c79691b33 100644 --- a/ports/espressif/Makefile +++ b/ports/espressif/Makefile @@ -250,10 +250,10 @@ endif SRC_C += $(wildcard common-hal/espidf/*.c) -ifneq ($(CIRCUITPY_ESP32_CAMERA),0) +ifneq ($(CIRCUITPY_ESPCAMERA),0) SRC_CAMERA := \ - $(wildcard common-hal/esp32_camera/*.c) \ - $(wildcard bindings/esp32_camera/*.c) + $(wildcard common-hal/espcamera/*.c) \ + $(wildcard bindings/espcamera/*.c) SRC_C += $(SRC_CAMERA) CFLAGS += -isystem esp32-camera/driver/include CFLAGS += -isystem esp32-camera/conversions/include @@ -333,7 +333,7 @@ endif .PHONY: do-sdkconfig do-sdkconfig: $(BUILD)/esp-idf/config/sdkconfig.h $(BUILD)/esp-idf/config/sdkconfig.h: boards/$(BOARD)/sdkconfig CMakeLists.txt | $(BUILD)/esp-idf - IDF_PATH=$(IDF_PATH) cmake -S . -B $(BUILD)/esp-idf -DSDKCONFIG=$(BUILD)/esp-idf/sdkconfig -DSDKCONFIG_DEFAULTS="$(SDKCONFIGS)" -DCMAKE_TOOLCHAIN_FILE=$(IDF_PATH)/tools/cmake/toolchain-$(IDF_TARGET).cmake -DIDF_TARGET=$(IDF_TARGET) -GNinja -DCIRCUITPY_ESP32_CAMERA=$(CIRCUITPY_ESP32_CAMERA) + IDF_PATH=$(IDF_PATH) cmake -S . -B $(BUILD)/esp-idf -DSDKCONFIG=$(BUILD)/esp-idf/sdkconfig -DSDKCONFIG_DEFAULTS="$(SDKCONFIGS)" -DCMAKE_TOOLCHAIN_FILE=$(IDF_PATH)/tools/cmake/toolchain-$(IDF_TARGET).cmake -DIDF_TARGET=$(IDF_TARGET) -GNinja -DCIRCUITPY_ESPCAMERA=$(CIRCUITPY_ESPCAMERA) # build a lib # Adding -d explain -j 1 -v to the ninja line will output debug info @@ -385,7 +385,7 @@ BINARY_BLOBS += esp-idf/components/xtensa/$(IDF_TARGET)/libxt_hal.a ESP_IDF_COMPONENTS_EXPANDED += esp-idf/components/xtensa/$(IDF_TARGET)/libxt_hal.a endif -ifneq ($(CIRCUITPY_ESP32_CAMERA),0) +ifneq ($(CIRCUITPY_ESPCAMERA),0) ESP_IDF_COMPONENTS_EXPANDED += $(BUILD)/esp-idf/esp-idf/esp32-camera/libesp32-camera.a #$(error $(ESP_IDF_COMPONENTS_EXPANDED)) endif diff --git a/ports/espressif/bindings/esp32_camera/Camera.c b/ports/espressif/bindings/esp32_camera/Camera.c deleted file mode 100644 index 114795c106..0000000000 --- a/ports/espressif/bindings/esp32_camera/Camera.c +++ /dev/null @@ -1,1001 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2022 Jeff Epler for Adafruit Industries - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include - -#include "py/mphal.h" -#include "py/obj.h" -#include "py/objproperty.h" -#include "py/runtime.h" - -#include "bindings/esp32_camera/__init__.h" -#include "bindings/esp32_camera/Camera.h" -#include "common-hal/esp32_camera/Camera.h" - -#include "shared-bindings/displayio/Bitmap.h" -#include "shared-bindings/microcontroller/Pin.h" -#include "shared-bindings/util.h" -#include "esp_camera.h" -#include "sensor.h" - -//| class Camera: -//| def __init__( -//| self, -//| *, -//| data_pins: List[microcontroller.Pin], -//| pixel_clock_pin: microcontroller.Pin, -//| vsync_pin: microcontroller.Pin, -//| href_pin: microcontroller.Pin, -//| i2c: busio.I2C, -//| external_clock_pin: Optional[microcontroller.Pin] = None, -//| external_clock_frequency: int = 20_000_000, -//| powerdown_pin: Optional[microcontroller.Pin] = None, -//| reset_pin: Optional[microcontroller.Pin] = None, -//| pixel_format: PixelFormat = PixelFormat.RGB565, -//| frame_size: FrameSize = FrameSize.QQVGA, -//| jpeg_quality: int = 15, -//| framebuffer_count: int = 1, -//| grab_mode: GrabMode = GrabMode.WHEN_EMPTY, -//| ) -> None: -//| """ -//| Configure and initialize a camera with the given properties -//| -//| This driver requires that the ``CIRCUITPY_RESERVED_PSRAM`` in ``settings.toml`` be large enough to hold the camera frambuffer(s). Generally, boards with built-in cameras will have a default setting that is large enough. If the constructor raises a MemoryError or an IDFError, this probably indicates the setting is too small and should be increased. -//| -//| -//| .. important:: -//| -//| Not all supported sensors have all -//| of the properties listed below. For instance, the -//| OV5640 supports `denoise`, but the -//| OV2640 does not. The underlying esp32-camera -//| library does not provide a reliable API to check -//| which settings are supported. CircuitPython makes -//| a best effort to determine when an unsupported -//| property is set and will raise an exception in -//| that case. -//| -//| :param data_pins: The 8 data data_pins used for image data transfer from the camera module, least significant bit first -//| :param pixel_clock_pin: The pixel clock output from the camera module -//| :param vsync_pin: The vertical sync pulse output from the camera module -//| :param href_pin: The horizontal reference output from the camera module -//| :param i2c: The I2C bus connected to the camera module -//| :param external_clock_pin: The pin on which to generate the external clock -//| :param external_clock_frequency: The frequency generated on the external clock pin -//| :param powerdown_pin: The powerdown input to the camera module -//| :param reset_pin: The reset input to the camera module -//| :param pixel_format: The pixel format of the captured image -//| :param frame_size: The size of captured image -//| :param jpeg_quality: For `PixelFormat.JPEG`, the quality. Higher numbers increase quality. If the quality is too high, the JPEG data will be larger than the availalble buffer size and the image will be unusable or truncated. The exact range of appropriate values depends on the sensor and must be determined empirically. -//| :param framebuffer_count: The number of framebuffers (1 for single-buffered and 2 for double-buffered) -//| :param grab_mode: When to grab a new frame -//| """ -STATIC mp_obj_t esp32_camera_camera_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { - enum { ARG_data_pins, ARG_pixel_clock_pin, ARG_vsync_pin, ARG_href_pin, ARG_i2c, ARG_external_clock_pin, ARG_external_clock_frequency, ARG_powerdown_pin, ARG_reset_pin, ARG_pixel_format, ARG_frame_size, ARG_jpeg_quality, ARG_framebuffer_count, ARG_grab_mode, NUM_ARGS }; - static const mp_arg_t allowed_args[] = { - { MP_QSTR_data_pins, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, - { MP_QSTR_pixel_clock_pin, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, - { MP_QSTR_vsync_pin, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, - { MP_QSTR_href_pin, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, - { MP_QSTR_i2c, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, - { MP_QSTR_external_clock_pin, MP_ARG_OBJ | MP_ARG_KW_ONLY, { .u_obj = MP_ROM_NONE } }, - { MP_QSTR_external_clock_frequency, MP_ARG_INT | MP_ARG_KW_ONLY, { .u_int = 20000000L } }, - { MP_QSTR_powerdown_pin, MP_ARG_OBJ | MP_ARG_KW_ONLY, { .u_obj = MP_ROM_NONE } }, - { MP_QSTR_reset_pin, MP_ARG_OBJ | MP_ARG_KW_ONLY, { .u_obj = MP_ROM_NONE } }, - { MP_QSTR_pixel_format, MP_ARG_OBJ | MP_ARG_KW_ONLY, { .u_obj = MP_ROM_PTR((void *)&pixel_format_RGB565_obj) } }, - { MP_QSTR_frame_size, MP_ARG_OBJ | MP_ARG_KW_ONLY, { .u_obj = MP_ROM_PTR((void *)&frame_size_QQVGA_obj) } }, - { MP_QSTR_jpeg_quality, MP_ARG_INT | MP_ARG_KW_ONLY, { .u_int = 15 } }, - { MP_QSTR_framebuffer_count, MP_ARG_INT | MP_ARG_KW_ONLY, { .u_int = 1 } }, - { MP_QSTR_grab_mode, MP_ARG_OBJ | MP_ARG_KW_ONLY, { .u_obj = MP_ROM_PTR((void *)&grab_mode_WHEN_EMPTY_obj) } }, - }; - - mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; - MP_STATIC_ASSERT(MP_ARRAY_SIZE(allowed_args) == NUM_ARGS); - mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - - uint8_t data_pins[8]; - uint8_t data_pin_count; - validate_pins(MP_QSTR_data_pins, data_pins, MP_ARRAY_SIZE(data_pins), args[ARG_data_pins].u_obj, &data_pin_count); - mp_arg_validate_length(data_pin_count, 8, MP_QSTR_data_pins); - - const mcu_pin_obj_t *pixel_clock_pin = - validate_obj_is_free_pin(args[ARG_pixel_clock_pin].u_obj, MP_QSTR_pixel_clock_pin); - const mcu_pin_obj_t *vsync_pin = - validate_obj_is_free_pin(args[ARG_vsync_pin].u_obj, MP_QSTR_vsync_pin); - const mcu_pin_obj_t *href_pin = - validate_obj_is_free_pin(args[ARG_href_pin].u_obj, MP_QSTR_href_pin); - busio_i2c_obj_t *i2c = MP_OBJ_TO_PTR(mp_arg_validate_type(args[ARG_i2c].u_obj, &busio_i2c_type, MP_QSTR_i2c)); - const mcu_pin_obj_t *external_clock_pin = - validate_obj_is_free_pin_or_none(args[ARG_external_clock_pin].u_obj, MP_QSTR_external_clock_pin); - const mcu_pin_obj_t *powerdown_pin = - validate_obj_is_free_pin_or_none(args[ARG_powerdown_pin].u_obj, MP_QSTR_powerdown_pin); - const mcu_pin_obj_t *reset_pin = - validate_obj_is_free_pin_or_none(args[ARG_reset_pin].u_obj, MP_QSTR_reset_pin); - const mp_int_t external_clock_frequency = - mp_arg_validate_int_range(args[ARG_external_clock_frequency].u_int, 0, 40000000, MP_QSTR_external_clock_frequency); - - camera_grab_mode_t grab_mode = validate_grab_mode(args[ARG_grab_mode].u_obj, MP_QSTR_grab_mode); - framesize_t frame_size = validate_frame_size(args[ARG_frame_size].u_obj, MP_QSTR_frame_size); - pixformat_t pixel_format = validate_pixel_format(args[ARG_pixel_format].u_obj, MP_QSTR_pixel_format); - mp_int_t jpeg_quality = mp_arg_validate_int_range(args[ARG_jpeg_quality].u_int, 2, 55, MP_QSTR_jpeg_quality); - mp_int_t framebuffer_count = mp_arg_validate_int_range(args[ARG_framebuffer_count].u_int, 1, 2, MP_QSTR_framebuffer_count); - - esp32_camera_camera_obj_t *self = m_new_obj(esp32_camera_camera_obj_t); - self->base.type = &esp32_camera_camera_type; - common_hal_esp32_camera_camera_construct( - self, - data_pins, - external_clock_pin, - pixel_clock_pin, - vsync_pin, - href_pin, - powerdown_pin, - reset_pin, - i2c, - external_clock_frequency, - pixel_format, - frame_size, - jpeg_quality, - framebuffer_count, - grab_mode); - return MP_OBJ_FROM_PTR(self); -} - -//| def deinit(self) -> None: -//| """Deinitialises the camera and releases all memory resources for reuse.""" -//| ... -STATIC mp_obj_t esp32_camera_camera_deinit(mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - common_hal_esp32_camera_camera_deinit(self); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_deinit_obj, esp32_camera_camera_deinit); - -STATIC void check_for_deinit(esp32_camera_camera_obj_t *self) { - if (common_hal_esp32_camera_camera_deinited(self)) { - raise_deinited_error(); - } -} - -//| def __enter__(self) -> Camera: -//| """No-op used by Context Managers.""" -//| ... -// Provided by context manager helper. - -//| def __exit__(self) -> None: -//| """Automatically deinitializes the hardware when exiting a context. See -//| :ref:`lifetime-and-contextmanagers` for more info.""" -//| ... -STATIC mp_obj_t esp32_camera_camera_obj___exit__(size_t n_args, const mp_obj_t *args) { - (void)n_args; - return esp32_camera_camera_deinit(args[0]); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(esp32_camera_camera___exit___obj, 4, 4, esp32_camera_camera_obj___exit__); - -//| frame_available: bool -//| """True if a frame is available, False otherwise""" - -STATIC mp_obj_t esp32_camera_camera_frame_available_get(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return mp_obj_new_bool(esp_camera_fb_available()); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_frame_available_get_obj, esp32_camera_camera_frame_available_get); - -MP_PROPERTY_GETTER(esp32_camera_camera_frame_available_obj, - (mp_obj_t)&esp32_camera_camera_frame_available_get_obj); - -//| def take( -//| self, timeout: Optional[float] = 0.25 -//| ) -> Optional[displayio.Bitmap | ReadableBuffer]: -//| """Record a frame. Wait up to 'timeout' seconds for a frame to be captured. -//| -//| In the case of timeout, `None` is returned. -//| If `pixel_format` is `PixelFormat.JPEG`, the returned value is a read-only `memoryview`. -//| Otherwise, the returned value is a read-only `displayio.Bitmap`. -//| """ -STATIC mp_obj_t esp32_camera_camera_take(size_t n_args, const mp_obj_t *args) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(args[0]); - mp_float_t timeout = n_args < 2 ? MICROPY_FLOAT_CONST(0.25) : mp_obj_get_float(args[1]); - check_for_deinit(self); - camera_fb_t *result = common_hal_esp32_camera_camera_take(self, (int)MICROPY_FLOAT_C_FUN(round)(timeout * 1000)); - if (!result) { - return mp_const_none; - } - pixformat_t format = common_hal_esp32_camera_camera_get_pixel_format(self); - if (format == PIXFORMAT_JPEG) { - return mp_obj_new_memoryview('b', result->len, result->buf); - } else { - int width = common_hal_esp32_camera_camera_get_width(self); - int height = common_hal_esp32_camera_camera_get_height(self); - displayio_bitmap_t *bitmap = m_new_obj(displayio_bitmap_t); - bitmap->base.type = &displayio_bitmap_type; - common_hal_displayio_bitmap_construct_from_buffer(bitmap, width, height, (format == PIXFORMAT_RGB565) ? 16 : 8, (uint32_t *)(void *)result->buf, true); - return bitmap; - } -} -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(esp32_camera_camera_take_obj, 1, 2, esp32_camera_camera_take); - - -//| def reconfigure( -//| self, -//| frame_size: Optional[FrameSize] = None, -//| pixel_format: Optional[PixelFormat] = None, -//| grab_mode: Optional[GrabMode] = None, -//| framebuffer_count: Optional[int] = None, -//| ) -> None: -//| """Change multiple related camera settings simultaneously -//| -//| Because these settings interact in complex ways, and take longer than -//| the other properties to set, they are set together in a single function call. -//| -//| If an argument is unspecified or None, then the setting is unchanged.""" - -STATIC mp_obj_t esp32_camera_camera_reconfigure(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); - check_for_deinit(self); - - enum { ARG_frame_size, ARG_pixel_format, ARG_grab_mode, ARG_framebuffer_count }; - static const mp_arg_t allowed_args[] = { - { MP_QSTR_frame_size, MP_ARG_OBJ, {.u_obj = MP_ROM_NONE} }, - { MP_QSTR_pixel_format, MP_ARG_OBJ, {.u_obj = MP_ROM_NONE} }, - { MP_QSTR_grab_mode, MP_ARG_OBJ, {.u_obj = MP_ROM_NONE} }, - { MP_QSTR_framebuffer_count, MP_ARG_OBJ, {.u_obj = MP_ROM_NONE} }, - }; - - mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; - mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - - framesize_t frame_size = - args[ARG_frame_size].u_obj != MP_ROM_NONE - ? validate_frame_size(args[ARG_frame_size].u_obj, MP_QSTR_frame_size) - : common_hal_esp32_camera_camera_get_frame_size(self); - pixformat_t pixel_format = - args[ARG_pixel_format].u_obj != MP_ROM_NONE - ? validate_pixel_format(args[ARG_pixel_format].u_obj, MP_QSTR_pixel_format) - : common_hal_esp32_camera_camera_get_pixel_format(self); - camera_grab_mode_t grab_mode = - args[ARG_grab_mode].u_obj != MP_ROM_NONE - ? validate_grab_mode(args[ARG_grab_mode].u_obj, MP_QSTR_grab_mode) - : common_hal_esp32_camera_camera_get_grab_mode(self); - bool framebuffer_count = - args[ARG_framebuffer_count].u_obj != MP_ROM_NONE - ? mp_obj_get_int(args[ARG_framebuffer_count].u_obj) - : common_hal_esp32_camera_camera_get_framebuffer_count(self); - - common_hal_esp32_camera_camera_reconfigure(self, frame_size, pixel_format, grab_mode, framebuffer_count); - - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_KW(esp32_camera_camera_reconfigure_obj, 1, esp32_camera_camera_reconfigure); - -//| pixel_format: PixelFormat -//| """The pixel format of captured frames""" - -STATIC mp_obj_t esp32_camera_camera_get_pixel_format(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return cp_enum_find(&esp32_camera_pixel_format_type, common_hal_esp32_camera_camera_get_pixel_format(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_pixel_format_obj, esp32_camera_camera_get_pixel_format); - -MP_PROPERTY_GETTER(esp32_camera_camera_pixel_format_obj, - (mp_obj_t)&esp32_camera_camera_get_pixel_format_obj); - - -//| frame_size: FrameSize -//| """The size of captured frames""" - -STATIC mp_obj_t esp32_camera_camera_get_frame_size(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return cp_enum_find(&esp32_camera_frame_size_type, common_hal_esp32_camera_camera_get_frame_size(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_frame_size_obj, esp32_camera_camera_get_frame_size); - -MP_PROPERTY_GETTER(esp32_camera_camera_frame_size_obj, - (mp_obj_t)&esp32_camera_camera_get_frame_size_obj); - -//| contrast: int -//| """The sensor contrast. Positive values increase contrast, negative values lower it. The total range is device-specific but is often from -2 to +2 inclusive.""" - -STATIC mp_obj_t esp32_camera_camera_get_contrast(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_contrast(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_contrast_obj, esp32_camera_camera_get_contrast); - -STATIC mp_obj_t esp32_camera_camera_set_contrast(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_contrast(self, mp_obj_get_int(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_contrast_obj, esp32_camera_camera_set_contrast); -MP_PROPERTY_GETSET(esp32_camera_camera_contrast_obj, - (mp_obj_t)&esp32_camera_camera_get_contrast_obj, - (mp_obj_t)&esp32_camera_camera_set_contrast_obj); - -//| brightness: int -//| """The sensor brightness. Positive values increase brightness, negative values lower it. The total range is device-specific but is often from -2 to +2 inclusive.""" - -STATIC mp_obj_t esp32_camera_camera_get_brightness(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_brightness(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_brightness_obj, esp32_camera_camera_get_brightness); - -STATIC mp_obj_t esp32_camera_camera_set_brightness(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_brightness(self, mp_obj_get_int(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_brightness_obj, esp32_camera_camera_set_brightness); -MP_PROPERTY_GETSET(esp32_camera_camera_brightness_obj, - (mp_obj_t)&esp32_camera_camera_get_brightness_obj, - (mp_obj_t)&esp32_camera_camera_set_brightness_obj); - -//| saturation: int -//| """The sensor saturation. Positive values increase saturation (more vibrant colors), negative values lower it (more muted colors). The total range is device-specific but the value is often from -2 to +2 inclusive.""" - -STATIC mp_obj_t esp32_camera_camera_get_saturation(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_saturation(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_saturation_obj, esp32_camera_camera_get_saturation); - -STATIC mp_obj_t esp32_camera_camera_set_saturation(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_saturation(self, mp_obj_get_int(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_saturation_obj, esp32_camera_camera_set_saturation); -MP_PROPERTY_GETSET(esp32_camera_camera_saturation_obj, - (mp_obj_t)&esp32_camera_camera_get_saturation_obj, - (mp_obj_t)&esp32_camera_camera_set_saturation_obj); - -//| sharpness: int -//| """The sensor sharpness. Positive values increase sharpness (more defined edges), negative values lower it (softer edges). The total range is device-specific but the value is often from -2 to +2 inclusive.""" - -STATIC mp_obj_t esp32_camera_camera_get_sharpness(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_sharpness(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_sharpness_obj, esp32_camera_camera_get_sharpness); - -STATIC mp_obj_t esp32_camera_camera_set_sharpness(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_sharpness(self, mp_obj_get_int(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_sharpness_obj, esp32_camera_camera_set_sharpness); -MP_PROPERTY_GETSET(esp32_camera_camera_sharpness_obj, - (mp_obj_t)&esp32_camera_camera_get_sharpness_obj, - (mp_obj_t)&esp32_camera_camera_set_sharpness_obj); - -//| denoise: int -//| """The sensor 'denoise' setting. Any camera sensor has inherent 'noise', especially in low brightness environments. Software algorithms can decrease noise at the expense of fine detail. A larger value increases the amount of software noise removal. The total range is device-specific but the value is often from 0 to 10.""" - -STATIC mp_obj_t esp32_camera_camera_get_denoise(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_denoise(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_denoise_obj, esp32_camera_camera_get_denoise); - -STATIC mp_obj_t esp32_camera_camera_set_denoise(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_denoise(self, mp_obj_get_int(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_denoise_obj, esp32_camera_camera_set_denoise); -MP_PROPERTY_GETSET(esp32_camera_camera_denoise_obj, - (mp_obj_t)&esp32_camera_camera_get_denoise_obj, - (mp_obj_t)&esp32_camera_camera_set_denoise_obj); - -//| gain_ceiling: GainCeiling -//| """The sensor 'gain ceiling' setting. "Gain" is an analog multiplier applied to the raw sensor data. The 'ceiling' is the maximum gain value that the sensor will use. A higher gain means that the sensor has a greater response to light, but also makes sensor noise more visible.""" - -STATIC mp_obj_t esp32_camera_camera_get_gain_ceiling(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return cp_enum_find(&esp32_camera_gain_ceiling_type, common_hal_esp32_camera_camera_get_gainceiling(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_gain_ceiling_obj, esp32_camera_camera_get_gain_ceiling); - -STATIC mp_obj_t esp32_camera_camera_set_gain_ceiling(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_gainceiling(self, validate_gain_ceiling(arg, MP_QSTR_gain_ceiling)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_gain_ceiling_obj, esp32_camera_camera_set_gain_ceiling); -MP_PROPERTY_GETSET(esp32_camera_camera_gain_ceiling_obj, - (mp_obj_t)&esp32_camera_camera_get_gain_ceiling_obj, - (mp_obj_t)&esp32_camera_camera_set_gain_ceiling_obj); - -//| quality: int -//| """The 'quality' setting when capturing JPEG images. This is similar to the quality setting when exporting a jpeg image from photo editing software. Typical values range from 5 to 40, with higher numbers leading to larger image sizes and better overall image quality. However, when the quality is set to a high number, the total size of the JPEG data can exceed the size of an internal buffer, causing image capture to fail.""" - -STATIC mp_obj_t esp32_camera_camera_get_quality(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_quality(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_quality_obj, esp32_camera_camera_get_quality); - -STATIC mp_obj_t esp32_camera_camera_set_quality(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_quality(self, mp_obj_get_int(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_quality_obj, esp32_camera_camera_set_quality); -MP_PROPERTY_GETSET(esp32_camera_camera_quality_obj, - (mp_obj_t)&esp32_camera_camera_get_quality_obj, - (mp_obj_t)&esp32_camera_camera_set_quality_obj); - -//| colorbar: bool -//| """When `True`, a test pattern image is captured and the real sensor data is not used.""" - -STATIC mp_obj_t esp32_camera_camera_get_colorbar(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return mp_obj_new_bool(common_hal_esp32_camera_camera_get_colorbar(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_colorbar_obj, esp32_camera_camera_get_colorbar); - -STATIC mp_obj_t esp32_camera_camera_set_colorbar(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_colorbar(self, mp_obj_is_true(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_colorbar_obj, esp32_camera_camera_set_colorbar); -MP_PROPERTY_GETSET(esp32_camera_camera_colorbar_obj, - (mp_obj_t)&esp32_camera_camera_get_colorbar_obj, - (mp_obj_t)&esp32_camera_camera_set_colorbar_obj); - -//| whitebal: bool -//| """When `True`, the camera attempts to automatically control white balance. When `False`, the `wb_mode` setting is used instead.""" - -STATIC mp_obj_t esp32_camera_camera_get_whitebal(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return mp_obj_new_bool(common_hal_esp32_camera_camera_get_whitebal(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_whitebal_obj, esp32_camera_camera_get_whitebal); - -STATIC mp_obj_t esp32_camera_camera_set_whitebal(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_whitebal(self, mp_obj_is_true(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_whitebal_obj, esp32_camera_camera_set_whitebal); -MP_PROPERTY_GETSET(esp32_camera_camera_whitebal_obj, - (mp_obj_t)&esp32_camera_camera_get_whitebal_obj, - (mp_obj_t)&esp32_camera_camera_set_whitebal_obj); - -//| gain_ctrl: bool -//| """When `True`, the camera attempts to automatically control the sensor gain, up to the value in the `gain_ceiling` property. When `False`, the `agc_gain` setting is used instead.""" - -STATIC mp_obj_t esp32_camera_camera_get_gain_ctrl(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return mp_obj_new_bool(common_hal_esp32_camera_camera_get_gain_ctrl(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_gain_ctrl_obj, esp32_camera_camera_get_gain_ctrl); - -STATIC mp_obj_t esp32_camera_camera_set_gain_ctrl(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_gain_ctrl(self, mp_obj_is_true(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_gain_ctrl_obj, esp32_camera_camera_set_gain_ctrl); -MP_PROPERTY_GETSET(esp32_camera_camera_gain_ctrl_obj, - (mp_obj_t)&esp32_camera_camera_get_gain_ctrl_obj, - (mp_obj_t)&esp32_camera_camera_set_gain_ctrl_obj); - -//| exposure_ctrl: bool -//| """When `True` the camera attempts to automatically control the exposure. When `False`, the `aec_value` setting is used instead.""" - -STATIC mp_obj_t esp32_camera_camera_get_exposure_ctrl(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return mp_obj_new_bool(common_hal_esp32_camera_camera_get_exposure_ctrl(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_exposure_ctrl_obj, esp32_camera_camera_get_exposure_ctrl); - -STATIC mp_obj_t esp32_camera_camera_set_exposure_ctrl(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_exposure_ctrl(self, mp_obj_is_true(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_exposure_ctrl_obj, esp32_camera_camera_set_exposure_ctrl); -MP_PROPERTY_GETSET(esp32_camera_camera_exposure_ctrl_obj, - (mp_obj_t)&esp32_camera_camera_get_exposure_ctrl_obj, - (mp_obj_t)&esp32_camera_camera_set_exposure_ctrl_obj); - -//| hmirror: bool -//| """When `True` the camera image is mirrored left-to-right""" - -STATIC mp_obj_t esp32_camera_camera_get_hmirror(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return mp_obj_new_bool(common_hal_esp32_camera_camera_get_hmirror(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_hmirror_obj, esp32_camera_camera_get_hmirror); - -STATIC mp_obj_t esp32_camera_camera_set_hmirror(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_hmirror(self, mp_obj_is_true(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_hmirror_obj, esp32_camera_camera_set_hmirror); -MP_PROPERTY_GETSET(esp32_camera_camera_hmirror_obj, - (mp_obj_t)&esp32_camera_camera_get_hmirror_obj, - (mp_obj_t)&esp32_camera_camera_set_hmirror_obj); - -//| vflip: bool -//| """When `True` the camera image is flipped top-to-bottom""" - -STATIC mp_obj_t esp32_camera_camera_get_vflip(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return mp_obj_new_bool(common_hal_esp32_camera_camera_get_vflip(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_vflip_obj, esp32_camera_camera_get_vflip); - -STATIC mp_obj_t esp32_camera_camera_set_vflip(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_vflip(self, mp_obj_is_true(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_vflip_obj, esp32_camera_camera_set_vflip); -MP_PROPERTY_GETSET(esp32_camera_camera_vflip_obj, - (mp_obj_t)&esp32_camera_camera_get_vflip_obj, - (mp_obj_t)&esp32_camera_camera_set_vflip_obj); - -//| aec2: bool -//| """When `True` the sensor's "night mode" is enabled, extending the range of automatic gain control.""" - -STATIC mp_obj_t esp32_camera_camera_get_aec2(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return mp_obj_new_bool(common_hal_esp32_camera_camera_get_aec2(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_aec2_obj, esp32_camera_camera_get_aec2); - -STATIC mp_obj_t esp32_camera_camera_set_aec2(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_aec2(self, mp_obj_is_true(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_aec2_obj, esp32_camera_camera_set_aec2); -MP_PROPERTY_GETSET(esp32_camera_camera_aec2_obj, - (mp_obj_t)&esp32_camera_camera_get_aec2_obj, - (mp_obj_t)&esp32_camera_camera_set_aec2_obj); - -//| awb_gain: bool -//| """Access the awb_gain property of the camera sensor""" - -STATIC mp_obj_t esp32_camera_camera_get_awb_gain(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return mp_obj_new_bool(common_hal_esp32_camera_camera_get_awb_gain(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_awb_gain_obj, esp32_camera_camera_get_awb_gain); - -STATIC mp_obj_t esp32_camera_camera_set_awb_gain(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_awb_gain(self, mp_obj_is_true(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_awb_gain_obj, esp32_camera_camera_set_awb_gain); -MP_PROPERTY_GETSET(esp32_camera_camera_awb_gain_obj, - (mp_obj_t)&esp32_camera_camera_get_awb_gain_obj, - (mp_obj_t)&esp32_camera_camera_set_awb_gain_obj); - -//| agc_gain: int -//| """Access the gain level of the sensor. Higher values produce brighter images. Typical settings range from 0 to 30. """ - -STATIC mp_obj_t esp32_camera_camera_get_agc_gain(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_agc_gain(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_agc_gain_obj, esp32_camera_camera_get_agc_gain); - -STATIC mp_obj_t esp32_camera_camera_set_agc_gain(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_agc_gain(self, mp_obj_get_int(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_agc_gain_obj, esp32_camera_camera_set_agc_gain); -MP_PROPERTY_GETSET(esp32_camera_camera_agc_gain_obj, - (mp_obj_t)&esp32_camera_camera_get_agc_gain_obj, - (mp_obj_t)&esp32_camera_camera_set_agc_gain_obj); - -//| aec_value: int -//| """Access the exposure value of the camera. Higher values produce brighter images. Typical settings range from 0 to 1200.""" - -STATIC mp_obj_t esp32_camera_camera_get_aec_value(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_aec_value(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_aec_value_obj, esp32_camera_camera_get_aec_value); - -STATIC mp_obj_t esp32_camera_camera_set_aec_value(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_aec_value(self, mp_obj_get_int(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_aec_value_obj, esp32_camera_camera_set_aec_value); -MP_PROPERTY_GETSET(esp32_camera_camera_aec_value_obj, - (mp_obj_t)&esp32_camera_camera_get_aec_value_obj, - (mp_obj_t)&esp32_camera_camera_set_aec_value_obj); - -//| special_effect: int -//| """Enable a "special effect". Zero is no special effect. On OV5640, special effects range from 0 to 6 inclusive and select various color modes.""" - -STATIC mp_obj_t esp32_camera_camera_get_special_effect(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_special_effect(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_special_effect_obj, esp32_camera_camera_get_special_effect); - -STATIC mp_obj_t esp32_camera_camera_set_special_effect(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_special_effect(self, mp_obj_get_int(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_special_effect_obj, esp32_camera_camera_set_special_effect); -MP_PROPERTY_GETSET(esp32_camera_camera_special_effect_obj, - (mp_obj_t)&esp32_camera_camera_get_special_effect_obj, - (mp_obj_t)&esp32_camera_camera_set_special_effect_obj); - -//| wb_mode: int -//| """The white balance mode. 0 is automatic white balance. Typical values range from 0 to 4 inclusive.""" - -STATIC mp_obj_t esp32_camera_camera_get_wb_mode(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_wb_mode(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_wb_mode_obj, esp32_camera_camera_get_wb_mode); - -STATIC mp_obj_t esp32_camera_camera_set_wb_mode(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_wb_mode(self, mp_obj_get_int(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_wb_mode_obj, esp32_camera_camera_set_wb_mode); -MP_PROPERTY_GETSET(esp32_camera_camera_wb_mode_obj, - (mp_obj_t)&esp32_camera_camera_get_wb_mode_obj, - (mp_obj_t)&esp32_camera_camera_set_wb_mode_obj); - -//| ae_level: int -//| """The exposure offset for automatic exposure. Typical values range from -2 to +2.""" - -STATIC mp_obj_t esp32_camera_camera_get_ae_level(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_ae_level(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_ae_level_obj, esp32_camera_camera_get_ae_level); - -STATIC mp_obj_t esp32_camera_camera_set_ae_level(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_ae_level(self, mp_obj_get_int(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_ae_level_obj, esp32_camera_camera_set_ae_level); -MP_PROPERTY_GETSET(esp32_camera_camera_ae_level_obj, - (mp_obj_t)&esp32_camera_camera_get_ae_level_obj, - (mp_obj_t)&esp32_camera_camera_set_ae_level_obj); - -//| dcw: bool -//| """When `True` an advanced white balance mode is selected.""" - -STATIC mp_obj_t esp32_camera_camera_get_dcw(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return mp_obj_new_bool(common_hal_esp32_camera_camera_get_dcw(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_dcw_obj, esp32_camera_camera_get_dcw); - -STATIC mp_obj_t esp32_camera_camera_set_dcw(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_dcw(self, mp_obj_is_true(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_dcw_obj, esp32_camera_camera_set_dcw); -MP_PROPERTY_GETSET(esp32_camera_camera_dcw_obj, - (mp_obj_t)&esp32_camera_camera_get_dcw_obj, - (mp_obj_t)&esp32_camera_camera_set_dcw_obj); - -//| bpc: bool -//| """When `True`, "black point compensation" is enabled. This can make black parts of the image darker.""" - -STATIC mp_obj_t esp32_camera_camera_get_bpc(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return mp_obj_new_bool(common_hal_esp32_camera_camera_get_bpc(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_bpc_obj, esp32_camera_camera_get_bpc); - -STATIC mp_obj_t esp32_camera_camera_set_bpc(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_bpc(self, mp_obj_is_true(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_bpc_obj, esp32_camera_camera_set_bpc); -MP_PROPERTY_GETSET(esp32_camera_camera_bpc_obj, - (mp_obj_t)&esp32_camera_camera_get_bpc_obj, - (mp_obj_t)&esp32_camera_camera_set_bpc_obj); - -//| wpc: bool -//| """When `True`, "white point compensation" is enabled. This can make white parts of the image whiter.""" - -STATIC mp_obj_t esp32_camera_camera_get_wpc(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return mp_obj_new_bool(common_hal_esp32_camera_camera_get_wpc(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_wpc_obj, esp32_camera_camera_get_wpc); - -STATIC mp_obj_t esp32_camera_camera_set_wpc(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_wpc(self, mp_obj_is_true(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_wpc_obj, esp32_camera_camera_set_wpc); -MP_PROPERTY_GETSET(esp32_camera_camera_wpc_obj, - (mp_obj_t)&esp32_camera_camera_get_wpc_obj, - (mp_obj_t)&esp32_camera_camera_set_wpc_obj); - -//| raw_gma: bool -//| """When `True`, raw gamma mode is enabled.""" - -STATIC mp_obj_t esp32_camera_camera_get_raw_gma(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return mp_obj_new_bool(common_hal_esp32_camera_camera_get_raw_gma(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_raw_gma_obj, esp32_camera_camera_get_raw_gma); - -STATIC mp_obj_t esp32_camera_camera_set_raw_gma(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_raw_gma(self, mp_obj_is_true(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_raw_gma_obj, esp32_camera_camera_set_raw_gma); -MP_PROPERTY_GETSET(esp32_camera_camera_raw_gma_obj, - (mp_obj_t)&esp32_camera_camera_get_raw_gma_obj, - (mp_obj_t)&esp32_camera_camera_set_raw_gma_obj); - -//| lenc: bool -//| """Enable "lens correction". This can help compensate for light fall-off at the edge of the sensor area.""" - -STATIC mp_obj_t esp32_camera_camera_get_lenc(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return mp_obj_new_bool(common_hal_esp32_camera_camera_get_lenc(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_lenc_obj, esp32_camera_camera_get_lenc); - -STATIC mp_obj_t esp32_camera_camera_set_lenc(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_lenc(self, mp_obj_is_true(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_lenc_obj, esp32_camera_camera_set_lenc); -MP_PROPERTY_GETSET(esp32_camera_camera_lenc_obj, - (mp_obj_t)&esp32_camera_camera_get_lenc_obj, - (mp_obj_t)&esp32_camera_camera_set_lenc_obj); - -//| max_frame_size: FrameSize -//| """The maximum frame size that can be captured""" -STATIC mp_obj_t esp32_camera_camera_get_max_frame_size(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return cp_enum_find(&esp32_camera_frame_size_type, common_hal_esp32_camera_camera_get_max_frame_size(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_max_frame_size_obj, esp32_camera_camera_get_max_frame_size); - -MP_PROPERTY_GETTER(esp32_camera_camera_max_frame_size_obj, - (mp_obj_t)&esp32_camera_camera_get_max_frame_size_obj); - - -//| address: int -//| """The I2C (SCCB) address of the sensor""" -STATIC mp_obj_t esp32_camera_camera_get_address(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_address(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_address_obj, esp32_camera_camera_get_address); - -MP_PROPERTY_GETTER(esp32_camera_camera_address_obj, - (mp_obj_t)&esp32_camera_camera_get_address_obj); - - -//| sensor_name: str -//| """The name of the sensor""" -STATIC mp_obj_t esp32_camera_camera_get_sensor_name(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - const char *sensor_name = common_hal_esp32_camera_camera_get_sensor_name(self); - return mp_obj_new_str(sensor_name, strlen(sensor_name)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_sensor_name_obj, esp32_camera_camera_get_sensor_name); - -MP_PROPERTY_GETTER(esp32_camera_camera_sensor_name_obj, - (mp_obj_t)&esp32_camera_camera_get_sensor_name_obj); - - -//| supports_jpeg: bool -//| """True if the sensor can capture images in JPEG format""" -STATIC mp_obj_t esp32_camera_camera_get_supports_jpeg(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return mp_obj_new_bool(common_hal_esp32_camera_camera_get_supports_jpeg(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_supports_jpeg_obj, esp32_camera_camera_get_supports_jpeg); - -MP_PROPERTY_GETTER(esp32_camera_camera_supports_jpeg_obj, - (mp_obj_t)&esp32_camera_camera_get_supports_jpeg_obj); - -//| height: int -//| """The height of the image being captured""" -STATIC mp_obj_t esp32_camera_camera_get_height(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_height(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_height_obj, esp32_camera_camera_get_height); - -MP_PROPERTY_GETTER(esp32_camera_camera_height_obj, - (mp_obj_t)&esp32_camera_camera_get_height_obj); - -//| width: int -//| """The width of the image being captured""" -STATIC mp_obj_t esp32_camera_camera_get_width(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_width(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_width_obj, esp32_camera_camera_get_width); - -MP_PROPERTY_GETTER(esp32_camera_camera_width_obj, - (mp_obj_t)&esp32_camera_camera_get_width_obj); - -//| grab_mode: GrabMode -//| """The grab mode of the camera""" -STATIC mp_obj_t esp32_camera_camera_get_grab_mode(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return cp_enum_find(&esp32_camera_grab_mode_type, common_hal_esp32_camera_camera_get_grab_mode(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_grab_mode_obj, esp32_camera_camera_get_grab_mode); - -MP_PROPERTY_GETTER(esp32_camera_camera_grab_mode_obj, - (mp_obj_t)&esp32_camera_camera_get_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); - return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_framebuffer_count(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_framebuffer_count_obj, esp32_camera_camera_get_framebuffer_count); - -MP_PROPERTY_GETTER(esp32_camera_camera_framebuffer_count_obj, - (mp_obj_t)&esp32_camera_camera_get_framebuffer_count_obj); - - -STATIC const mp_rom_map_elem_t esp32_camera_camera_locals_table[] = { - { MP_ROM_QSTR(MP_QSTR_address), MP_ROM_PTR(&esp32_camera_camera_address_obj) }, - { MP_ROM_QSTR(MP_QSTR_aec2), MP_ROM_PTR(&esp32_camera_camera_aec2_obj) }, - { MP_ROM_QSTR(MP_QSTR_aec_value), MP_ROM_PTR(&esp32_camera_camera_aec_value_obj) }, - { MP_ROM_QSTR(MP_QSTR_ae_level), MP_ROM_PTR(&esp32_camera_camera_ae_level_obj) }, - { MP_ROM_QSTR(MP_QSTR_agc_gain), MP_ROM_PTR(&esp32_camera_camera_agc_gain_obj) }, - { MP_ROM_QSTR(MP_QSTR_awb_gain), MP_ROM_PTR(&esp32_camera_camera_awb_gain_obj) }, - { MP_ROM_QSTR(MP_QSTR_bpc), MP_ROM_PTR(&esp32_camera_camera_bpc_obj) }, - { MP_ROM_QSTR(MP_QSTR_brightness), MP_ROM_PTR(&esp32_camera_camera_brightness_obj) }, - { MP_ROM_QSTR(MP_QSTR_colorbar), MP_ROM_PTR(&esp32_camera_camera_colorbar_obj) }, - { MP_ROM_QSTR(MP_QSTR_contrast), MP_ROM_PTR(&esp32_camera_camera_contrast_obj) }, - { MP_ROM_QSTR(MP_QSTR_dcw), MP_ROM_PTR(&esp32_camera_camera_dcw_obj) }, - { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&esp32_camera_camera_deinit_obj) }, - { MP_ROM_QSTR(MP_QSTR_denoise), MP_ROM_PTR(&esp32_camera_camera_denoise_obj) }, - { MP_ROM_QSTR(MP_QSTR_framebuffer_count), MP_ROM_PTR(&esp32_camera_camera_framebuffer_count_obj) }, - { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&mp_identity_obj) }, - { MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&esp32_camera_camera___exit___obj) }, - { MP_ROM_QSTR(MP_QSTR_exposure_ctrl), MP_ROM_PTR(&esp32_camera_camera_exposure_ctrl_obj) }, - { MP_ROM_QSTR(MP_QSTR_frame_available), MP_ROM_PTR(&esp32_camera_camera_frame_available_obj) }, - { MP_ROM_QSTR(MP_QSTR_frame_size), MP_ROM_PTR(&esp32_camera_camera_frame_size_obj) }, - { MP_ROM_QSTR(MP_QSTR_gain_ceiling), MP_ROM_PTR(&esp32_camera_camera_gain_ceiling_obj) }, - { MP_ROM_QSTR(MP_QSTR_gain_ctrl), MP_ROM_PTR(&esp32_camera_camera_gain_ctrl_obj) }, - { MP_ROM_QSTR(MP_QSTR_grab_mode), MP_ROM_PTR(&esp32_camera_camera_grab_mode_obj) }, - { MP_ROM_QSTR(MP_QSTR_height), MP_ROM_PTR(&esp32_camera_camera_height_obj) }, - { MP_ROM_QSTR(MP_QSTR_hmirror), MP_ROM_PTR(&esp32_camera_camera_hmirror_obj) }, - { MP_ROM_QSTR(MP_QSTR_lenc), MP_ROM_PTR(&esp32_camera_camera_lenc_obj) }, - { MP_ROM_QSTR(MP_QSTR_max_frame_size), MP_ROM_PTR(&esp32_camera_camera_max_frame_size_obj) }, - { MP_ROM_QSTR(MP_QSTR_pixel_format), MP_ROM_PTR(&esp32_camera_camera_pixel_format_obj) }, - { MP_ROM_QSTR(MP_QSTR_quality), MP_ROM_PTR(&esp32_camera_camera_quality_obj) }, - { MP_ROM_QSTR(MP_QSTR_raw_gma), MP_ROM_PTR(&esp32_camera_camera_raw_gma_obj) }, - { MP_ROM_QSTR(MP_QSTR_reconfigure), MP_ROM_PTR(&esp32_camera_camera_reconfigure_obj) }, - { MP_ROM_QSTR(MP_QSTR_saturation), MP_ROM_PTR(&esp32_camera_camera_saturation_obj) }, - { MP_ROM_QSTR(MP_QSTR_sensor_name), MP_ROM_PTR(&esp32_camera_camera_sensor_name_obj) }, - { MP_ROM_QSTR(MP_QSTR_sharpness), MP_ROM_PTR(&esp32_camera_camera_sharpness_obj) }, - { MP_ROM_QSTR(MP_QSTR_special_effect), MP_ROM_PTR(&esp32_camera_camera_special_effect_obj) }, - { MP_ROM_QSTR(MP_QSTR_supports_jpeg), MP_ROM_PTR(&esp32_camera_camera_supports_jpeg_obj) }, - { MP_ROM_QSTR(MP_QSTR_take), MP_ROM_PTR(&esp32_camera_camera_take_obj) }, - { MP_ROM_QSTR(MP_QSTR_vflip), MP_ROM_PTR(&esp32_camera_camera_vflip_obj) }, - { MP_ROM_QSTR(MP_QSTR_wb_mode), MP_ROM_PTR(&esp32_camera_camera_wb_mode_obj) }, - { MP_ROM_QSTR(MP_QSTR_whitebal), MP_ROM_PTR(&esp32_camera_camera_whitebal_obj) }, - { MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&esp32_camera_camera_width_obj) }, - { MP_ROM_QSTR(MP_QSTR_wpc), MP_ROM_PTR(&esp32_camera_camera_wpc_obj) }, -}; - -STATIC MP_DEFINE_CONST_DICT(esp32_camera_camera_locals_dict, esp32_camera_camera_locals_table); - -const mp_obj_type_t esp32_camera_camera_type = { - .base = { &mp_type_type }, - .name = MP_QSTR_Camera, - .make_new = esp32_camera_camera_make_new, - .locals_dict = (mp_obj_t)&esp32_camera_camera_locals_dict, -}; diff --git a/ports/espressif/bindings/espcamera/Camera.c b/ports/espressif/bindings/espcamera/Camera.c new file mode 100644 index 0000000000..824bc7d3dc --- /dev/null +++ b/ports/espressif/bindings/espcamera/Camera.c @@ -0,0 +1,1001 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Jeff Epler for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include + +#include "py/mphal.h" +#include "py/obj.h" +#include "py/objproperty.h" +#include "py/runtime.h" + +#include "bindings/espcamera/__init__.h" +#include "bindings/espcamera/Camera.h" +#include "common-hal/espcamera/Camera.h" + +#include "shared-bindings/displayio/Bitmap.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "shared-bindings/util.h" +#include "esp_camera.h" +#include "sensor.h" + +//| class Camera: +//| def __init__( +//| self, +//| *, +//| data_pins: List[microcontroller.Pin], +//| pixel_clock_pin: microcontroller.Pin, +//| vsync_pin: microcontroller.Pin, +//| href_pin: microcontroller.Pin, +//| i2c: busio.I2C, +//| external_clock_pin: Optional[microcontroller.Pin] = None, +//| external_clock_frequency: int = 20_000_000, +//| powerdown_pin: Optional[microcontroller.Pin] = None, +//| reset_pin: Optional[microcontroller.Pin] = None, +//| pixel_format: PixelFormat = PixelFormat.RGB565, +//| frame_size: FrameSize = FrameSize.QQVGA, +//| jpeg_quality: int = 15, +//| framebuffer_count: int = 1, +//| grab_mode: GrabMode = GrabMode.WHEN_EMPTY, +//| ) -> None: +//| """ +//| Configure and initialize a camera with the given properties +//| +//| This driver requires that the ``CIRCUITPY_RESERVED_PSRAM`` in ``settings.toml`` be large enough to hold the camera frambuffer(s). Generally, boards with built-in cameras will have a default setting that is large enough. If the constructor raises a MemoryError or an IDFError, this probably indicates the setting is too small and should be increased. +//| +//| +//| .. important:: +//| +//| Not all supported sensors have all +//| of the properties listed below. For instance, the +//| OV5640 supports `denoise`, but the +//| OV2640 does not. The underlying esp32-camera +//| library does not provide a reliable API to check +//| which settings are supported. CircuitPython makes +//| a best effort to determine when an unsupported +//| property is set and will raise an exception in +//| that case. +//| +//| :param data_pins: The 8 data data_pins used for image data transfer from the camera module, least significant bit first +//| :param pixel_clock_pin: The pixel clock output from the camera module +//| :param vsync_pin: The vertical sync pulse output from the camera module +//| :param href_pin: The horizontal reference output from the camera module +//| :param i2c: The I2C bus connected to the camera module +//| :param external_clock_pin: The pin on which to generate the external clock +//| :param external_clock_frequency: The frequency generated on the external clock pin +//| :param powerdown_pin: The powerdown input to the camera module +//| :param reset_pin: The reset input to the camera module +//| :param pixel_format: The pixel format of the captured image +//| :param frame_size: The size of captured image +//| :param jpeg_quality: For `PixelFormat.JPEG`, the quality. Higher numbers increase quality. If the quality is too high, the JPEG data will be larger than the availalble buffer size and the image will be unusable or truncated. The exact range of appropriate values depends on the sensor and must be determined empirically. +//| :param framebuffer_count: The number of framebuffers (1 for single-buffered and 2 for double-buffered) +//| :param grab_mode: When to grab a new frame +//| """ +STATIC mp_obj_t espcamera_camera_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { + enum { ARG_data_pins, ARG_pixel_clock_pin, ARG_vsync_pin, ARG_href_pin, ARG_i2c, ARG_external_clock_pin, ARG_external_clock_frequency, ARG_powerdown_pin, ARG_reset_pin, ARG_pixel_format, ARG_frame_size, ARG_jpeg_quality, ARG_framebuffer_count, ARG_grab_mode, NUM_ARGS }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_data_pins, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, + { MP_QSTR_pixel_clock_pin, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, + { MP_QSTR_vsync_pin, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, + { MP_QSTR_href_pin, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, + { MP_QSTR_i2c, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, + { MP_QSTR_external_clock_pin, MP_ARG_OBJ | MP_ARG_KW_ONLY, { .u_obj = MP_ROM_NONE } }, + { MP_QSTR_external_clock_frequency, MP_ARG_INT | MP_ARG_KW_ONLY, { .u_int = 20000000L } }, + { MP_QSTR_powerdown_pin, MP_ARG_OBJ | MP_ARG_KW_ONLY, { .u_obj = MP_ROM_NONE } }, + { MP_QSTR_reset_pin, MP_ARG_OBJ | MP_ARG_KW_ONLY, { .u_obj = MP_ROM_NONE } }, + { MP_QSTR_pixel_format, MP_ARG_OBJ | MP_ARG_KW_ONLY, { .u_obj = MP_ROM_PTR((void *)&pixel_format_RGB565_obj) } }, + { MP_QSTR_frame_size, MP_ARG_OBJ | MP_ARG_KW_ONLY, { .u_obj = MP_ROM_PTR((void *)&frame_size_QQVGA_obj) } }, + { MP_QSTR_jpeg_quality, MP_ARG_INT | MP_ARG_KW_ONLY, { .u_int = 15 } }, + { MP_QSTR_framebuffer_count, MP_ARG_INT | MP_ARG_KW_ONLY, { .u_int = 1 } }, + { MP_QSTR_grab_mode, MP_ARG_OBJ | MP_ARG_KW_ONLY, { .u_obj = MP_ROM_PTR((void *)&grab_mode_WHEN_EMPTY_obj) } }, + }; + + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + MP_STATIC_ASSERT(MP_ARRAY_SIZE(allowed_args) == NUM_ARGS); + mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + uint8_t data_pins[8]; + uint8_t data_pin_count; + validate_pins(MP_QSTR_data_pins, data_pins, MP_ARRAY_SIZE(data_pins), args[ARG_data_pins].u_obj, &data_pin_count); + mp_arg_validate_length(data_pin_count, 8, MP_QSTR_data_pins); + + const mcu_pin_obj_t *pixel_clock_pin = + validate_obj_is_free_pin(args[ARG_pixel_clock_pin].u_obj, MP_QSTR_pixel_clock_pin); + const mcu_pin_obj_t *vsync_pin = + validate_obj_is_free_pin(args[ARG_vsync_pin].u_obj, MP_QSTR_vsync_pin); + const mcu_pin_obj_t *href_pin = + validate_obj_is_free_pin(args[ARG_href_pin].u_obj, MP_QSTR_href_pin); + busio_i2c_obj_t *i2c = MP_OBJ_TO_PTR(mp_arg_validate_type(args[ARG_i2c].u_obj, &busio_i2c_type, MP_QSTR_i2c)); + const mcu_pin_obj_t *external_clock_pin = + validate_obj_is_free_pin_or_none(args[ARG_external_clock_pin].u_obj, MP_QSTR_external_clock_pin); + const mcu_pin_obj_t *powerdown_pin = + validate_obj_is_free_pin_or_none(args[ARG_powerdown_pin].u_obj, MP_QSTR_powerdown_pin); + const mcu_pin_obj_t *reset_pin = + validate_obj_is_free_pin_or_none(args[ARG_reset_pin].u_obj, MP_QSTR_reset_pin); + const mp_int_t external_clock_frequency = + mp_arg_validate_int_range(args[ARG_external_clock_frequency].u_int, 0, 40000000, MP_QSTR_external_clock_frequency); + + camera_grab_mode_t grab_mode = validate_grab_mode(args[ARG_grab_mode].u_obj, MP_QSTR_grab_mode); + framesize_t frame_size = validate_frame_size(args[ARG_frame_size].u_obj, MP_QSTR_frame_size); + pixformat_t pixel_format = validate_pixel_format(args[ARG_pixel_format].u_obj, MP_QSTR_pixel_format); + mp_int_t jpeg_quality = mp_arg_validate_int_range(args[ARG_jpeg_quality].u_int, 2, 55, MP_QSTR_jpeg_quality); + mp_int_t framebuffer_count = mp_arg_validate_int_range(args[ARG_framebuffer_count].u_int, 1, 2, MP_QSTR_framebuffer_count); + + espcamera_camera_obj_t *self = m_new_obj(espcamera_camera_obj_t); + self->base.type = &espcamera_camera_type; + common_hal_espcamera_camera_construct( + self, + data_pins, + external_clock_pin, + pixel_clock_pin, + vsync_pin, + href_pin, + powerdown_pin, + reset_pin, + i2c, + external_clock_frequency, + pixel_format, + frame_size, + jpeg_quality, + framebuffer_count, + grab_mode); + return MP_OBJ_FROM_PTR(self); +} + +//| def deinit(self) -> None: +//| """Deinitialises the camera and releases all memory resources for reuse.""" +//| ... +STATIC mp_obj_t espcamera_camera_deinit(mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + common_hal_espcamera_camera_deinit(self); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_deinit_obj, espcamera_camera_deinit); + +STATIC void check_for_deinit(espcamera_camera_obj_t *self) { + if (common_hal_espcamera_camera_deinited(self)) { + raise_deinited_error(); + } +} + +//| def __enter__(self) -> Camera: +//| """No-op used by Context Managers.""" +//| ... +// Provided by context manager helper. + +//| def __exit__(self) -> None: +//| """Automatically deinitializes the hardware when exiting a context. See +//| :ref:`lifetime-and-contextmanagers` for more info.""" +//| ... +STATIC mp_obj_t espcamera_camera_obj___exit__(size_t n_args, const mp_obj_t *args) { + (void)n_args; + return espcamera_camera_deinit(args[0]); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(espcamera_camera___exit___obj, 4, 4, espcamera_camera_obj___exit__); + +//| frame_available: bool +//| """True if a frame is available, False otherwise""" + +STATIC mp_obj_t espcamera_camera_frame_available_get(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(esp_camera_fb_available()); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_frame_available_get_obj, espcamera_camera_frame_available_get); + +MP_PROPERTY_GETTER(espcamera_camera_frame_available_obj, + (mp_obj_t)&espcamera_camera_frame_available_get_obj); + +//| def take( +//| self, timeout: Optional[float] = 0.25 +//| ) -> Optional[displayio.Bitmap | ReadableBuffer]: +//| """Record a frame. Wait up to 'timeout' seconds for a frame to be captured. +//| +//| In the case of timeout, `None` is returned. +//| If `pixel_format` is `PixelFormat.JPEG`, the returned value is a read-only `memoryview`. +//| Otherwise, the returned value is a read-only `displayio.Bitmap`. +//| """ +STATIC mp_obj_t espcamera_camera_take(size_t n_args, const mp_obj_t *args) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(args[0]); + mp_float_t timeout = n_args < 2 ? MICROPY_FLOAT_CONST(0.25) : mp_obj_get_float(args[1]); + check_for_deinit(self); + camera_fb_t *result = common_hal_espcamera_camera_take(self, (int)MICROPY_FLOAT_C_FUN(round)(timeout * 1000)); + if (!result) { + return mp_const_none; + } + pixformat_t format = common_hal_espcamera_camera_get_pixel_format(self); + if (format == PIXFORMAT_JPEG) { + return mp_obj_new_memoryview('b', result->len, result->buf); + } else { + int width = common_hal_espcamera_camera_get_width(self); + int height = common_hal_espcamera_camera_get_height(self); + displayio_bitmap_t *bitmap = m_new_obj(displayio_bitmap_t); + bitmap->base.type = &displayio_bitmap_type; + common_hal_displayio_bitmap_construct_from_buffer(bitmap, width, height, (format == PIXFORMAT_RGB565) ? 16 : 8, (uint32_t *)(void *)result->buf, true); + return bitmap; + } +} +STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(espcamera_camera_take_obj, 1, 2, espcamera_camera_take); + + +//| def reconfigure( +//| self, +//| frame_size: Optional[FrameSize] = None, +//| pixel_format: Optional[PixelFormat] = None, +//| grab_mode: Optional[GrabMode] = None, +//| framebuffer_count: Optional[int] = None, +//| ) -> None: +//| """Change multiple related camera settings simultaneously +//| +//| Because these settings interact in complex ways, and take longer than +//| the other properties to set, they are set together in a single function call. +//| +//| If an argument is unspecified or None, then the setting is unchanged.""" + +STATIC mp_obj_t espcamera_camera_reconfigure(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); + check_for_deinit(self); + + enum { ARG_frame_size, ARG_pixel_format, ARG_grab_mode, ARG_framebuffer_count }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_frame_size, MP_ARG_OBJ, {.u_obj = MP_ROM_NONE} }, + { MP_QSTR_pixel_format, MP_ARG_OBJ, {.u_obj = MP_ROM_NONE} }, + { MP_QSTR_grab_mode, MP_ARG_OBJ, {.u_obj = MP_ROM_NONE} }, + { MP_QSTR_framebuffer_count, MP_ARG_OBJ, {.u_obj = MP_ROM_NONE} }, + }; + + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + framesize_t frame_size = + args[ARG_frame_size].u_obj != MP_ROM_NONE + ? validate_frame_size(args[ARG_frame_size].u_obj, MP_QSTR_frame_size) + : common_hal_espcamera_camera_get_frame_size(self); + pixformat_t pixel_format = + args[ARG_pixel_format].u_obj != MP_ROM_NONE + ? validate_pixel_format(args[ARG_pixel_format].u_obj, MP_QSTR_pixel_format) + : common_hal_espcamera_camera_get_pixel_format(self); + camera_grab_mode_t grab_mode = + args[ARG_grab_mode].u_obj != MP_ROM_NONE + ? validate_grab_mode(args[ARG_grab_mode].u_obj, MP_QSTR_grab_mode) + : common_hal_espcamera_camera_get_grab_mode(self); + bool framebuffer_count = + args[ARG_framebuffer_count].u_obj != MP_ROM_NONE + ? mp_obj_get_int(args[ARG_framebuffer_count].u_obj) + : common_hal_espcamera_camera_get_framebuffer_count(self); + + common_hal_espcamera_camera_reconfigure(self, frame_size, pixel_format, grab_mode, framebuffer_count); + + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_KW(espcamera_camera_reconfigure_obj, 1, espcamera_camera_reconfigure); + +//| pixel_format: PixelFormat +//| """The pixel format of captured frames""" + +STATIC mp_obj_t espcamera_camera_get_pixel_format(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return cp_enum_find(&espcamera_pixel_format_type, common_hal_espcamera_camera_get_pixel_format(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_pixel_format_obj, espcamera_camera_get_pixel_format); + +MP_PROPERTY_GETTER(espcamera_camera_pixel_format_obj, + (mp_obj_t)&espcamera_camera_get_pixel_format_obj); + + +//| frame_size: FrameSize +//| """The size of captured frames""" + +STATIC mp_obj_t espcamera_camera_get_frame_size(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return cp_enum_find(&espcamera_frame_size_type, common_hal_espcamera_camera_get_frame_size(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_frame_size_obj, espcamera_camera_get_frame_size); + +MP_PROPERTY_GETTER(espcamera_camera_frame_size_obj, + (mp_obj_t)&espcamera_camera_get_frame_size_obj); + +//| contrast: int +//| """The sensor contrast. Positive values increase contrast, negative values lower it. The total range is device-specific but is often from -2 to +2 inclusive.""" + +STATIC mp_obj_t espcamera_camera_get_contrast(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_espcamera_camera_get_contrast(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_contrast_obj, espcamera_camera_get_contrast); + +STATIC mp_obj_t espcamera_camera_set_contrast(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_contrast(self, mp_obj_get_int(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_contrast_obj, espcamera_camera_set_contrast); +MP_PROPERTY_GETSET(espcamera_camera_contrast_obj, + (mp_obj_t)&espcamera_camera_get_contrast_obj, + (mp_obj_t)&espcamera_camera_set_contrast_obj); + +//| brightness: int +//| """The sensor brightness. Positive values increase brightness, negative values lower it. The total range is device-specific but is often from -2 to +2 inclusive.""" + +STATIC mp_obj_t espcamera_camera_get_brightness(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_espcamera_camera_get_brightness(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_brightness_obj, espcamera_camera_get_brightness); + +STATIC mp_obj_t espcamera_camera_set_brightness(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_brightness(self, mp_obj_get_int(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_brightness_obj, espcamera_camera_set_brightness); +MP_PROPERTY_GETSET(espcamera_camera_brightness_obj, + (mp_obj_t)&espcamera_camera_get_brightness_obj, + (mp_obj_t)&espcamera_camera_set_brightness_obj); + +//| saturation: int +//| """The sensor saturation. Positive values increase saturation (more vibrant colors), negative values lower it (more muted colors). The total range is device-specific but the value is often from -2 to +2 inclusive.""" + +STATIC mp_obj_t espcamera_camera_get_saturation(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_espcamera_camera_get_saturation(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_saturation_obj, espcamera_camera_get_saturation); + +STATIC mp_obj_t espcamera_camera_set_saturation(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_saturation(self, mp_obj_get_int(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_saturation_obj, espcamera_camera_set_saturation); +MP_PROPERTY_GETSET(espcamera_camera_saturation_obj, + (mp_obj_t)&espcamera_camera_get_saturation_obj, + (mp_obj_t)&espcamera_camera_set_saturation_obj); + +//| sharpness: int +//| """The sensor sharpness. Positive values increase sharpness (more defined edges), negative values lower it (softer edges). The total range is device-specific but the value is often from -2 to +2 inclusive.""" + +STATIC mp_obj_t espcamera_camera_get_sharpness(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_espcamera_camera_get_sharpness(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_sharpness_obj, espcamera_camera_get_sharpness); + +STATIC mp_obj_t espcamera_camera_set_sharpness(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_sharpness(self, mp_obj_get_int(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_sharpness_obj, espcamera_camera_set_sharpness); +MP_PROPERTY_GETSET(espcamera_camera_sharpness_obj, + (mp_obj_t)&espcamera_camera_get_sharpness_obj, + (mp_obj_t)&espcamera_camera_set_sharpness_obj); + +//| denoise: int +//| """The sensor 'denoise' setting. Any camera sensor has inherent 'noise', especially in low brightness environments. Software algorithms can decrease noise at the expense of fine detail. A larger value increases the amount of software noise removal. The total range is device-specific but the value is often from 0 to 10.""" + +STATIC mp_obj_t espcamera_camera_get_denoise(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_espcamera_camera_get_denoise(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_denoise_obj, espcamera_camera_get_denoise); + +STATIC mp_obj_t espcamera_camera_set_denoise(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_denoise(self, mp_obj_get_int(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_denoise_obj, espcamera_camera_set_denoise); +MP_PROPERTY_GETSET(espcamera_camera_denoise_obj, + (mp_obj_t)&espcamera_camera_get_denoise_obj, + (mp_obj_t)&espcamera_camera_set_denoise_obj); + +//| gain_ceiling: GainCeiling +//| """The sensor 'gain ceiling' setting. "Gain" is an analog multiplier applied to the raw sensor data. The 'ceiling' is the maximum gain value that the sensor will use. A higher gain means that the sensor has a greater response to light, but also makes sensor noise more visible.""" + +STATIC mp_obj_t espcamera_camera_get_gain_ceiling(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return cp_enum_find(&espcamera_gain_ceiling_type, common_hal_espcamera_camera_get_gainceiling(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_gain_ceiling_obj, espcamera_camera_get_gain_ceiling); + +STATIC mp_obj_t espcamera_camera_set_gain_ceiling(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_gainceiling(self, validate_gain_ceiling(arg, MP_QSTR_gain_ceiling)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_gain_ceiling_obj, espcamera_camera_set_gain_ceiling); +MP_PROPERTY_GETSET(espcamera_camera_gain_ceiling_obj, + (mp_obj_t)&espcamera_camera_get_gain_ceiling_obj, + (mp_obj_t)&espcamera_camera_set_gain_ceiling_obj); + +//| quality: int +//| """The 'quality' setting when capturing JPEG images. This is similar to the quality setting when exporting a jpeg image from photo editing software. Typical values range from 5 to 40, with higher numbers leading to larger image sizes and better overall image quality. However, when the quality is set to a high number, the total size of the JPEG data can exceed the size of an internal buffer, causing image capture to fail.""" + +STATIC mp_obj_t espcamera_camera_get_quality(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_espcamera_camera_get_quality(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_quality_obj, espcamera_camera_get_quality); + +STATIC mp_obj_t espcamera_camera_set_quality(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_quality(self, mp_obj_get_int(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_quality_obj, espcamera_camera_set_quality); +MP_PROPERTY_GETSET(espcamera_camera_quality_obj, + (mp_obj_t)&espcamera_camera_get_quality_obj, + (mp_obj_t)&espcamera_camera_set_quality_obj); + +//| colorbar: bool +//| """When `True`, a test pattern image is captured and the real sensor data is not used.""" + +STATIC mp_obj_t espcamera_camera_get_colorbar(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_espcamera_camera_get_colorbar(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_colorbar_obj, espcamera_camera_get_colorbar); + +STATIC mp_obj_t espcamera_camera_set_colorbar(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_colorbar(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_colorbar_obj, espcamera_camera_set_colorbar); +MP_PROPERTY_GETSET(espcamera_camera_colorbar_obj, + (mp_obj_t)&espcamera_camera_get_colorbar_obj, + (mp_obj_t)&espcamera_camera_set_colorbar_obj); + +//| whitebal: bool +//| """When `True`, the camera attempts to automatically control white balance. When `False`, the `wb_mode` setting is used instead.""" + +STATIC mp_obj_t espcamera_camera_get_whitebal(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_espcamera_camera_get_whitebal(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_whitebal_obj, espcamera_camera_get_whitebal); + +STATIC mp_obj_t espcamera_camera_set_whitebal(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_whitebal(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_whitebal_obj, espcamera_camera_set_whitebal); +MP_PROPERTY_GETSET(espcamera_camera_whitebal_obj, + (mp_obj_t)&espcamera_camera_get_whitebal_obj, + (mp_obj_t)&espcamera_camera_set_whitebal_obj); + +//| gain_ctrl: bool +//| """When `True`, the camera attempts to automatically control the sensor gain, up to the value in the `gain_ceiling` property. When `False`, the `agc_gain` setting is used instead.""" + +STATIC mp_obj_t espcamera_camera_get_gain_ctrl(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_espcamera_camera_get_gain_ctrl(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_gain_ctrl_obj, espcamera_camera_get_gain_ctrl); + +STATIC mp_obj_t espcamera_camera_set_gain_ctrl(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_gain_ctrl(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_gain_ctrl_obj, espcamera_camera_set_gain_ctrl); +MP_PROPERTY_GETSET(espcamera_camera_gain_ctrl_obj, + (mp_obj_t)&espcamera_camera_get_gain_ctrl_obj, + (mp_obj_t)&espcamera_camera_set_gain_ctrl_obj); + +//| exposure_ctrl: bool +//| """When `True` the camera attempts to automatically control the exposure. When `False`, the `aec_value` setting is used instead.""" + +STATIC mp_obj_t espcamera_camera_get_exposure_ctrl(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_espcamera_camera_get_exposure_ctrl(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_exposure_ctrl_obj, espcamera_camera_get_exposure_ctrl); + +STATIC mp_obj_t espcamera_camera_set_exposure_ctrl(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_exposure_ctrl(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_exposure_ctrl_obj, espcamera_camera_set_exposure_ctrl); +MP_PROPERTY_GETSET(espcamera_camera_exposure_ctrl_obj, + (mp_obj_t)&espcamera_camera_get_exposure_ctrl_obj, + (mp_obj_t)&espcamera_camera_set_exposure_ctrl_obj); + +//| hmirror: bool +//| """When `True` the camera image is mirrored left-to-right""" + +STATIC mp_obj_t espcamera_camera_get_hmirror(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_espcamera_camera_get_hmirror(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_hmirror_obj, espcamera_camera_get_hmirror); + +STATIC mp_obj_t espcamera_camera_set_hmirror(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_hmirror(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_hmirror_obj, espcamera_camera_set_hmirror); +MP_PROPERTY_GETSET(espcamera_camera_hmirror_obj, + (mp_obj_t)&espcamera_camera_get_hmirror_obj, + (mp_obj_t)&espcamera_camera_set_hmirror_obj); + +//| vflip: bool +//| """When `True` the camera image is flipped top-to-bottom""" + +STATIC mp_obj_t espcamera_camera_get_vflip(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_espcamera_camera_get_vflip(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_vflip_obj, espcamera_camera_get_vflip); + +STATIC mp_obj_t espcamera_camera_set_vflip(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_vflip(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_vflip_obj, espcamera_camera_set_vflip); +MP_PROPERTY_GETSET(espcamera_camera_vflip_obj, + (mp_obj_t)&espcamera_camera_get_vflip_obj, + (mp_obj_t)&espcamera_camera_set_vflip_obj); + +//| aec2: bool +//| """When `True` the sensor's "night mode" is enabled, extending the range of automatic gain control.""" + +STATIC mp_obj_t espcamera_camera_get_aec2(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_espcamera_camera_get_aec2(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_aec2_obj, espcamera_camera_get_aec2); + +STATIC mp_obj_t espcamera_camera_set_aec2(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_aec2(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_aec2_obj, espcamera_camera_set_aec2); +MP_PROPERTY_GETSET(espcamera_camera_aec2_obj, + (mp_obj_t)&espcamera_camera_get_aec2_obj, + (mp_obj_t)&espcamera_camera_set_aec2_obj); + +//| awb_gain: bool +//| """Access the awb_gain property of the camera sensor""" + +STATIC mp_obj_t espcamera_camera_get_awb_gain(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_espcamera_camera_get_awb_gain(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_awb_gain_obj, espcamera_camera_get_awb_gain); + +STATIC mp_obj_t espcamera_camera_set_awb_gain(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_awb_gain(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_awb_gain_obj, espcamera_camera_set_awb_gain); +MP_PROPERTY_GETSET(espcamera_camera_awb_gain_obj, + (mp_obj_t)&espcamera_camera_get_awb_gain_obj, + (mp_obj_t)&espcamera_camera_set_awb_gain_obj); + +//| agc_gain: int +//| """Access the gain level of the sensor. Higher values produce brighter images. Typical settings range from 0 to 30. """ + +STATIC mp_obj_t espcamera_camera_get_agc_gain(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_espcamera_camera_get_agc_gain(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_agc_gain_obj, espcamera_camera_get_agc_gain); + +STATIC mp_obj_t espcamera_camera_set_agc_gain(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_agc_gain(self, mp_obj_get_int(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_agc_gain_obj, espcamera_camera_set_agc_gain); +MP_PROPERTY_GETSET(espcamera_camera_agc_gain_obj, + (mp_obj_t)&espcamera_camera_get_agc_gain_obj, + (mp_obj_t)&espcamera_camera_set_agc_gain_obj); + +//| aec_value: int +//| """Access the exposure value of the camera. Higher values produce brighter images. Typical settings range from 0 to 1200.""" + +STATIC mp_obj_t espcamera_camera_get_aec_value(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_espcamera_camera_get_aec_value(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_aec_value_obj, espcamera_camera_get_aec_value); + +STATIC mp_obj_t espcamera_camera_set_aec_value(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_aec_value(self, mp_obj_get_int(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_aec_value_obj, espcamera_camera_set_aec_value); +MP_PROPERTY_GETSET(espcamera_camera_aec_value_obj, + (mp_obj_t)&espcamera_camera_get_aec_value_obj, + (mp_obj_t)&espcamera_camera_set_aec_value_obj); + +//| special_effect: int +//| """Enable a "special effect". Zero is no special effect. On OV5640, special effects range from 0 to 6 inclusive and select various color modes.""" + +STATIC mp_obj_t espcamera_camera_get_special_effect(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_espcamera_camera_get_special_effect(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_special_effect_obj, espcamera_camera_get_special_effect); + +STATIC mp_obj_t espcamera_camera_set_special_effect(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_special_effect(self, mp_obj_get_int(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_special_effect_obj, espcamera_camera_set_special_effect); +MP_PROPERTY_GETSET(espcamera_camera_special_effect_obj, + (mp_obj_t)&espcamera_camera_get_special_effect_obj, + (mp_obj_t)&espcamera_camera_set_special_effect_obj); + +//| wb_mode: int +//| """The white balance mode. 0 is automatic white balance. Typical values range from 0 to 4 inclusive.""" + +STATIC mp_obj_t espcamera_camera_get_wb_mode(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_espcamera_camera_get_wb_mode(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_wb_mode_obj, espcamera_camera_get_wb_mode); + +STATIC mp_obj_t espcamera_camera_set_wb_mode(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_wb_mode(self, mp_obj_get_int(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_wb_mode_obj, espcamera_camera_set_wb_mode); +MP_PROPERTY_GETSET(espcamera_camera_wb_mode_obj, + (mp_obj_t)&espcamera_camera_get_wb_mode_obj, + (mp_obj_t)&espcamera_camera_set_wb_mode_obj); + +//| ae_level: int +//| """The exposure offset for automatic exposure. Typical values range from -2 to +2.""" + +STATIC mp_obj_t espcamera_camera_get_ae_level(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_espcamera_camera_get_ae_level(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_ae_level_obj, espcamera_camera_get_ae_level); + +STATIC mp_obj_t espcamera_camera_set_ae_level(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_ae_level(self, mp_obj_get_int(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_ae_level_obj, espcamera_camera_set_ae_level); +MP_PROPERTY_GETSET(espcamera_camera_ae_level_obj, + (mp_obj_t)&espcamera_camera_get_ae_level_obj, + (mp_obj_t)&espcamera_camera_set_ae_level_obj); + +//| dcw: bool +//| """When `True` an advanced white balance mode is selected.""" + +STATIC mp_obj_t espcamera_camera_get_dcw(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_espcamera_camera_get_dcw(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_dcw_obj, espcamera_camera_get_dcw); + +STATIC mp_obj_t espcamera_camera_set_dcw(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_dcw(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_dcw_obj, espcamera_camera_set_dcw); +MP_PROPERTY_GETSET(espcamera_camera_dcw_obj, + (mp_obj_t)&espcamera_camera_get_dcw_obj, + (mp_obj_t)&espcamera_camera_set_dcw_obj); + +//| bpc: bool +//| """When `True`, "black point compensation" is enabled. This can make black parts of the image darker.""" + +STATIC mp_obj_t espcamera_camera_get_bpc(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_espcamera_camera_get_bpc(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_bpc_obj, espcamera_camera_get_bpc); + +STATIC mp_obj_t espcamera_camera_set_bpc(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_bpc(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_bpc_obj, espcamera_camera_set_bpc); +MP_PROPERTY_GETSET(espcamera_camera_bpc_obj, + (mp_obj_t)&espcamera_camera_get_bpc_obj, + (mp_obj_t)&espcamera_camera_set_bpc_obj); + +//| wpc: bool +//| """When `True`, "white point compensation" is enabled. This can make white parts of the image whiter.""" + +STATIC mp_obj_t espcamera_camera_get_wpc(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_espcamera_camera_get_wpc(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_wpc_obj, espcamera_camera_get_wpc); + +STATIC mp_obj_t espcamera_camera_set_wpc(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_wpc(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_wpc_obj, espcamera_camera_set_wpc); +MP_PROPERTY_GETSET(espcamera_camera_wpc_obj, + (mp_obj_t)&espcamera_camera_get_wpc_obj, + (mp_obj_t)&espcamera_camera_set_wpc_obj); + +//| raw_gma: bool +//| """When `True`, raw gamma mode is enabled.""" + +STATIC mp_obj_t espcamera_camera_get_raw_gma(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_espcamera_camera_get_raw_gma(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_raw_gma_obj, espcamera_camera_get_raw_gma); + +STATIC mp_obj_t espcamera_camera_set_raw_gma(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_raw_gma(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_raw_gma_obj, espcamera_camera_set_raw_gma); +MP_PROPERTY_GETSET(espcamera_camera_raw_gma_obj, + (mp_obj_t)&espcamera_camera_get_raw_gma_obj, + (mp_obj_t)&espcamera_camera_set_raw_gma_obj); + +//| lenc: bool +//| """Enable "lens correction". This can help compensate for light fall-off at the edge of the sensor area.""" + +STATIC mp_obj_t espcamera_camera_get_lenc(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_espcamera_camera_get_lenc(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_lenc_obj, espcamera_camera_get_lenc); + +STATIC mp_obj_t espcamera_camera_set_lenc(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_lenc(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_lenc_obj, espcamera_camera_set_lenc); +MP_PROPERTY_GETSET(espcamera_camera_lenc_obj, + (mp_obj_t)&espcamera_camera_get_lenc_obj, + (mp_obj_t)&espcamera_camera_set_lenc_obj); + +//| max_frame_size: FrameSize +//| """The maximum frame size that can be captured""" +STATIC mp_obj_t espcamera_camera_get_max_frame_size(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return cp_enum_find(&espcamera_frame_size_type, common_hal_espcamera_camera_get_max_frame_size(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_max_frame_size_obj, espcamera_camera_get_max_frame_size); + +MP_PROPERTY_GETTER(espcamera_camera_max_frame_size_obj, + (mp_obj_t)&espcamera_camera_get_max_frame_size_obj); + + +//| address: int +//| """The I2C (SCCB) address of the sensor""" +STATIC mp_obj_t espcamera_camera_get_address(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_espcamera_camera_get_address(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_address_obj, espcamera_camera_get_address); + +MP_PROPERTY_GETTER(espcamera_camera_address_obj, + (mp_obj_t)&espcamera_camera_get_address_obj); + + +//| sensor_name: str +//| """The name of the sensor""" +STATIC mp_obj_t espcamera_camera_get_sensor_name(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + const char *sensor_name = common_hal_espcamera_camera_get_sensor_name(self); + return mp_obj_new_str(sensor_name, strlen(sensor_name)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_sensor_name_obj, espcamera_camera_get_sensor_name); + +MP_PROPERTY_GETTER(espcamera_camera_sensor_name_obj, + (mp_obj_t)&espcamera_camera_get_sensor_name_obj); + + +//| supports_jpeg: bool +//| """True if the sensor can capture images in JPEG format""" +STATIC mp_obj_t espcamera_camera_get_supports_jpeg(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_espcamera_camera_get_supports_jpeg(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_supports_jpeg_obj, espcamera_camera_get_supports_jpeg); + +MP_PROPERTY_GETTER(espcamera_camera_supports_jpeg_obj, + (mp_obj_t)&espcamera_camera_get_supports_jpeg_obj); + +//| height: int +//| """The height of the image being captured""" +STATIC mp_obj_t espcamera_camera_get_height(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_espcamera_camera_get_height(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_height_obj, espcamera_camera_get_height); + +MP_PROPERTY_GETTER(espcamera_camera_height_obj, + (mp_obj_t)&espcamera_camera_get_height_obj); + +//| width: int +//| """The width of the image being captured""" +STATIC mp_obj_t espcamera_camera_get_width(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_espcamera_camera_get_width(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_width_obj, espcamera_camera_get_width); + +MP_PROPERTY_GETTER(espcamera_camera_width_obj, + (mp_obj_t)&espcamera_camera_get_width_obj); + +//| grab_mode: GrabMode +//| """The grab mode of the camera""" +STATIC mp_obj_t espcamera_camera_get_grab_mode(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return cp_enum_find(&espcamera_grab_mode_type, common_hal_espcamera_camera_get_grab_mode(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_grab_mode_obj, espcamera_camera_get_grab_mode); + +MP_PROPERTY_GETTER(espcamera_camera_grab_mode_obj, + (mp_obj_t)&espcamera_camera_get_grab_mode_obj); + + +//| framebuffer_count: int +//| """True if double buffering is used""" +//| +STATIC mp_obj_t espcamera_camera_get_framebuffer_count(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_espcamera_camera_get_framebuffer_count(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_framebuffer_count_obj, espcamera_camera_get_framebuffer_count); + +MP_PROPERTY_GETTER(espcamera_camera_framebuffer_count_obj, + (mp_obj_t)&espcamera_camera_get_framebuffer_count_obj); + + +STATIC const mp_rom_map_elem_t espcamera_camera_locals_table[] = { + { MP_ROM_QSTR(MP_QSTR_address), MP_ROM_PTR(&espcamera_camera_address_obj) }, + { MP_ROM_QSTR(MP_QSTR_aec2), MP_ROM_PTR(&espcamera_camera_aec2_obj) }, + { MP_ROM_QSTR(MP_QSTR_aec_value), MP_ROM_PTR(&espcamera_camera_aec_value_obj) }, + { MP_ROM_QSTR(MP_QSTR_ae_level), MP_ROM_PTR(&espcamera_camera_ae_level_obj) }, + { MP_ROM_QSTR(MP_QSTR_agc_gain), MP_ROM_PTR(&espcamera_camera_agc_gain_obj) }, + { MP_ROM_QSTR(MP_QSTR_awb_gain), MP_ROM_PTR(&espcamera_camera_awb_gain_obj) }, + { MP_ROM_QSTR(MP_QSTR_bpc), MP_ROM_PTR(&espcamera_camera_bpc_obj) }, + { MP_ROM_QSTR(MP_QSTR_brightness), MP_ROM_PTR(&espcamera_camera_brightness_obj) }, + { MP_ROM_QSTR(MP_QSTR_colorbar), MP_ROM_PTR(&espcamera_camera_colorbar_obj) }, + { MP_ROM_QSTR(MP_QSTR_contrast), MP_ROM_PTR(&espcamera_camera_contrast_obj) }, + { MP_ROM_QSTR(MP_QSTR_dcw), MP_ROM_PTR(&espcamera_camera_dcw_obj) }, + { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&espcamera_camera_deinit_obj) }, + { MP_ROM_QSTR(MP_QSTR_denoise), MP_ROM_PTR(&espcamera_camera_denoise_obj) }, + { MP_ROM_QSTR(MP_QSTR_framebuffer_count), MP_ROM_PTR(&espcamera_camera_framebuffer_count_obj) }, + { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&mp_identity_obj) }, + { MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&espcamera_camera___exit___obj) }, + { MP_ROM_QSTR(MP_QSTR_exposure_ctrl), MP_ROM_PTR(&espcamera_camera_exposure_ctrl_obj) }, + { MP_ROM_QSTR(MP_QSTR_frame_available), MP_ROM_PTR(&espcamera_camera_frame_available_obj) }, + { MP_ROM_QSTR(MP_QSTR_frame_size), MP_ROM_PTR(&espcamera_camera_frame_size_obj) }, + { MP_ROM_QSTR(MP_QSTR_gain_ceiling), MP_ROM_PTR(&espcamera_camera_gain_ceiling_obj) }, + { MP_ROM_QSTR(MP_QSTR_gain_ctrl), MP_ROM_PTR(&espcamera_camera_gain_ctrl_obj) }, + { MP_ROM_QSTR(MP_QSTR_grab_mode), MP_ROM_PTR(&espcamera_camera_grab_mode_obj) }, + { MP_ROM_QSTR(MP_QSTR_height), MP_ROM_PTR(&espcamera_camera_height_obj) }, + { MP_ROM_QSTR(MP_QSTR_hmirror), MP_ROM_PTR(&espcamera_camera_hmirror_obj) }, + { MP_ROM_QSTR(MP_QSTR_lenc), MP_ROM_PTR(&espcamera_camera_lenc_obj) }, + { MP_ROM_QSTR(MP_QSTR_max_frame_size), MP_ROM_PTR(&espcamera_camera_max_frame_size_obj) }, + { MP_ROM_QSTR(MP_QSTR_pixel_format), MP_ROM_PTR(&espcamera_camera_pixel_format_obj) }, + { MP_ROM_QSTR(MP_QSTR_quality), MP_ROM_PTR(&espcamera_camera_quality_obj) }, + { MP_ROM_QSTR(MP_QSTR_raw_gma), MP_ROM_PTR(&espcamera_camera_raw_gma_obj) }, + { MP_ROM_QSTR(MP_QSTR_reconfigure), MP_ROM_PTR(&espcamera_camera_reconfigure_obj) }, + { MP_ROM_QSTR(MP_QSTR_saturation), MP_ROM_PTR(&espcamera_camera_saturation_obj) }, + { MP_ROM_QSTR(MP_QSTR_sensor_name), MP_ROM_PTR(&espcamera_camera_sensor_name_obj) }, + { MP_ROM_QSTR(MP_QSTR_sharpness), MP_ROM_PTR(&espcamera_camera_sharpness_obj) }, + { MP_ROM_QSTR(MP_QSTR_special_effect), MP_ROM_PTR(&espcamera_camera_special_effect_obj) }, + { MP_ROM_QSTR(MP_QSTR_supports_jpeg), MP_ROM_PTR(&espcamera_camera_supports_jpeg_obj) }, + { MP_ROM_QSTR(MP_QSTR_take), MP_ROM_PTR(&espcamera_camera_take_obj) }, + { MP_ROM_QSTR(MP_QSTR_vflip), MP_ROM_PTR(&espcamera_camera_vflip_obj) }, + { MP_ROM_QSTR(MP_QSTR_wb_mode), MP_ROM_PTR(&espcamera_camera_wb_mode_obj) }, + { MP_ROM_QSTR(MP_QSTR_whitebal), MP_ROM_PTR(&espcamera_camera_whitebal_obj) }, + { MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&espcamera_camera_width_obj) }, + { MP_ROM_QSTR(MP_QSTR_wpc), MP_ROM_PTR(&espcamera_camera_wpc_obj) }, +}; + +STATIC MP_DEFINE_CONST_DICT(espcamera_camera_locals_dict, espcamera_camera_locals_table); + +const mp_obj_type_t espcamera_camera_type = { + .base = { &mp_type_type }, + .name = MP_QSTR_Camera, + .make_new = espcamera_camera_make_new, + .locals_dict = (mp_obj_t)&espcamera_camera_locals_dict, +}; diff --git a/ports/espressif/bindings/esp32_camera/Camera.h b/ports/espressif/bindings/espcamera/Camera.h similarity index 72% rename from ports/espressif/bindings/esp32_camera/Camera.h rename to ports/espressif/bindings/espcamera/Camera.h index f190808531..c6d8182090 100644 --- a/ports/espressif/bindings/esp32_camera/Camera.h +++ b/ports/espressif/bindings/espcamera/Camera.h @@ -33,11 +33,11 @@ #include "shared-bindings/busio/I2C.h" -extern const mp_obj_type_t esp32_camera_camera_type; -typedef struct esp32_camera_camera_obj esp32_camera_camera_obj_t; +extern const mp_obj_type_t espcamera_camera_type; +typedef struct espcamera_camera_obj espcamera_camera_obj_t; -extern void common_hal_esp32_camera_camera_construct( - esp32_camera_camera_obj_t *self, +extern void common_hal_espcamera_camera_construct( + espcamera_camera_obj_t *self, uint8_t data_pins[8], const mcu_pin_obj_t *external_clock_pin, const mcu_pin_obj_t *pixel_clock_pin, @@ -53,11 +53,11 @@ extern void common_hal_esp32_camera_camera_construct( mp_int_t framebuffer_count, camera_grab_mode_t grab_mode); -extern void common_hal_esp32_camera_camera_deinit(esp32_camera_camera_obj_t *self); -extern bool common_hal_esp32_camera_camera_deinited(esp32_camera_camera_obj_t *self); -extern bool common_hal_esp32_camera_camera_available(esp32_camera_camera_obj_t *self); -extern camera_fb_t *common_hal_esp32_camera_camera_take(esp32_camera_camera_obj_t *self, int timeout_ms); -extern void common_hal_esp32_camera_camera_reconfigure(esp32_camera_camera_obj_t *self, framesize_t frame_size, pixformat_t pixel_format, camera_grab_mode_t grab_mode, mp_int_t framebuffer_count); +extern void common_hal_espcamera_camera_deinit(espcamera_camera_obj_t *self); +extern bool common_hal_espcamera_camera_deinited(espcamera_camera_obj_t *self); +extern bool common_hal_espcamera_camera_available(espcamera_camera_obj_t *self); +extern camera_fb_t *common_hal_espcamera_camera_take(espcamera_camera_obj_t *self, int timeout_ms); +extern void common_hal_espcamera_camera_reconfigure(espcamera_camera_obj_t *self, framesize_t frame_size, pixformat_t pixel_format, camera_grab_mode_t grab_mode, mp_int_t framebuffer_count); #define DECLARE_SENSOR_GETSET(type, name, field_name, setter_function_name) \ DECLARE_SENSOR_GET(type, name, field_name, setter_function_name) \ @@ -70,10 +70,10 @@ extern void common_hal_esp32_camera_camera_reconfigure(esp32_camera_camera_obj_t DECLARE_SENSOR_GET(type, name, status.status_field_name, setter_function_name) #define DECLARE_SENSOR_GET(type, name, status_field_name, setter_function_name) \ - extern type common_hal_esp32_camera_camera_get_##name(esp32_camera_camera_obj_t * self); + extern type common_hal_espcamera_camera_get_##name(espcamera_camera_obj_t * self); #define DECLARE_SENSOR_SET(type, name, setter_function_name) \ - extern void common_hal_esp32_camera_camera_set_##name(esp32_camera_camera_obj_t * self, type value); + extern void common_hal_espcamera_camera_set_##name(espcamera_camera_obj_t * self, type value); DECLARE_SENSOR_GET(pixformat_t, pixel_format, pixformat, set_pixformat) DECLARE_SENSOR_STATUS_GET(framesize_t, frame_size, framesize, set_framesize) @@ -104,13 +104,13 @@ DECLARE_SENSOR_STATUS_GETSET(bool, raw_gma, raw_gma, set_raw_gma); DECLARE_SENSOR_STATUS_GETSET(bool, lenc, lenc, set_lenc); // From settings -extern camera_grab_mode_t common_hal_esp32_camera_camera_get_grab_mode(esp32_camera_camera_obj_t *self); -extern int common_hal_esp32_camera_camera_get_framebuffer_count(esp32_camera_camera_obj_t *self); +extern camera_grab_mode_t common_hal_espcamera_camera_get_grab_mode(espcamera_camera_obj_t *self); +extern int common_hal_espcamera_camera_get_framebuffer_count(espcamera_camera_obj_t *self); // From camera_sensor_info_t -extern int common_hal_esp32_camera_camera_get_address(esp32_camera_camera_obj_t *self); -extern const char *common_hal_esp32_camera_camera_get_sensor_name(esp32_camera_camera_obj_t *self); -extern const bool common_hal_esp32_camera_camera_get_supports_jpeg(esp32_camera_camera_obj_t *self); -extern framesize_t common_hal_esp32_camera_camera_get_max_frame_size(esp32_camera_camera_obj_t *self); -extern int common_hal_esp32_camera_camera_get_width(esp32_camera_camera_obj_t *self); -extern int common_hal_esp32_camera_camera_get_height(esp32_camera_camera_obj_t *self); +extern int common_hal_espcamera_camera_get_address(espcamera_camera_obj_t *self); +extern const char *common_hal_espcamera_camera_get_sensor_name(espcamera_camera_obj_t *self); +extern const bool common_hal_espcamera_camera_get_supports_jpeg(espcamera_camera_obj_t *self); +extern framesize_t common_hal_espcamera_camera_get_max_frame_size(espcamera_camera_obj_t *self); +extern int common_hal_espcamera_camera_get_width(espcamera_camera_obj_t *self); +extern int common_hal_espcamera_camera_get_height(espcamera_camera_obj_t *self); diff --git a/ports/espressif/bindings/esp32_camera/__init__.c b/ports/espressif/bindings/espcamera/__init__.c similarity index 53% rename from ports/espressif/bindings/esp32_camera/__init__.c rename to ports/espressif/bindings/espcamera/__init__.c index 36c837106c..37b506015f 100644 --- a/ports/espressif/bindings/esp32_camera/__init__.c +++ b/ports/espressif/bindings/espcamera/__init__.c @@ -29,13 +29,13 @@ #include "py/mphal.h" #include "bindings/espidf/__init__.h" -#include "bindings/esp32_camera/__init__.h" -#include "bindings/esp32_camera/Camera.h" +#include "bindings/espcamera/__init__.h" +#include "bindings/espcamera/Camera.h" #include "esp_camera.h" #include "sensor.h" -//| """Wrapper for the esp32_camera library +//| """Wrapper for the espcamera library //| //| This library enables access to any camera sensor supported by the library, //| including OV5640 and OV2640. @@ -56,20 +56,20 @@ //| """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); +MAKE_ENUM_VALUE(espcamera_grab_mode_type, grab_mode, WHEN_EMPTY, CAMERA_GRAB_WHEN_EMPTY); +MAKE_ENUM_VALUE(espcamera_grab_mode_type, grab_mode, LATEST, CAMERA_GRAB_LATEST); -MAKE_ENUM_MAP(esp32_camera_grab_mode) { +MAKE_ENUM_MAP(espcamera_grab_mode) { MAKE_ENUM_MAP_ENTRY(grab_mode, WHEN_EMPTY), MAKE_ENUM_MAP_ENTRY(grab_mode, LATEST), }; -STATIC MP_DEFINE_CONST_DICT(esp32_camera_grab_mode_locals_dict, esp32_camera_grab_mode_locals_table); -MAKE_PRINTER(esp32_camera, esp32_camera_grab_mode); -MAKE_ENUM_TYPE(esp32_camera, GrabMode, esp32_camera_grab_mode); +STATIC MP_DEFINE_CONST_DICT(espcamera_grab_mode_locals_dict, espcamera_grab_mode_locals_table); +MAKE_PRINTER(espcamera, espcamera_grab_mode); +MAKE_ENUM_TYPE(espcamera, GrabMode, espcamera_grab_mode); camera_grab_mode_t validate_grab_mode(mp_obj_t obj, qstr arg_name) { - return cp_enum_value(&esp32_camera_grab_mode_type, obj, arg_name); + return cp_enum_value(&espcamera_grab_mode_type, obj, arg_name); } //| class PixelFormat: @@ -85,22 +85,22 @@ camera_grab_mode_t validate_grab_mode(mp_obj_t obj, qstr arg_name) { //| """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); -MAKE_ENUM_VALUE(esp32_camera_pixel_format_type, pixel_format, JPEG, PIXFORMAT_JPEG); +MAKE_ENUM_VALUE(espcamera_pixel_format_type, pixel_format, RGB565, PIXFORMAT_RGB565); +MAKE_ENUM_VALUE(espcamera_pixel_format_type, pixel_format, GRAYSCALE, PIXFORMAT_GRAYSCALE); +MAKE_ENUM_VALUE(espcamera_pixel_format_type, pixel_format, JPEG, PIXFORMAT_JPEG); -MAKE_ENUM_MAP(esp32_camera_pixel_format) { +MAKE_ENUM_MAP(espcamera_pixel_format) { MAKE_ENUM_MAP_ENTRY(pixel_format, RGB565), MAKE_ENUM_MAP_ENTRY(pixel_format, GRAYSCALE), MAKE_ENUM_MAP_ENTRY(pixel_format, JPEG), }; -STATIC MP_DEFINE_CONST_DICT(esp32_camera_pixel_format_locals_dict, esp32_camera_pixel_format_locals_table); -MAKE_PRINTER(esp32_camera, esp32_camera_pixel_format); -MAKE_ENUM_TYPE(esp32_camera, PixelFormat, esp32_camera_pixel_format); +STATIC MP_DEFINE_CONST_DICT(espcamera_pixel_format_locals_dict, espcamera_pixel_format_locals_table); +MAKE_PRINTER(espcamera, espcamera_pixel_format); +MAKE_ENUM_TYPE(espcamera, PixelFormat, espcamera_pixel_format); pixformat_t validate_pixel_format(mp_obj_t obj, qstr arg_name) { - return cp_enum_value(&esp32_camera_pixel_format_type, obj, arg_name); + return cp_enum_value(&espcamera_pixel_format_type, obj, arg_name); } //| class FrameSize: @@ -173,29 +173,29 @@ pixformat_t validate_pixel_format(mp_obj_t obj, qstr arg_name) { //| """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); -MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, QQVGA, FRAMESIZE_QQVGA); -MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, QCIF, FRAMESIZE_QCIF); -MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, HQVGA, FRAMESIZE_HQVGA); -MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, QVGA, FRAMESIZE_QVGA); -MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, CIF, FRAMESIZE_CIF); -MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, HVGA, FRAMESIZE_HVGA); -MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, VGA, FRAMESIZE_VGA); -MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, SVGA, FRAMESIZE_SVGA); -MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, XGA, FRAMESIZE_XGA); -MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, HD, FRAMESIZE_HD); -MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, SXGA, FRAMESIZE_SXGA); -MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, UXGA, FRAMESIZE_UXGA); -MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, FHD, FRAMESIZE_FHD); -MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, P_HD, FRAMESIZE_P_HD); -MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, P_3MP, FRAMESIZE_P_3MP); -MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, QXGA, FRAMESIZE_QXGA); -MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, QHD, FRAMESIZE_QHD); -MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, WQXGA, FRAMESIZE_WQXGA); -MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, P_FHD, FRAMESIZE_P_FHD); -MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, QSXGA, FRAMESIZE_QSXGA); -MAKE_ENUM_MAP(esp32_camera_frame_size) { +MAKE_ENUM_VALUE(espcamera_frame_size_type, frame_size, R96X96, FRAMESIZE_96X96); +MAKE_ENUM_VALUE(espcamera_frame_size_type, frame_size, R240X240, FRAMESIZE_240X240); +MAKE_ENUM_VALUE(espcamera_frame_size_type, frame_size, QQVGA, FRAMESIZE_QQVGA); +MAKE_ENUM_VALUE(espcamera_frame_size_type, frame_size, QCIF, FRAMESIZE_QCIF); +MAKE_ENUM_VALUE(espcamera_frame_size_type, frame_size, HQVGA, FRAMESIZE_HQVGA); +MAKE_ENUM_VALUE(espcamera_frame_size_type, frame_size, QVGA, FRAMESIZE_QVGA); +MAKE_ENUM_VALUE(espcamera_frame_size_type, frame_size, CIF, FRAMESIZE_CIF); +MAKE_ENUM_VALUE(espcamera_frame_size_type, frame_size, HVGA, FRAMESIZE_HVGA); +MAKE_ENUM_VALUE(espcamera_frame_size_type, frame_size, VGA, FRAMESIZE_VGA); +MAKE_ENUM_VALUE(espcamera_frame_size_type, frame_size, SVGA, FRAMESIZE_SVGA); +MAKE_ENUM_VALUE(espcamera_frame_size_type, frame_size, XGA, FRAMESIZE_XGA); +MAKE_ENUM_VALUE(espcamera_frame_size_type, frame_size, HD, FRAMESIZE_HD); +MAKE_ENUM_VALUE(espcamera_frame_size_type, frame_size, SXGA, FRAMESIZE_SXGA); +MAKE_ENUM_VALUE(espcamera_frame_size_type, frame_size, UXGA, FRAMESIZE_UXGA); +MAKE_ENUM_VALUE(espcamera_frame_size_type, frame_size, FHD, FRAMESIZE_FHD); +MAKE_ENUM_VALUE(espcamera_frame_size_type, frame_size, P_HD, FRAMESIZE_P_HD); +MAKE_ENUM_VALUE(espcamera_frame_size_type, frame_size, P_3MP, FRAMESIZE_P_3MP); +MAKE_ENUM_VALUE(espcamera_frame_size_type, frame_size, QXGA, FRAMESIZE_QXGA); +MAKE_ENUM_VALUE(espcamera_frame_size_type, frame_size, QHD, FRAMESIZE_QHD); +MAKE_ENUM_VALUE(espcamera_frame_size_type, frame_size, WQXGA, FRAMESIZE_WQXGA); +MAKE_ENUM_VALUE(espcamera_frame_size_type, frame_size, P_FHD, FRAMESIZE_P_FHD); +MAKE_ENUM_VALUE(espcamera_frame_size_type, frame_size, QSXGA, FRAMESIZE_QSXGA); +MAKE_ENUM_MAP(espcamera_frame_size) { MAKE_ENUM_MAP_ENTRY(frame_size, R96X96), MAKE_ENUM_MAP_ENTRY(frame_size, R240X240), MAKE_ENUM_MAP_ENTRY(frame_size, QQVGA), @@ -220,12 +220,12 @@ MAKE_ENUM_MAP(esp32_camera_frame_size) { MAKE_ENUM_MAP_ENTRY(frame_size, QSXGA), }; -STATIC MP_DEFINE_CONST_DICT(esp32_camera_frame_size_locals_dict, esp32_camera_frame_size_locals_table); -MAKE_PRINTER(esp32_camera, esp32_camera_frame_size); -MAKE_ENUM_TYPE(esp32_camera, FrameSize, esp32_camera_frame_size); +STATIC MP_DEFINE_CONST_DICT(espcamera_frame_size_locals_dict, espcamera_frame_size_locals_table); +MAKE_PRINTER(espcamera, espcamera_frame_size); +MAKE_ENUM_TYPE(espcamera, FrameSize, espcamera_frame_size); framesize_t validate_frame_size(mp_obj_t obj, qstr arg_name) { - return cp_enum_value(&esp32_camera_frame_size_type, obj, arg_name); + return cp_enum_value(&espcamera_frame_size_type, obj, arg_name); } //| class GainCeiling: @@ -242,15 +242,15 @@ framesize_t validate_frame_size(mp_obj_t obj, qstr arg_name) { //| 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); -MAKE_ENUM_VALUE(esp32_camera_gain_ceiling_type, gain_ceiling, GAIN_8X, GAINCEILING_8X); -MAKE_ENUM_VALUE(esp32_camera_gain_ceiling_type, gain_ceiling, GAIN_16X, GAINCEILING_16X); -MAKE_ENUM_VALUE(esp32_camera_gain_ceiling_type, gain_ceiling, GAIN_32X, GAINCEILING_32X); -MAKE_ENUM_VALUE(esp32_camera_gain_ceiling_type, gain_ceiling, GAIN_64X, GAINCEILING_64X); -MAKE_ENUM_VALUE(esp32_camera_gain_ceiling_type, gain_ceiling, GAIN_128X, GAINCEILING_128X); +MAKE_ENUM_VALUE(espcamera_gain_ceiling_type, gain_ceiling, GAIN_2X, GAINCEILING_2X); +MAKE_ENUM_VALUE(espcamera_gain_ceiling_type, gain_ceiling, GAIN_4X, GAINCEILING_4X); +MAKE_ENUM_VALUE(espcamera_gain_ceiling_type, gain_ceiling, GAIN_8X, GAINCEILING_8X); +MAKE_ENUM_VALUE(espcamera_gain_ceiling_type, gain_ceiling, GAIN_16X, GAINCEILING_16X); +MAKE_ENUM_VALUE(espcamera_gain_ceiling_type, gain_ceiling, GAIN_32X, GAINCEILING_32X); +MAKE_ENUM_VALUE(espcamera_gain_ceiling_type, gain_ceiling, GAIN_64X, GAINCEILING_64X); +MAKE_ENUM_VALUE(espcamera_gain_ceiling_type, gain_ceiling, GAIN_128X, GAINCEILING_128X); -MAKE_ENUM_MAP(esp32_camera_gain_ceiling) { +MAKE_ENUM_MAP(espcamera_gain_ceiling) { MAKE_ENUM_MAP_ENTRY(gain_ceiling, GAIN_2X), MAKE_ENUM_MAP_ENTRY(gain_ceiling, GAIN_4X), MAKE_ENUM_MAP_ENTRY(gain_ceiling, GAIN_8X), @@ -260,28 +260,28 @@ MAKE_ENUM_MAP(esp32_camera_gain_ceiling) { MAKE_ENUM_MAP_ENTRY(gain_ceiling, GAIN_128X) }; -STATIC MP_DEFINE_CONST_DICT(esp32_camera_gain_ceiling_locals_dict, esp32_camera_gain_ceiling_locals_table); -MAKE_PRINTER(esp32_camera, esp32_camera_gain_ceiling); -MAKE_ENUM_TYPE(esp32_camera, GainCeiling, esp32_camera_gain_ceiling); +STATIC MP_DEFINE_CONST_DICT(espcamera_gain_ceiling_locals_dict, espcamera_gain_ceiling_locals_table); +MAKE_PRINTER(espcamera, espcamera_gain_ceiling); +MAKE_ENUM_TYPE(espcamera, GainCeiling, espcamera_gain_ceiling); gainceiling_t validate_gain_ceiling(mp_obj_t obj, qstr arg_name) { - return cp_enum_value(&esp32_camera_gain_ceiling_type, obj, arg_name); + return cp_enum_value(&espcamera_gain_ceiling_type, obj, arg_name); } -STATIC const mp_rom_map_elem_t esp32_camera_module_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_esp32_camera) }, - { MP_ROM_QSTR(MP_QSTR_Camera), MP_ROM_PTR(&esp32_camera_camera_type), }, - { MP_ROM_QSTR(MP_QSTR_FrameSize), &esp32_camera_frame_size_type }, - { MP_ROM_QSTR(MP_QSTR_GainCeiling), &esp32_camera_gain_ceiling_type }, - { MP_ROM_QSTR(MP_QSTR_GrabMode), &esp32_camera_grab_mode_type }, - { MP_ROM_QSTR(MP_QSTR_PixelFormat), &esp32_camera_pixel_format_type }, +STATIC const mp_rom_map_elem_t espcamera_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_espcamera) }, + { MP_ROM_QSTR(MP_QSTR_Camera), MP_ROM_PTR(&espcamera_camera_type), }, + { MP_ROM_QSTR(MP_QSTR_FrameSize), &espcamera_frame_size_type }, + { MP_ROM_QSTR(MP_QSTR_GainCeiling), &espcamera_gain_ceiling_type }, + { MP_ROM_QSTR(MP_QSTR_GrabMode), &espcamera_grab_mode_type }, + { MP_ROM_QSTR(MP_QSTR_PixelFormat), &espcamera_pixel_format_type }, }; -STATIC MP_DEFINE_CONST_DICT(esp32_camera_module_globals, esp32_camera_module_globals_table); +STATIC MP_DEFINE_CONST_DICT(espcamera_module_globals, espcamera_module_globals_table); -const mp_obj_module_t esp32_camera_module = { +const mp_obj_module_t espcamera_module = { .base = { &mp_type_module }, - .globals = (mp_obj_dict_t *)&esp32_camera_module_globals, + .globals = (mp_obj_dict_t *)&espcamera_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_esp32_camera, esp32_camera_module, CIRCUITPY_ESP32_CAMERA); +MP_REGISTER_MODULE(MP_QSTR_espcamera, espcamera_module, CIRCUITPY_ESPCAMERA); diff --git a/ports/espressif/bindings/esp32_camera/__init__.h b/ports/espressif/bindings/espcamera/__init__.h similarity index 88% rename from ports/espressif/bindings/esp32_camera/__init__.h rename to ports/espressif/bindings/espcamera/__init__.h index a0e7290ff9..6e55ac3870 100644 --- a/ports/espressif/bindings/esp32_camera/__init__.h +++ b/ports/espressif/bindings/espcamera/__init__.h @@ -31,13 +31,13 @@ #include "esp_camera.h" -extern const mp_obj_type_t esp32_camera_grab_mode_type; +extern const mp_obj_type_t espcamera_grab_mode_type; extern const cp_enum_obj_t grab_mode_WHEN_EMPTY_obj; -extern const mp_obj_type_t esp32_camera_pixel_format_type; +extern const mp_obj_type_t espcamera_pixel_format_type; extern const cp_enum_obj_t pixel_format_RGB565_obj; -extern const mp_obj_type_t esp32_camera_frame_size_type; +extern const mp_obj_type_t espcamera_frame_size_type; extern const cp_enum_obj_t frame_size_QQVGA_obj; -extern const mp_obj_type_t esp32_camera_gain_ceiling_type; +extern const mp_obj_type_t espcamera_gain_ceiling_type; extern camera_grab_mode_t validate_grab_mode(mp_obj_t obj, qstr arg_name); extern pixformat_t validate_pixel_format(mp_obj_t obj, qstr arg_name); diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/mpconfigboard.mk b/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/mpconfigboard.mk index 4ecf6aa969..a8d02f082c 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/mpconfigboard.mk @@ -10,4 +10,4 @@ CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB OPTIMIZATION_FLAGS = -Os -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/mpconfigboard.mk b/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/mpconfigboard.mk index 3c1cf0d609..582ed4409c 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/mpconfigboard.mk @@ -8,4 +8,4 @@ IDF_TARGET = esp32s3 CIRCUITPY_ESP_FLASH_MODE = qio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 8MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_tft/mpconfigboard.mk b/ports/espressif/boards/adafruit_feather_esp32s3_tft/mpconfigboard.mk index baff69b1ac..858d0b1859 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s3_tft/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_feather_esp32s3_tft/mpconfigboard.mk @@ -11,4 +11,4 @@ CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB OPTIMIZATION_FLAGS = -Os -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/adafruit_feather_huzzah32/mpconfigboard.mk b/ports/espressif/boards/adafruit_feather_huzzah32/mpconfigboard.mk index 221543547c..c314f90246 100644 --- a/ports/espressif/boards/adafruit_feather_huzzah32/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_feather_huzzah32/mpconfigboard.mk @@ -6,4 +6,4 @@ IDF_TARGET = esp32 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/adafruit_funhouse/mpconfigboard.mk b/ports/espressif/boards/adafruit_funhouse/mpconfigboard.mk index 8b08c94022..7d5c91f154 100644 --- a/ports/espressif/boards/adafruit_funhouse/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_funhouse/mpconfigboard.mk @@ -9,7 +9,7 @@ CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_PortalBase diff --git a/ports/espressif/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.mk b/ports/espressif/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.mk index ee2bfdb069..d941039078 100644 --- a/ports/espressif/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.mk @@ -9,7 +9,7 @@ CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_PortalBase diff --git a/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.mk b/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.mk index 15dd51e5ff..e695bae635 100644 --- a/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.mk @@ -13,4 +13,4 @@ CIRCUITPY_ESP_FLASH_SIZE = 8MB FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Requests FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Register -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/crcibernetica-ideaboard/mpconfigboard.mk b/ports/espressif/boards/crcibernetica-ideaboard/mpconfigboard.mk index 3921140b5c..5862ee1192 100644 --- a/ports/espressif/boards/crcibernetica-ideaboard/mpconfigboard.mk +++ b/ports/espressif/boards/crcibernetica-ideaboard/mpconfigboard.mk @@ -6,7 +6,7 @@ IDF_TARGET = esp32 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 8MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 # Include these Python libraries in firmware FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Requests diff --git a/ports/espressif/boards/doit_esp32_devkit_v1/mpconfigboard.mk b/ports/espressif/boards/doit_esp32_devkit_v1/mpconfigboard.mk index 7aa352e16e..23f905dfdf 100644 --- a/ports/espressif/boards/doit_esp32_devkit_v1/mpconfigboard.mk +++ b/ports/espressif/boards/doit_esp32_devkit_v1/mpconfigboard.mk @@ -6,4 +6,4 @@ IDF_TARGET = esp32 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.mk b/ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.mk index 67e88a1639..73acab519c 100644 --- a/ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.mk +++ b/ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.mk @@ -10,4 +10,4 @@ CIRCUITPY_NEOPIXEL_WRITE = 0 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/mpconfigboard.mk index 31e79b2425..d92eff48d0 100644 --- a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/mpconfigboard.mk @@ -8,4 +8,4 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.mk index 7ffb076348..5a2a4794bd 100644 --- a/ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.mk @@ -9,4 +9,4 @@ CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 16MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/espressif_esp32s3_box_lite/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s3_box_lite/mpconfigboard.mk index f4a746026a..a4bd29fa52 100644 --- a/ports/espressif/boards/espressif_esp32s3_box_lite/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s3_box_lite/mpconfigboard.mk @@ -9,4 +9,4 @@ CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 16MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/mpconfigboard.mk index 7ae39254b4..6f56013e09 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/mpconfigboard.mk @@ -8,4 +8,4 @@ IDF_TARGET = esp32s3 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 8MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/mpconfigboard.mk index ac58db8aed..55ad754736 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/mpconfigboard.mk @@ -8,4 +8,4 @@ IDF_TARGET = esp32s3 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 8MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/espressif_esp32s3_usb_otg_n8/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s3_usb_otg_n8/mpconfigboard.mk index dd8403f779..868e29bf60 100644 --- a/ports/espressif/boards/espressif_esp32s3_usb_otg_n8/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s3_usb_otg_n8/mpconfigboard.mk @@ -8,4 +8,4 @@ IDF_TARGET = esp32s3 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 8MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/espressif_saola_1_wroom/mpconfigboard.mk b/ports/espressif/boards/espressif_saola_1_wroom/mpconfigboard.mk index 4748b1c306..03feef98ce 100644 --- a/ports/espressif/boards/espressif_saola_1_wroom/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_saola_1_wroom/mpconfigboard.mk @@ -8,4 +8,4 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/franzininho_wifi_wroom/mpconfigboard.mk b/ports/espressif/boards/franzininho_wifi_wroom/mpconfigboard.mk index 193a867fb2..76661511e2 100644 --- a/ports/espressif/boards/franzininho_wifi_wroom/mpconfigboard.mk +++ b/ports/espressif/boards/franzininho_wifi_wroom/mpconfigboard.mk @@ -8,4 +8,4 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/gravitech_cucumber_m/mpconfigboard.mk b/ports/espressif/boards/gravitech_cucumber_m/mpconfigboard.mk index a7d4d9fb7c..801bd8b508 100644 --- a/ports/espressif/boards/gravitech_cucumber_m/mpconfigboard.mk +++ b/ports/espressif/boards/gravitech_cucumber_m/mpconfigboard.mk @@ -8,4 +8,4 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/gravitech_cucumber_ms/mpconfigboard.mk b/ports/espressif/boards/gravitech_cucumber_ms/mpconfigboard.mk index bbcbfde29a..b57f74f23d 100644 --- a/ports/espressif/boards/gravitech_cucumber_ms/mpconfigboard.mk +++ b/ports/espressif/boards/gravitech_cucumber_ms/mpconfigboard.mk @@ -8,4 +8,4 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/mpconfigboard.mk b/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/mpconfigboard.mk index b5cc1bae7c..3244d38869 100644 --- a/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/mpconfigboard.mk +++ b/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/mpconfigboard.mk @@ -8,4 +8,4 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/lolin_s3/mpconfigboard.mk b/ports/espressif/boards/lolin_s3/mpconfigboard.mk index b0b146b03c..c81e3e6fb9 100644 --- a/ports/espressif/boards/lolin_s3/mpconfigboard.mk +++ b/ports/espressif/boards/lolin_s3/mpconfigboard.mk @@ -10,4 +10,4 @@ CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 16MB OPTIMIZATION_FLAGS = -Os -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/m5stack_atom_echo/mpconfigboard.mk b/ports/espressif/boards/m5stack_atom_echo/mpconfigboard.mk index 663ceaad81..63ed093f0a 100644 --- a/ports/espressif/boards/m5stack_atom_echo/mpconfigboard.mk +++ b/ports/espressif/boards/m5stack_atom_echo/mpconfigboard.mk @@ -7,4 +7,4 @@ CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/m5stack_atom_lite/mpconfigboard.mk b/ports/espressif/boards/m5stack_atom_lite/mpconfigboard.mk index 6adf65d2bc..e1ba503b8c 100644 --- a/ports/espressif/boards/m5stack_atom_lite/mpconfigboard.mk +++ b/ports/espressif/boards/m5stack_atom_lite/mpconfigboard.mk @@ -7,4 +7,4 @@ CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/m5stack_atom_matrix/mpconfigboard.mk b/ports/espressif/boards/m5stack_atom_matrix/mpconfigboard.mk index c34fa9d836..ecf9319584 100644 --- a/ports/espressif/boards/m5stack_atom_matrix/mpconfigboard.mk +++ b/ports/espressif/boards/m5stack_atom_matrix/mpconfigboard.mk @@ -7,4 +7,4 @@ CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/m5stack_atom_u/mpconfigboard.mk b/ports/espressif/boards/m5stack_atom_u/mpconfigboard.mk index 18bb6d3dc0..f271671113 100644 --- a/ports/espressif/boards/m5stack_atom_u/mpconfigboard.mk +++ b/ports/espressif/boards/m5stack_atom_u/mpconfigboard.mk @@ -7,4 +7,4 @@ CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/m5stack_core_basic/mpconfigboard.mk b/ports/espressif/boards/m5stack_core_basic/mpconfigboard.mk index 1abf68428c..dedcde81e6 100644 --- a/ports/espressif/boards/m5stack_core_basic/mpconfigboard.mk +++ b/ports/espressif/boards/m5stack_core_basic/mpconfigboard.mk @@ -6,4 +6,4 @@ IDF_TARGET = esp32 CIRCUITPY_ESP_FLASH_MODE = qio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 16MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/m5stack_core_fire/mpconfigboard.mk b/ports/espressif/boards/m5stack_core_fire/mpconfigboard.mk index 7a66a977b1..82e462012c 100644 --- a/ports/espressif/boards/m5stack_core_fire/mpconfigboard.mk +++ b/ports/espressif/boards/m5stack_core_fire/mpconfigboard.mk @@ -6,4 +6,4 @@ IDF_TARGET = esp32 CIRCUITPY_ESP_FLASH_MODE = qio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 16MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/m5stack_stick_c/mpconfigboard.mk b/ports/espressif/boards/m5stack_stick_c/mpconfigboard.mk index b82fb5ef74..5910605915 100644 --- a/ports/espressif/boards/m5stack_stick_c/mpconfigboard.mk +++ b/ports/espressif/boards/m5stack_stick_c/mpconfigboard.mk @@ -6,4 +6,4 @@ IDF_TARGET = esp32 CIRCUITPY_ESP_FLASH_MODE = qio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/maker_badge/mpconfigboard.mk b/ports/espressif/boards/maker_badge/mpconfigboard.mk index 75d713d904..687f91ad60 100644 --- a/ports/espressif/boards/maker_badge/mpconfigboard.mk +++ b/ports/espressif/boards/maker_badge/mpconfigboard.mk @@ -3,7 +3,7 @@ USB_PID = 0x2030 USB_PRODUCT = "Maker badge" USB_MANUFACTURER = "Czech maker" -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 CIRCUITPY_ESP_FLASH_MODE=dio CIRCUITPY_ESP_FLASH_FREQ=40m diff --git a/ports/espressif/boards/mixgo_ce_serial/mpconfigboard.mk b/ports/espressif/boards/mixgo_ce_serial/mpconfigboard.mk index 490675e467..1e4ed0b859 100644 --- a/ports/espressif/boards/mixgo_ce_serial/mpconfigboard.mk +++ b/ports/espressif/boards/mixgo_ce_serial/mpconfigboard.mk @@ -9,9 +9,9 @@ CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Requests FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel FROZEN_MPY_DIRS += $(TOP)/frozen/mixgo_cp_lib/mixgoce_lib -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/mixgo_ce_udisk/mpconfigboard.mk b/ports/espressif/boards/mixgo_ce_udisk/mpconfigboard.mk index 5c6649ce6e..e9cd0c6d4a 100644 --- a/ports/espressif/boards/mixgo_ce_udisk/mpconfigboard.mk +++ b/ports/espressif/boards/mixgo_ce_udisk/mpconfigboard.mk @@ -9,9 +9,9 @@ CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Requests FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel FROZEN_MPY_DIRS += $(TOP)/frozen/mixgo_cp_lib/mixgoce_lib -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/morpheans_morphesp-240/mpconfigboard.mk b/ports/espressif/boards/morpheans_morphesp-240/mpconfigboard.mk index abd2fc12e9..18dd435c53 100644 --- a/ports/espressif/boards/morpheans_morphesp-240/mpconfigboard.mk +++ b/ports/espressif/boards/morpheans_morphesp-240/mpconfigboard.mk @@ -8,4 +8,4 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/muselab_nanoesp32_s2_wroom/mpconfigboard.mk b/ports/espressif/boards/muselab_nanoesp32_s2_wroom/mpconfigboard.mk index f2a622bc08..04fde1e562 100644 --- a/ports/espressif/boards/muselab_nanoesp32_s2_wroom/mpconfigboard.mk +++ b/ports/espressif/boards/muselab_nanoesp32_s2_wroom/mpconfigboard.mk @@ -8,4 +8,4 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/smartbeedesigns_bee_motion_s3/mpconfigboard.mk b/ports/espressif/boards/smartbeedesigns_bee_motion_s3/mpconfigboard.mk index 8a5fab0c1a..7e58f9979d 100644 --- a/ports/espressif/boards/smartbeedesigns_bee_motion_s3/mpconfigboard.mk +++ b/ports/espressif/boards/smartbeedesigns_bee_motion_s3/mpconfigboard.mk @@ -11,4 +11,4 @@ CIRCUITPY_ESP_FLASH_SIZE = 8MB FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/smartbeedesigns_bee_s3/mpconfigboard.mk b/ports/espressif/boards/smartbeedesigns_bee_s3/mpconfigboard.mk index 25a1db15ec..9d0974517d 100644 --- a/ports/espressif/boards/smartbeedesigns_bee_s3/mpconfigboard.mk +++ b/ports/espressif/boards/smartbeedesigns_bee_s3/mpconfigboard.mk @@ -11,4 +11,4 @@ CIRCUITPY_ESP_FLASH_SIZE = 8MB FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/targett_module_clip_wroom/mpconfigboard.mk b/ports/espressif/boards/targett_module_clip_wroom/mpconfigboard.mk index 3163320208..e13c654aa6 100644 --- a/ports/espressif/boards/targett_module_clip_wroom/mpconfigboard.mk +++ b/ports/espressif/boards/targett_module_clip_wroom/mpconfigboard.mk @@ -8,4 +8,4 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/common-hal/esp32_camera/Camera.c b/ports/espressif/common-hal/espcamera/Camera.c similarity index 83% rename from ports/espressif/common-hal/esp32_camera/Camera.c rename to ports/espressif/common-hal/espcamera/Camera.c index 34ad1fbbb9..e3e5ef49f9 100644 --- a/ports/espressif/common-hal/esp32_camera/Camera.c +++ b/ports/espressif/common-hal/espcamera/Camera.c @@ -27,9 +27,9 @@ #include "py/mperrno.h" #include "py/runtime.h" -#include "bindings/esp32_camera/Camera.h" +#include "bindings/espcamera/Camera.h" #include "bindings/espidf/__init__.h" -#include "common-hal/esp32_camera/Camera.h" +#include "common-hal/espcamera/Camera.h" #include "shared-bindings/busio/I2C.h" #include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/util.h" @@ -38,10 +38,10 @@ #include "esp32-camera/driver/private_include/cam_hal.h" #if !CONFIG_SPIRAM -#error esp32_camera only works on boards configured with spiram, disable it in mpconfigboard.mk +#error espcamera only works on boards configured with spiram, disable it in mpconfigboard.mk #endif -static void i2c_lock(esp32_camera_camera_obj_t *self) { +static void i2c_lock(espcamera_camera_obj_t *self) { if (common_hal_busio_i2c_deinited(self->i2c)) { raise_deinited_error(); } @@ -50,7 +50,7 @@ static void i2c_lock(esp32_camera_camera_obj_t *self) { } } -static void i2c_unlock(esp32_camera_camera_obj_t *self) { +static void i2c_unlock(espcamera_camera_obj_t *self) { common_hal_busio_i2c_unlock(self->i2c); } @@ -60,8 +60,8 @@ static void maybe_claim_pin(const mcu_pin_obj_t *pin) { } } -void common_hal_esp32_camera_camera_construct( - esp32_camera_camera_obj_t *self, +void common_hal_espcamera_camera_construct( + espcamera_camera_obj_t *self, uint8_t data_pins[8], const mcu_pin_obj_t *external_clock_pin, const mcu_pin_obj_t *pixel_clock_pin, @@ -79,7 +79,7 @@ void common_hal_esp32_camera_camera_construct( if (common_hal_espidf_get_reserved_psram() == 0) { mp_raise_msg(&mp_type_MemoryError, translate( - "esp32_camera.Camera requires reserved PSRAM to be configured. " + "espcamera.Camera requires reserved PSRAM to be configured. " "See the documentation for instructions.")); } for (int i = 0; i < 8; i++) { @@ -140,8 +140,8 @@ void common_hal_esp32_camera_camera_construct( CHECK_ESP_RESULT(result); } -extern void common_hal_esp32_camera_camera_deinit(esp32_camera_camera_obj_t *self) { - if (common_hal_esp32_camera_camera_deinited(self)) { +extern void common_hal_espcamera_camera_deinit(espcamera_camera_obj_t *self) { + if (common_hal_espcamera_camera_deinited(self)) { return; } @@ -165,15 +165,15 @@ extern void common_hal_esp32_camera_camera_deinit(esp32_camera_camera_obj_t *sel self->camera_config.xclk_freq_hz = 0; } -bool common_hal_esp32_camera_camera_deinited(esp32_camera_camera_obj_t *self) { +bool common_hal_espcamera_camera_deinited(espcamera_camera_obj_t *self) { return !self->camera_config.xclk_freq_hz; } -bool common_hal_esp32_camera_camera_available(esp32_camera_camera_obj_t *self) { +bool common_hal_espcamera_camera_available(espcamera_camera_obj_t *self) { return esp_camera_fb_available(); } -camera_fb_t *common_hal_esp32_camera_camera_take(esp32_camera_camera_obj_t *self, int timeout_ms) { +camera_fb_t *common_hal_espcamera_camera_take(espcamera_camera_obj_t *self, int timeout_ms) { if (self->buffer_to_return) { esp_camera_fb_return(self->buffer_to_return); self->buffer_to_return = NULL; @@ -189,7 +189,7 @@ camera_fb_t *common_hal_esp32_camera_camera_take(esp32_camera_camera_obj_t *self SENSOR_GETSET(type, name, status.status_field_name, setter_function_name) #define SENSOR_GET(type, name, status_field_name, setter_function_name) \ - type common_hal_esp32_camera_camera_get_##name(esp32_camera_camera_obj_t * self) { \ + type common_hal_espcamera_camera_get_##name(espcamera_camera_obj_t * self) { \ i2c_lock(self); \ sensor_t *sensor = esp_camera_sensor_get(); \ i2c_unlock(self); \ @@ -200,7 +200,7 @@ camera_fb_t *common_hal_esp32_camera_camera_take(esp32_camera_camera_obj_t *self } #define SENSOR_SET(type, name, setter_function_name) \ - void common_hal_esp32_camera_camera_set_##name(esp32_camera_camera_obj_t * self, type value) { \ + void common_hal_espcamera_camera_set_##name(espcamera_camera_obj_t * self, type value) { \ i2c_lock(self); \ sensor_t *sensor = esp_camera_sensor_get(); \ i2c_unlock(self); \ @@ -212,15 +212,15 @@ camera_fb_t *common_hal_esp32_camera_camera_take(esp32_camera_camera_obj_t *self } \ } -pixformat_t common_hal_esp32_camera_camera_get_pixel_format(esp32_camera_camera_obj_t *self) { +pixformat_t common_hal_espcamera_camera_get_pixel_format(espcamera_camera_obj_t *self) { return self->camera_config.pixel_format; } -framesize_t common_hal_esp32_camera_camera_get_frame_size(esp32_camera_camera_obj_t *self) { +framesize_t common_hal_espcamera_camera_get_frame_size(espcamera_camera_obj_t *self) { return self->camera_config.frame_size; } -void common_hal_esp32_camera_camera_reconfigure(esp32_camera_camera_obj_t *self, framesize_t frame_size, pixformat_t pixel_format, camera_grab_mode_t grab_mode, mp_int_t framebuffer_count) { +void common_hal_espcamera_camera_reconfigure(espcamera_camera_obj_t *self, framesize_t frame_size, pixformat_t pixel_format, camera_grab_mode_t grab_mode, mp_int_t framebuffer_count) { sensor_t *sensor = esp_camera_sensor_get(); camera_sensor_info_t *sensor_info = esp_camera_sensor_get_info(&sensor->id); @@ -272,46 +272,46 @@ SENSOR_STATUS_GETSET(bool, wpc, wpc, set_wpc); SENSOR_STATUS_GETSET(bool, raw_gma, raw_gma, set_raw_gma); SENSOR_STATUS_GETSET(bool, lenc, lenc, set_lenc); -const char *common_hal_esp32_camera_camera_get_sensor_name(esp32_camera_camera_obj_t *self) { +const char *common_hal_espcamera_camera_get_sensor_name(espcamera_camera_obj_t *self) { sensor_t *sensor = esp_camera_sensor_get(); camera_sensor_info_t *sensor_info = esp_camera_sensor_get_info(&sensor->id); return sensor_info->name; } -const bool common_hal_esp32_camera_camera_get_supports_jpeg(esp32_camera_camera_obj_t *self) { +const bool common_hal_espcamera_camera_get_supports_jpeg(espcamera_camera_obj_t *self) { sensor_t *sensor = esp_camera_sensor_get(); camera_sensor_info_t *sensor_info = esp_camera_sensor_get_info(&sensor->id); return sensor_info->support_jpeg; } -const framesize_t common_hal_esp32_camera_camera_get_max_frame_size(esp32_camera_camera_obj_t *self) { +const framesize_t common_hal_espcamera_camera_get_max_frame_size(espcamera_camera_obj_t *self) { sensor_t *sensor = esp_camera_sensor_get(); camera_sensor_info_t *sensor_info = esp_camera_sensor_get_info(&sensor->id); return sensor_info->max_size; } -const int common_hal_esp32_camera_camera_get_address(esp32_camera_camera_obj_t *self) { +const int common_hal_espcamera_camera_get_address(espcamera_camera_obj_t *self) { sensor_t *sensor = esp_camera_sensor_get(); camera_sensor_info_t *sensor_info = esp_camera_sensor_get_info(&sensor->id); return sensor_info->sccb_addr; } -const int common_hal_esp32_camera_camera_get_width(esp32_camera_camera_obj_t *self) { +const int common_hal_espcamera_camera_get_width(espcamera_camera_obj_t *self) { sensor_t *sensor = esp_camera_sensor_get(); framesize_t framesize = sensor->status.framesize; return resolution[framesize].width; } -const int common_hal_esp32_camera_camera_get_height(esp32_camera_camera_obj_t *self) { +const int common_hal_espcamera_camera_get_height(espcamera_camera_obj_t *self) { sensor_t *sensor = esp_camera_sensor_get(); framesize_t framesize = sensor->status.framesize; return resolution[framesize].height; } -const camera_grab_mode_t common_hal_esp32_camera_camera_get_grab_mode(esp32_camera_camera_obj_t *self) { +const camera_grab_mode_t common_hal_espcamera_camera_get_grab_mode(espcamera_camera_obj_t *self) { return self->camera_config.grab_mode; } -const int common_hal_esp32_camera_camera_get_framebuffer_count(esp32_camera_camera_obj_t *self) { +const int common_hal_espcamera_camera_get_framebuffer_count(espcamera_camera_obj_t *self) { return self->camera_config.fb_count; } diff --git a/ports/espressif/common-hal/esp32_camera/Camera.h b/ports/espressif/common-hal/espcamera/Camera.h similarity index 96% rename from ports/espressif/common-hal/esp32_camera/Camera.h rename to ports/espressif/common-hal/espcamera/Camera.h index 4f34fa54cd..007686a523 100644 --- a/ports/espressif/common-hal/esp32_camera/Camera.h +++ b/ports/espressif/common-hal/espcamera/Camera.h @@ -31,10 +31,10 @@ #include "shared-bindings/pwmio/PWMOut.h" #include "common-hal/busio/I2C.h" -typedef struct esp32_camera_camera_obj { +typedef struct espcamera_camera_obj { mp_obj_base_t base; camera_config_t camera_config; camera_fb_t *buffer_to_return; pwmio_pwmout_obj_t pwm; busio_i2c_obj_t *i2c; -} esp32_camera_obj_t; +} espcamera_obj_t; diff --git a/ports/espressif/mpconfigport.mk b/ports/espressif/mpconfigport.mk index b7b991eb40..460e651705 100644 --- a/ports/espressif/mpconfigport.mk +++ b/ports/espressif/mpconfigport.mk @@ -24,7 +24,7 @@ CIRCUITPY_BLEIO_HCI = 0 CIRCUITPY_CANIO ?= 1 CIRCUITPY_COUNTIO ?= 1 CIRCUITPY_DUALBANK ?= 1 -CIRCUITPY_ESP32_CAMERA ?= 1 +CIRCUITPY_ESPCAMERA ?= 1 CIRCUITPY_ESPIDF ?= 1 CIRCUITPY_ESPULP ?= 1 CIRCUITPY_FRAMEBUFFERIO ?= 1 @@ -55,7 +55,7 @@ else ifeq ($(IDF_TARGET),esp32c3) CIRCUITPY_ALARM = 0 CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_COUNTIO = 0 -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 CIRCUITPY_ESPULP = 0 CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_MEMORYMAP = 0 @@ -81,8 +81,8 @@ CIRCUITPY_DUALBANK = 0 endif # Modules dependent on other modules -CIRCUITPY_GIFIO ?= $(CIRCUITPY_ESP32_CAMERA) -CIRCUITPY_QRIO ?= $(CIRCUITPY_ESP32_CAMERA) +CIRCUITPY_GIFIO ?= $(CIRCUITPY_ESPCAMERA) +CIRCUITPY_QRIO ?= $(CIRCUITPY_ESPCAMERA) # Features dependent on other features ifneq ($(CIRCUITPY_USB),0) diff --git a/ports/espressif/supervisor/port.c b/ports/espressif/supervisor/port.c index 6dd09ed238..b9c9790de4 100644 --- a/ports/espressif/supervisor/port.c +++ b/ports/espressif/supervisor/port.c @@ -78,7 +78,7 @@ #include "shared-bindings/_bleio/__init__.h" #endif -#if CIRCUITPY_ESP32_CAMERA +#if CIRCUITPY_ESPCAMERA #include "esp_camera.h" #endif @@ -341,7 +341,7 @@ safe_mode_t port_init(void) { void reset_port(void) { // TODO deinit for esp32-camera - #if CIRCUITPY_ESP32_CAMERA + #if CIRCUITPY_ESPCAMERA esp_camera_deinit(); #endif diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index 3c1c173a51..d489edf038 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -221,17 +221,16 @@ CFLAGS += -DCIRCUITPY_OS_GETENV=$(CIRCUITPY_OS_GETENV) CIRCUITPY_ERRNO ?= $(CIRCUITPY_FULL_BUILD) CFLAGS += -DCIRCUITPY_ERRNO=$(CIRCUITPY_ERRNO) -# CIRCUITPY_ESPIDF and CIRCUITPY_ESPULP is handled in the espressif tree. -# Only for ESP32S chips. -# Assume not a ESP build. +# Espressif specific modules. +# Assume not an Espressif build. CIRCUITPY_ESPIDF ?= 0 CFLAGS += -DCIRCUITPY_ESPIDF=$(CIRCUITPY_ESPIDF) CIRCUITPY_ESPULP ?= 0 CFLAGS += -DCIRCUITPY_ESPULP=$(CIRCUITPY_ESPULP) -CIRCUITPY_ESP32_CAMERA ?= 0 -CFLAGS += -DCIRCUITPY_ESP32_CAMERA=$(CIRCUITPY_ESP32_CAMERA) +CIRCUITPY_ESPCAMERA ?= 0 +CFLAGS += -DCIRCUITPY_ESPCAMERA=$(CIRCUITPY_ESPCAMERA) CIRCUITPY__EVE ?= 0 CFLAGS += -DCIRCUITPY__EVE=$(CIRCUITPY__EVE) diff --git a/shared-bindings/imagecapture/__init__.c b/shared-bindings/imagecapture/__init__.c index fdd4424114..71d0b9125b 100644 --- a/shared-bindings/imagecapture/__init__.c +++ b/shared-bindings/imagecapture/__init__.c @@ -35,7 +35,7 @@ //| //| .. seealso:: //| -//| Espressif microcontrollers use the `esp32_camera` module together. +//| Espressif microcontrollers use the `espcamera` module together. //| //| """ STATIC const mp_rom_map_elem_t imagecapture_module_globals_table[] = { From ab0cbb5a041506e4a7eeb566ff3ad7a2d62716ad Mon Sep 17 00:00:00 2001 From: Alec Delaney <89490472+tekktrik@users.noreply.github.com> Date: Fri, 27 Jan 2023 13:56:35 -0500 Subject: [PATCH 11/52] Update notification workflow --- .github/workflows/notify.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/notify.yml b/.github/workflows/notify.yml index 4cfb22298f..da1ac0a18e 100644 --- a/.github/workflows/notify.yml +++ b/.github/workflows/notify.yml @@ -7,8 +7,12 @@ on: jobs: notify: runs-on: ubuntu-latest + permissions: + issues: write steps: - - uses: jenschelkopf/issue-label-notification-action@1.3 + - uses: tekktrik/issue-labeled-ping@v1 with: - recipients: | - ulab=@v923z + github-token: ${{ secrets.GITHUB_TOKEN }} + user: v923z + label: ulab + message: Heads up {user} - the "{label}" label was applied to this issue. From aaa9ac4aff34753b7527b97e9030e0c9f04a19dc Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Sat, 28 Jan 2023 00:59:07 +0100 Subject: [PATCH 12/52] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 9 +++++---- locale/cs.po | 9 +++++---- locale/de_DE.po | 18 ++++++++++++------ locale/el.po | 9 +++++---- locale/en_GB.po | 9 +++++---- locale/es.po | 18 ++++++++++++------ locale/fil.po | 9 +++++---- locale/fr.po | 18 ++++++++++++------ locale/hi.po | 9 +++++---- locale/it_IT.po | 9 +++++---- locale/ja.po | 9 +++++---- locale/ko.po | 9 +++++---- locale/nl.po | 9 +++++---- locale/pl.po | 9 +++++---- locale/pt_BR.po | 18 ++++++++++++------ locale/ru.po | 9 +++++---- locale/sv.po | 18 ++++++++++++------ locale/tr.po | 9 +++++---- locale/zh_Latn_pinyin.po | 21 ++++++++++++++------- 19 files changed, 139 insertions(+), 89 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 962284a846..088df0b059 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -671,6 +671,7 @@ msgstr "Pin bus %d sudah digunakan" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h msgid "Button A was pressed at start up.\n" msgstr "" @@ -2978,9 +2979,9 @@ msgstr "" msgid "error = 0x%08lX" msgstr "error = 0x%08lX" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" @@ -3357,7 +3358,7 @@ msgstr "key tidak valid" msgid "invalid micropython decorator" msgstr "micropython decorator tidak valid" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "" @@ -3614,7 +3615,7 @@ msgstr "" msgid "no response from SD card" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c +#: ports/espressif/common-hal/espcamera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "" diff --git a/locale/cs.po b/locale/cs.po index 4b49cbe531..2f7c53ee13 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -672,6 +672,7 @@ msgstr "Sběrnicový pin %d je již používán" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h msgid "Button A was pressed at start up.\n" msgstr "" @@ -2965,9 +2966,9 @@ msgstr "" msgid "error = 0x%08lX" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" @@ -3344,7 +3345,7 @@ msgstr "" msgid "invalid micropython decorator" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "" @@ -3601,7 +3602,7 @@ msgstr "" msgid "no response from SD card" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c +#: ports/espressif/common-hal/espcamera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index 1a3bdbca56..0dde7441cc 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -675,6 +675,7 @@ msgstr "Bus-Pin %d wird schon benutzt" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h msgid "Button A was pressed at start up.\n" msgstr "Beim Starten wurde Taste A gedrückt.\n" @@ -3035,13 +3036,11 @@ msgstr "epoch_time wird auf diesem Board nicht unterstützt" msgid "error = 0x%08lX" msgstr "Fehler = 0x%08lX" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" -"esp32_camera.Camera benötigt reservierten PSRAM um konfiguriert werden zu " -"können. Sieh in der Dokumentation für eine Anleitung nach." #: py/runtime.c msgid "exceptions must derive from BaseException" @@ -3418,7 +3417,7 @@ msgstr "ungültiger Schlüssel" msgid "invalid micropython decorator" msgstr "ungültiger micropython decorator" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "Invalide Einstellung" @@ -3681,7 +3680,7 @@ msgstr "kein Reset Pin verfügbar" msgid "no response from SD card" msgstr "keine Antwort von der SD-Karte" -#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c +#: ports/espressif/common-hal/espcamera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "kein solches Attribut" @@ -4431,6 +4430,13 @@ msgstr "zi muss eine Gleitkommazahl sein" msgid "zi must be of shape (n_section, 2)" msgstr "zi muss die Form (n_section, 2) haben" +#~ msgid "" +#~ "esp32_camera.Camera requires reserved PSRAM to be configured. See the " +#~ "documentation for instructions." +#~ msgstr "" +#~ "esp32_camera.Camera benötigt reservierten PSRAM um konfiguriert werden zu " +#~ "können. Sieh in der Dokumentation für eine Anleitung nach." + #~ msgid "%q must be of type %q" #~ msgstr "%q muss vom Type %q sein" diff --git a/locale/el.po b/locale/el.po index f48b8e08db..0077b44c2e 100644 --- a/locale/el.po +++ b/locale/el.po @@ -678,6 +678,7 @@ msgstr "Bus pin %d είναι ήδη σε χρήση" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h msgid "Button A was pressed at start up.\n" msgstr "" @@ -2974,9 +2975,9 @@ msgstr "" msgid "error = 0x%08lX" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" @@ -3353,7 +3354,7 @@ msgstr "" msgid "invalid micropython decorator" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "" @@ -3610,7 +3611,7 @@ msgstr "" msgid "no response from SD card" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c +#: ports/espressif/common-hal/espcamera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "" diff --git a/locale/en_GB.po b/locale/en_GB.po index dee3f6f4c3..03af36dbaa 100644 --- a/locale/en_GB.po +++ b/locale/en_GB.po @@ -675,6 +675,7 @@ msgstr "Bus pin %d is already in use" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h msgid "Button A was pressed at start up.\n" msgstr "" @@ -2984,9 +2985,9 @@ msgstr "epoch_time not supported on this board" msgid "error = 0x%08lX" msgstr "error = 0x%08lX" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" @@ -3363,7 +3364,7 @@ msgstr "invalid key" msgid "invalid micropython decorator" msgstr "invalid micropython decorator" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "" @@ -3620,7 +3621,7 @@ msgstr "no reset pin available" msgid "no response from SD card" msgstr "no response from SD card" -#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c +#: ports/espressif/common-hal/espcamera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "no such attribute" diff --git a/locale/es.po b/locale/es.po index 613d957812..f68a30a125 100644 --- a/locale/es.po +++ b/locale/es.po @@ -680,6 +680,7 @@ msgstr "Bus pin %d ya está siendo utilizado" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h msgid "Button A was pressed at start up.\n" msgstr "Botón A fue presionado al inicio.\n" @@ -3038,13 +3039,11 @@ msgstr "epoch_time no esta soportado en esta tarjeta" msgid "error = 0x%08lX" msgstr "error = 0x%08lX" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" -"esp32_camera. la camara necesita PSRAM reservada para ser configurada. Vea " -"la documentacion para mas instrucciones." #: py/runtime.c msgid "exceptions must derive from BaseException" @@ -3419,7 +3418,7 @@ msgstr "llave inválida" msgid "invalid micropython decorator" msgstr "decorador de micropython inválido" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "configuracion invalida" @@ -3680,7 +3679,7 @@ msgstr "no hay pin de reinicio disponible" msgid "no response from SD card" msgstr "no hay respuesta de la tarjeta SD" -#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c +#: ports/espressif/common-hal/espcamera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "no hay tal atributo" @@ -4427,6 +4426,13 @@ msgstr "zi debe ser de tipo flotante" msgid "zi must be of shape (n_section, 2)" msgstr "zi debe ser una forma (n_section,2)" +#~ msgid "" +#~ "esp32_camera.Camera requires reserved PSRAM to be configured. See the " +#~ "documentation for instructions." +#~ msgstr "" +#~ "esp32_camera. la camara necesita PSRAM reservada para ser configurada. " +#~ "Vea la documentacion para mas instrucciones." + #~ msgid "%q must be of type %q" #~ msgstr "%q debe ser de typo %q" diff --git a/locale/fil.po b/locale/fil.po index e44a5a5acd..4c203ecbba 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -668,6 +668,7 @@ msgstr "Ginagamit na ang DAC" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h msgid "Button A was pressed at start up.\n" msgstr "" @@ -2976,9 +2977,9 @@ msgstr "" msgid "error = 0x%08lX" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" @@ -3356,7 +3357,7 @@ msgstr "mali ang key" msgid "invalid micropython decorator" msgstr "mali ang micropython decorator" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "" @@ -3617,7 +3618,7 @@ msgstr "" msgid "no response from SD card" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c +#: ports/espressif/common-hal/espcamera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "walang ganoon na attribute" diff --git a/locale/fr.po b/locale/fr.po index 6eb2e23cf7..6a0e5ac876 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -681,6 +681,7 @@ msgstr "La broche %d du bus est déjà utilisée" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h msgid "Button A was pressed at start up.\n" msgstr "Le bouton A était pressé au démarrage.\n" @@ -3062,13 +3063,11 @@ msgstr "epoch_time n'est pas supporté sur ce panneau" msgid "error = 0x%08lX" msgstr "erreur = 0x%08lX" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" -"esp32_camera.Camera nécessite la configuration de PSRAM réservée. Se référer " -"à la documentation." #: py/runtime.c msgid "exceptions must derive from BaseException" @@ -3445,7 +3444,7 @@ msgstr "clé invalide" msgid "invalid micropython decorator" msgstr "décorateur micropython invalide" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "réglage invalide" @@ -3707,7 +3706,7 @@ msgstr "pas de broche de réinitialisation disponible" msgid "no response from SD card" msgstr "pas de réponse de la carte SD" -#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c +#: ports/espressif/common-hal/espcamera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "pas de tel attribut" @@ -4456,6 +4455,13 @@ msgstr "zi doit être de type float" msgid "zi must be of shape (n_section, 2)" msgstr "zi doit être de forme (n_section, 2)" +#~ msgid "" +#~ "esp32_camera.Camera requires reserved PSRAM to be configured. See the " +#~ "documentation for instructions." +#~ msgstr "" +#~ "esp32_camera.Camera nécessite la configuration de PSRAM réservée. Se " +#~ "référer à la documentation." + #~ msgid "%q must be of type %q" #~ msgstr "%q doit être du type %q" diff --git a/locale/hi.po b/locale/hi.po index 79177b1701..81903ac5a7 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -663,6 +663,7 @@ msgstr "" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h msgid "Button A was pressed at start up.\n" msgstr "" @@ -2947,9 +2948,9 @@ msgstr "" msgid "error = 0x%08lX" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" @@ -3326,7 +3327,7 @@ msgstr "" msgid "invalid micropython decorator" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "" @@ -3583,7 +3584,7 @@ msgstr "" msgid "no response from SD card" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c +#: ports/espressif/common-hal/espcamera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index 9e7fbfce01..50a754422d 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -675,6 +675,7 @@ msgstr "Bus pin %d è già in uso" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h msgid "Button A was pressed at start up.\n" msgstr "" @@ -2984,9 +2985,9 @@ msgstr "" msgid "error = 0x%08lX" msgstr "errore = 0x%08lX" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" @@ -3364,7 +3365,7 @@ msgstr "chiave non valida" msgid "invalid micropython decorator" msgstr "decoratore non valido in micropython" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "" @@ -3626,7 +3627,7 @@ msgstr "" msgid "no response from SD card" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c +#: ports/espressif/common-hal/espcamera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "attributo inesistente" diff --git a/locale/ja.po b/locale/ja.po index 0c8387fe73..5ead67824f 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -675,6 +675,7 @@ msgstr "Busピン%dはすでに使用中" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h msgid "Button A was pressed at start up.\n" msgstr "" @@ -2971,9 +2972,9 @@ msgstr "" msgid "error = 0x%08lX" msgstr "error = 0x1%08lX" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" @@ -3351,7 +3352,7 @@ msgstr "不正な鍵" msgid "invalid micropython decorator" msgstr "不正なmicropythonデコレータ" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "" @@ -3608,7 +3609,7 @@ msgstr "利用可能なリセットピンがありません" msgid "no response from SD card" msgstr "SDカードからの応答がありません" -#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c +#: ports/espressif/common-hal/espcamera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "指定の属性はありません" diff --git a/locale/ko.po b/locale/ko.po index 59cc20b1e1..078d04dfc8 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -666,6 +666,7 @@ msgstr "" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h msgid "Button A was pressed at start up.\n" msgstr "" @@ -2951,9 +2952,9 @@ msgstr "" msgid "error = 0x%08lX" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" @@ -3330,7 +3331,7 @@ msgstr "키가 유효하지 않습니다" msgid "invalid micropython decorator" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "" @@ -3587,7 +3588,7 @@ msgstr "" msgid "no response from SD card" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c +#: ports/espressif/common-hal/espcamera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index b8310d5ced..1b360e50b7 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -668,6 +668,7 @@ msgstr "Bus pin %d al in gebruik" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h msgid "Button A was pressed at start up.\n" msgstr "" @@ -2980,9 +2981,9 @@ msgstr "epoch_time niet ondersteund op dit bord" msgid "error = 0x%08lX" msgstr "fout = 0x%08lX" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" @@ -3360,7 +3361,7 @@ msgstr "ongeldige sleutel" msgid "invalid micropython decorator" msgstr "ongeldige micropython decorator" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "" @@ -3620,7 +3621,7 @@ msgstr "geen reset pin beschikbaar" msgid "no response from SD card" msgstr "geen antwoord van SD kaart" -#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c +#: ports/espressif/common-hal/espcamera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "niet zo'n attribuut" diff --git a/locale/pl.po b/locale/pl.po index ac54e220ad..66d1699919 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -670,6 +670,7 @@ msgstr "Nóżka magistrali %d jest w użyciu" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h msgid "Button A was pressed at start up.\n" msgstr "" @@ -2959,9 +2960,9 @@ msgstr "" msgid "error = 0x%08lX" msgstr "błąd = 0x%08lX" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" @@ -3338,7 +3339,7 @@ msgstr "zły klucz" msgid "invalid micropython decorator" msgstr "zły dekorator micropythona" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "" @@ -3595,7 +3596,7 @@ msgstr "" msgid "no response from SD card" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c +#: ports/espressif/common-hal/espcamera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "nie ma takiego atrybutu" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 2bddd54617..1a31baac8a 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -683,6 +683,7 @@ msgstr "O pino bus %d já está em uso" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h msgid "Button A was pressed at start up.\n" msgstr "O botão A foi pressionado na inicialização.\n" @@ -3039,13 +3040,11 @@ msgstr "O epoch_time não é compatível com esta placa" msgid "error = 0x%08lX" msgstr "erro = 0x%08lX" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" -"esp32_camera.Camera requer que uma reserva PSRAM seja configurada. Consulte " -"a documentação para obter mais informações." #: py/runtime.c msgid "exceptions must derive from BaseException" @@ -3421,7 +3420,7 @@ msgstr "chave inválida" msgid "invalid micropython decorator" msgstr "o decorador micropython é inválido" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "configuração inválida" @@ -3683,7 +3682,7 @@ msgstr "nenhum pino de redefinição está disponível" msgid "no response from SD card" msgstr "não houve resposta do cartão SD" -#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c +#: ports/espressif/common-hal/espcamera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "não há tal atributo" @@ -4431,6 +4430,13 @@ msgstr "zi deve ser de um tipo float" msgid "zi must be of shape (n_section, 2)" msgstr "zi deve estar na forma (n_section, 2)" +#~ msgid "" +#~ "esp32_camera.Camera requires reserved PSRAM to be configured. See the " +#~ "documentation for instructions." +#~ msgstr "" +#~ "esp32_camera.Camera requer que uma reserva PSRAM seja configurada. " +#~ "Consulte a documentação para obter mais informações." + #~ msgid "%q must be of type %q" #~ msgstr "%q deve ser do tipo %q" diff --git a/locale/ru.po b/locale/ru.po index 86b977f6f3..b272bc295d 100644 --- a/locale/ru.po +++ b/locale/ru.po @@ -680,6 +680,7 @@ msgstr "Пин шины %d уже используется" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h msgid "Button A was pressed at start up.\n" msgstr "Кнопка A была нажата при загрузке\n" @@ -3015,9 +3016,9 @@ msgstr "" msgid "error = 0x%08lX" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" @@ -3394,7 +3395,7 @@ msgstr "" msgid "invalid micropython decorator" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "" @@ -3651,7 +3652,7 @@ msgstr "нет доступного контакта сброса" msgid "no response from SD card" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c +#: ports/espressif/common-hal/espcamera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "" diff --git a/locale/sv.po b/locale/sv.po index 132b296fb9..b29d242fbe 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -675,6 +675,7 @@ msgstr "Busspinne %d används redan" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h msgid "Button A was pressed at start up.\n" msgstr "Knapp A trycktes ned vid start.\n" @@ -3008,13 +3009,11 @@ msgstr "epoch_time stöds inte av detta kort" msgid "error = 0x%08lX" msgstr "fel = 0x%08lX" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" -"esp32_camera.Camera kräver reserverad PSRAM att konfigureras. Se " -"dokumentationen för instruktioner." #: py/runtime.c msgid "exceptions must derive from BaseException" @@ -3389,7 +3388,7 @@ msgstr "ogiltig nyckel" msgid "invalid micropython decorator" msgstr "ogiltig mikropython-dekorator" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "ogiltig inställning" @@ -3649,7 +3648,7 @@ msgstr "ingen reset-pinne tillgänglig" msgid "no response from SD card" msgstr "inget svar från SD-kort" -#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c +#: ports/espressif/common-hal/espcamera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "inget sådant attribut" @@ -4393,6 +4392,13 @@ msgstr "zi måste vara av typ float" msgid "zi must be of shape (n_section, 2)" msgstr "zi måste vara i formen (n_section, 2)" +#~ msgid "" +#~ "esp32_camera.Camera requires reserved PSRAM to be configured. See the " +#~ "documentation for instructions." +#~ msgstr "" +#~ "esp32_camera.Camera kräver reserverad PSRAM att konfigureras. Se " +#~ "dokumentationen för instruktioner." + #~ msgid "%q must be of type %q" #~ msgstr "%q måste vara av typen %q" diff --git a/locale/tr.po b/locale/tr.po index 5a8f259dac..14e378bf61 100644 --- a/locale/tr.po +++ b/locale/tr.po @@ -678,6 +678,7 @@ msgstr "Veriyolu pini %d kullanımda" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h msgid "Button A was pressed at start up.\n" msgstr "Başlatma sırasında A düğmesine basıldı.\n" @@ -2973,9 +2974,9 @@ msgstr "" msgid "error = 0x%08lX" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" @@ -3352,7 +3353,7 @@ msgstr "" msgid "invalid micropython decorator" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "" @@ -3609,7 +3610,7 @@ msgstr "" msgid "no response from SD card" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c +#: ports/espressif/common-hal/espcamera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index dde7f576ba..80270fb391 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -677,6 +677,7 @@ msgstr "Zǒngxiàn yǐnjiǎo %d yǐjīng zài shǐyòng zhōng" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h msgid "Button A was pressed at start up.\n" msgstr "qǐ dòng shí àn xià àn niǔ A.\n" @@ -924,7 +925,8 @@ msgstr "Fāngxiàng shūrù shí qūdòng móshì méiyǒu shǐyòng." #: py/obj.c msgid "During handling of the above exception, another exception occurred:" -msgstr "zài chǔ lǐ shàng shù yì cháng qī jiān, fā shēng le lìng yí gè yì cháng:" +msgstr "" +"zài chǔ lǐ shàng shù yì cháng qī jiān, fā shēng le lìng yí gè yì cháng:" #: shared-bindings/aesio/aes.c msgid "ECB only operates on 16 bytes at a time" @@ -3014,13 +3016,11 @@ msgstr "epoch_time bǎn bù zhī chí cǐ bǎn běn" msgid "error = 0x%08lX" msgstr "cuòwù = 0x%08lX" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" -"esp32_camera. shè xiàng jī xū yào pèi zhì yù liú de PSRAM. yǒu guān shuō " -"míng, qǐng cān yuè wén dàng." #: py/runtime.c msgid "exceptions must derive from BaseException" @@ -3395,7 +3395,7 @@ msgstr "wúxiào de mì yào" msgid "invalid micropython decorator" msgstr "wúxiào de MicroPython zhuāngshì qì" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "shèzhì wúxiào" @@ -3653,7 +3653,7 @@ msgstr "Méiyǒu kěyòng de fùwèi yǐn jiǎo" msgid "no response from SD card" msgstr "SD kǎ wú huíyīng" -#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c +#: ports/espressif/common-hal/espcamera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "méiyǒu cǐ shǔxìng" @@ -4399,6 +4399,13 @@ msgstr "zi bìxū wèi fú diǎn xíng" msgid "zi must be of shape (n_section, 2)" msgstr "zi bìxū jùyǒu xíngzhuàng (n_section,2)" +#~ msgid "" +#~ "esp32_camera.Camera requires reserved PSRAM to be configured. See the " +#~ "documentation for instructions." +#~ msgstr "" +#~ "esp32_camera. shè xiàng jī xū yào pèi zhì yù liú de PSRAM. yǒu guān shuō " +#~ "míng, qǐng cān yuè wén dàng." + #~ msgid "%q must be of type %q" #~ msgstr "%q bì xū shì %q lèi xíng" From 401d160c5808ff899496fa45788b3f375471849a Mon Sep 17 00:00:00 2001 From: MicroDev <70126934+MicroDev1@users.noreply.github.com> Date: Sat, 28 Jan 2023 11:03:59 +0530 Subject: [PATCH 13/52] opi flash needs to be flashed in dout --- .../boards/espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.mk index 96ef4e45c9..78423955bb 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.mk @@ -5,6 +5,6 @@ USB_MANUFACTURER = "Espressif" IDF_TARGET = esp32s3 -CIRCUITPY_ESP_FLASH_MODE=qio +CIRCUITPY_ESP_FLASH_MODE=dout CIRCUITPY_ESP_FLASH_FREQ=80m CIRCUITPY_ESP_FLASH_SIZE=32MB From fc0bd6b7eb23191ff68f37e86883febade7465a2 Mon Sep 17 00:00:00 2001 From: MicroDev <70126934+MicroDev1@users.noreply.github.com> Date: Sat, 28 Jan 2023 15:30:04 +0530 Subject: [PATCH 14/52] use composite action for fetching submodules --- .github/actions/fetch_submodules/action.yml | 82 +++++++++++++ .github/workflows/build.yml | 125 +++++--------------- .github/workflows/create_website_pr.yml | 17 +-- .github/workflows/ports_windows.yml | 30 +---- 4 files changed, 119 insertions(+), 135 deletions(-) create mode 100644 .github/actions/fetch_submodules/action.yml diff --git a/.github/actions/fetch_submodules/action.yml b/.github/actions/fetch_submodules/action.yml new file mode 100644 index 0000000000..407259967c --- /dev/null +++ b/.github/actions/fetch_submodules/action.yml @@ -0,0 +1,82 @@ +name: 'Fetch Submodules' + +inputs: + submodules: + description: 'The submodules to cache' + required: false + default: '["extmod/ulab", "lib/", "tools/"]' + type: string + + cache: + description: 'The cache action to use' + required: false + default: 'restore' + type: choice + options: + - cache + - restore + + version: + description: 'Whether to generate CP version' + required: false + default: false + type: boolean + +outputs: + frozen: + description: 'Whether frozen submodules were fetched' + value: ${{ steps.cp-deps.outputs.frozen_tags }} + + version: + description: 'The CP version' + value: ${{ steps.cp-version.outputs.cp-version }} + +runs: + using: "composite" + steps: + - name: Create submodule status + id: create-submodule-status + run: | + git submodule status ${{ join(fromJSON(inputs.submodules), ' ') }} >> submodule_status + echo $(cut -d ' ' -f 2 submodule_status) | echo "submodules=[\"$(sed "s/ /\", \"/g")\"]" >> $GITHUB_OUTPUT + shell: bash + + - name: Cache submodules + if: ${{ inputs.cache == 'cache' }} + uses: actions/cache@v3 + with: + path: ".git/modules/\n${{ join(fromJSON(steps.create-submodule-status.outputs.submodules), '\n') }}" + key: submodules-common-${{ hashFiles('submodule_status') }} + enableCrossOsArchive: true + + - name: Restore submodules + if: ${{ inputs.cache == 'restore' }} + uses: actions/cache/restore@v3 + with: + path: ".git/modules/\n${{ join(fromJSON(steps.create-submodule-status.outputs.submodules), '\n') }}" + key: submodules-common-${{ hashFiles('submodule_status') }} + enableCrossOsArchive: true + + - name: Remove submodule status + run: rm submodule_status + shell: bash + + - name: CircuitPython dependencies + id: cp-deps + run: python tools/ci_fetch_deps.py ${{ matrix.board || github.job }} + shell: bash + + - name: CircuitPython version + id: cp-version + if: ${{ inputs.version == 'true' }} + run: | + echo "::group::Fetch history and tags" + git fetch --no-recurse-submodules --shallow-since="2021-07-01" --tags https://github.com/adafruit/circuitpython HEAD + git fetch --no-recurse-submodules --shallow-since="2021-07-01" origin $GITHUB_SHA + git repack -d + echo "::endgroup::" + CP_VERSION=$(tools/describe) + echo "$CP_VERSION" + echo "CP_VERSION=$CP_VERSION" >> $GITHUB_ENV + echo "cp-version=$CP_VERSION" >> $GITHUB_OUTPUT + shell: bash diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 44309b87f6..f7d57041e6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,9 +16,6 @@ concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true -env: - CACHE_SUBMODULES: "['extmod/ulab', 'lib/', 'tools/']" - jobs: test: runs-on: ubuntu-20.04 @@ -28,7 +25,7 @@ jobs: boards-arm: ${{ steps.set-matrix.outputs.boards-arm }} boards-espressif: ${{ steps.set-matrix.outputs.boards-espressif }} boards-riscv: ${{ steps.set-matrix.outputs.boards-riscv }} - cp-version: ${{ steps.cp-version.outputs.cp-version }} + cp-version: ${{ steps.set-up-submodules.outputs.version }} steps: - name: Dump GitHub context run: echo "$GITHUB_CONTEXT" @@ -45,28 +42,12 @@ jobs: python-version: "3.x" - name: Duplicate USB VID/PID check run: python3 -u -m tools.ci_check_duplicate_usb_vid_pid - - name: Create submodule status - run: git submodule status ${{ join(fromJSON(env.CACHE_SUBMODULES), ' ') }} >> submodule_status - - name: Cache submodules - uses: actions/cache@v3 + - name: Set up submodules + id: set-up-submodules + uses: ./.github/actions/fetch_submodules with: - path: ".git/modules/\n${{ join(fromJSON(env.CACHE_SUBMODULES), '\n') }}" - key: submodules-common-${{ hashFiles('submodule_status') }} - - name: CircuitPython dependencies - run: | - python tools/ci_fetch_deps.py ${{ github.job }} - echo "::group::Fetch history and tags" - git fetch --no-recurse-submodules --shallow-since="2021-07-01" --tags https://github.com/adafruit/circuitpython HEAD - git fetch --no-recurse-submodules --shallow-since="2021-07-01" origin $GITHUB_SHA - git repack -d - echo "::endgroup::" - - name: CircuitPython version - id: cp-version - run: | - CP_VERSION=$(tools/describe) - echo "$CP_VERSION" - echo "CP_VERSION=$CP_VERSION" >> $GITHUB_ENV - echo "cp-version=$CP_VERSION" >> $GITHUB_OUTPUT + cache: "cache" + version: true - name: Install dependencies run: | sudo apt-get update @@ -202,17 +183,8 @@ jobs: uses: actions/setup-python@v4 with: python-version: "3.x" - - name: Create submodule status - run: git submodule status ${{ join(fromJSON(env.CACHE_SUBMODULES), ' ') }} >> submodule_status - - name: Restore submodules - uses: actions/cache/restore@v3 - with: - path: ".git/modules/\n${{ join(fromJSON(env.CACHE_SUBMODULES), '\n') }}" - key: submodules-common-${{ hashFiles('submodule_status') }} - - name: CircuitPython dependencies - run: python tools/ci_fetch_deps.py ${{ github.job }} - - name: CircuitPython version - run: tools/describe + - name: Set up submodules + uses: ./.github/actions/fetch_submodules - name: Versions run: | gcc --version @@ -260,21 +232,12 @@ jobs: with: submodules: false fetch-depth: 1 - - name: Create submodule status - run: git submodule status ${{ join(fromJSON(env.CACHE_SUBMODULES), ' ') }} >> submodule_status - - name: Restore submodules - uses: actions/cache/restore@v3 - with: - path: ".git/modules/\n${{ join(fromJSON(env.CACHE_SUBMODULES), '\n') }}" - key: submodules-common-${{ hashFiles('submodule_status') }} - - name: CircuitPython dependencies - run: python tools/ci_fetch_deps.py ${{ github.job }} - - name: CircuitPython version - run: tools/describe - name: Set up python uses: actions/setup-python@v4 with: python-version: "3.x" + - name: Set up submodules + uses: ./.github/actions/fetch_submodules - name: Install dependencies run: | sudo apt-get update @@ -343,16 +306,9 @@ jobs: uses: actions/setup-python@v4 with: python-version: "3.x" - - name: Create submodule status - run: git submodule status ${{ join(fromJSON(env.CACHE_SUBMODULES), ' ') }} >> submodule_status - - name: Restore submodules - uses: actions/cache/restore@v3 - with: - path: ".git/modules/\n${{ join(fromJSON(env.CACHE_SUBMODULES), '\n') }}" - key: submodules-common-${{ hashFiles('submodule_status') }} - - name: CircuitPython dependencies - id: cp-deps - run: python tools/ci_fetch_deps.py ${{ matrix.board }} + - name: Set up submodules + id: set-up-submodules + uses: ./.github/actions/fetch_submodules - name: Install dependencies run: | sudo apt-get install -y gettext mtools @@ -379,7 +335,7 @@ jobs: python3 --version mkfs.fat --version || true - name: Build mpy-cross - if: ${{ steps.cp-deps.outputs.frozen_tags == 'True' }} + if: ${{ steps.set-up-submodules.outputs.frozen == 'True' }} run: make -C mpy-cross -j2 - name: Setup build failure matcher run: echo "::add-matcher::$GITHUB_WORKSPACE/.github/workflows/match-build-fail.json" @@ -425,16 +381,9 @@ jobs: uses: actions/setup-python@v4 with: python-version: "3.x" - - name: Create submodule status - run: git submodule status ${{ join(fromJSON(env.CACHE_SUBMODULES), ' ') }} >> submodule_status - - name: Restore submodules - uses: actions/cache/restore@v3 - with: - path: ".git/modules/\n${{ join(fromJSON(env.CACHE_SUBMODULES), '\n') }}" - key: submodules-common-${{ hashFiles('submodule_status') }} - - name: CircuitPython dependencies - id: cp-deps - run: python tools/ci_fetch_deps.py ${{ matrix.board }} + - name: Set up submodules + id: set-up-submodules + uses: ./.github/actions/fetch_submodules - uses: carlosperate/arm-none-eabi-gcc-action@v1 with: release: '10-2020-q4' @@ -448,7 +397,7 @@ jobs: arm-none-eabi-gcc --version python3 --version - name: Build mpy-cross - if: ${{ steps.cp-deps.outputs.frozen_tags == 'True' }} + if: ${{ steps.set-up-submodules.outputs.frozen == 'True' }} run: make -C mpy-cross -j2 - name: Setup build failure matcher run: echo "::add-matcher::$GITHUB_WORKSPACE/.github/workflows/match-build-fail.json" @@ -474,7 +423,6 @@ jobs: AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - build-espressif: runs-on: ubuntu-22.04 needs: test @@ -498,13 +446,6 @@ jobs: uses: actions/setup-python@v4 with: python-version: "3.10" - - name: Create submodule status - run: git submodule status ${{ join(fromJSON(env.CACHE_SUBMODULES), ' ') }} >> submodule_status - - name: Restore submodules - uses: actions/cache/restore@v3 - with: - path: ".git/modules/\n${{ join(fromJSON(env.CACHE_SUBMODULES), '\n') }}" - key: submodules-common-${{ hashFiles('submodule_status') }} - name: Get IDF commit id: idf-commit run: | @@ -518,19 +459,13 @@ jobs: .git/modules/ports/espressif/esp-idf ports/espressif/esp-idf key: submodules-idf-${{ steps.idf-commit.outputs.commit }} - - name: CircuitPython dependencies - id: cp-deps - run: python tools/ci_fetch_deps.py ${{ matrix.board }} - - name: CircuitPython version - run: tools/describe - name: Cache IDF tools uses: actions/cache@v3 with: path: ${{ env.IDF_TOOLS_PATH }} key: ${{ runner.os }}-Python-${{ steps.setup-python.outputs.python-version }}-tools-idf-${{ steps.idf-commit.outputs.commit }} - - name: Clone IDF submodules - run: git submodule update --init --depth=1 - working-directory: ${{ env.IDF_PATH }} + - name: Initialize IDF submodules + run: git submodule update --init --depth=1 --recursive $IDF_PATH - name: Install IDF tools run: | echo "Installing ESP-IDF tools" @@ -539,6 +474,9 @@ jobs: echo "Installing Python environment and packages" $IDF_PATH/tools/idf_tools.py --non-interactive install-python-env rm -rf $IDF_TOOLS_PATH/dist + - name: Set up submodules + id: set-up-submodules + uses: ./.github/actions/fetch_submodules - name: Install dependencies run: | source $IDF_PATH/export.sh @@ -552,7 +490,7 @@ jobs: ninja --version cmake --version - name: Build mpy-cross - if: ${{ steps.cp-deps.outputs.frozen_tags == 'True' }} + if: ${{ steps.set-up-submodules.outputs.frozen == 'True' }} run: make -C mpy-cross -j2 - name: Setup build failure matcher run: echo "::add-matcher::$GITHUB_WORKSPACE/.github/workflows/match-build-fail.json" @@ -600,16 +538,9 @@ jobs: uses: actions/setup-python@v4 with: python-version: "3.x" - - name: Create submodule status - run: git submodule status ${{ join(fromJSON(env.CACHE_SUBMODULES), ' ') }} >> submodule_status - - name: Restore submodules - uses: actions/cache/restore@v3 - with: - path: ".git/modules/\n${{ join(fromJSON(env.CACHE_SUBMODULES), '\n') }}" - key: submodules-common-${{ hashFiles('submodule_status') }} - - name: CircuitPython dependencies - id: cp-deps - run: python tools/ci_fetch_deps.py ${{ matrix.board }} + - name: Set up submodules + id: set-up-submodules + uses: ./.github/actions/fetch_submodules - name: Install dependencies run: | sudo apt-get install -y gettext @@ -622,7 +553,7 @@ jobs: riscv64-unknown-elf-gcc --version python3 --version - name: Build mpy-cross - if: ${{ steps.cp-deps.outputs.frozen_tags == 'True' }} + if: ${{ steps.set-up-submodules.outputs.frozen == 'True' }} run: make -C mpy-cross -j2 - name: Setup build failure matcher run: echo "::add-matcher::$GITHUB_WORKSPACE/.github/workflows/match-build-fail.json" diff --git a/.github/workflows/create_website_pr.yml b/.github/workflows/create_website_pr.yml index 2130b8ae45..19004d9bea 100644 --- a/.github/workflows/create_website_pr.yml +++ b/.github/workflows/create_website_pr.yml @@ -25,19 +25,10 @@ jobs: uses: actions/setup-python@v4 with: python-version: "3.x" - - name: CircuitPython dependencies - run: | - python tools/ci_fetch_deps.py ${{ github.job }} - echo "::group::Fetch history and tags" - git fetch --no-recurse-submodules --shallow-since="2021-07-01" --tags https://github.com/adafruit/circuitpython HEAD - git fetch --no-recurse-submodules --shallow-since="2021-07-01" origin $GITHUB_SHA - git repack -d - echo "::endgroup::" - - name: CircuitPython version - run: | - CP_VERSION=$(tools/describe) - echo "$CP_VERSION" - echo "CP_VERSION=$CP_VERSION" >> $GITHUB_ENV + - name: Set up submodules + uses: ./.github/actions/fetch_submodules + with: + version: true - name: Install dependencies run: pip install -r requirements-dev.txt - name: Versions diff --git a/.github/workflows/ports_windows.yml b/.github/workflows/ports_windows.yml index f889e70d6d..66d09c2418 100644 --- a/.github/workflows/ports_windows.yml +++ b/.github/workflows/ports_windows.yml @@ -19,7 +19,7 @@ concurrency: cancel-in-progress: true jobs: - build: + windows: runs-on: windows-2022 defaults: run: @@ -75,31 +75,11 @@ jobs: with: submodules: false fetch-depth: 1 - - name: Create submodule status - run: git submodule status extmod/ulab lib/ tools/ >> submodule_status - - name: Restore submodules - uses: actions/cache/restore@v3 + + - name: Set up submodules + uses: ./.github/actions/fetch_submodules with: - path: | - .git/modules/ - extmod/ulab - lib/ - tools/ - key: submodules-common-${{ hashFiles('submodule_status') }} - enableCrossOsArchive: true - - name: CircuitPython dependencies - run: | - python tools/ci_fetch_deps.py windows - echo "::group::Fetch history and tags" - git fetch --no-recurse-submodules --shallow-since="2021-07-01" --tags https://github.com/adafruit/circuitpython HEAD - git fetch --no-recurse-submodules --shallow-since="2021-07-01" origin $GITHUB_SHA - git repack -d - echo "::endgroup::" - - name: CircuitPython version - run: | - CP_VERSION=$(tools/describe) - echo "$CP_VERSION" - echo "CP_VERSION=$CP_VERSION" >> $GITHUB_ENV + version: true - name: build mpy-cross run: make -j2 -C mpy-cross From 5b814a4561d66c7e3778236b96e3893330be3795 Mon Sep 17 00:00:00 2001 From: Radomir Dopieralski Date: Sat, 28 Jan 2023 15:16:19 +0100 Subject: [PATCH 15/52] pewpew m4: enable CDC back CDC got disabled on this board by mistake --- ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk b/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk index 32be4805d7..0560da84fe 100644 --- a/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk @@ -11,6 +11,7 @@ LONGINT_IMPL = NONE CIRCUITPY_FULL_BUILD = 0 +CIRCUITPY_ANALOGIO = 0 CIRCUITPY_ALARM = 0 CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_AUDIOMP3 = 0 @@ -31,14 +32,13 @@ CIRCUITPY_ROTARYIO = 0 CIRCUITPY_RTC = 0 CIRCUITPY_SAMD = 0 CIRCUITPY_TOUCHIO = 0 -CIRCUITPY_USB_CDC = 0 CIRCUITPY_USB_HID = 0 CIRCUITPY_USB_MIDI = 0 CIRCUITPY_VECTORIO = 0 CIRCUITPY_BUSDEVICE = 0 CIRCUITPY_BITMAPTOOLS = 0 +CIRCUITPY_WATCHDOG = 0 -CIRCUITPY_ANALOGIO = 1 CIRCUITPY_AUDIOIO = 1 CIRCUITPY_AUDIOMIXER = 1 CIRCUITPY_DISPLAYIO = 1 From 858e212e34f9ffaaa1c2b5b17331e52bf780b6ad Mon Sep 17 00:00:00 2001 From: MicroDev <70126934+MicroDev1@users.noreply.github.com> Date: Sun, 29 Jan 2023 00:23:02 +0530 Subject: [PATCH 16/52] enable octal flash in sdkconfig --- .../sdkconfig | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/sdkconfig b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/sdkconfig index f508f4a67c..f915462e11 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/sdkconfig +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/sdkconfig @@ -27,6 +27,49 @@ CONFIG_SPIRAM_USE_MEMMAP=y # CONFIG_SPIRAM_USE_CAPS_ALLOC is not set # CONFIG_SPIRAM_USE_MALLOC is not set CONFIG_SPIRAM_MEMTEST=y + +# +# Serial flasher config +# +CONFIG_ESPTOOLPY_BAUD_OTHER_VAL=115200 +# CONFIG_ESPTOOLPY_NO_STUB is not set +CONFIG_ESPTOOLPY_OCT_FLASH=y +CONFIG_ESPTOOLPY_FLASHMODE_OPI=y +# CONFIG_ESPTOOLPY_FLASH_SAMPLE_MODE_STR is not set +CONFIG_ESPTOOLPY_FLASH_SAMPLE_MODE_DTR=y +CONFIG_ESPTOOLPY_FLASHMODE="dout" +CONFIG_ESPTOOLPY_FLASHFREQ_80M=y +# CONFIG_ESPTOOLPY_FLASHFREQ_40M is not set +# CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set +CONFIG_ESPTOOLPY_FLASHFREQ="80m" +# CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_2MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_4MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_8MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_16MB is not set +CONFIG_ESPTOOLPY_FLASHSIZE_32MB=y +# CONFIG_ESPTOOLPY_FLASHSIZE_64MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_128MB is not set +CONFIG_ESPTOOLPY_FLASHSIZE="32MB" +CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y +CONFIG_ESPTOOLPY_BEFORE_RESET=y +# CONFIG_ESPTOOLPY_BEFORE_NORESET is not set +CONFIG_ESPTOOLPY_BEFORE="default_reset" +CONFIG_ESPTOOLPY_AFTER_RESET=y +# CONFIG_ESPTOOLPY_AFTER_NORESET is not set +CONFIG_ESPTOOLPY_AFTER="hard_reset" +# CONFIG_ESPTOOLPY_MONITOR_BAUD_CONSOLE is not set +# CONFIG_ESPTOOLPY_MONITOR_BAUD_9600B is not set +# CONFIG_ESPTOOLPY_MONITOR_BAUD_57600B is not set +CONFIG_ESPTOOLPY_MONITOR_BAUD_115200B=y +# CONFIG_ESPTOOLPY_MONITOR_BAUD_230400B is not set +# CONFIG_ESPTOOLPY_MONITOR_BAUD_921600B is not set +# CONFIG_ESPTOOLPY_MONITOR_BAUD_2MB is not set +# CONFIG_ESPTOOLPY_MONITOR_BAUD_OTHER is not set +CONFIG_ESPTOOLPY_MONITOR_BAUD_OTHER_VAL=115200 +CONFIG_ESPTOOLPY_MONITOR_BAUD=115200 +# end of Serial flasher config + # # LWIP # From f0058774d0a4798c9c4f40ffa2851949b58fe0ed Mon Sep 17 00:00:00 2001 From: Neradoc Date: Sat, 28 Jan 2023 20:31:59 +0100 Subject: [PATCH 17/52] add CIRCUITPY_SKIP_SAFE_MODE_WAIT to circuitpy_mpconfig.mk use #if (also a CIRCUITPY_ULAB) --- py/circuitpy_mpconfig.mk | 5 +++++ shared-bindings/adafruit_pixelbuf/PixelBuf.c | 2 +- supervisor/shared/safe_mode.c | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index d489edf038..8ec338c372 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -393,6 +393,11 @@ CFLAGS += -DCIRCUITPY_SETTABLE_PROCESSOR_FREQUENCY=$(CIRCUITPY_SETTABLE_PROCESSO CIRCUITPY_SHARPDISPLAY ?= $(CIRCUITPY_FRAMEBUFFERIO) CFLAGS += -DCIRCUITPY_SHARPDISPLAY=$(CIRCUITPY_SHARPDISPLAY) +# Disable the safe mode blink at boot. Speeds up boot time, but makes it +# impossible to enter safe mode by pressing buttons on boot. +CIRCUITPY_SKIP_SAFE_MODE_WAIT ?= 0 +CFLAGS += -DCIRCUITPY_SKIP_SAFE_MODE_WAIT=$(CIRCUITPY_SKIP_SAFE_MODE_WAIT) + CIRCUITPY_SOCKETPOOL ?= $(CIRCUITPY_WIFI) CFLAGS += -DCIRCUITPY_SOCKETPOOL=$(CIRCUITPY_SOCKETPOOL) diff --git a/shared-bindings/adafruit_pixelbuf/PixelBuf.c b/shared-bindings/adafruit_pixelbuf/PixelBuf.c index cf18804ec9..b5b0f1bb41 100644 --- a/shared-bindings/adafruit_pixelbuf/PixelBuf.c +++ b/shared-bindings/adafruit_pixelbuf/PixelBuf.c @@ -40,7 +40,7 @@ #include "shared-module/adafruit_pixelbuf/PixelBuf.h" #include "shared-bindings/digitalio/DigitalInOut.h" -#ifdef CIRCUITPY_ULAB +#if CIRCUITPY_ULAB #include "extmod/ulab/code/ndarray.h" #endif diff --git a/supervisor/shared/safe_mode.c b/supervisor/shared/safe_mode.c index d23b78d624..c7e93e6393 100644 --- a/supervisor/shared/safe_mode.c +++ b/supervisor/shared/safe_mode.c @@ -66,7 +66,7 @@ safe_mode_t wait_for_safe_mode_reset(void) { reset_reason != RESET_REASON_SOFTWARE) { return NO_SAFE_MODE; } - #ifdef CIRCUITPY_SKIP_SAFE_MODE_WAIT + #if CIRCUITPY_SKIP_SAFE_MODE_WAIT return NO_SAFE_MODE; #endif port_set_saved_word(SAFE_MODE_DATA_GUARD | (MANUAL_SAFE_MODE << 8)); From 172ef91e71ef0af4275e85e862559e2017d3227d Mon Sep 17 00:00:00 2001 From: Jose David M Date: Sat, 28 Jan 2023 02:50:12 +0000 Subject: [PATCH 18/52] Translated using Weblate (Spanish) Currently translated at 100.0% (992 of 992 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/es/ --- locale/es.po | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/locale/es.po b/locale/es.po index f68a30a125..497fadf870 100644 --- a/locale/es.po +++ b/locale/es.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2023-01-18 18:05+0000\n" +"PO-Revision-Date: 2023-01-29 16:16+0000\n" "Last-Translator: Jose David M \n" "Language-Team: \n" "Language: es\n" @@ -16,7 +16,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.15.1-dev\n" +"X-Generator: Weblate 4.16-dev\n" #: main.c msgid "" @@ -3044,6 +3044,8 @@ msgid "" "espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" +"espcamera. La cámara requiere una configuración de PSRAM reservada. " +"Refiérase a la documentación para más instrucciones." #: py/runtime.c msgid "exceptions must derive from BaseException" From 07c45b9bcfea4dff5088f16037ca9b61d0d11fbc Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Sat, 28 Jan 2023 12:13:36 +0000 Subject: [PATCH 19/52] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (992 of 992 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 1a31baac8a..8b370922d4 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2023-01-13 18:51+0000\n" +"PO-Revision-Date: 2023-01-29 16:16+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -14,7 +14,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n > 1;\n" -"X-Generator: Weblate 4.15.1-dev\n" +"X-Generator: Weblate 4.16-dev\n" #: main.c msgid "" @@ -3045,6 +3045,8 @@ msgid "" "espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" +"O espcamera.Camera requer que o PSRAM seja reservado para que possa ser " +"configurado. Consulte a documentação para obter mais informações." #: py/runtime.c msgid "exceptions must derive from BaseException" From aee16df340f106126d9055b27efc526538ea9349 Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Sat, 28 Jan 2023 16:14:34 +0000 Subject: [PATCH 20/52] Translated using Weblate (Swedish) Currently translated at 100.0% (992 of 992 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/ --- locale/sv.po | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/locale/sv.po b/locale/sv.po index b29d242fbe..01037522cf 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2023-01-13 18:51+0000\n" +"PO-Revision-Date: 2023-01-29 16:16+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" "Language: sv\n" @@ -14,7 +14,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.15.1-dev\n" +"X-Generator: Weblate 4.16-dev\n" #: main.c msgid "" @@ -3014,6 +3014,8 @@ msgid "" "espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" +"espcamera.Camera kräver reserverat PSRAM att vara konfigurerat. Se " +"dokumentationen för instruktioner." #: py/runtime.c msgid "exceptions must derive from BaseException" From 4ef363a797779901cb57aaa83a4757d7ac1fac45 Mon Sep 17 00:00:00 2001 From: MicroDev <70126934+MicroDev1@users.noreply.github.com> Date: Sun, 29 Jan 2023 16:12:05 +0530 Subject: [PATCH 21/52] improve dualbank and storage extension docs --- shared-bindings/dualbank/__init__.c | 46 +++++++++++++++++------------ shared-bindings/storage/__init__.c | 5 +++- 2 files changed, 31 insertions(+), 20 deletions(-) diff --git a/shared-bindings/dualbank/__init__.c b/shared-bindings/dualbank/__init__.c index d3f75a4153..fedc9c08af 100644 --- a/shared-bindings/dualbank/__init__.c +++ b/shared-bindings/dualbank/__init__.c @@ -30,25 +30,32 @@ #include "supervisor/flash.h" #endif -//| """DUALBANK Module +//| """Dualbank Module //| -//| The `dualbank` module adds ability to update and switch -//| between the two app partitions. +//| The `dualbank` module adds ability to update and switch between the +//| two identical app partitions, which can contain different firmware versions. //| -//| There are two identical partitions, these contain different -//| firmware versions. //| Having two partitions enables rollback functionality. //| -//| The two partitions are defined as boot partition and -//| next-update partition. Calling `dualbank.flash()` writes -//| the next-update partition. +//| The two partitions are defined as the boot partition and the next-update partition. +//| Calling `dualbank.flash()` writes the next-update partition. //| -//| After the next-update partition is written a validation -//| check is performed and on a successful validation this -//| partition is set as the boot partition. On next reset, -//| firmware will be loaded from this partition. +//| After the next-update partition is written a validation check is performed +//| and on a successful validation this partition is set as the boot partition. +//| On next reset, firmware will be loaded from this partition. //| -//| Here is the sequence of commands to follow: +//| Use cases: +//| * Can be used for ``OTA`` Over-The-Air updates. +//| * Can be used for ``dual-boot`` of different firmware versions or platforms. +//| +//| .. note:: +//| +//| Boards with flash ``=2MB``: +//| This module is unavailable as the flash is only large enough for one app partition. +//| +//| Boards with flash ``>2MB``: +//| This module is enabled/disabled at runtime based on whether the ``CIRCUITPY`` drive +//| is extended or not. See `storage.erase_filesystem()` for more information. //| //| .. code-block:: python //| @@ -68,10 +75,12 @@ STATIC void raise_error_if_storage_extended(void) { #endif //| def flash(buffer: ReadableBuffer, offset: int = 0) -> None: -//| """Writes one of two app partitions at the given offset. +//| """Writes one of the two app partitions at the given offset. //| -//| This can be called multiple times when flashing the firmware -//| in small chunks. +//| This can be called multiple times when flashing the firmware in smaller chunks. +//| +//| :param ReadableBuffer buffer: The entire firmware or a partial chunk. +//| :param int offset: Start writing at this offset in the app partition. //| """ //| ... //| @@ -102,10 +111,9 @@ STATIC mp_obj_t dualbank_flash(size_t n_args, const mp_obj_t *pos_args, mp_map_t STATIC MP_DEFINE_CONST_FUN_OBJ_KW(dualbank_flash_obj, 0, dualbank_flash); //| def switch() -> None: -//| """Switches the boot partition. +//| """Switches to the next-update partition. //| -//| On next reset, firmware will be loaded from the partition -//| just switched over to. +//| On next reset, firmware will be loaded from the partition just switched over to. //| """ //| ... //| diff --git a/shared-bindings/storage/__init__.c b/shared-bindings/storage/__init__.c index ad8b847fd5..8e2eee6511 100644 --- a/shared-bindings/storage/__init__.c +++ b/shared-bindings/storage/__init__.c @@ -166,8 +166,11 @@ MP_DEFINE_CONST_FUN_OBJ_1(storage_getmount_obj, storage_getmount); //| extended by setting this to `True`. If this isn't provided or //| set to `None` (default), the existing configuration will be used. //| +//| .. note:: New firmware starts with storage extended. In case of an existing +//| filesystem (e.g. uf2 load), the existing extension setting is preserved. +//| //| .. warning:: All the data on ``CIRCUITPY`` will be lost, and -//| CircuitPython will restart on certain boards.""" +//| CircuitPython will restart on certain boards.""" //| ... //| From efec211ee18b97ec8e1665c46bfe48f403e11db5 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Sun, 29 Jan 2023 22:56:24 -0500 Subject: [PATCH 22/52] update .readthedocs.yml --- .readthedocs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 94ba8750b0..29a915766f 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -14,7 +14,7 @@ build: python: "3" jobs: post_install: - - python tools/ci_fetch_deps.py docs HEAD + - python tools/ci_fetch_deps.py build-doc formats: - pdf From dc5cd275555ce9e57e4d68575a1e9b092723bb3f Mon Sep 17 00:00:00 2001 From: RetiredWizard Date: Mon, 30 Jan 2023 02:01:33 -0500 Subject: [PATCH 23/52] seeed_xiao_esp32c3 flash mode change to dio I was having trouble flashing CircuitPython to the Seeed xiao esp32c3 using the make flash option. With the help of DAN and Neradoc I was able to perform a manual flash and use the make flash option to flash an Adafruit_qtpy_esp32c3 bin but when I went back and attempted to use make flash on the seeed bin it didn't work. Comparing the builds, the flash mode was different and after making this change the seeed build now flashes properly using make flash. --- ports/espressif/boards/seeed_xiao_esp32c3/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/espressif/boards/seeed_xiao_esp32c3/mpconfigboard.mk b/ports/espressif/boards/seeed_xiao_esp32c3/mpconfigboard.mk index 68722982ab..d7325cf44e 100644 --- a/ports/espressif/boards/seeed_xiao_esp32c3/mpconfigboard.mk +++ b/ports/espressif/boards/seeed_xiao_esp32c3/mpconfigboard.mk @@ -3,6 +3,6 @@ CIRCUITPY_CREATION_ID = 0x00C30001 IDF_TARGET = esp32c3 -CIRCUITPY_ESP_FLASH_MODE = qio +CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 4MB From 6e31cd0a4f55556ea083028dd25e43d029a03b05 Mon Sep 17 00:00:00 2001 From: Wind-stormger Date: Mon, 30 Jan 2023 15:41:42 +0800 Subject: [PATCH 24/52] Update mpconfigboard.h --- ports/espressif/boards/bpi_bit_s2/mpconfigboard.h | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/espressif/boards/bpi_bit_s2/mpconfigboard.h b/ports/espressif/boards/bpi_bit_s2/mpconfigboard.h index 5225325454..ddb51cdb6d 100644 --- a/ports/espressif/boards/bpi_bit_s2/mpconfigboard.h +++ b/ports/espressif/boards/bpi_bit_s2/mpconfigboard.h @@ -30,6 +30,7 @@ #define MICROPY_HW_MCU_NAME "ESP32S2" // #define MICROPY_HW_NEOPIXEL (&pin_GPIO18) +#define MICROPY_HW_LED_STATUS (&pin_GPIO0) #define DEFAULT_I2C_BUS_SCL (&pin_GPIO16) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO15) From d6ebf1bf43ad42f97418c77c82b98e6b1d418da2 Mon Sep 17 00:00:00 2001 From: brainboardz Date: Mon, 30 Jan 2023 17:12:21 -0500 Subject: [PATCH 25/52] First commit --- .../boards/brainboardz_neuron/board.c | 48 ++++++++++++++ .../boards/brainboardz_neuron/mpconfigboard.h | 33 ++++++++++ .../brainboardz_neuron/mpconfigboard.mk | 17 +++++ .../boards/brainboardz_neuron/pins.c | 64 +++++++++++++++++++ .../boards/brainboardz_neuron/sdkconfig | 34 ++++++++++ 5 files changed, 196 insertions(+) create mode 100755 ports/espressif/boards/brainboardz_neuron/board.c create mode 100755 ports/espressif/boards/brainboardz_neuron/mpconfigboard.h create mode 100755 ports/espressif/boards/brainboardz_neuron/mpconfigboard.mk create mode 100755 ports/espressif/boards/brainboardz_neuron/pins.c create mode 100755 ports/espressif/boards/brainboardz_neuron/sdkconfig diff --git a/ports/espressif/boards/brainboardz_neuron/board.c b/ports/espressif/boards/brainboardz_neuron/board.c new file mode 100755 index 0000000000..ff9418ec86 --- /dev/null +++ b/ports/espressif/boards/brainboardz_neuron/board.c @@ -0,0 +1,48 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" +#include "mpconfigboard.h" +#include "shared-bindings/microcontroller/Pin.h" + +void board_init(void) { + // Debug UART + #ifdef DEBUG + common_hal_never_reset_pin(&pin_GPIO43); + common_hal_never_reset_pin(&pin_GPIO44); + #endif +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { + +} + +void board_deinit(void) { +} diff --git a/ports/espressif/boards/brainboardz_neuron/mpconfigboard.h b/ports/espressif/boards/brainboardz_neuron/mpconfigboard.h new file mode 100755 index 0000000000..9507917ead --- /dev/null +++ b/ports/espressif/boards/brainboardz_neuron/mpconfigboard.h @@ -0,0 +1,33 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +// Micropython setup + +#define MICROPY_HW_BOARD_NAME "Neuron" +#define MICROPY_HW_MCU_NAME "ESP32S3" + +#define DEFAULT_UART_BUS_RX (&pin_GPIO44) +#define DEFAULT_UART_BUS_TX (&pin_GPIO43) diff --git a/ports/espressif/boards/brainboardz_neuron/mpconfigboard.mk b/ports/espressif/boards/brainboardz_neuron/mpconfigboard.mk new file mode 100755 index 0000000000..d6bbc7a7af --- /dev/null +++ b/ports/espressif/boards/brainboardz_neuron/mpconfigboard.mk @@ -0,0 +1,17 @@ +USB_VID = 0x239A +USB_PID = 0x80C8 +USB_PRODUCT = "Neuron" +USB_MANUFACTURER = "BrainBoardz" + +IDF_TARGET = esp32s3 + +INTERNAL_FLASH_FILESYSTEM = 1 +LONGINT_IMPL = MPZ + +# The default queue depth of 16 overflows on release builds, +# so increase it to 32. +CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 + +CIRCUITPY_ESP_FLASH_MODE=dio +CIRCUITPY_ESP_FLASH_FREQ=80m +CIRCUITPY_ESP_FLASH_SIZE=8MB diff --git a/ports/espressif/boards/brainboardz_neuron/pins.c b/ports/espressif/boards/brainboardz_neuron/pins.c new file mode 100755 index 0000000000..496983e650 --- /dev/null +++ b/ports/espressif/boards/brainboardz_neuron/pins.c @@ -0,0 +1,64 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_IO17), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_IO35), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_IO37), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_IO38), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_IO39), MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_IO40), MP_ROM_PTR(&pin_GPIO40) }, + { MP_ROM_QSTR(MP_QSTR_IO41), MP_ROM_PTR(&pin_GPIO41) }, + { MP_ROM_QSTR(MP_QSTR_IO42), MP_ROM_PTR(&pin_GPIO42) }, + { MP_ROM_QSTR(MP_QSTR_IO43), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_IO44), MP_ROM_PTR(&pin_GPIO44) }, + { MP_ROM_QSTR(MP_QSTR_IO45), MP_ROM_PTR(&pin_GPIO45) }, + { MP_ROM_QSTR(MP_QSTR_IO46), MP_ROM_PTR(&pin_GPIO46) }, + { MP_ROM_QSTR(MP_QSTR_IO47), MP_ROM_PTR(&pin_GPIO47) }, + { MP_ROM_QSTR(MP_QSTR_IO48), MP_ROM_PTR(&pin_GPIO48) }, + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) }, + + + // I2C BUS + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO9) }, + + // SD Card + { MP_ROM_QSTR(MP_QSTR_SD_MISO), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_SD_MOSI), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_SD_CLK), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO16) }, + + // BLINK + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO21) }, + + // BOOT SOFTWARE BOOT + { MP_ROM_QSTR(MP_QSTR_BOOT), MP_ROM_PTR(&pin_GPIO0) } +}; + +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/brainboardz_neuron/sdkconfig b/ports/espressif/boards/brainboardz_neuron/sdkconfig new file mode 100755 index 0000000000..89070ebd52 --- /dev/null +++ b/ports/espressif/boards/brainboardz_neuron/sdkconfig @@ -0,0 +1,34 @@ +CONFIG_ESP32S3_SPIRAM_SUPPORT=y +# +# SPI RAM config +# +# CONFIG_SPIRAM_MODE_QUAD is not set +CONFIG_SPIRAM_MODE_OCT=y +# CONFIG_SPIRAM_TYPE_AUTO is not set +CONFIG_SPIRAM_TYPE_ESPPSRAM64=y +CONFIG_SPIRAM_SIZE=8388608 +# end of SPI RAM config + +CONFIG_DEFAULT_PSRAM_CLK_IO=30 +# +# PSRAM Clock and CS IO for ESP32S3 +# +CONFIG_DEFAULT_PSRAM_CS_IO=26 +# end of PSRAM Clock and CS IO for ESP32S3 + +# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set +# CONFIG_SPIRAM_RODATA is not set +CONFIG_SPIRAM_SPEED_80M=y +# CONFIG_SPIRAM_SPEED_40M is not set +CONFIG_SPIRAM=y +CONFIG_SPIRAM_BOOT_INIT=y +# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set +CONFIG_SPIRAM_USE_MEMMAP=y +# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +# CONFIG_SPIRAM_USE_MALLOC is not set +CONFIG_SPIRAM_MEMTEST=y +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="neuron" +# end of LWIP From 34f480d735134e831889c1529f3438c791fde9e9 Mon Sep 17 00:00:00 2001 From: brainboardz Date: Mon, 30 Jan 2023 19:03:57 -0500 Subject: [PATCH 26/52] Second Commit --- ports/espressif/boards/brainboardz_neuron/mpconfigboard.mk | 2 +- ports/espressif/boards/brainboardz_neuron/sdkconfig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/espressif/boards/brainboardz_neuron/mpconfigboard.mk b/ports/espressif/boards/brainboardz_neuron/mpconfigboard.mk index d6bbc7a7af..1a9b410c06 100755 --- a/ports/espressif/boards/brainboardz_neuron/mpconfigboard.mk +++ b/ports/espressif/boards/brainboardz_neuron/mpconfigboard.mk @@ -1,4 +1,4 @@ -USB_VID = 0x239A +USB_VID = 0x303A USB_PID = 0x80C8 USB_PRODUCT = "Neuron" USB_MANUFACTURER = "BrainBoardz" diff --git a/ports/espressif/boards/brainboardz_neuron/sdkconfig b/ports/espressif/boards/brainboardz_neuron/sdkconfig index 89070ebd52..39bd2cdb4e 100755 --- a/ports/espressif/boards/brainboardz_neuron/sdkconfig +++ b/ports/espressif/boards/brainboardz_neuron/sdkconfig @@ -30,5 +30,5 @@ CONFIG_SPIRAM_MEMTEST=y # # LWIP # -CONFIG_LWIP_LOCAL_HOSTNAME="neuron" +CONFIG_LWIP_LOCAL_HOSTNAME="BrainBoardzNeuron" # end of LWIP From 7c525fdcb0d0046f45816c0ac8488c4f286be602 Mon Sep 17 00:00:00 2001 From: brainboardz Date: Mon, 30 Jan 2023 19:54:11 -0500 Subject: [PATCH 27/52] Third Commit --- ports/espressif/boards/brainboardz_neuron/pins.c | 1 - 1 file changed, 1 deletion(-) diff --git a/ports/espressif/boards/brainboardz_neuron/pins.c b/ports/espressif/boards/brainboardz_neuron/pins.c index 496983e650..577df2ada8 100755 --- a/ports/espressif/boards/brainboardz_neuron/pins.c +++ b/ports/espressif/boards/brainboardz_neuron/pins.c @@ -43,7 +43,6 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) }, { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) }, - // I2C BUS { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO8) }, { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO9) }, From 3f3519e0abbbf783b7621c1fafd102cda05c6da4 Mon Sep 17 00:00:00 2001 From: brainboardz Date: Mon, 30 Jan 2023 20:10:34 -0500 Subject: [PATCH 28/52] Fourth Commit --- ports/espressif/boards/brainboardz_neuron/pins.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ports/espressif/boards/brainboardz_neuron/pins.c b/ports/espressif/boards/brainboardz_neuron/pins.c index 577df2ada8..d6e61810a9 100755 --- a/ports/espressif/boards/brainboardz_neuron/pins.c +++ b/ports/espressif/boards/brainboardz_neuron/pins.c @@ -43,20 +43,16 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) }, { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) }, - // I2C BUS { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO8) }, { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO9) }, - // SD Card { MP_ROM_QSTR(MP_QSTR_SD_MISO), MP_ROM_PTR(&pin_GPIO13) }, { MP_ROM_QSTR(MP_QSTR_SD_MOSI), MP_ROM_PTR(&pin_GPIO15) }, { MP_ROM_QSTR(MP_QSTR_SD_CLK), MP_ROM_PTR(&pin_GPIO14) }, { MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO16) }, - // BLINK { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO21) }, - // BOOT SOFTWARE BOOT { MP_ROM_QSTR(MP_QSTR_BOOT), MP_ROM_PTR(&pin_GPIO0) } }; From e10816f34c89dc5995078976696e16e95e45d96d Mon Sep 17 00:00:00 2001 From: brainboardz Date: Mon, 30 Jan 2023 20:20:37 -0500 Subject: [PATCH 29/52] Fifth Commit --- ports/espressif/boards/brainboardz_neuron/pins.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/ports/espressif/boards/brainboardz_neuron/pins.c b/ports/espressif/boards/brainboardz_neuron/pins.c index d6e61810a9..252cf906f9 100755 --- a/ports/espressif/boards/brainboardz_neuron/pins.c +++ b/ports/espressif/boards/brainboardz_neuron/pins.c @@ -39,21 +39,19 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_IO46), MP_ROM_PTR(&pin_GPIO46) }, { MP_ROM_QSTR(MP_QSTR_IO47), MP_ROM_PTR(&pin_GPIO47) }, { MP_ROM_QSTR(MP_QSTR_IO48), MP_ROM_PTR(&pin_GPIO48) }, - + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) }, { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) }, - + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO8) }, { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO9) }, - + { MP_ROM_QSTR(MP_QSTR_SD_MISO), MP_ROM_PTR(&pin_GPIO13) }, { MP_ROM_QSTR(MP_QSTR_SD_MOSI), MP_ROM_PTR(&pin_GPIO15) }, { MP_ROM_QSTR(MP_QSTR_SD_CLK), MP_ROM_PTR(&pin_GPIO14) }, { MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO16) }, { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO21) }, - { MP_ROM_QSTR(MP_QSTR_BOOT), MP_ROM_PTR(&pin_GPIO0) } }; - MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From f71b4bc0180a88568fdc7669131ac83ea883d9d7 Mon Sep 17 00:00:00 2001 From: brainboardz Date: Mon, 30 Jan 2023 20:32:19 -0500 Subject: [PATCH 30/52] Sixth Commit --- ports/espressif/boards/brainboardz_neuron/pins.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ports/espressif/boards/brainboardz_neuron/pins.c b/ports/espressif/boards/brainboardz_neuron/pins.c index 252cf906f9..17d38717b3 100755 --- a/ports/espressif/boards/brainboardz_neuron/pins.c +++ b/ports/espressif/boards/brainboardz_neuron/pins.c @@ -39,19 +39,16 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_IO46), MP_ROM_PTR(&pin_GPIO46) }, { MP_ROM_QSTR(MP_QSTR_IO47), MP_ROM_PTR(&pin_GPIO47) }, { MP_ROM_QSTR(MP_QSTR_IO48), MP_ROM_PTR(&pin_GPIO48) }, - { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) }, { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) }, - { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO8) }, { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO9) }, - { MP_ROM_QSTR(MP_QSTR_SD_MISO), MP_ROM_PTR(&pin_GPIO13) }, { MP_ROM_QSTR(MP_QSTR_SD_MOSI), MP_ROM_PTR(&pin_GPIO15) }, { MP_ROM_QSTR(MP_QSTR_SD_CLK), MP_ROM_PTR(&pin_GPIO14) }, { MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO16) }, - { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO21) }, - { MP_ROM_QSTR(MP_QSTR_BOOT), MP_ROM_PTR(&pin_GPIO0) } + { MP_ROM_QSTR(MP_QSTR_BOOT), MP_ROM_PTR(&pin_GPIO0) }, + }; MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From f3b1ceeb81eb2c15ea7f8713c95d23025e55f5fb Mon Sep 17 00:00:00 2001 From: brainboardz Date: Mon, 30 Jan 2023 20:45:57 -0500 Subject: [PATCH 31/52] Seventh Commit --- ports/espressif/boards/brainboardz_neuron/pins.c | 1 - 1 file changed, 1 deletion(-) diff --git a/ports/espressif/boards/brainboardz_neuron/pins.c b/ports/espressif/boards/brainboardz_neuron/pins.c index 17d38717b3..85673a15b6 100755 --- a/ports/espressif/boards/brainboardz_neuron/pins.c +++ b/ports/espressif/boards/brainboardz_neuron/pins.c @@ -49,6 +49,5 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO16) }, { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO21) }, { MP_ROM_QSTR(MP_QSTR_BOOT), MP_ROM_PTR(&pin_GPIO0) }, - }; MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From b8d6f20308ee865432ffb18c164faae32d296372 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 31 Jan 2023 10:02:21 -0600 Subject: [PATCH 32/52] Add front buttons as D0/1/2, matching the silk --- .../boards/adafruit_feather_esp32s2_reverse_tft/pins.c | 4 ++++ .../boards/adafruit_feather_esp32s3_reverse_tft/pins.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/pins.c b/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/pins.c index 0a331c93fd..32718700b1 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/pins.c +++ b/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/pins.c @@ -67,6 +67,10 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO0) }, { MP_ROM_QSTR(MP_QSTR_BOOT0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO2) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_reverse_tft/pins.c b/ports/espressif/boards/adafruit_feather_esp32s3_reverse_tft/pins.c index 0a331c93fd..32718700b1 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s3_reverse_tft/pins.c +++ b/ports/espressif/boards/adafruit_feather_esp32s3_reverse_tft/pins.c @@ -67,6 +67,10 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO0) }, { MP_ROM_QSTR(MP_QSTR_BOOT0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO2) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, From e54775a8cbc431362b2ea408ad6092ec6486c360 Mon Sep 17 00:00:00 2001 From: jposada202020 Date: Tue, 31 Jan 2023 18:58:27 -0500 Subject: [PATCH 33/52] adding information regarding the version for libraries --- docs/design_guide.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/design_guide.rst b/docs/design_guide.rst index 4170d499fe..784284892c 100644 --- a/docs/design_guide.rst +++ b/docs/design_guide.rst @@ -267,6 +267,14 @@ After the license comment:: """ +Version description +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +After the import statements:: + + __version__ = "0.0.0+auto.0" + __repo__ = "" + Class description ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ From 2656ccffe48a40a936a43cef9e51beceb2e390f1 Mon Sep 17 00:00:00 2001 From: brainboardz Date: Tue, 31 Jan 2023 19:35:57 -0500 Subject: [PATCH 34/52] Commit01-31 --- .../boards/brainboardz_neuron/board.c | 11 +----- .../brainboardz_neuron/mpconfigboard.mk | 8 +---- .../boards/brainboardz_neuron/pins.c | 35 +++++++++++++------ 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/ports/espressif/boards/brainboardz_neuron/board.c b/ports/espressif/boards/brainboardz_neuron/board.c index ff9418ec86..3b1f5efd87 100755 --- a/ports/espressif/boards/brainboardz_neuron/board.c +++ b/ports/espressif/boards/brainboardz_neuron/board.c @@ -36,13 +36,4 @@ void board_init(void) { #endif } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/brainboardz_neuron/mpconfigboard.mk b/ports/espressif/boards/brainboardz_neuron/mpconfigboard.mk index 1a9b410c06..1083b18264 100755 --- a/ports/espressif/boards/brainboardz_neuron/mpconfigboard.mk +++ b/ports/espressif/boards/brainboardz_neuron/mpconfigboard.mk @@ -1,17 +1,11 @@ USB_VID = 0x303A USB_PID = 0x80C8 + USB_PRODUCT = "Neuron" USB_MANUFACTURER = "BrainBoardz" IDF_TARGET = esp32s3 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - CIRCUITPY_ESP_FLASH_MODE=dio CIRCUITPY_ESP_FLASH_FREQ=80m CIRCUITPY_ESP_FLASH_SIZE=8MB diff --git a/ports/espressif/boards/brainboardz_neuron/pins.c b/ports/espressif/boards/brainboardz_neuron/pins.c index 85673a15b6..b0cbb91563 100755 --- a/ports/espressif/boards/brainboardz_neuron/pins.c +++ b/ports/espressif/boards/brainboardz_neuron/pins.c @@ -4,6 +4,8 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS { MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_BT), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) }, { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, @@ -11,20 +13,37 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, { MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, { MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) }, { MP_ROM_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) }, { MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_SD_MISO), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_SD_CLK), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_SD_MOSI), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_IO17), MP_ROM_PTR(&pin_GPIO17) }, { MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) }, { MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO19) }, { MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_IO35), MP_ROM_PTR(&pin_GPIO35) }, { MP_ROM_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) }, { MP_ROM_QSTR(MP_QSTR_IO37), MP_ROM_PTR(&pin_GPIO37) }, @@ -33,21 +52,17 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_IO40), MP_ROM_PTR(&pin_GPIO40) }, { MP_ROM_QSTR(MP_QSTR_IO41), MP_ROM_PTR(&pin_GPIO41) }, { MP_ROM_QSTR(MP_QSTR_IO42), MP_ROM_PTR(&pin_GPIO42) }, + { MP_ROM_QSTR(MP_QSTR_IO43), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_IO44), MP_ROM_PTR(&pin_GPIO44) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) }, + { MP_ROM_QSTR(MP_QSTR_IO45), MP_ROM_PTR(&pin_GPIO45) }, { MP_ROM_QSTR(MP_QSTR_IO46), MP_ROM_PTR(&pin_GPIO46) }, { MP_ROM_QSTR(MP_QSTR_IO47), MP_ROM_PTR(&pin_GPIO47) }, { MP_ROM_QSTR(MP_QSTR_IO48), MP_ROM_PTR(&pin_GPIO48) }, - { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) }, - { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) }, - { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO8) }, - { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO9) }, - { MP_ROM_QSTR(MP_QSTR_SD_MISO), MP_ROM_PTR(&pin_GPIO13) }, - { MP_ROM_QSTR(MP_QSTR_SD_MOSI), MP_ROM_PTR(&pin_GPIO15) }, - { MP_ROM_QSTR(MP_QSTR_SD_CLK), MP_ROM_PTR(&pin_GPIO14) }, - { MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO16) }, - { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO21) }, - { MP_ROM_QSTR(MP_QSTR_BOOT), MP_ROM_PTR(&pin_GPIO0) }, + }; MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From d9d94eacca3eaf335c3c7ef4371dd34db3c5c841 Mon Sep 17 00:00:00 2001 From: MicroDev <70126934+MicroDev1@users.noreply.github.com> Date: Wed, 1 Feb 2023 13:38:41 +0530 Subject: [PATCH 35/52] run updated pre-commit --- ports/espressif/bindings/espcamera/__init__.c | 1 + ports/espressif/bindings/espidf/__init__.c | 4 +- .../bindings/rp2pio/StateMachine.c | 4 +- ports/raspberrypi/bindings/rp2pio/__init__.c | 1 + .../stm/boards/swan_r5/tests/board_voltage.py | 4 +- ports/stm/tools/parse_af_csv.py | 1 + py/genlast.py | 1 - py/makeqstrdata.py | 1 + py/maketranslationdata.py | 3 +- shared-bindings/_bleio/Characteristic.c | 3 +- shared-bindings/_bleio/CharacteristicBuffer.c | 1 - shared-bindings/_bleio/ScanResults.c | 3 +- shared-bindings/_bleio/__init__.c | 1 + shared-bindings/_eve/__init__.c | 99 ++++++++++++------- .../i2c_device/I2CDevice.c | 1 - .../spi_device/SPIDevice.c | 1 - shared-bindings/adafruit_pixelbuf/PixelBuf.c | 3 +- shared-bindings/alarm/__init__.c | 1 + shared-bindings/atexit/__init__.c | 3 +- shared-bindings/audiomixer/MixerVoice.c | 3 +- shared-bindings/audiomp3/MP3Decoder.c | 1 - shared-bindings/bitmaptools/__init__.c | 1 + shared-bindings/bitops/__init__.c | 1 + shared-bindings/board/__init__.c | 10 +- shared-bindings/busio/I2C.c | 1 - shared-bindings/busio/SPI.c | 1 - shared-bindings/canio/__init__.c | 1 + shared-bindings/displayio/Display.c | 7 +- shared-bindings/displayio/EPaperDisplay.c | 3 +- shared-bindings/displayio/I2CDisplay.c | 3 +- shared-bindings/dualbank/__init__.c | 1 + .../framebufferio/FramebufferDisplay.c | 9 +- shared-bindings/getpass/__init__.c | 2 +- shared-bindings/hashlib/Hash.c | 3 +- shared-bindings/ipaddress/__init__.c | 1 + shared-bindings/is31fl3741/IS31FL3741.c | 3 +- shared-bindings/keypad/Event.c | 3 +- shared-bindings/math/__init__.c | 1 + shared-bindings/memorymonitor/__init__.c | 1 + shared-bindings/microcontroller/__init__.c | 1 + shared-bindings/msgpack/__init__.c | 1 + shared-bindings/neopixel_write/__init__.c | 3 +- shared-bindings/rainbowio/__init__.c | 3 +- shared-bindings/random/__init__.c | 1 + shared-bindings/rtc/__init__.c | 1 + shared-bindings/sdcardio/SDCard.c | 2 - shared-bindings/sdioio/SDCard.c | 2 - shared-bindings/socketpool/Socket.c | 3 +- shared-bindings/socketpool/SocketPool.c | 1 + shared-bindings/ssl/SSLSocket.c | 3 +- shared-bindings/ssl/__init__.c | 1 + shared-bindings/struct/__init__.c | 1 + shared-bindings/supervisor/__init__.c | 1 + shared-bindings/traceback/__init__.c | 1 + shared-bindings/uheap/__init__.c | 1 + shared-bindings/usb/core/__init__.c | 1 + shared-bindings/usb_cdc/__init__.c | 1 + shared-bindings/usb_hid/__init__.c | 1 + shared-bindings/usb_midi/__init__.c | 1 + shared-bindings/ustack/__init__.c | 1 + shared-bindings/vectorio/Circle.c | 3 +- shared-bindings/vectorio/Polygon.c | 3 +- shared-bindings/vectorio/Rectangle.c | 3 +- shared-bindings/watchdog/__init__.c | 1 + shared-bindings/zlib/__init__.c | 1 + tests/extmod/framebuf_subclass.py | 1 + tests/extmod/uasyncio_exception.py | 3 + tests/extmod/vfs_fat_fileio1.py | 1 - tests/extmod/vfs_fat_fileio2.py | 1 - tests/extmod/vfs_fat_more.py | 1 - tests/extmod/vfs_fat_oldproto.py | 1 - tests/extmod/vfs_fat_ramdisk.py | 1 - tests/extmod/vfs_fat_ramdisklarge.py | 1 - tests/import/module_getattr.py | 1 + tests/inlineasm/asmsum.py | 2 - tests/micropython/const2.py | 4 + tests/micropython/heapalloc_yield_from.py | 2 + tests/micropython/native_closure.py | 3 + tests/micropython/native_gen.py | 2 + tests/micropython/native_misc.py | 4 + tests/micropython/native_try.py | 3 + tests/micropython/native_try_deep.py | 1 + tests/micropython/native_with.py | 1 + tests/micropython/viper_args.py | 1 + tests/micropython/viper_cond.py | 3 + tests/micropython/viper_misc.py | 17 ++++ tests/micropython/viper_misc2.py | 1 + tests/micropython/viper_misc_intbig.py | 1 + tests/micropython/viper_try.py | 3 + tests/micropython/viper_types.py | 3 + tests/micropython/viper_with.py | 1 + tests/misc/non_compliant.py | 3 + tests/misc/sys_settrace_generator.py | 2 - .../sys_settrace_generic.py | 1 + tests/perf_bench/bm_nqueens.py | 1 + tests/perf_bench/misc_aes.py | 2 + tests/run-internalbench.py | 1 - tests/stress/qstr_limit.py | 2 + tests/stress/recursive_gen.py | 2 + tests/thread/mutate_bytearray.py | 1 + tests/thread/mutate_dict.py | 1 + tests/thread/mutate_instance.py | 2 + tests/thread/mutate_list.py | 1 + tests/thread/mutate_set.py | 1 + tests/thread/stress_aes.py | 2 + tests/thread/thread_qstr1.py | 1 + tests/unicode/unicode_id.py | 2 + tools/codeformat.py | 1 + tools/extract_pyi.py | 2 +- tools/gen_crt_bundle.py | 2 - tools/gendoc.py | 1 + tools/mpy-tool.py | 1 + tools/preprocess_frozen_modules.py | 1 - 113 files changed, 237 insertions(+), 93 deletions(-) diff --git a/ports/espressif/bindings/espcamera/__init__.c b/ports/espressif/bindings/espcamera/__init__.c index 37b506015f..633f547fe9 100644 --- a/ports/espressif/bindings/espcamera/__init__.c +++ b/ports/espressif/bindings/espcamera/__init__.c @@ -45,6 +45,7 @@ //| Non-Espressif microcontrollers use the `imagecapture` module together with wrapper libraries such as `adafruit_ov5640 `_. //| //| """ +//| //| class GrabMode: //| """Controls when a new frame is grabbed.""" diff --git a/ports/espressif/bindings/espidf/__init__.c b/ports/espressif/bindings/espidf/__init__.c index 12781000ae..c1ef9da1e0 100644 --- a/ports/espressif/bindings/espidf/__init__.c +++ b/ports/espressif/bindings/espidf/__init__.c @@ -37,6 +37,7 @@ //| """Direct access to a few ESP-IDF details. This module *should not* include any functionality //| that could be implemented by other frameworks. It should only include ESP-IDF specific //| things.""" +//| //| def heap_caps_get_total_size() -> int: //| """Return the total size of the ESP-IDF, which includes the CircuitPython heap.""" @@ -72,7 +73,8 @@ MP_DEFINE_CONST_FUN_OBJ_0(espidf_heap_caps_get_largest_free_block_obj, espidf_he //| """Erase all data in the non-volatile storage (nvs), including data stored by with `microcontroller.nvm` //| //| 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.""" +//| 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()); diff --git a/ports/raspberrypi/bindings/rp2pio/StateMachine.c b/ports/raspberrypi/bindings/rp2pio/StateMachine.c index 5301086709..ada9f46020 100644 --- a/ports/raspberrypi/bindings/rp2pio/StateMachine.c +++ b/ports/raspberrypi/bindings/rp2pio/StateMachine.c @@ -94,7 +94,6 @@ //| wrap_target: int = 0, //| wrap: int = -1, //| ) -> None: -//| //| """Construct a StateMachine object on the given pins with the given program. //| //| :param ReadableBuffer program: the program to run with the state machine @@ -659,7 +658,8 @@ MP_DEFINE_CONST_FUN_OBJ_KW(rp2pio_statemachine_readinto_obj, 2, rp2pio_statemach //| :param int in_start: Start of the slice of ``buffer_in`` to read into: ``buffer_in[in_start:in_end]`` //| :param int in_end: End of the slice; this index is not included. Defaults to ``len(buffer_in)`` //| :param bool swap_out: For 2- and 4-byte elements, swap (reverse) the byte order for the buffer being transmitted (written) -//| :param bool swap_in: For 2- and 4-rx elements, swap (reverse) the byte order for the buffer being received (read)""" +//| :param bool swap_in: For 2- and 4-rx elements, swap (reverse) the byte order for the buffer being received (read) +//| """ //| ... STATIC mp_obj_t rp2pio_statemachine_write_readinto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { diff --git a/ports/raspberrypi/bindings/rp2pio/__init__.c b/ports/raspberrypi/bindings/rp2pio/__init__.c index ce3be4aa52..193a3a2025 100644 --- a/ports/raspberrypi/bindings/rp2pio/__init__.c +++ b/ports/raspberrypi/bindings/rp2pio/__init__.c @@ -38,6 +38,7 @@ //| Learn guide `_. //| //| """ +//| //| def pins_are_sequential(pins: List[microcontroller.Pin]) -> bool: //| """Return True if the pins have sequential GPIO numbers, False otherwise""" diff --git a/ports/stm/boards/swan_r5/tests/board_voltage.py b/ports/stm/boards/swan_r5/tests/board_voltage.py index 6191067fde..2cb0ad4cc0 100644 --- a/ports/stm/boards/swan_r5/tests/board_voltage.py +++ b/ports/stm/boards/swan_r5/tests/board_voltage.py @@ -44,6 +44,7 @@ PASS = "PASS" FAIL = "FAIL" NA = "N/A" + # Determine if given value is a number def _is_number(val): try: @@ -61,7 +62,6 @@ def _deinit_pins(gpios): # Toggle IO pins while waiting for answer def _toggle_wait(pin_gpios): - timestamp = time.monotonic() led_state = False failed = [] @@ -96,7 +96,6 @@ def buildPin(pin): def run_test(pins): - """ Toggles all available GPIO on and off repeatedly. @@ -114,7 +113,6 @@ def run_test(pins): gpio_pins = analog_pins + digital_pins if gpio_pins: - # Print out the LEDs found print("GPIO pins found:", end=" ") for pin in gpio_pins: diff --git a/ports/stm/tools/parse_af_csv.py b/ports/stm/tools/parse_af_csv.py index 3e48d4145d..e3188e2e24 100644 --- a/ports/stm/tools/parse_af_csv.py +++ b/ports/stm/tools/parse_af_csv.py @@ -31,6 +31,7 @@ import sys # # See examples/stm32f405.csv for example formatting. + # Most peripherals (SPI, I2C) output 3 values: # peripheral index, alt function, pin string def evaluate_periph(inper, inlist, periph, subtype, altfn, pin): diff --git a/py/genlast.py b/py/genlast.py index 460271af81..1c5089fdfc 100644 --- a/py/genlast.py +++ b/py/genlast.py @@ -59,7 +59,6 @@ def maybe_preprocess(command, output_dir, fn): if __name__ == "__main__": - idx1 = sys.argv.index("--") idx2 = sys.argv.index("--", idx1 + 1) output_dir = sys.argv[1] diff --git a/py/makeqstrdata.py b/py/makeqstrdata.py index 2abbdedefd..d16bb0d09a 100644 --- a/py/makeqstrdata.py +++ b/py/makeqstrdata.py @@ -249,6 +249,7 @@ static_qstr_list = [ "zip", ] + # this must match the equivalent function in qstr.c def compute_hash(qstr, bytes_hash): hash = 5381 diff --git a/py/maketranslationdata.py b/py/maketranslationdata.py index fbf396c73f..a07f70265c 100644 --- a/py/maketranslationdata.py +++ b/py/maketranslationdata.py @@ -84,6 +84,7 @@ C_ESCAPES = { '"': '\\"', } + # this must match the equivalent function in qstr.c def compute_hash(qstr, bytes_hash): hash = 5381 @@ -277,7 +278,7 @@ def compute_huffman_coding(translation_name, translations, f): counter = collections.Counter() for t in texts: - for (found, word) in extractor.iter_words(t): + for found, word in extractor.iter_words(t): if not found: for substr in iter_substrings(word, minlen=2, maxlen=11): counter[substr] += 1 diff --git a/shared-bindings/_bleio/Characteristic.c b/shared-bindings/_bleio/Characteristic.c index e1c5fc3ad5..823250c365 100644 --- a/shared-bindings/_bleio/Characteristic.c +++ b/shared-bindings/_bleio/Characteristic.c @@ -256,7 +256,8 @@ MP_PROPERTY_GETTER(bleio_characteristic_service_obj, //| """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 float indicate: True if Characteristic should receive indications of remote writes""" +//| :param float indicate: True if Characteristic should receive indications of remote writes +//| """ //| ... STATIC mp_obj_t bleio_characteristic_set_cccd(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { bleio_characteristic_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); diff --git a/shared-bindings/_bleio/CharacteristicBuffer.c b/shared-bindings/_bleio/CharacteristicBuffer.c index 12853b3ac3..218d72bdbb 100644 --- a/shared-bindings/_bleio/CharacteristicBuffer.c +++ b/shared-bindings/_bleio/CharacteristicBuffer.c @@ -47,7 +47,6 @@ STATIC void raise_error_if_not_connected(bleio_characteristic_buffer_obj_t *self //| 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 //| add the newly-written bytes to a FIFO buffer. //| diff --git a/shared-bindings/_bleio/ScanResults.c b/shared-bindings/_bleio/ScanResults.c index b0f37d9fe5..ec4e0c72e8 100644 --- a/shared-bindings/_bleio/ScanResults.c +++ b/shared-bindings/_bleio/ScanResults.c @@ -54,7 +54,8 @@ STATIC mp_obj_t scanresults_iternext(mp_obj_t self_in) { //| ... //| def __next__(self) -> ScanEntry: //| """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. +//| """ //| ... //| diff --git a/shared-bindings/_bleio/__init__.c b/shared-bindings/_bleio/__init__.c index 59c6c354a4..f34d3af5c5 100644 --- a/shared-bindings/_bleio/__init__.c +++ b/shared-bindings/_bleio/__init__.c @@ -58,6 +58,7 @@ //| adapter: Adapter //| """BLE Adapter used to manage device discovery and connections. //| This object is the sole instance of `_bleio.Adapter`.""" +//| //| class BluetoothError(Exception): //| """Catchall exception for Bluetooth related errors.""" diff --git a/shared-bindings/_eve/__init__.c b/shared-bindings/_eve/__init__.c index bd0cf9b4ea..5975ee1ca1 100644 --- a/shared-bindings/_eve/__init__.c +++ b/shared-bindings/_eve/__init__.c @@ -93,7 +93,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(cc_obj, _cc); //| :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 ref: specifies the reference value for the alpha test. Range 0-255. The initial value is 0 //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _alphafunc(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { @@ -109,7 +110,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(alphafunc_obj, _alphafunc); //| //| :param int prim: graphics primitive. //| -//| Valid primitives are ``BITMAPS``, ``POINTS``, ``LINES``, ``LINE_STRIP``, ``EDGE_STRIP_R``, ``EDGE_STRIP_L``, ``EDGE_STRIP_A``, ``EDGE_STRIP_B`` and ``RECTS``.""" +//| Valid primitives are ``BITMAPS``, ``POINTS``, ``LINES``, ``LINE_STRIP``, ``EDGE_STRIP_R``, ``EDGE_STRIP_L``, ``EDGE_STRIP_A``, ``EDGE_STRIP_B`` and ``RECTS``. +//| """ //| ... STATIC mp_obj_t _begin(mp_obj_t self, mp_obj_t a0) { @@ -137,7 +139,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmapextformat_obj, _bitmapextformat); //| //| :param int handle: bitmap handle. Range 0-31. The initial value is 0 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _bitmaphandle(mp_obj_t self, mp_obj_t a0) { @@ -218,7 +221,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitmapsize_obj, 6, 6, _bitmapsize); //| def BitmapSource(self, addr: int) -> None: //| """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 +//| """ //| ... STATIC mp_obj_t _bitmapsource(mp_obj_t self, mp_obj_t a0) { @@ -255,7 +259,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitmapswizzle_obj, 5, 5, _bitmapswizz //| //| The initial value is **p** = 0, **v** = 256. This represents the value 1.0. //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _bitmaptransforma(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { @@ -274,7 +279,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransforma_obj, _bitmaptransforma); //| //| The initial value is **p** = 0, **v** = 0. This represents the value 0.0. //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _bitmaptransformb(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { @@ -290,7 +296,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransformb_obj, _bitmaptransformb); //| //| :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 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _bitmaptransformc(mp_obj_t self, mp_obj_t a0) { @@ -308,7 +315,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmaptransformc_obj, _bitmaptransformc); //| //| The initial value is **p** = 0, **v** = 0. This represents the value 0.0. //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _bitmaptransformd(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { @@ -327,7 +335,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransformd_obj, _bitmaptransformd); //| //| The initial value is **p** = 0, **v** = 256. This represents the value 1.0. //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _bitmaptransforme(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { @@ -343,7 +352,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransforme_obj, _bitmaptransforme); //| //| :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 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _bitmaptransformf(mp_obj_t self, mp_obj_t a0) { @@ -359,7 +369,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmaptransformf_obj, _bitmaptransformf); //| :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 dst: specifies how the destination blending factor is computed, one of the same constants as **src**. Range 0-7. The initial value is ONE_MINUS_SRC_ALPHA(4) //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _blendfunc(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { @@ -388,7 +399,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(call_obj, _call); //| //| :param int cell: bitmap cell number. Range 0-127. The initial value is 0 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _cell(mp_obj_t self, mp_obj_t a0) { @@ -403,7 +415,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(cell_obj, _cell); //| //| :param int alpha: alpha value used when the color buffer is cleared. Range 0-255. The initial value is 0 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _clearcolora(mp_obj_t self, mp_obj_t a0) { @@ -420,7 +433,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(clearcolora_obj, _clearcolora); //| :param int green: green value used when the color buffer is cleared. Range 0-255. The initial value is 0 //| :param int blue: blue value used when the color buffer is cleared. Range 0-255. The initial value is 0 //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _clearcolorrgb(size_t n_args, const mp_obj_t *args) { @@ -454,7 +468,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(clear_obj, 1, 4, _clear); //| //| :param int s: value used when the stencil buffer is cleared. Range 0-255. The initial value is 0 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _clearstencil(mp_obj_t self, mp_obj_t a0) { @@ -469,7 +484,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(clearstencil_obj, _clearstencil); //| //| :param int s: value used when the tag buffer is cleared. Range 0-255. The initial value is 0 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ STATIC mp_obj_t _cleartag(mp_obj_t self, mp_obj_t a0) { uint32_t s = mp_obj_get_int_truncated(a0); @@ -483,7 +499,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(cleartag_obj, _cleartag); //| //| :param int alpha: alpha for the current color. Range 0-255. The initial value is 255 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _colora(mp_obj_t self, mp_obj_t a0) { @@ -501,7 +518,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(colora_obj, _colora); //| :param int b: allow updates to the frame buffer blue component. Range 0-1. The initial value is 1 //| :param int a: allow updates to the frame buffer alpha component. Range 0-1. The initial value is 1 //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _colormask(size_t n_args, const mp_obj_t *args) { @@ -521,7 +539,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(colormask_obj, 5, 5, _colormask); //| :param int green: green for the current color. Range 0-255. The initial value is 255 //| :param int blue: blue for the current color. Range 0-255. The initial value is 255 //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _colorrgb(size_t n_args, const mp_obj_t *args) { @@ -547,7 +566,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(display_obj, _display); //| def End(self) -> None: //| """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`. +//| """ //| ... STATIC mp_obj_t _end(mp_obj_t self) { @@ -599,7 +619,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(nop_obj, _nop); //| //| :param int addr: Address in graphics SRAM, 2-byte aligned. Range 0-4194303. The initial value is 0 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _palettesource(mp_obj_t self, mp_obj_t a0) { @@ -648,7 +669,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(savecontext_obj, _savecontext); //| :param int width: The width of the scissor clip rectangle, in pixels. Range 0-4095. The initial value is hsize //| :param int height: The height of the scissor clip rectangle, in pixels. Range 0-4095. The initial value is 2048 //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _scissorsize(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { @@ -665,7 +687,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(scissorsize_obj, _scissorsize); //| :param int x: The :math:`x` coordinate of the scissor clip rectangle, in pixels. Range 0-2047. The initial value is 0 //| :param int y: The :math:`y` coordinate of the scissor clip rectangle, in pixels. Range 0-2047. The initial value is 0 //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _scissorxy(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { @@ -683,7 +706,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(scissorxy_obj, _scissorxy); //| :param int ref: specifies the reference value for the stencil test. Range 0-255. The initial value is 0 //| :param int mask: specifies a mask that is ANDed with the reference value and the stored stencil value. Range 0-255. The initial value is 255 //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _stencilfunc(size_t n_args, const mp_obj_t *args) { @@ -700,7 +724,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(stencilfunc_obj, 4, 4, _stencilfunc); //| //| :param int mask: the mask used to enable writing stencil bits. Range 0-255. The initial value is 255 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _stencilmask(mp_obj_t self, mp_obj_t a0) { @@ -716,7 +741,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(stencilmask_obj, _stencilmask); //| :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 spass: specifies the action to take when the stencil test passes, one of the same constants as **sfail**. Range 0-7. The initial value is KEEP(1) //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _stencilop(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { @@ -732,7 +758,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(stencilop_obj, _stencilop); //| //| :param int mask: allow updates to the tag buffer. Range 0-1. The initial value is 1 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _tagmask(mp_obj_t self, mp_obj_t a0) { @@ -747,7 +774,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(tagmask_obj, _tagmask); //| //| :param int s: tag value. Range 0-255. The initial value is 255 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _tag(mp_obj_t self, mp_obj_t a0) { @@ -857,7 +885,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(vertex2f_obj, _vertex2f); //| //| :param float width: line width in pixels. Range 0-511. The initial value is 1 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _linewidth(mp_obj_t self, mp_obj_t a0) { @@ -872,7 +901,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(linewidth_obj, _linewidth); //| //| :param float size: point diameter in pixels. Range 0-1023. The initial value is 1 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _pointsize(mp_obj_t self, mp_obj_t a0) { @@ -887,7 +917,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(pointsize_obj, _pointsize); //| //| :param float x: signed x-coordinate in pixels. Range ±4095. The initial value is 0 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _vertextranslatex(mp_obj_t self, mp_obj_t a0) { @@ -902,7 +933,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(vertextranslatex_obj, _vertextranslatex); //| //| :param float y: signed y-coordinate in pixels. Range ±4095. The initial value is 0 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... @@ -918,7 +950,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(vertextranslatey_obj, _vertextranslatey); //| //| :param int frac: Number of fractional bits in X,Y coordinates, 0-4. Range 0-7. The initial value is 4 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... // } diff --git a/shared-bindings/adafruit_bus_device/i2c_device/I2CDevice.c b/shared-bindings/adafruit_bus_device/i2c_device/I2CDevice.c index d2b7f0c6ce..a77179c886 100644 --- a/shared-bindings/adafruit_bus_device/i2c_device/I2CDevice.c +++ b/shared-bindings/adafruit_bus_device/i2c_device/I2CDevice.c @@ -43,7 +43,6 @@ //| """I2C Device Manager""" //| //| def __init__(self, i2c: busio.I2C, device_address: int, probe: bool = True) -> None: -//| //| """Represents a single I2C device and manages locking the bus and the device //| address. //| diff --git a/shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c b/shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c index 6626d27f77..6108247aa1 100644 --- a/shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c +++ b/shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c @@ -51,7 +51,6 @@ //| phase: int = 0, //| extra_clocks: int = 0 //| ) -> None: -//| //| """ //| Represents a single SPI device and manages locking the bus and the device address. //| diff --git a/shared-bindings/adafruit_pixelbuf/PixelBuf.c b/shared-bindings/adafruit_pixelbuf/PixelBuf.c index b5b0f1bb41..2848a02c62 100644 --- a/shared-bindings/adafruit_pixelbuf/PixelBuf.c +++ b/shared-bindings/adafruit_pixelbuf/PixelBuf.c @@ -78,7 +78,8 @@ static void parse_byteorder(mp_obj_t byteorder_obj, pixelbuf_byteorder_details_t //| :param float brightness: Brightness (0 to 1.0, default 1.0) //| :param bool auto_write: Whether to automatically write pixels (Default False) //| :param ~circuitpython_typing.ReadableBuffer header: Sequence of bytes to always send before pixel values. -//| :param ~circuitpython_typing.ReadableBuffer trailer: Sequence of bytes to always send after pixel values.""" +//| :param ~circuitpython_typing.ReadableBuffer trailer: Sequence of bytes to always send after pixel values. +//| """ //| ... STATIC mp_obj_t pixelbuf_pixelbuf_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_size, ARG_byteorder, ARG_brightness, ARG_auto_write, ARG_header, ARG_trailer }; diff --git a/shared-bindings/alarm/__init__.c b/shared-bindings/alarm/__init__.c index f61482682f..29c9b49d3f 100644 --- a/shared-bindings/alarm/__init__.c +++ b/shared-bindings/alarm/__init__.c @@ -73,6 +73,7 @@ //| """The most recently triggered alarm. If CircuitPython was sleeping, the alarm that woke it from sleep. //| If no alarm occured since the last hard reset or soft restart, value is ``None``. //| """ +//| // wake_alarm is implemented as a dictionary entry, so there's no code here. diff --git a/shared-bindings/atexit/__init__.c b/shared-bindings/atexit/__init__.c index 914cac582b..9a91e0bc80 100644 --- a/shared-bindings/atexit/__init__.c +++ b/shared-bindings/atexit/__init__.c @@ -37,11 +37,11 @@ //| |see_cpython_module| :mod:`cpython:atexit`. //| """ //| ... +//| //| def register( //| func: Callable[..., Any], *args: Optional[Any], **kwargs: Optional[Any] //| ) -> Callable[..., Any]: -//| //| """Register func as a function to be executed at termination. //| //| Any optional arguments that are to be passed to func must be passed as arguments to `register()`. @@ -65,7 +65,6 @@ STATIC mp_obj_t atexit_register(size_t n_args, const mp_obj_t *pos_args, mp_map_ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(atexit_register_obj, 1, atexit_register); //| def unregister(func: Callable[..., Any]) -> None: -//| //| """Remove func from the list of functions to be run at termination. //| //| `unregister()` silently does nothing if func was not previously registered. If func has been registered more than once, diff --git a/shared-bindings/audiomixer/MixerVoice.c b/shared-bindings/audiomixer/MixerVoice.c index 0bdef1f4cd..16a1be520f 100644 --- a/shared-bindings/audiomixer/MixerVoice.c +++ b/shared-bindings/audiomixer/MixerVoice.c @@ -62,7 +62,8 @@ STATIC mp_obj_t audiomixer_mixervoice_make_new(const mp_obj_type_t *type, size_t //| //| Sample must be an `audiocore.WaveFile`, `audiocore.RawSample`, `audiomixer.Mixer` or `audiomp3.MP3Decoder`. //| -//| The sample must match the `audiomixer.Mixer`'s encoding settings given in the constructor.""" +//| The sample must match the `audiomixer.Mixer`'s encoding settings given in the constructor. +//| """ //| ... STATIC mp_obj_t audiomixer_mixervoice_obj_play(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_sample, ARG_loop }; diff --git a/shared-bindings/audiomp3/MP3Decoder.c b/shared-bindings/audiomp3/MP3Decoder.c index 4a8805b294..68e78cb0d5 100644 --- a/shared-bindings/audiomp3/MP3Decoder.c +++ b/shared-bindings/audiomp3/MP3Decoder.c @@ -45,7 +45,6 @@ //| """ //| //| def __init__(self, file: Union[str, typing.BinaryIO], buffer: WriteableBuffer) -> None: -//| //| """Load a .mp3 file for playback with `audioio.AudioOut` or `audiobusio.I2SOut`. //| //| :param Union[str, typing.BinaryIO] file: The name of a mp3 file (preferred) or an already opened mp3 file diff --git a/shared-bindings/bitmaptools/__init__.c b/shared-bindings/bitmaptools/__init__.c index 4d968db717..493ff93b09 100644 --- a/shared-bindings/bitmaptools/__init__.c +++ b/shared-bindings/bitmaptools/__init__.c @@ -50,6 +50,7 @@ //| `_ //| for information about using the :py:mod:`displayio` module. //| """ +//| STATIC int16_t validate_point(mp_obj_t point, int16_t default_value) { // Checks if point is None and returns default_value, otherwise decodes integer value diff --git a/shared-bindings/bitops/__init__.c b/shared-bindings/bitops/__init__.c index ea4e70ae3a..3107b310db 100644 --- a/shared-bindings/bitops/__init__.c +++ b/shared-bindings/bitops/__init__.c @@ -30,6 +30,7 @@ #include "shared-bindings/bitops/__init__.h" //| """Routines for low-level manipulation of binary data""" +//| //| def bit_transpose( //| input: ReadableBuffer, output: WriteableBuffer, width: int = 8 diff --git a/shared-bindings/board/__init__.c b/shared-bindings/board/__init__.c index e4003d4f6b..971ed2f676 100644 --- a/shared-bindings/board/__init__.c +++ b/shared-bindings/board/__init__.c @@ -58,10 +58,12 @@ //| """Board ID string. The unique identifier for the board model in //| circuitpython, as well as on circuitpython.org. //| Example: "hallowing_m0_express".""" +//| //| def I2C() -> busio.I2C: //| """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`.""" +//| The object created is a singleton, and uses the default parameter values for `busio.I2C`. +//| """ //| ... //| #if CIRCUITPY_BOARD_I2C @@ -78,7 +80,8 @@ MP_DEFINE_CONST_FUN_OBJ_0(board_i2c_obj, board_i2c_0); //| def SPI() -> busio.SPI: //| """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`.""" +//| The object created is a singleton, and uses the default parameter values for `busio.SPI`. +//| """ //| ... //| #if CIRCUITPY_BOARD_SPI @@ -95,7 +98,8 @@ MP_DEFINE_CONST_FUN_OBJ_0(board_spi_obj, board_spi_0); //| def UART() -> busio.UART: //| """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`.""" +//| The object created is a singleton, and uses the default parameter values for `busio.UART`. +//| """ //| ... //| #if CIRCUITPY_BOARD_UART diff --git a/shared-bindings/busio/I2C.c b/shared-bindings/busio/I2C.c index de373aaeb4..5cf52eaa1a 100644 --- a/shared-bindings/busio/I2C.c +++ b/shared-bindings/busio/I2C.c @@ -48,7 +48,6 @@ //| frequency: int = 100000, //| timeout: int = 255 //| ) -> None: -//| //| """I2C is a two-wire protocol for communicating between devices. At the //| physical level it consists of 2 wires: SCL and SDA, the clock and data //| lines respectively. diff --git a/shared-bindings/busio/SPI.c b/shared-bindings/busio/SPI.c index af985ed632..ccdceb5760 100644 --- a/shared-bindings/busio/SPI.c +++ b/shared-bindings/busio/SPI.c @@ -61,7 +61,6 @@ //| MISO: Optional[microcontroller.Pin] = None, //| half_duplex: bool = False, //| ) -> None: -//| //| """Construct an SPI object on the given pins. //| //| .. note:: The SPI peripherals allocated in order of desirability, if possible, diff --git a/shared-bindings/canio/__init__.c b/shared-bindings/canio/__init__.c index 0416e5cb39..ecef7ebde6 100644 --- a/shared-bindings/canio/__init__.c +++ b/shared-bindings/canio/__init__.c @@ -58,6 +58,7 @@ //| For more information on working with this module, refer to //| `this Learn Guide on using it `_. //| """ +//| #include "py/obj.h" #include "py/enum.h" diff --git a/shared-bindings/displayio/Display.c b/shared-bindings/displayio/Display.c index 448aa25b79..47b1de8914 100644 --- a/shared-bindings/displayio/Display.c +++ b/shared-bindings/displayio/Display.c @@ -41,6 +41,7 @@ //| _DisplayBus = Union["FourWire", "paralleldisplay.ParallelBus", "I2CDisplay"] //| """:py:class:`FourWire`, :py:class:`paralleldisplay.ParallelBus` or :py:class:`I2CDisplay`""" +//| //| class Display: //| """Manage updating a display over a display bus @@ -282,7 +283,8 @@ MP_DEFINE_CONST_FUN_OBJ_2(displayio_display_show_obj, displayio_display_obj_show //| //| :param Optional[int] target_frames_per_second: The target frame rate that :py:func:`refresh` should try to //| achieve. Set to `None` for immediate refresh. -//| :param int minimum_frames_per_second: The minimum number of times the screen should be updated per second.""" +//| :param int minimum_frames_per_second: The minimum number of times the screen should be updated per second. +//| """ //| ... STATIC mp_obj_t displayio_display_obj_refresh(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_target_frames_per_second, ARG_minimum_frames_per_second }; @@ -445,7 +447,8 @@ MP_PROPERTY_GETSET(displayio_display_root_group_obj, //| """Extract the pixels from a single row //| //| :param int y: The top edge of the area -//| :param ~circuitpython_typing.WriteableBuffer buffer: The buffer in which to place the pixel data""" +//| :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) { diff --git a/shared-bindings/displayio/EPaperDisplay.c b/shared-bindings/displayio/EPaperDisplay.c index 6fde664670..4745223ad3 100644 --- a/shared-bindings/displayio/EPaperDisplay.c +++ b/shared-bindings/displayio/EPaperDisplay.c @@ -117,7 +117,8 @@ //| :param float seconds_per_frame: Minimum number of seconds between screen refreshes //| :param bool always_toggle_chip_select: When True, chip select is toggled every byte //| :param bool grayscale: When true, the color ram is the low bit of 2-bit grayscale -//| :param bool two_byte_sequence_length: When true, use two bytes to define sequence length""" +//| :param bool two_byte_sequence_length: When true, use two bytes to define sequence length +//| """ //| ... STATIC mp_obj_t displayio_epaperdisplay_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_display_bus, ARG_start_sequence, ARG_stop_sequence, ARG_width, ARG_height, diff --git a/shared-bindings/displayio/I2CDisplay.c b/shared-bindings/displayio/I2CDisplay.c index 14edf7b0be..f2647b0b16 100644 --- a/shared-bindings/displayio/I2CDisplay.c +++ b/shared-bindings/displayio/I2CDisplay.c @@ -59,7 +59,8 @@ //| //| :param busio.I2C i2c_bus: The I2C bus that make up the clock and data lines //| :param int device_address: The I2C address of the device -//| :param microcontroller.Pin reset: Reset pin. When None only software reset can be used""" +//| :param microcontroller.Pin reset: Reset pin. When None only software reset can be used +//| """ //| ... STATIC mp_obj_t displayio_i2cdisplay_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_i2c_bus, ARG_device_address, ARG_reset }; diff --git a/shared-bindings/dualbank/__init__.c b/shared-bindings/dualbank/__init__.c index fedc9c08af..b77fb6d76b 100644 --- a/shared-bindings/dualbank/__init__.c +++ b/shared-bindings/dualbank/__init__.c @@ -65,6 +65,7 @@ //| dualbank.switch() //| """ //| ... +//| #if CIRCUITPY_STORAGE_EXTEND STATIC void raise_error_if_storage_extended(void) { diff --git a/shared-bindings/framebufferio/FramebufferDisplay.c b/shared-bindings/framebufferio/FramebufferDisplay.c index 51124984bf..030b924c1e 100644 --- a/shared-bindings/framebufferio/FramebufferDisplay.c +++ b/shared-bindings/framebufferio/FramebufferDisplay.c @@ -58,7 +58,8 @@ //| //| :param ~circuitpython_typing.FrameBuffer framebuffer: The framebuffer that the display is connected to //| :param bool auto_refresh: Automatically refresh the screen -//| :param int rotation: The rotation of the display in degrees clockwise. Must be in 90 degree increments (0, 90, 180, 270)""" +//| :param int rotation: The rotation of the display in degrees clockwise. Must be in 90 degree increments (0, 90, 180, 270) +//| """ //| ... STATIC mp_obj_t framebufferio_framebufferdisplay_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_framebuffer, ARG_rotation, ARG_auto_refresh, NUM_ARGS }; @@ -134,7 +135,8 @@ MP_DEFINE_CONST_FUN_OBJ_2(framebufferio_framebufferdisplay_show_obj, framebuffer //| without calls to this.) //| //| :param int target_frames_per_second: How many times a second `refresh` should be called and the screen updated. -//| :param int minimum_frames_per_second: The minimum number of times the screen should be updated per second.""" +//| :param int minimum_frames_per_second: The minimum number of times the screen should be updated per second. +//| """ //| ... STATIC mp_obj_t framebufferio_framebufferdisplay_obj_refresh(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_target_frames_per_second, ARG_minimum_frames_per_second }; @@ -263,7 +265,8 @@ MP_PROPERTY_GETTER(framebufferio_framebufferframebuffer_obj, //| """Extract the pixels from a single row //| //| :param int y: The top edge of the area -//| :param ~circuitpython_typing.WriteableBuffer buffer: The buffer in which to place the pixel data""" +//| :param ~circuitpython_typing.WriteableBuffer buffer: The buffer in which to place the pixel data +//| """ //| ... STATIC mp_obj_t framebufferio_framebufferdisplay_obj_fill_row(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_y, ARG_buffer }; diff --git a/shared-bindings/getpass/__init__.c b/shared-bindings/getpass/__init__.c index 340b8fd7c6..811d78e03d 100644 --- a/shared-bindings/getpass/__init__.c +++ b/shared-bindings/getpass/__init__.c @@ -33,9 +33,9 @@ //| //| """ //| ... +//| //| def getpass(prompt: Optional[str] = "Password: ", stream: Optional[io.FileIO] = None) -> str: -//| //| """Prompt the user without echoing. //| //| :param str prompt: The user is prompted using the string ``prompt``, which defaults to ``'Password: '``. diff --git a/shared-bindings/hashlib/Hash.c b/shared-bindings/hashlib/Hash.c index f385885b4d..e3cbbc39d3 100644 --- a/shared-bindings/hashlib/Hash.c +++ b/shared-bindings/hashlib/Hash.c @@ -49,7 +49,8 @@ MP_PROPERTY_GETTER(hashlib_hash_digest_size_obj, (mp_obj_t)&hashlib_hash_digest_ //| def update(self, data: ReadableBuffer) -> None: //| """Update the hash with the given bytes. //| -//| :param ~circuitpython_typing.ReadableBuffer data: Update the hash from data in this buffer""" +//| :param ~circuitpython_typing.ReadableBuffer data: Update the hash from data in this buffer +//| """ //| ... mp_obj_t hashlib_hash_update(mp_obj_t self_in, mp_obj_t buf_in) { mp_check_self(mp_obj_is_type(self_in, &hashlib_hash_type)); diff --git a/shared-bindings/ipaddress/__init__.c b/shared-bindings/ipaddress/__init__.c index fb4c8bf38d..6da5a52299 100644 --- a/shared-bindings/ipaddress/__init__.c +++ b/shared-bindings/ipaddress/__init__.c @@ -35,6 +35,7 @@ //| The `ipaddress` module provides types for IP addresses. It is a subset of CPython's ipaddress //| module. //| """ +//| bool ipaddress_parse_ipv4address(const char *str_data, size_t str_len, uint32_t *ip_out) { diff --git a/shared-bindings/is31fl3741/IS31FL3741.c b/shared-bindings/is31fl3741/IS31FL3741.c index 706e3deb2b..17b12da67a 100644 --- a/shared-bindings/is31fl3741/IS31FL3741.c +++ b/shared-bindings/is31fl3741/IS31FL3741.c @@ -141,7 +141,8 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(is31fl3741_IS31FL3741_set_led_obj, 4, 4, is3 //| """Write buf out on the I2C bus to the IS31FL3741. //| //| :param ~Tuple[int, ...] mapping: map the pixels in the buffer to the order addressed by the driver chip -//| :param ~_typing.ReadableBuffer buf: The bytes to clock out. No assumption is made about color order""" +//| :param ~_typing.ReadableBuffer buf: The bytes to clock out. No assumption is made about color order +//| """ //| ... //| STATIC mp_obj_t is31fl3741_IS31FL3741_write(mp_obj_t self_in, mp_obj_t mapping, mp_obj_t buffer) { diff --git a/shared-bindings/keypad/Event.c b/shared-bindings/keypad/Event.c index 56a5815636..c8d24294f8 100644 --- a/shared-bindings/keypad/Event.c +++ b/shared-bindings/keypad/Event.c @@ -148,7 +148,8 @@ STATIC mp_obj_t keypad_event_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_ob //| def __hash__(self) -> int: //| """Returns a hash for the `Event`, so it can be used in dictionaries, etc.. //| -//| Note that as events with different timestamps compare equal, they also hash to the same value.""" +//| Note that as events with different timestamps compare equal, they also hash to the same value. +//| """ //| ... //| STATIC mp_obj_t keypad_event_unary_op(mp_unary_op_t op, mp_obj_t self_in) { diff --git a/shared-bindings/math/__init__.c b/shared-bindings/math/__init__.c index 42a32749da..8aee44ffb8 100644 --- a/shared-bindings/math/__init__.c +++ b/shared-bindings/math/__init__.c @@ -86,6 +86,7 @@ STATIC NORETURN void math_error(void) { //| //| pi: float //| """the ratio of a circle's circumference to its diameter""" +//| //| def acos(x: float) -> float: //| """Return the inverse cosine of ``x``.""" diff --git a/shared-bindings/memorymonitor/__init__.c b/shared-bindings/memorymonitor/__init__.c index 12c91cd150..7b05acd095 100644 --- a/shared-bindings/memorymonitor/__init__.c +++ b/shared-bindings/memorymonitor/__init__.c @@ -34,6 +34,7 @@ #include "shared-bindings/memorymonitor/AllocationSize.h" //| """Memory monitoring helpers""" +//| //| class AllocationError(Exception): //| """Catchall exception for allocation related errors.""" diff --git a/shared-bindings/microcontroller/__init__.c b/shared-bindings/microcontroller/__init__.c index 5716f7270e..2c1fdd5b58 100644 --- a/shared-bindings/microcontroller/__init__.c +++ b/shared-bindings/microcontroller/__init__.c @@ -60,6 +60,7 @@ //| """CPU information and control, such as ``cpus[0].temperature`` and ``cpus[1].frequency`` //| (clock frequency) on chips with more than 1 cpu. The index selects which cpu. //| This object is an instance of `microcontroller.Processor`.""" +//| //| def delay_us(delay: int) -> None: //| """Dedicated delay method used for very short delays. **Do not** do long delays diff --git a/shared-bindings/msgpack/__init__.c b/shared-bindings/msgpack/__init__.c index d505e3a6d8..7773d6d190 100644 --- a/shared-bindings/msgpack/__init__.c +++ b/shared-bindings/msgpack/__init__.c @@ -84,6 +84,7 @@ //| print(f"{data} -> {buffer.getvalue()} -> {decoded}") //| //| """ +//| //| def pack( //| obj: object, diff --git a/shared-bindings/neopixel_write/__init__.c b/shared-bindings/neopixel_write/__init__.c index 66c36af34b..cc0e2a041a 100644 --- a/shared-bindings/neopixel_write/__init__.c +++ b/shared-bindings/neopixel_write/__init__.c @@ -109,7 +109,8 @@ STATIC void check_for_deinit(digitalio_digitalinout_obj_t *self) { //| """Write buf out on the given DigitalInOut. //| //| :param ~digitalio.DigitalInOut digitalinout: the DigitalInOut to output with -//| :param ~circuitpython_typing.ReadableBuffer buf: The bytes to clock out. No assumption is made about color order""" +//| :param ~circuitpython_typing.ReadableBuffer buf: The bytes to clock out. No assumption is made about color order +//| """ //| ... //| STATIC mp_obj_t neopixel_write_neopixel_write_(mp_obj_t digitalinout_obj, mp_obj_t buf) { diff --git a/shared-bindings/rainbowio/__init__.c b/shared-bindings/rainbowio/__init__.c index 0dfdcd3a45..324f43198e 100644 --- a/shared-bindings/rainbowio/__init__.c +++ b/shared-bindings/rainbowio/__init__.c @@ -33,7 +33,8 @@ //| //| def colorwheel(n: float) -> int: //| """C implementation of the common colorwheel() function found in many examples. -//| Returns the colorwheel RGB value as an integer value for n (usable in neopixel and dotstar).""" +//| Returns the colorwheel RGB value as an integer value for n (usable in neopixel and dotstar). +//| """ //| ... //| STATIC mp_obj_t rainbowio_colorwheel(mp_obj_t n) { diff --git a/shared-bindings/random/__init__.c b/shared-bindings/random/__init__.c index fcf432931e..33cd9e90d0 100644 --- a/shared-bindings/random/__init__.c +++ b/shared-bindings/random/__init__.c @@ -47,6 +47,7 @@ //| from typing import TypeVar //| //| _T = TypeVar("_T") +//| //| def seed(seed: int) -> None: //| """Sets the starting seed of the random number generation. Further calls to diff --git a/shared-bindings/rtc/__init__.c b/shared-bindings/rtc/__init__.c index 64adfe7d9e..0220745c0f 100644 --- a/shared-bindings/rtc/__init__.c +++ b/shared-bindings/rtc/__init__.c @@ -36,6 +36,7 @@ //| The `rtc` module provides support for a Real Time Clock. You can access and manage the //| RTC using :class:`rtc.RTC`. It also backs the :func:`time.time` and :func:`time.localtime` //| functions using the onboard RTC if present.""" +//| void rtc_reset(void) { MP_STATE_VM(rtc_time_source) = (mp_obj_t)&rtc_rtc_obj; diff --git a/shared-bindings/sdcardio/SDCard.c b/shared-bindings/sdcardio/SDCard.c index 960d4a733e..ce67834774 100644 --- a/shared-bindings/sdcardio/SDCard.c +++ b/shared-bindings/sdcardio/SDCard.c @@ -126,7 +126,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(sdcardio_sdcard_deinit_obj, sdcardio_sdcard_deinit); //| def readblocks(self, start_block: int, buf: WriteableBuffer) -> None: -//| //| """Read one or more blocks from the card //| //| :param int start_block: The block to start reading from @@ -166,7 +165,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(sdcardio_sdcard_sync_obj, sdcardio_sdcard_sync); //| def writeblocks(self, start_block: int, buf: ReadableBuffer) -> None: -//| //| """Write one or more blocks to the card //| //| :param int start_block: The block to start writing from diff --git a/shared-bindings/sdioio/SDCard.c b/shared-bindings/sdioio/SDCard.c index f4cc4a9bb1..776b20fafe 100644 --- a/shared-bindings/sdioio/SDCard.c +++ b/shared-bindings/sdioio/SDCard.c @@ -160,7 +160,6 @@ STATIC mp_obj_t sdioio_sdcard_count(mp_obj_t self_in) { MP_DEFINE_CONST_FUN_OBJ_1(sdioio_sdcard_count_obj, sdioio_sdcard_count); //| def readblocks(self, start_block: int, buf: WriteableBuffer) -> None: -//| //| """Read one or more blocks from the card //| //| :param int start_block: The block to start reading from @@ -182,7 +181,6 @@ STATIC mp_obj_t sdioio_sdcard_readblocks(mp_obj_t self_in, mp_obj_t start_block_ MP_DEFINE_CONST_FUN_OBJ_3(sdioio_sdcard_readblocks_obj, sdioio_sdcard_readblocks); //| def writeblocks(self, start_block: int, buf: ReadableBuffer) -> None: -//| //| """Write one or more blocks to the card //| //| :param int start_block: The block to start writing from diff --git a/shared-bindings/socketpool/Socket.c b/shared-bindings/socketpool/Socket.c index fbf78a4cdc..9d439b5bd4 100644 --- a/shared-bindings/socketpool/Socket.c +++ b/shared-bindings/socketpool/Socket.c @@ -379,7 +379,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socketpool_socket_setsockopt_obj, 4, //| def settimeout(self, value: int) -> None: //| """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. +//| """ //| ... //| STATIC mp_obj_t socketpool_socket_settimeout(mp_obj_t self_in, mp_obj_t timeout_in) { diff --git a/shared-bindings/socketpool/SocketPool.c b/shared-bindings/socketpool/SocketPool.c index f056c741f3..3023721378 100644 --- a/shared-bindings/socketpool/SocketPool.c +++ b/shared-bindings/socketpool/SocketPool.c @@ -52,6 +52,7 @@ //| returned by :py:attr:`wifi.radio` //| """ //| ... +//| STATIC mp_obj_t socketpool_socketpool_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { mp_arg_check_num(n_args, n_kw, 1, 1, false); diff --git a/shared-bindings/ssl/SSLSocket.c b/shared-bindings/ssl/SSLSocket.c index d6f4ad051c..e0e7911715 100644 --- a/shared-bindings/ssl/SSLSocket.c +++ b/shared-bindings/ssl/SSLSocket.c @@ -240,7 +240,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(ssl_sslsocket_send_obj, ssl_sslsocket_send); //| def settimeout(self, value: int) -> None: //| """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. +//| """ //| ... STATIC mp_obj_t ssl_sslsocket_settimeout(mp_obj_t self_in, mp_obj_t timeout_in) { ssl_sslsocket_obj_t *self = MP_OBJ_TO_PTR(self_in); diff --git a/shared-bindings/ssl/__init__.c b/shared-bindings/ssl/__init__.c index 9204c92790..6967860054 100644 --- a/shared-bindings/ssl/__init__.c +++ b/shared-bindings/ssl/__init__.c @@ -36,6 +36,7 @@ //| //| |see_cpython_module| :mod:`cpython:ssl`. //| """ +//| //| def create_default_context() -> ssl.SSLContext: //| """Return the default SSLContext.""" diff --git a/shared-bindings/struct/__init__.c b/shared-bindings/struct/__init__.c index 59bc78005d..5b63a15f15 100644 --- a/shared-bindings/struct/__init__.c +++ b/shared-bindings/struct/__init__.c @@ -46,6 +46,7 @@ //| //| Supported format codes: *b*, *B*, *x*, *h*, *H*, *i*, *I*, *l*, *L*, *q*, *Q*, //| *s*, *P*, *f*, *d* (the latter 2 depending on the floating-point support).""" +//| //| def calcsize(fmt: str) -> int: diff --git a/shared-bindings/supervisor/__init__.c b/shared-bindings/supervisor/__init__.c index 37f35e2e18..2c84fbc0dd 100644 --- a/shared-bindings/supervisor/__init__.c +++ b/shared-bindings/supervisor/__init__.c @@ -59,6 +59,7 @@ //| The status bar reports the current IP or BLE connection, what file is running, //| the last exception name and location, and firmware version information. //| This object is the sole instance of `supervisor.StatusBar`.""" +//| //| def reload() -> None: //| """Reload the main Python code and run it (equivalent to hitting Ctrl-D at the REPL).""" diff --git a/shared-bindings/traceback/__init__.c b/shared-bindings/traceback/__init__.c index 153587e919..3ad601eb39 100644 --- a/shared-bindings/traceback/__init__.c +++ b/shared-bindings/traceback/__init__.c @@ -37,6 +37,7 @@ //| |see_cpython_module| :mod:`cpython:traceback`. //| """ //| ... +//| STATIC void traceback_exception_common(bool is_print_exception, mp_print_t *print, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_exc, ARG_value, ARG_tb, ARG_limit, ARG_file, ARG_chain }; diff --git a/shared-bindings/uheap/__init__.c b/shared-bindings/uheap/__init__.c index 376be78ef1..40aa869225 100644 --- a/shared-bindings/uheap/__init__.c +++ b/shared-bindings/uheap/__init__.c @@ -32,6 +32,7 @@ #include "shared-bindings/uheap/__init__.h" //| """Heap size analysis""" +//| //| def info(object: object) -> int: //| """Prints memory debugging info for the given object and returns the diff --git a/shared-bindings/usb/core/__init__.c b/shared-bindings/usb/core/__init__.c index 84d202945a..faeef23a88 100644 --- a/shared-bindings/usb/core/__init__.c +++ b/shared-bindings/usb/core/__init__.c @@ -40,6 +40,7 @@ //| //| This is a subset of the PyUSB core module. //| """ +//| //| class USBError(OSError): //| """Catchall exception for USB related errors.""" diff --git a/shared-bindings/usb_cdc/__init__.c b/shared-bindings/usb_cdc/__init__.c index e23e289309..b4e712e854 100644 --- a/shared-bindings/usb_cdc/__init__.c +++ b/shared-bindings/usb_cdc/__init__.c @@ -62,6 +62,7 @@ //| """A `Serial` object that can be used to send and receive binary data to and from //| the host. //| Note that `data` is *disabled* by default. ``data`` is ``None`` if disabled.""" +//| //| def disable() -> None: //| """Do not present any USB CDC device to the host. diff --git a/shared-bindings/usb_hid/__init__.c b/shared-bindings/usb_hid/__init__.c index 9cb9303143..5c61cc52de 100644 --- a/shared-bindings/usb_hid/__init__.c +++ b/shared-bindings/usb_hid/__init__.c @@ -47,6 +47,7 @@ //| containing a `Device` that describes the boot device chosen (keyboard or mouse). //| The request for a boot device overrides any other HID devices. //| """ +//| //| def disable() -> None: //| """Do not present any USB HID devices to the host computer. diff --git a/shared-bindings/usb_midi/__init__.c b/shared-bindings/usb_midi/__init__.c index 982cd144da..d3d5cf2626 100644 --- a/shared-bindings/usb_midi/__init__.c +++ b/shared-bindings/usb_midi/__init__.c @@ -42,6 +42,7 @@ //| //| ports: Tuple[Union[PortIn, PortOut], ...] //| """Tuple of all MIDI ports. Each item is ether `PortIn` or `PortOut`.""" +//| //| def disable() -> None: //| """Disable presenting a USB MIDI device to the host. diff --git a/shared-bindings/ustack/__init__.c b/shared-bindings/ustack/__init__.c index b42fb2a614..17bdcbb1c0 100644 --- a/shared-bindings/ustack/__init__.c +++ b/shared-bindings/ustack/__init__.c @@ -35,6 +35,7 @@ //| """Stack information and analysis""" +//| #if MICROPY_MAX_STACK_USAGE //| def max_stack_usage() -> int: diff --git a/shared-bindings/vectorio/Circle.c b/shared-bindings/vectorio/Circle.c index 87cd46ad9a..9896876a8a 100644 --- a/shared-bindings/vectorio/Circle.c +++ b/shared-bindings/vectorio/Circle.c @@ -24,7 +24,8 @@ //| :param int radius: The radius of the circle in pixels //| :param int x: Initial x position of the axis. //| :param int y: Initial y position of the axis. -//| :param int color_index: Initial color_index to use when selecting color from the palette.""" +//| :param int color_index: Initial color_index to use when selecting color from the palette. +//| """ static mp_obj_t vectorio_circle_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_pixel_shader, ARG_radius, ARG_x, ARG_y, ARG_color_index }; static const mp_arg_t allowed_args[] = { diff --git a/shared-bindings/vectorio/Polygon.c b/shared-bindings/vectorio/Polygon.c index 6ad102e6e6..b188fc4955 100644 --- a/shared-bindings/vectorio/Polygon.c +++ b/shared-bindings/vectorio/Polygon.c @@ -32,7 +32,8 @@ //| :param List[Tuple[int,int]] points: Vertices for the polygon //| :param int x: Initial screen x position of the 0,0 origin in the points list. //| :param int y: Initial screen y position of the 0,0 origin in the points list. -//| :param int color_index: Initial color_index to use when selecting color from the palette.""" +//| :param int color_index: Initial color_index to use when selecting color from the palette. +//| """ static mp_obj_t vectorio_polygon_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_pixel_shader, ARG_points_list, ARG_x, ARG_y, ARG_color_index }; static const mp_arg_t allowed_args[] = { diff --git a/shared-bindings/vectorio/Rectangle.c b/shared-bindings/vectorio/Rectangle.c index a4f3e12e69..ad864f2c2d 100644 --- a/shared-bindings/vectorio/Rectangle.c +++ b/shared-bindings/vectorio/Rectangle.c @@ -25,7 +25,8 @@ //| :param int height: The number of pixels high //| :param int x: Initial x position of the top left corner. //| :param int y: Initial y position of the top left corner. -//| :param int color_index: Initial color_index to use when selecting color from the palette.""" +//| :param int color_index: Initial color_index to use when selecting color from the palette. +//| """ static mp_obj_t vectorio_rectangle_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_pixel_shader, ARG_width, ARG_height, ARG_x, ARG_y, ARG_color_index }; static const mp_arg_t allowed_args[] = { diff --git a/shared-bindings/watchdog/__init__.c b/shared-bindings/watchdog/__init__.c index df55ab7c16..5281f1c3fc 100644 --- a/shared-bindings/watchdog/__init__.c +++ b/shared-bindings/watchdog/__init__.c @@ -49,6 +49,7 @@ //| w.timeout=2.5 # Set a timeout of 2.5 seconds //| w.mode = WatchDogMode.RAISE //| w.feed()""" +//| //| class WatchDogTimeout(Exception): //| """Exception raised when the watchdog timer is set to diff --git a/shared-bindings/zlib/__init__.c b/shared-bindings/zlib/__init__.c index d9c2a01810..ba02914638 100644 --- a/shared-bindings/zlib/__init__.c +++ b/shared-bindings/zlib/__init__.c @@ -46,6 +46,7 @@ //| The `zlib` module allows limited functionality similar to the CPython zlib library. //| This module allows to decompress binary data compressed with DEFLATE algorithm //| (commonly used in zlib library and gzip archiver). Compression is not yet implemented.""" +//| //| def zlib_decompress( //| data: bytes, wbits: Optional[int] = 0, bufsize: Optional[int] = 0 diff --git a/tests/extmod/framebuf_subclass.py b/tests/extmod/framebuf_subclass.py index a9e3c5efc7..4cd9ea4eb5 100644 --- a/tests/extmod/framebuf_subclass.py +++ b/tests/extmod/framebuf_subclass.py @@ -34,6 +34,7 @@ fb.pixel(2, 2, 0x0708) fb2.blit(fb, 0, 0) print(bytes(fb2)) + # Test that blitting something that isn't a subclass fails with TypeError. class NotAFrameBuf: pass diff --git a/tests/extmod/uasyncio_exception.py b/tests/extmod/uasyncio_exception.py index aae55d6320..4e4f978dc2 100644 --- a/tests/extmod/uasyncio_exception.py +++ b/tests/extmod/uasyncio_exception.py @@ -9,6 +9,7 @@ except ImportError: print("SKIP") raise SystemExit + # main task raising an exception async def main(): print("main start") @@ -21,6 +22,7 @@ try: except ValueError as er: print("ValueError", er.args[0]) + # sub-task raising an exception async def task(): print("task start") @@ -40,6 +42,7 @@ try: except ValueError as er: print("ValueError", er.args[0]) + # main task raising an exception with sub-task not yet scheduled # TODO not currently working, task is never scheduled async def task(): diff --git a/tests/extmod/vfs_fat_fileio1.py b/tests/extmod/vfs_fat_fileio1.py index 10e92d6940..935f01d24f 100644 --- a/tests/extmod/vfs_fat_fileio1.py +++ b/tests/extmod/vfs_fat_fileio1.py @@ -13,7 +13,6 @@ except AttributeError: class RAMFS: - SEC_SIZE = 512 def __init__(self, blocks): diff --git a/tests/extmod/vfs_fat_fileio2.py b/tests/extmod/vfs_fat_fileio2.py index 7c75a6d044..6094b5a6f1 100644 --- a/tests/extmod/vfs_fat_fileio2.py +++ b/tests/extmod/vfs_fat_fileio2.py @@ -13,7 +13,6 @@ except AttributeError: class RAMFS: - SEC_SIZE = 512 def __init__(self, blocks): diff --git a/tests/extmod/vfs_fat_more.py b/tests/extmod/vfs_fat_more.py index 1b7b04ee63..f5de729402 100644 --- a/tests/extmod/vfs_fat_more.py +++ b/tests/extmod/vfs_fat_more.py @@ -12,7 +12,6 @@ except AttributeError: class RAMFS: - SEC_SIZE = 512 def __init__(self, blocks): diff --git a/tests/extmod/vfs_fat_oldproto.py b/tests/extmod/vfs_fat_oldproto.py index e447ff4eb3..1998319dbe 100644 --- a/tests/extmod/vfs_fat_oldproto.py +++ b/tests/extmod/vfs_fat_oldproto.py @@ -13,7 +13,6 @@ except AttributeError: class RAMFS_OLD: - SEC_SIZE = 512 def __init__(self, blocks): diff --git a/tests/extmod/vfs_fat_ramdisk.py b/tests/extmod/vfs_fat_ramdisk.py index 4b79391102..a22d480dfd 100644 --- a/tests/extmod/vfs_fat_ramdisk.py +++ b/tests/extmod/vfs_fat_ramdisk.py @@ -13,7 +13,6 @@ except AttributeError: class RAMFS: - SEC_SIZE = 512 def __init__(self, blocks): diff --git a/tests/extmod/vfs_fat_ramdisklarge.py b/tests/extmod/vfs_fat_ramdisklarge.py index 69d4a8cbbd..649a53db14 100644 --- a/tests/extmod/vfs_fat_ramdisklarge.py +++ b/tests/extmod/vfs_fat_ramdisklarge.py @@ -14,7 +14,6 @@ except AttributeError: class RAMBDevSparse: - SEC_SIZE = 512 def __init__(self, blocks): diff --git a/tests/import/module_getattr.py b/tests/import/module_getattr.py index df7a621815..9ca0d18455 100644 --- a/tests/import/module_getattr.py +++ b/tests/import/module_getattr.py @@ -8,6 +8,7 @@ try: except AttributeError: pass + # define __getattr__ def __getattr__(attr): if attr == "does_not_exist": diff --git a/tests/inlineasm/asmsum.py b/tests/inlineasm/asmsum.py index 6535a495d4..208709a25f 100644 --- a/tests/inlineasm/asmsum.py +++ b/tests/inlineasm/asmsum.py @@ -1,6 +1,5 @@ @micropython.asm_thumb def asm_sum_words(r0, r1): - # r0 = len # r1 = ptr # r2 = sum @@ -25,7 +24,6 @@ def asm_sum_words(r0, r1): @micropython.asm_thumb def asm_sum_bytes(r0, r1): - # r0 = len # r1 = ptr # r2 = sum diff --git a/tests/micropython/const2.py b/tests/micropython/const2.py index ed4720122e..d8b68c25f3 100644 --- a/tests/micropython/const2.py +++ b/tests/micropython/const2.py @@ -11,6 +11,7 @@ import micropython as X print(globals()["X"]) + # function name that matches a constant def X(): print("function X", X) @@ -18,6 +19,7 @@ def X(): globals()["X"]() + # arguments that match a constant def f(X, *Y, **Z): pass @@ -25,6 +27,7 @@ def f(X, *Y, **Z): f(1) + # class name that matches a constant class X: def f(self): @@ -33,6 +36,7 @@ class X: globals()["X"]().f() + # constant within a class class A: C1 = const(4) diff --git a/tests/micropython/heapalloc_yield_from.py b/tests/micropython/heapalloc_yield_from.py index 58788b1dbc..9507171890 100644 --- a/tests/micropython/heapalloc_yield_from.py +++ b/tests/micropython/heapalloc_yield_from.py @@ -2,6 +2,7 @@ import micropython + # Yielding from a function generator def sub_gen(a): for i in range(a): @@ -18,6 +19,7 @@ print(next(g)) print(next(g)) micropython.heap_unlock() + # Yielding from a user iterator class G: def __init__(self): diff --git a/tests/micropython/native_closure.py b/tests/micropython/native_closure.py index 07014e90da..8182cfea70 100644 --- a/tests/micropython/native_closure.py +++ b/tests/micropython/native_closure.py @@ -1,5 +1,6 @@ # test native emitter can handle closures correctly + # basic closure @micropython.native def f(): @@ -15,6 +16,7 @@ def f(): print(f()()) + # closing over an argument @micropython.native def f(x): @@ -28,6 +30,7 @@ def f(x): print(f(2)()) + # closing over an argument and a normal local @micropython.native def f(x): diff --git a/tests/micropython/native_gen.py b/tests/micropython/native_gen.py index fb42f9e25e..7ea45b1497 100644 --- a/tests/micropython/native_gen.py +++ b/tests/micropython/native_gen.py @@ -1,5 +1,6 @@ # test for native generators + # simple generator with yield and return @micropython.native def gen1(x): @@ -16,6 +17,7 @@ try: except StopIteration as e: print(e.args[0]) + # using yield from @micropython.native def gen2(x): diff --git a/tests/micropython/native_misc.py b/tests/micropython/native_misc.py index f5ef807fe1..f40fcb2407 100644 --- a/tests/micropython/native_misc.py +++ b/tests/micropython/native_misc.py @@ -1,5 +1,6 @@ # tests for natively compiled functions + # basic test @micropython.native def native_test(x): @@ -14,6 +15,7 @@ import gc gc.collect() native_test(3) + # native with 2 args @micropython.native def f(a, b): @@ -22,6 +24,7 @@ def f(a, b): f(1, 2) + # native with 3 args @micropython.native def f(a, b, c): @@ -30,6 +33,7 @@ def f(a, b, c): f(1, 2, 3) + # check not operator @micropython.native def f(a): diff --git a/tests/micropython/native_try.py b/tests/micropython/native_try.py index 492b59085c..6a2152b28c 100644 --- a/tests/micropython/native_try.py +++ b/tests/micropython/native_try.py @@ -1,5 +1,6 @@ # test native try handling + # basic try-finally @micropython.native def f(): @@ -14,6 +15,7 @@ try: except NameError: print("NameError") + # nested try-except with try-finally @micropython.native def f(): @@ -28,6 +30,7 @@ def f(): f() + # check that locals written to in try blocks keep their values @micropython.native def f(): diff --git a/tests/micropython/native_try_deep.py b/tests/micropython/native_try_deep.py index 3d31248df0..26b9243e03 100644 --- a/tests/micropython/native_try_deep.py +++ b/tests/micropython/native_try_deep.py @@ -1,5 +1,6 @@ # test native try handling + # deeply nested try (9 deep) @micropython.native def f(): diff --git a/tests/micropython/native_with.py b/tests/micropython/native_with.py index 4e20b23856..9c0b98af90 100644 --- a/tests/micropython/native_with.py +++ b/tests/micropython/native_with.py @@ -21,6 +21,7 @@ def f(): f() + # nested with and try-except @micropython.native def f(): diff --git a/tests/micropython/viper_args.py b/tests/micropython/viper_args.py index 8e3225331a..27c73fa795 100644 --- a/tests/micropython/viper_args.py +++ b/tests/micropython/viper_args.py @@ -56,6 +56,7 @@ def f6(x1: int, x2: int, x3: int, x4: int, x5: int, x6: int): f6(1, 2, 3, 4, 5, 6) + # test compiling *x, **x, * args (currently unsupported at runtime) @micropython.viper def f(*x, **y): diff --git a/tests/micropython/viper_cond.py b/tests/micropython/viper_cond.py index d5ebf837bd..752261ff50 100644 --- a/tests/micropython/viper_cond.py +++ b/tests/micropython/viper_cond.py @@ -10,6 +10,7 @@ def f(): f() + # using True as a conditional @micropython.viper def f(): @@ -20,6 +21,7 @@ def f(): f() + # using an int as a conditional @micropython.viper def g(): @@ -30,6 +32,7 @@ def g(): g() + # using an int as a conditional that has the lower 16-bits clear @micropython.viper def h(): diff --git a/tests/micropython/viper_misc.py b/tests/micropython/viper_misc.py index 41389c751d..f9267f65ca 100644 --- a/tests/micropython/viper_misc.py +++ b/tests/micropython/viper_misc.py @@ -1,5 +1,6 @@ import micropython + # viper function taking and returning ints @micropython.viper def viper_int(x: int, y: int) -> int: @@ -8,6 +9,7 @@ def viper_int(x: int, y: int) -> int: print(viper_int(1, 2)) + # viper function taking and returning objects @micropython.viper def viper_object(x: object, y: object) -> object: @@ -16,6 +18,7 @@ def viper_object(x: object, y: object) -> object: print(viper_object(1, 2)) + # return None as non-object (should return 0) @micropython.viper def viper_ret_none() -> int: @@ -24,6 +27,7 @@ def viper_ret_none() -> int: print(viper_ret_none()) + # return Ellipsis as object @micropython.viper def viper_ret_ellipsis() -> object: @@ -32,6 +36,7 @@ def viper_ret_ellipsis() -> object: print(viper_ret_ellipsis()) + # 3 args @micropython.viper def viper_3args(a: int, b: int, c: int) -> int: @@ -40,6 +45,7 @@ def viper_3args(a: int, b: int, c: int) -> int: print(viper_3args(1, 2, 3)) + # 4 args @micropython.viper def viper_4args(a: int, b: int, c: int, d: int) -> int: @@ -49,6 +55,7 @@ def viper_4args(a: int, b: int, c: int, d: int) -> int: # viper call with 4 args not yet supported # print(viper_4args(1, 2, 3, 4)) + # a local (should have automatic type int) @micropython.viper def viper_local(x: int) -> int: @@ -58,6 +65,7 @@ def viper_local(x: int) -> int: print(viper_local(3)) + # without type annotation, types should default to object @micropython.viper def viper_no_annotation(x, y): @@ -66,6 +74,7 @@ def viper_no_annotation(x, y): print(viper_no_annotation(4, 5)) + # a for loop @micropython.viper def viper_for(a: int, b: int) -> int: @@ -77,6 +86,7 @@ def viper_for(a: int, b: int) -> int: print(viper_for(10, 10000)) + # accessing a global @micropython.viper def viper_access_global(): @@ -87,6 +97,7 @@ def viper_access_global(): print(viper_access_global(), gl) + # calling print with object and int types @micropython.viper def viper_print(x, y: int): @@ -95,6 +106,7 @@ def viper_print(x, y: int): viper_print(1, 2) + # convert constants to objects in tuple @micropython.viper def viper_tuple_consts(x): @@ -103,6 +115,7 @@ def viper_tuple_consts(x): print(viper_tuple_consts(0)) + # making a tuple from an object and an int @micropython.viper def viper_tuple(x, y: int): @@ -111,6 +124,7 @@ def viper_tuple(x, y: int): print(viper_tuple(1, 2)) + # making a list from an object and an int @micropython.viper def viper_list(x, y: int): @@ -119,6 +133,7 @@ def viper_list(x, y: int): print(viper_list(1, 2)) + # making a set from an object and an int @micropython.viper def viper_set(x, y: int): @@ -127,6 +142,7 @@ def viper_set(x, y: int): print(sorted(list(viper_set(1, 2)))) + # raising an exception @micropython.viper def viper_raise(x: int): @@ -138,6 +154,7 @@ try: except OSError as e: print(repr(e)) + # calling GC after defining the function @micropython.viper def viper_gc() -> int: diff --git a/tests/micropython/viper_misc2.py b/tests/micropython/viper_misc2.py index 8f0be487d6..cc77134bd4 100644 --- a/tests/micropython/viper_misc2.py +++ b/tests/micropython/viper_misc2.py @@ -1,5 +1,6 @@ # Miscellaneous viper tests + # Test correct use of registers in load and store @micropython.viper def expand(dest: ptr8, source: ptr8, length: int): diff --git a/tests/micropython/viper_misc_intbig.py b/tests/micropython/viper_misc_intbig.py index 055c08d8e5..91673f2c10 100644 --- a/tests/micropython/viper_misc_intbig.py +++ b/tests/micropython/viper_misc_intbig.py @@ -1,5 +1,6 @@ import micropython + # unsigned ints @micropython.viper def viper_uint() -> uint: diff --git a/tests/micropython/viper_try.py b/tests/micropython/viper_try.py index 61335af221..f5822a6682 100644 --- a/tests/micropython/viper_try.py +++ b/tests/micropython/viper_try.py @@ -1,5 +1,6 @@ # test try handling within a viper function + # basic try-finally @micropython.viper def f(): @@ -14,6 +15,7 @@ try: except NameError: print("NameError") + # nested try-except with try-finally @micropython.viper def f(): @@ -28,6 +30,7 @@ def f(): f() + # check that locals written to in try blocks keep their values @micropython.viper def f(): diff --git a/tests/micropython/viper_types.py b/tests/micropython/viper_types.py index 3af148171e..3e0a4f6640 100644 --- a/tests/micropython/viper_types.py +++ b/tests/micropython/viper_types.py @@ -2,6 +2,7 @@ import micropython + # converting incoming arg to bool @micropython.viper def f1(x: bool): @@ -13,6 +14,7 @@ f1(1) f1([]) f1([1]) + # taking and returning a bool @micropython.viper def f2(x: bool) -> bool: @@ -22,6 +24,7 @@ def f2(x: bool) -> bool: print(f2([])) print(f2([1])) + # converting to bool within function @micropython.viper def f3(x) -> bool: diff --git a/tests/micropython/viper_with.py b/tests/micropython/viper_with.py index d640c8ae0f..40fbf6fb31 100644 --- a/tests/micropython/viper_with.py +++ b/tests/micropython/viper_with.py @@ -21,6 +21,7 @@ def f(): f() + # nested with and try-except @micropython.viper def f(): diff --git a/tests/misc/non_compliant.py b/tests/misc/non_compliant.py index cff1894106..1c3706ec33 100644 --- a/tests/misc/non_compliant.py +++ b/tests/misc/non_compliant.py @@ -111,6 +111,7 @@ try: except NotImplementedError: print("NotImplementedError") + # can't assign attributes to a function def f(): pass @@ -127,6 +128,7 @@ try: except TypeError: print("TypeError") + # test when object explicitly listed at not-last position in parent tuple # this is not compliant with CPython because of illegal MRO class A: @@ -140,6 +142,7 @@ class B(object, A): B().foo() + # can't assign property (or other special accessors) to already-subclassed class class A: pass diff --git a/tests/misc/sys_settrace_generator.py b/tests/misc/sys_settrace_generator.py index 43065df4ae..1199f1f4eb 100644 --- a/tests/misc/sys_settrace_generator.py +++ b/tests/misc/sys_settrace_generator.py @@ -48,11 +48,9 @@ def test_generator(): gen = make_gen() r = 0 try: - r += gen.send(None) while True: - r += gen.send(None) except StopIteration as e: diff --git a/tests/misc/sys_settrace_subdir/sys_settrace_generic.py b/tests/misc/sys_settrace_subdir/sys_settrace_generic.py index a60ca955d7..fcf034af25 100644 --- a/tests/misc/sys_settrace_subdir/sys_settrace_generic.py +++ b/tests/misc/sys_settrace_subdir/sys_settrace_generic.py @@ -1,5 +1,6 @@ print("Now comes the language constructions tests.") + # function def test_func(): def test_sub_func(): diff --git a/tests/perf_bench/bm_nqueens.py b/tests/perf_bench/bm_nqueens.py index 773dd3f7ed..160f1178aa 100644 --- a/tests/perf_bench/bm_nqueens.py +++ b/tests/perf_bench/bm_nqueens.py @@ -5,6 +5,7 @@ # author: collinwinter@google.com (Collin Winter) # n_queens function: Copyright 2009 Raymond Hettinger + # Pure-Python implementation of itertools.permutations(). def permutations(iterable, r=None): """permutations(range(3), 2) --> (0,1) (0,2) (1,0) (1,2) (2,0) (2,1)""" diff --git a/tests/perf_bench/misc_aes.py b/tests/perf_bench/misc_aes.py index 0743737cb7..8a9c58bb38 100644 --- a/tests/perf_bench/misc_aes.py +++ b/tests/perf_bench/misc_aes.py @@ -33,6 +33,7 @@ aes_s_box_table = bytes(( )) # fmt: on + # multiplication of polynomials modulo x^8 + x^4 + x^3 + x + 1 = 0x11b def aes_gf8_mul_2(x): if x & 0x80: @@ -64,6 +65,7 @@ def aes_r_con(a): ################################################################## # basic AES algorithm; see FIPS-197 + # all inputs must be size 16 def aes_add_round_key(state, w): for i in range(16): diff --git a/tests/run-internalbench.py b/tests/run-internalbench.py index 606fc3b772..24f6d5a771 100755 --- a/tests/run-internalbench.py +++ b/tests/run-internalbench.py @@ -26,7 +26,6 @@ def run_tests(pyb, test_dict): for base_test, tests in sorted(test_dict.items()): print(base_test + ":") for test_file in tests: - # run MicroPython if pyb is None: # run on PC diff --git a/tests/stress/qstr_limit.py b/tests/stress/qstr_limit.py index d8ce0cf7cd..08b10a039f 100644 --- a/tests/stress/qstr_limit.py +++ b/tests/stress/qstr_limit.py @@ -17,6 +17,7 @@ for l in range(254, 259): continue print(var in g) + # calling a function with kwarg def f(**k): print(k) @@ -36,6 +37,7 @@ for l in range(254, 259): except RuntimeError: print("RuntimeError", l) + # hasattr, setattr, getattr class A: pass diff --git a/tests/stress/recursive_gen.py b/tests/stress/recursive_gen.py index 8c21397658..e051abb84d 100644 --- a/tests/stress/recursive_gen.py +++ b/tests/stress/recursive_gen.py @@ -1,5 +1,6 @@ # test deeply recursive generators + # simple "yield from" recursion def gen(): yield from gen() @@ -10,6 +11,7 @@ try: except RuntimeError: print("RuntimeError") + # recursion via an iterator over a generator def gen2(): for x in gen2(): diff --git a/tests/thread/mutate_bytearray.py b/tests/thread/mutate_bytearray.py index 9b52e0c016..7bacabec3a 100644 --- a/tests/thread/mutate_bytearray.py +++ b/tests/thread/mutate_bytearray.py @@ -9,6 +9,7 @@ import _thread # the shared bytearray ba = bytearray() + # main thread function def th(n, lo, hi): for repeat in range(n): diff --git a/tests/thread/mutate_dict.py b/tests/thread/mutate_dict.py index 0840dcafba..fb87190e77 100644 --- a/tests/thread/mutate_dict.py +++ b/tests/thread/mutate_dict.py @@ -9,6 +9,7 @@ import _thread # the shared dict di = {"a": "A", "b": "B", "c": "C", "d": "D"} + # main thread function def th(n, lo, hi): for repeat in range(n): diff --git a/tests/thread/mutate_instance.py b/tests/thread/mutate_instance.py index 8ba91cbde3..cc0ad9885d 100644 --- a/tests/thread/mutate_instance.py +++ b/tests/thread/mutate_instance.py @@ -6,6 +6,7 @@ import _thread + # the shared user class and instance class User: def __init__(self): @@ -16,6 +17,7 @@ class User: user = User() + # main thread function def th(n, lo, hi): for repeat in range(n): diff --git a/tests/thread/mutate_list.py b/tests/thread/mutate_list.py index 8ce15c0852..4df86b3008 100644 --- a/tests/thread/mutate_list.py +++ b/tests/thread/mutate_list.py @@ -9,6 +9,7 @@ import _thread # the shared list li = list() + # main thread function def th(n, lo, hi): for repeat in range(n): diff --git a/tests/thread/mutate_set.py b/tests/thread/mutate_set.py index 61169b8aa9..587a3a259a 100644 --- a/tests/thread/mutate_set.py +++ b/tests/thread/mutate_set.py @@ -9,6 +9,7 @@ import _thread # the shared set se = set([-1, -2, -3, -4]) + # main thread function def th(n, lo, hi): for repeat in range(n): diff --git a/tests/thread/stress_aes.py b/tests/thread/stress_aes.py index 673337563d..199fe3c88c 100644 --- a/tests/thread/stress_aes.py +++ b/tests/thread/stress_aes.py @@ -40,6 +40,7 @@ aes_s_box_table = bytes(( )) # fmt: on + # multiplication of polynomials modulo x^8 + x^4 + x^3 + x + 1 = 0x11b def aes_gf8_mul_2(x): if x & 0x80: @@ -82,6 +83,7 @@ def aes_r_con(a): # using OCB, where the sequence is xored against the plaintext. # Care must be taken to (almost) always choose a different IV. + # all inputs must be size 16 def aes_add_round_key(state, w): for i in range(16): diff --git a/tests/thread/thread_qstr1.py b/tests/thread/thread_qstr1.py index 2099f94bdb..9e7d7f0326 100644 --- a/tests/thread/thread_qstr1.py +++ b/tests/thread/thread_qstr1.py @@ -10,6 +10,7 @@ except ImportError: import time import _thread + # function to check the interned string def check(s, val): assert type(s) == str diff --git a/tests/unicode/unicode_id.py b/tests/unicode/unicode_id.py index 3a58e3f72b..32817287e9 100644 --- a/tests/unicode/unicode_id.py +++ b/tests/unicode/unicode_id.py @@ -10,6 +10,7 @@ bβ = 3 βb = 4 print(α, αβγ, bβ, βb) + # function, argument, local identifiers def α(β, γ): δ = β + γ @@ -18,6 +19,7 @@ def α(β, γ): α(1, 2) + # class, method identifiers class φ: def __init__(self): diff --git a/tools/codeformat.py b/tools/codeformat.py index 223c2bad45..f76e5f0681 100644 --- a/tools/codeformat.py +++ b/tools/codeformat.py @@ -71,6 +71,7 @@ EXCLUSIONS = [ "ports/raspberrypi/lwip_src", ] + # None of the standard Python path matching routines implement the matching # we want, which is most like git's "pathspec" version of globs. # In particular, we want "**/" to match all directories. diff --git a/tools/extract_pyi.py b/tools/extract_pyi.py index 5f4f9c9561..e6bc703c02 100644 --- a/tools/extract_pyi.py +++ b/tools/extract_pyi.py @@ -215,7 +215,7 @@ def convert_folder(top_level, stub_directory): return (ok, total) error = False - for (level, msg) in find_stub_issues(tree): + for level, msg in find_stub_issues(tree): if level == "ERROR": error = True print(f"[{level}] {msg}") diff --git a/tools/gen_crt_bundle.py b/tools/gen_crt_bundle.py index eb314bf25e..da0d8837a9 100755 --- a/tools/gen_crt_bundle.py +++ b/tools/gen_crt_bundle.py @@ -72,7 +72,6 @@ class CertificateBundle: os.remove(ca_bundle_bin_file) def add_from_path(self, crts_path): - found = False for file_path in os.listdir(crts_path): found |= self.add_from_file(os.path.join(crts_path, file_path)) @@ -161,7 +160,6 @@ class CertificateBundle: return bundle def add_with_filter(self, crts_path, filter_path): - filter_set = set() with open(filter_path, "r", encoding="utf-8") as f: csv_reader = csv.reader(f, delimiter=",") diff --git a/tools/gendoc.py b/tools/gendoc.py index bf79b3cf5f..f3df853e49 100644 --- a/tools/gendoc.py +++ b/tools/gendoc.py @@ -11,6 +11,7 @@ import argparse import re import markdown + # given a list of (name,regex) pairs, find the first one that matches the given line def re_match_first(regexs, line): for name, regex in regexs: diff --git a/tools/mpy-tool.py b/tools/mpy-tool.py index 32b064d35f..02ea656c99 100755 --- a/tools/mpy-tool.py +++ b/tools/mpy-tool.py @@ -107,6 +107,7 @@ MP_BC_LOAD_GLOBAL = 0x12 MP_BC_LOAD_ATTR = 0x13 MP_BC_STORE_ATTR = 0x18 + # this function mirrors that in py/bc.c def mp_opcode_format(bytecode, ip, count_var_uint): opcode = bytecode[ip] diff --git a/tools/preprocess_frozen_modules.py b/tools/preprocess_frozen_modules.py index 30263d2e02..6c41c4cd43 100755 --- a/tools/preprocess_frozen_modules.py +++ b/tools/preprocess_frozen_modules.py @@ -46,7 +46,6 @@ def version_string(path=None, *, valid_semver=False): # with actual version info derived from git. def copy_and_process(in_dir, out_dir): for root, subdirs, files in os.walk(in_dir): - # Skip library examples directory and subfolders. relative_path_parts = Path(root).relative_to(in_dir).parts if relative_path_parts and relative_path_parts[0] in [ From 79e07bfe00afd4f6b9e63c8ab030818a62a651a2 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 1 Feb 2023 09:08:18 -0600 Subject: [PATCH 36/52] update ulab to 6.0.7 --- extmod/ulab | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extmod/ulab b/extmod/ulab index e68bb707b2..f2dd2230c4 160000 --- a/extmod/ulab +++ b/extmod/ulab @@ -1 +1 @@ -Subproject commit e68bb707b20ee326d84ab75fc9fb35f2e85b87e3 +Subproject commit f2dd2230c4fdf1aa5c7a160782efdde18e8204bb From c9e45433ffe7499b44e1876241a066bf195ad36e Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Wed, 1 Feb 2023 14:03:52 -0500 Subject: [PATCH 37/52] make translate --- locale/circuitpython.pot | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index b2c7155f18..72ee60cc0c 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -2479,6 +2479,10 @@ msgstr "" msgid "array has too many dimensions" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2907,6 +2911,10 @@ msgstr "" msgid "div/mod not implemented for uint" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "divide by zero" +msgstr "" + #: py/runtime.c msgid "division by zero" msgstr "" @@ -3720,6 +3728,10 @@ msgstr "" msgid "only mono is supported" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "" From 764d731e2491fb0bff26719a0a6b3d1928ea2f74 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Wed, 1 Feb 2023 22:25:19 +0100 Subject: [PATCH 38/52] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 12 ++++++++++++ locale/cs.po | 12 ++++++++++++ locale/de_DE.po | 15 ++++++++++++--- locale/el.po | 12 ++++++++++++ locale/en_GB.po | 15 ++++++++++++--- locale/es.po | 15 ++++++++++++--- locale/fil.po | 12 ++++++++++++ locale/fr.po | 15 ++++++++++++--- locale/hi.po | 12 ++++++++++++ locale/it_IT.po | 12 ++++++++++++ locale/ja.po | 12 ++++++++++++ locale/ko.po | 12 ++++++++++++ locale/nl.po | 12 ++++++++++++ locale/pl.po | 12 ++++++++++++ locale/pt_BR.po | 15 ++++++++++++--- locale/ru.po | 12 ++++++++++++ locale/sv.po | 15 ++++++++++++--- locale/tr.po | 12 ++++++++++++ locale/zh_Latn_pinyin.po | 15 ++++++++++++--- 19 files changed, 228 insertions(+), 21 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 088df0b059..546828a14d 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -2510,6 +2510,10 @@ msgstr "" msgid "array has too many dimensions" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2938,6 +2942,10 @@ msgstr "" msgid "div/mod not implemented for uint" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "divide by zero" +msgstr "" + #: py/runtime.c msgid "division by zero" msgstr "" @@ -3752,6 +3760,10 @@ msgstr "" msgid "only mono is supported" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "" diff --git a/locale/cs.po b/locale/cs.po index 2f7c53ee13..51ed1674f7 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -2497,6 +2497,10 @@ msgstr "" msgid "array has too many dimensions" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2925,6 +2929,10 @@ msgstr "" msgid "div/mod not implemented for uint" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "divide by zero" +msgstr "" + #: py/runtime.c msgid "division by zero" msgstr "" @@ -3738,6 +3746,10 @@ msgstr "" msgid "only mono is supported" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index 0dde7441cc..594e2005cc 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -2555,6 +2555,10 @@ msgstr "Array- und Indexlänge müssen gleich sein" msgid "array has too many dimensions" msgstr "Das Array hat zu viele Dimensionen" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2995,6 +2999,10 @@ msgstr "Abmessungen stimmen nicht überein" msgid "div/mod not implemented for uint" msgstr "div/mod für uint nicht implementiert" +#: extmod/ulab/code/numpy/create.c +msgid "divide by zero" +msgstr "durch Null dividieren" + #: py/runtime.c msgid "division by zero" msgstr "Division durch Null" @@ -3818,6 +3826,10 @@ msgstr "nur eine bit_depth=16 wird unterstützt" msgid "only mono is supported" msgstr "nur Mono wird unterstützt" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "" @@ -4505,9 +4517,6 @@ msgstr "zi muss die Form (n_section, 2) haben" #~ msgid "complex division by zero" #~ msgstr "Komplexe Division durch null" -#~ msgid "divide by zero" -#~ msgstr "durch Null dividieren" - #~ msgid "int() arg 2 must be >= 2 and <= 36" #~ msgstr "int() arg 2 muss >= 2 und <= 36 sein" diff --git a/locale/el.po b/locale/el.po index 0077b44c2e..7c816d4a9f 100644 --- a/locale/el.po +++ b/locale/el.po @@ -2506,6 +2506,10 @@ msgstr "" msgid "array has too many dimensions" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2934,6 +2938,10 @@ msgstr "" msgid "div/mod not implemented for uint" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "divide by zero" +msgstr "" + #: py/runtime.c msgid "division by zero" msgstr "" @@ -3747,6 +3755,10 @@ msgstr "" msgid "only mono is supported" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "" diff --git a/locale/en_GB.po b/locale/en_GB.po index 03af36dbaa..ece9ec14f3 100644 --- a/locale/en_GB.po +++ b/locale/en_GB.po @@ -2513,6 +2513,10 @@ msgstr "array and index length must be equal" msgid "array has too many dimensions" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2944,6 +2948,10 @@ msgstr "dimensions do not match" msgid "div/mod not implemented for uint" msgstr "div/mod not implemented for uint" +#: extmod/ulab/code/numpy/create.c +msgid "divide by zero" +msgstr "divide by zero" + #: py/runtime.c msgid "division by zero" msgstr "division by zero" @@ -3757,6 +3765,10 @@ msgstr "only bit_depth=16 is supported" msgid "only mono is supported" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "" @@ -4408,9 +4420,6 @@ msgstr "zi must be of shape (n_section, 2)" #~ msgid "complex division by zero" #~ msgstr "complex division by zero" -#~ msgid "divide by zero" -#~ msgstr "divide by zero" - #~ msgid "int() arg 2 must be >= 2 and <= 36" #~ msgstr "int() arg 2 must be >= 2 and <= 36" diff --git a/locale/es.po b/locale/es.po index 497fadf870..2503a3150d 100644 --- a/locale/es.po +++ b/locale/es.po @@ -2563,6 +2563,10 @@ msgstr "Longitud del array e índice tienen que ser iguales" msgid "array has too many dimensions" msgstr "La matriz tiene demasiadas dimensiones" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2998,6 +3002,10 @@ msgstr "las dimensiones no concuerdan" msgid "div/mod not implemented for uint" msgstr "div/mod no implementado para uint" +#: extmod/ulab/code/numpy/create.c +msgid "divide by zero" +msgstr "divide por cero" + #: py/runtime.c msgid "division by zero" msgstr "división por cero" @@ -3820,6 +3828,10 @@ msgstr "solo se admite bit_depth=16" msgid "only mono is supported" msgstr "solamente mono esta suportado" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "solamente oversample=64 esta soportado" @@ -4485,9 +4497,6 @@ msgstr "zi debe ser una forma (n_section,2)" #~ msgid "complex division by zero" #~ msgstr "división compleja por cero" -#~ msgid "divide by zero" -#~ msgstr "divide por cero" - #~ msgid "int() arg 2 must be >= 2 and <= 36" #~ msgstr "int() arg 2 debe ser >= 2 y <= 36" diff --git a/locale/fil.po b/locale/fil.po index 4c203ecbba..64a40976f5 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -2497,6 +2497,10 @@ msgstr "" msgid "array has too many dimensions" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2936,6 +2940,10 @@ msgstr "" msgid "div/mod not implemented for uint" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "divide by zero" +msgstr "" + #: py/runtime.c msgid "division by zero" msgstr "dibisyon ng zero" @@ -3755,6 +3763,10 @@ msgstr "" msgid "only mono is supported" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "" diff --git a/locale/fr.po b/locale/fr.po index 6a0e5ac876..28f95530cb 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -2581,6 +2581,10 @@ msgstr "la taille de la matrice et de l'index doivent être égaux" msgid "array has too many dimensions" msgstr "la tableau à trop de dimensions" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -3022,6 +3026,10 @@ msgstr "les dimensions ne correspondent pas" msgid "div/mod not implemented for uint" msgstr "div/mod ne sont pas implémentés pour uint" +#: extmod/ulab/code/numpy/create.c +msgid "divide by zero" +msgstr "division par zéro" + #: py/runtime.c msgid "division by zero" msgstr "division par zéro" @@ -3845,6 +3853,10 @@ msgstr "seul bit_depth = 16 est pris en charge" msgid "only mono is supported" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "" @@ -4527,9 +4539,6 @@ msgstr "zi doit être de forme (n_section, 2)" #~ msgid "complex division by zero" #~ msgstr "division complexe par zéro" -#~ msgid "divide by zero" -#~ msgstr "division par zéro" - #~ msgid "int() arg 2 must be >= 2 and <= 36" #~ msgstr "" #~ "Le deuxième argument de int() doit être compris entre 2 et 36 inclus" diff --git a/locale/hi.po b/locale/hi.po index 81903ac5a7..4fc15e35b4 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -2479,6 +2479,10 @@ msgstr "" msgid "array has too many dimensions" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2907,6 +2911,10 @@ msgstr "" msgid "div/mod not implemented for uint" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "divide by zero" +msgstr "" + #: py/runtime.c msgid "division by zero" msgstr "" @@ -3720,6 +3728,10 @@ msgstr "" msgid "only mono is supported" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index 50a754422d..85167249c6 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -2507,6 +2507,10 @@ msgstr "" msgid "array has too many dimensions" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2944,6 +2948,10 @@ msgstr "" msgid "div/mod not implemented for uint" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "divide by zero" +msgstr "" + #: py/runtime.c msgid "division by zero" msgstr "divisione per zero" @@ -3766,6 +3774,10 @@ msgstr "" msgid "only mono is supported" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "" diff --git a/locale/ja.po b/locale/ja.po index 5ead67824f..5f2c6a7aa2 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -2499,6 +2499,10 @@ msgstr "" msgid "array has too many dimensions" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2931,6 +2935,10 @@ msgstr "" msgid "div/mod not implemented for uint" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "divide by zero" +msgstr "" + #: py/runtime.c msgid "division by zero" msgstr "ゼロ除算 (division by zero)" @@ -3745,6 +3753,10 @@ msgstr "bit_depth=16のみ対応しています" msgid "only mono is supported" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "" diff --git a/locale/ko.po b/locale/ko.po index 078d04dfc8..8a4ebc9082 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -2483,6 +2483,10 @@ msgstr "" msgid "array has too many dimensions" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2911,6 +2915,10 @@ msgstr "" msgid "div/mod not implemented for uint" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "divide by zero" +msgstr "" + #: py/runtime.c msgid "division by zero" msgstr "" @@ -3724,6 +3732,10 @@ msgstr "" msgid "only mono is supported" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index 1b360e50b7..5122a036bc 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -2509,6 +2509,10 @@ msgstr "array en indexlengte moeten gelijk zijn" msgid "array has too many dimensions" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2940,6 +2944,10 @@ msgstr "" msgid "div/mod not implemented for uint" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "divide by zero" +msgstr "" + #: py/runtime.c msgid "division by zero" msgstr "deling door nul" @@ -3757,6 +3765,10 @@ msgstr "alleen bit_depth=16 wordt ondersteund" msgid "only mono is supported" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "" diff --git a/locale/pl.po b/locale/pl.po index 66d1699919..41c0c432a7 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -2490,6 +2490,10 @@ msgstr "" msgid "array has too many dimensions" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2919,6 +2923,10 @@ msgstr "" msgid "div/mod not implemented for uint" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "divide by zero" +msgstr "" + #: py/runtime.c msgid "division by zero" msgstr "dzielenie przez zero" @@ -3732,6 +3740,10 @@ msgstr "obsługiwane jest tylko bit_depth=16" msgid "only mono is supported" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 8b370922d4..b6a5eccd37 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -2562,6 +2562,10 @@ msgstr "a matriz e comprimento do índice devem ser iguais" msgid "array has too many dimensions" msgstr "a matriz possui muitas dimensões" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2999,6 +3003,10 @@ msgstr "as dimensões não coincidem" msgid "div/mod not implemented for uint" msgstr "div/mod não implementado para uint" +#: extmod/ulab/code/numpy/create.c +msgid "divide by zero" +msgstr "divido por zero" + #: py/runtime.c msgid "division by zero" msgstr "divisão por zero" @@ -3820,6 +3828,10 @@ msgstr "apenas bit_depth = 16 é compatível" msgid "only mono is supported" msgstr "Apenas o mono é compatível" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "apenas oversample=64 é compatível" @@ -4510,9 +4522,6 @@ msgstr "zi deve estar na forma (n_section, 2)" #~ msgid "complex division by zero" #~ msgstr "divisão complexa por zero" -#~ msgid "divide by zero" -#~ msgstr "divido por zero" - #~ msgid "int() arg 2 must be >= 2 and <= 36" #~ msgstr "int() arg 2 deve ser >= 2 e <= 36" diff --git a/locale/ru.po b/locale/ru.po index b272bc295d..205c1a1c0e 100644 --- a/locale/ru.po +++ b/locale/ru.po @@ -2547,6 +2547,10 @@ msgstr "" msgid "array has too many dimensions" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2975,6 +2979,10 @@ msgstr "" msgid "div/mod not implemented for uint" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "divide by zero" +msgstr "" + #: py/runtime.c msgid "division by zero" msgstr "" @@ -3788,6 +3796,10 @@ msgstr "" msgid "only mono is supported" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "" diff --git a/locale/sv.po b/locale/sv.po index 01037522cf..29fd45ca87 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -2535,6 +2535,10 @@ msgstr "array och indexlängd måste vara lika" msgid "array has too many dimensions" msgstr "array har för många dimensioner" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2968,6 +2972,10 @@ msgstr "dimensioner matchar inte" msgid "div/mod not implemented for uint" msgstr "div/mod inte implementerat för uint" +#: extmod/ulab/code/numpy/create.c +msgid "divide by zero" +msgstr "division med noll" + #: py/runtime.c msgid "division by zero" msgstr "division med noll" @@ -3786,6 +3794,10 @@ msgstr "bara bit_depth=16 stöds" msgid "only mono is supported" msgstr "endast mono stöds" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "endast oversample=64 stöds" @@ -4472,9 +4484,6 @@ msgstr "zi måste vara i formen (n_section, 2)" #~ msgid "complex division by zero" #~ msgstr "komplex division med noll" -#~ msgid "divide by zero" -#~ msgstr "division med noll" - #~ msgid "int() arg 2 must be >= 2 and <= 36" #~ msgstr "int() arg 2 måste vara >= 2 och <= 36" diff --git a/locale/tr.po b/locale/tr.po index 14e378bf61..85a0d6af12 100644 --- a/locale/tr.po +++ b/locale/tr.po @@ -2505,6 +2505,10 @@ msgstr "" msgid "array has too many dimensions" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2933,6 +2937,10 @@ msgstr "" msgid "div/mod not implemented for uint" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "divide by zero" +msgstr "" + #: py/runtime.c msgid "division by zero" msgstr "" @@ -3746,6 +3754,10 @@ msgstr "" msgid "only mono is supported" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 80270fb391..121a54dcbb 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -2541,6 +2541,10 @@ msgstr "shù zǔ hé suǒ yǐn cháng dù bì xū xiāng děng" msgid "array has too many dimensions" msgstr "shùzǔ yǒu tài duō wéidù" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2975,6 +2979,10 @@ msgstr "chǐ cùn bù pǐ pèi" msgid "div/mod not implemented for uint" msgstr "div/ mó zǔ wèi wéi wèi shí xiàn" +#: extmod/ulab/code/numpy/create.c +msgid "divide by zero" +msgstr "chú yǐ líng" + #: py/runtime.c msgid "division by zero" msgstr "bèi líng chú" @@ -3789,6 +3797,10 @@ msgstr "Jǐn zhīchí wèi shēndù = 16" msgid "only mono is supported" msgstr "jǐn zhī chí dān shēng dào" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "jǐn zhī chí guò cǎi yàng =64" @@ -4474,9 +4486,6 @@ msgstr "zi bìxū jùyǒu xíngzhuàng (n_section,2)" #~ msgid "complex division by zero" #~ msgstr "fùzá de fēngé wèi 0" -#~ msgid "divide by zero" -#~ msgstr "chú yǐ líng" - #~ msgid "int() arg 2 must be >= 2 and <= 36" #~ msgstr "zhěngshù() cānshù 2 bìxū > = 2 qiě <= 36" From 8529ec2649a85b43b973fff2a5f57a836a1a6b5e Mon Sep 17 00:00:00 2001 From: Jose David M Date: Wed, 1 Feb 2023 21:40:09 +0000 Subject: [PATCH 39/52] Translated using Weblate (Spanish) Currently translated at 100.0% (995 of 995 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/es/ --- locale/es.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/es.po b/locale/es.po index 2503a3150d..d40e92464c 100644 --- a/locale/es.po +++ b/locale/es.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2023-01-29 16:16+0000\n" +"PO-Revision-Date: 2023-02-01 22:11+0000\n" "Last-Translator: Jose David M \n" "Language-Team: \n" "Language: es\n" @@ -2565,7 +2565,7 @@ msgstr "La matriz tiene demasiadas dimensiones" #: extmod/ulab/code/ndarray.c msgid "array is too big" -msgstr "" +msgstr "el arreglo es muy grande" #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c @@ -3830,7 +3830,7 @@ msgstr "solamente mono esta suportado" #: extmod/ulab/code/numpy/create.c msgid "only ndarrays can be concatenated" -msgstr "" +msgstr "solamente ndarrays pueden ser concatenadas" #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" From 77c6daf4b83f3d24c85c429bc2be9a57755253d1 Mon Sep 17 00:00:00 2001 From: Gregory Neverov Date: Wed, 1 Feb 2023 16:33:22 -0800 Subject: [PATCH 40/52] don't throw exception --- ports/raspberrypi/common-hal/alarm/SleepMemory.c | 1 - 1 file changed, 1 deletion(-) diff --git a/ports/raspberrypi/common-hal/alarm/SleepMemory.c b/ports/raspberrypi/common-hal/alarm/SleepMemory.c index c1765296dc..1f0dddfc51 100644 --- a/ports/raspberrypi/common-hal/alarm/SleepMemory.c +++ b/ports/raspberrypi/common-hal/alarm/SleepMemory.c @@ -34,7 +34,6 @@ void alarm_sleep_memory_reset(void) { } uint32_t common_hal_alarm_sleep_memory_get_length(alarm_sleep_memory_obj_t *self) { - mp_raise_NotImplementedError(translate("Sleep Memory not available")); return 0; } From 750535d4af713d1a18825db2ff4caf46c65531fb Mon Sep 17 00:00:00 2001 From: root Date: Thu, 2 Feb 2023 14:55:57 -0600 Subject: [PATCH 41/52] Correct assignment of RMT channels on ESP32C3 --- ports/espressif/peripherals/rmt.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ports/espressif/peripherals/rmt.c b/ports/espressif/peripherals/rmt.c index 362bf85748..8dea2c0ab1 100644 --- a/ports/espressif/peripherals/rmt.c +++ b/ports/espressif/peripherals/rmt.c @@ -40,6 +40,14 @@ void peripherals_rmt_reset(void) { rmt_channel_t peripherals_find_and_reserve_rmt(bool mode) { size_t start_channel = 0; size_t end_channel = RMT_CHANNEL_MAX; + // ESP32C3 can only send on channels 0-1 and receive on channels 2-3 + #if defined(CONFIG_IDF_TARGET_ESP32C3) + if (mode == RECEIVE_MODE) { + start_channel = 2; + } else { + end_channel = 2; + } + #endif // ESP32C3 #if SOC_RMT_CHANNELS_PER_GROUP > 4 if (mode == RECEIVE_MODE) { start_channel = 4; From 8ca22a8a41414b2f124b1fcb404ebd3e822f4671 Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Thu, 2 Feb 2023 03:37:50 +0000 Subject: [PATCH 42/52] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (995 of 995 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index b6a5eccd37..8d5e776397 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2023-01-29 16:16+0000\n" +"PO-Revision-Date: 2023-02-03 04:15+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -2564,7 +2564,7 @@ msgstr "a matriz possui muitas dimensões" #: extmod/ulab/code/ndarray.c msgid "array is too big" -msgstr "" +msgstr "a array é grande demais" #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c @@ -3830,7 +3830,7 @@ msgstr "Apenas o mono é compatível" #: extmod/ulab/code/numpy/create.c msgid "only ndarrays can be concatenated" -msgstr "" +msgstr "somente os ndarrays podem ser concatenados" #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" From f13e6d8758df942acdb4c89f6b4a458858bb5109 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 3 Feb 2023 11:25:50 -0500 Subject: [PATCH 43/52] update flash chip for Metro M7 1011 --- ports/mimxrt10xx/boards/metro_m7_1011/mpconfigboard.h | 2 +- ports/mimxrt10xx/boards/metro_m7_1011/mpconfigboard.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/mimxrt10xx/boards/metro_m7_1011/mpconfigboard.h b/ports/mimxrt10xx/boards/metro_m7_1011/mpconfigboard.h index 23009f353f..589b2a2b65 100644 --- a/ports/mimxrt10xx/boards/metro_m7_1011/mpconfigboard.h +++ b/ports/mimxrt10xx/boards/metro_m7_1011/mpconfigboard.h @@ -7,7 +7,7 @@ // make sure you don't overwrite code #define CIRCUITPY_INTERNAL_NVM_SIZE 0 -#define BOARD_FLASH_SIZE (4 * 1024 * 1024) +#define BOARD_FLASH_SIZE (8 * 1024 * 1024) #define DEFAULT_I2C_BUS_SCL (&pin_GPIO_02) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO_01) diff --git a/ports/mimxrt10xx/boards/metro_m7_1011/mpconfigboard.mk b/ports/mimxrt10xx/boards/metro_m7_1011/mpconfigboard.mk index 2655217c78..56155aa4d0 100644 --- a/ports/mimxrt10xx/boards/metro_m7_1011/mpconfigboard.mk +++ b/ports/mimxrt10xx/boards/metro_m7_1011/mpconfigboard.mk @@ -5,7 +5,7 @@ USB_MANUFACTURER = "Adafruit" CHIP_VARIANT = MIMXRT1011DAE5A CHIP_FAMILY = MIMXRT1011 -FLASH = W25Q32JV +FLASH = W25Q64JV # Include these Python libraries in the firmware FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_ESP32SPI From 75ed28665c1eb869266a7759dc4f730b993fe404 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 3 Feb 2023 13:54:51 -0600 Subject: [PATCH 44/52] espressif: i2sout: enlarge buffers --- ports/espressif/common-hal/audiobusio/__init__.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ports/espressif/common-hal/audiobusio/__init__.c b/ports/espressif/common-hal/audiobusio/__init__.c index d6c3676d6a..eb35c83908 100644 --- a/ports/espressif/common-hal/audiobusio/__init__.c +++ b/ports/espressif/common-hal/audiobusio/__init__.c @@ -84,7 +84,7 @@ static void i2s_fill_buffer(i2s_t *self) { if (self->instance < 0 || self->instance >= I2S_NUM_MAX) { return; } -#define STACK_BUFFER_SIZE (512) +#define STACK_BUFFER_SIZE (4096) int16_t signed_samples[STACK_BUFFER_SIZE / sizeof(int16_t)]; if (!self->playing || self->paused || !self->sample || self->stopping) { @@ -188,8 +188,8 @@ void port_i2s_allocate_init(i2s_t *self, bool left_justified) { .bits_per_sample = 16, .channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT, .communication_format = left_justified ? I2S_COMM_FORMAT_STAND_I2S : I2S_COMM_FORMAT_STAND_I2S, - .dma_buf_count = 2, - .dma_buf_len = 128, // in _frames_, so 128 is 512 bytes per dma buf + .dma_buf_count = 3, + .dma_buf_len = 1024, // in _frames_, so 1024 is 4096 bytes per dma buf .use_apll = false, }; CHECK_ESP_RESULT(i2s_driver_install(self->instance, &i2s_config, I2S_QUEUE_SIZE, &i2s_queues[self->instance])); From 41dff5d8cc8e1f1fc682171b97b75cd04b1ab76d Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 3 Feb 2023 13:55:20 -0600 Subject: [PATCH 45/52] espressif: i2sout: don't needlessly set sample rate this may reduce glitches when starting samples --- ports/espressif/common-hal/audiobusio/__init__.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ports/espressif/common-hal/audiobusio/__init__.c b/ports/espressif/common-hal/audiobusio/__init__.c index eb35c83908..d1a695fbf3 100644 --- a/ports/espressif/common-hal/audiobusio/__init__.c +++ b/ports/espressif/common-hal/audiobusio/__init__.c @@ -223,7 +223,11 @@ void port_i2s_play(i2s_t *self, mp_obj_t sample, bool loop) { audiosample_reset_buffer(self->sample, false, 0); - CHECK_ESP_RESULT(i2s_set_sample_rates(self->instance, audiosample_sample_rate(sample))); + uint32_t sample_rate = audiosample_sample_rate(sample); + if (sample_rate != self->i2s_config.sample_rate) { + CHECK_ESP_RESULT(i2s_set_sample_rates(self->instance, audiosample_sample_rate(sample))); + self->i2s_config.sample_rate = sample_rate; + } background_callback_add(&self->callback, i2s_callback_fun, self); } From b03eed32fbbcec426bf721588bcaeb575cde1f10 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 3 Feb 2023 13:57:47 -0600 Subject: [PATCH 46/52] espressif: i2sout: wait a short time to succesfully write data --- ports/espressif/common-hal/audiobusio/__init__.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ports/espressif/common-hal/audiobusio/__init__.c b/ports/espressif/common-hal/audiobusio/__init__.c index d1a695fbf3..e58aeefe88 100644 --- a/ports/espressif/common-hal/audiobusio/__init__.c +++ b/ports/espressif/common-hal/audiobusio/__init__.c @@ -80,6 +80,8 @@ void i2s_reset(void) { } } +#define I2S_WRITE_DELAY pdMS_TO_TICKS(1) + static void i2s_fill_buffer(i2s_t *self) { if (self->instance < 0 || self->instance >= I2S_NUM_MAX) { return; @@ -92,7 +94,7 @@ static void i2s_fill_buffer(i2s_t *self) { size_t bytes_written = 0; do { - CHECK_ESP_RESULT(i2s_write(self->instance, signed_samples, sizeof(signed_samples), &bytes_written, 0)); + CHECK_ESP_RESULT(i2s_write(self->instance, signed_samples, sizeof(signed_samples), &bytes_written, I2S_WRITE_DELAY)); } while (bytes_written != 0); return; } @@ -120,9 +122,9 @@ static void i2s_fill_buffer(i2s_t *self) { size_t bytecount = self->sample_end - self->sample_data; if (self->samples_signed && self->channel_count == 2) { if (self->bytes_per_sample == 2) { - CHECK_ESP_RESULT(i2s_write(self->instance, self->sample_data, bytecount, &bytes_written, 0)); + CHECK_ESP_RESULT(i2s_write(self->instance, self->sample_data, bytecount, &bytes_written, I2S_WRITE_DELAY)); } else { - CHECK_ESP_RESULT(i2s_write_expand(self->instance, self->sample_data, bytecount, 8, 16, &bytes_written, 0)); + CHECK_ESP_RESULT(i2s_write_expand(self->instance, self->sample_data, bytecount, 8, 16, &bytes_written, I2S_WRITE_DELAY)); } } else { const size_t bytes_per_output_frame = 4; @@ -151,7 +153,7 @@ static void i2s_fill_buffer(i2s_t *self) { } } size_t expanded_bytes_written = 0; - CHECK_ESP_RESULT(i2s_write(self->instance, signed_samples, bytes_per_output_frame * framecount, &expanded_bytes_written, 0)); + CHECK_ESP_RESULT(i2s_write(self->instance, signed_samples, bytes_per_output_frame * framecount, &expanded_bytes_written, I2S_WRITE_DELAY)); assert(expanded_bytes_written % 4 == 0); bytes_written = expanded_bytes_written / bytes_per_output_frame * bytes_per_input_frame; } From fab1bb5f2186d6c2f022ef5715ce6bb8c536c21e Mon Sep 17 00:00:00 2001 From: foamyguy Date: Fri, 3 Feb 2023 17:43:12 -0600 Subject: [PATCH 47/52] fix for native is31fl3741 --- shared-module/is31fl3741/FrameBuffer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared-module/is31fl3741/FrameBuffer.c b/shared-module/is31fl3741/FrameBuffer.c index d795c0d5e7..07bd3324f9 100644 --- a/shared-module/is31fl3741/FrameBuffer.c +++ b/shared-module/is31fl3741/FrameBuffer.c @@ -172,7 +172,7 @@ void common_hal_is31fl3741_FrameBuffer_refresh(is31fl3741_FrameBuffer_obj_t *sel } else { color = (rsum << 16) + (gsum << 8) + bsum; } - common_hal_is31fl3741_draw_pixel(self->is31fl3741, x, y, color, self->mapping, self->height); + common_hal_is31fl3741_draw_pixel(self->is31fl3741, x, y, color, self->mapping, self->scale_height); } } } else { @@ -193,7 +193,7 @@ void common_hal_is31fl3741_FrameBuffer_refresh(is31fl3741_FrameBuffer_obj_t *sel color = *buffer; } - common_hal_is31fl3741_draw_pixel(self->is31fl3741, x, y, color, self->mapping, self->height); + common_hal_is31fl3741_draw_pixel(self->is31fl3741, x, y, color, self->mapping, self->scale_height); buffer++; } } else { From 07e8506b79b22f04cad5520716748e41d18e3f64 Mon Sep 17 00:00:00 2001 From: Alex Sirota <67526318+ajs256@users.noreply.github.com> Date: Fri, 3 Feb 2023 20:19:11 -0800 Subject: [PATCH 48/52] Add board hack_club_sprig --- .../boards/hack_club_sprig/board.c | 128 ++++++++++++++++++ .../boards/hack_club_sprig/mpconfigboard.h | 4 + .../boards/hack_club_sprig/mpconfigboard.mk | 11 ++ .../hack_club_sprig/pico-sdk-configboard.h | 1 + .../raspberrypi/boards/hack_club_sprig/pins.c | 85 ++++++++++++ 5 files changed, 229 insertions(+) create mode 100644 ports/raspberrypi/boards/hack_club_sprig/board.c create mode 100644 ports/raspberrypi/boards/hack_club_sprig/mpconfigboard.h create mode 100644 ports/raspberrypi/boards/hack_club_sprig/mpconfigboard.mk create mode 100644 ports/raspberrypi/boards/hack_club_sprig/pico-sdk-configboard.h create mode 100644 ports/raspberrypi/boards/hack_club_sprig/pins.c diff --git a/ports/raspberrypi/boards/hack_club_sprig/board.c b/ports/raspberrypi/boards/hack_club_sprig/board.c new file mode 100644 index 0000000000..0169e85e0e --- /dev/null +++ b/ports/raspberrypi/boards/hack_club_sprig/board.c @@ -0,0 +1,128 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" +#include "mpconfigboard.h" +#include "shared-bindings/busio/SPI.h" +#include "shared-bindings/displayio/FourWire.h" +#include "shared-module/displayio/__init__.h" +#include "shared-module/displayio/mipi_constants.h" +#include "supervisor/shared/board.h" + +displayio_fourwire_obj_t board_display_obj; + +// display init sequence from CircuitPython library https://github.com/adafruit/Adafruit_CircuitPython_ST7735R/blob/dfae353330cf051d1f31db9e4b681c8d70900cc5/adafruit_st7735r.py +uint8_t display_init_sequence[] = { + // sw reset + 0x01, 0x80, 0x96, + // sleep out and delay + 0x11, 0x80, 0xFF, + // _FRMCTR1 + 0xB1, 0x03, 0x01, 0x2C, 0x2D, + // _FRMCTR2 + 0xB2, 0x03, 0x01, 0x2C, 0x2D, + // _FRMCTR3 + 0xB3, 0x06, 0x01, 0x2C, 0x2D, 0x01, 0x2C, 0x2D, + // _INVCTR line inversion + 0xB4, 0x01, 0x07, + // _PWCTR1 GVDD = 4.7V, 1.0uA + 0xC0, 0x03, 0xA2, 0x02, 0x84, + // _PWCTR2 VGH=14.7V, VGL=-7.35V + 0xC1, 0x01, 0xC5, + // _PWCTR3 Opamp current small, Boost frequency + 0xC2, 0x02, 0x0A, 0x00, + 0xC3, 0x02, 0x8A, 0x2A, + 0xC4, 0x02, 0x8A, 0xEE, + // _VMCTR1 VCOMH = 4V, VOML = -1.1V + 0xC5, 0x01, 0x0E, + // _INVOFF + 0x20, 0x00, + // _MADCTL bottom to top refresh + 0x36, 0x01, 0x18, + // COLMOD - 16 bit color + 0x3A, 0x01, 0x05, + // _GMCTRP1 Gamma + 0xE0, 0x10, 0x02, 0x1C, 0x07, 0x12, 0x37, 0x32, 0x29, 0x2D, 0x29, 0x25, 0x2B, 0x39, 0x00, 0x01, 0x03, 0x10, + // _GMCTRN1 + 0xE1, 0x10, 0x03, 0x1d, 0x07, 0x06, 0x2E, 0x2C, 0x29, 0x2D, 0x2E, 0x2E, 0x37, 0x3F, 0x00, 0x00, 0x02, 0x10, + // _NORON + 0x13, 0x80, 0x0A, + // _DISPON + 0x29, 0x80, 0x64, + // _MADCTL Default rotation + BGR encoding + 0x36, 0x01, 0xC0, +}; + + +void board_init(void) { + busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; + common_hal_busio_spi_construct(spi, &pin_GPIO18, &pin_GPIO19, &pin_GPIO16, false); + common_hal_busio_spi_never_reset(spi); + + displayio_fourwire_obj_t *bus = &displays[0].fourwire_bus; + bus->base.type = &displayio_fourwire_type; + common_hal_displayio_fourwire_construct(bus, + spi, + &pin_GPIO22, // DC + &pin_GPIO20, // CS + &pin_GPIO26, // RST + 30000000, + 0, + 0); + + displayio_display_obj_t *display = &displays[0].display; + display->base.type = &displayio_display_type; + common_hal_displayio_display_construct(display, + bus, + 160, // Width + 128, // Height + 0, // column start + 0, // row start + 270, // rotation + 16, // Color depth + false, // Grayscale + false, // pixels in a byte share a row. Only valid for depths < 8 + 1, // bytes per cell. Only valid for depths < 8 + false, // reverse_pixels_in_byte. Only valid for depths < 8 + true, // reverse_bytes_in_word + MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command + MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command + MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command + display_init_sequence, + sizeof(display_init_sequence), + &pin_GPIO17, // backlight pin + NO_BRIGHTNESS_COMMAND, + 1.0f, // brightness + false, // single_byte_bounds + false, // data_as_commands + true, // auto_refresh + 60, // native_frames_per_second + true, // backlight_on_high + false, // SH1107_addressing + 50000); // backlight pwm frequency +} + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/hack_club_sprig/mpconfigboard.h b/ports/raspberrypi/boards/hack_club_sprig/mpconfigboard.h new file mode 100644 index 0000000000..442e455c5e --- /dev/null +++ b/ports/raspberrypi/boards/hack_club_sprig/mpconfigboard.h @@ -0,0 +1,4 @@ +#define MICROPY_HW_BOARD_NAME "Hack Club Sprig" +#define MICROPY_HW_MCU_NAME "rp2040" + +#define MICROPY_HW_LED_STATUS (&pin_GPIO4) diff --git a/ports/raspberrypi/boards/hack_club_sprig/mpconfigboard.mk b/ports/raspberrypi/boards/hack_club_sprig/mpconfigboard.mk new file mode 100644 index 0000000000..1bde636031 --- /dev/null +++ b/ports/raspberrypi/boards/hack_club_sprig/mpconfigboard.mk @@ -0,0 +1,11 @@ +USB_VID = 0x1209 +USB_PID = 0x9000 +USB_PRODUCT = "Sprig" +USB_MANUFACTURER = "Hack Club" + +CHIP_VARIANT = RP2040 +CHIP_FAMILY = rp2 + +EXTERNAL_FLASH_DEVICES = "W25Q16JVxQ" + +CIRCUITPY__EVE = 1 diff --git a/ports/raspberrypi/boards/hack_club_sprig/pico-sdk-configboard.h b/ports/raspberrypi/boards/hack_club_sprig/pico-sdk-configboard.h new file mode 100644 index 0000000000..36da55d457 --- /dev/null +++ b/ports/raspberrypi/boards/hack_club_sprig/pico-sdk-configboard.h @@ -0,0 +1 @@ +// Put board-specific pico-sdk definitions here. This file must exist. diff --git a/ports/raspberrypi/boards/hack_club_sprig/pins.c b/ports/raspberrypi/boards/hack_club_sprig/pins.c new file mode 100644 index 0000000000..f82b8fafc5 --- /dev/null +++ b/ports/raspberrypi/boards/hack_club_sprig/pins.c @@ -0,0 +1,85 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_GP0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_GP1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_GP2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_GP3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_GP4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_GP5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_GP6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_GP7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_GP8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_GP9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_GP10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_GP11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_GP12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_GP13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_GP14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_GP15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_GP16), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_GP17), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_GP18), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_GP19), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_GP20), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_GP21), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_GP22), MP_ROM_PTR(&pin_GPIO22) }, + + { MP_ROM_QSTR(MP_QSTR_SMPS_MODE), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_GP23), MP_ROM_PTR(&pin_GPIO23) }, + + { MP_ROM_QSTR(MP_QSTR_VBUS_SENSE), MP_ROM_PTR(&pin_GPIO24) }, + { MP_ROM_QSTR(MP_QSTR_GP24), MP_ROM_PTR(&pin_GPIO24) }, + + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_GP25), MP_ROM_PTR(&pin_GPIO25) }, + + { MP_ROM_QSTR(MP_QSTR_GP26_A0), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_GP26), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) }, + + { MP_ROM_QSTR(MP_QSTR_GP27_A1), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_GP27), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27) }, + + { MP_ROM_QSTR(MP_QSTR_GP28_A2), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_GP28), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28) }, + + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO29) }, + { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO29) }, + + + // Start Sprig-specific definitions + + { MP_ROM_QSTR(MP_QSTR_BLUE_LED), MP_ROM_PTR(&pin_GPIO4) }, + + { MP_ROM_QSTR(MP_QSTR_BUTTON_W), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON_A), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON_S), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON_D), MP_ROM_PTR(&pin_GPIO8) }, + + { MP_ROM_QSTR(MP_QSTR_AUDIO_DIN), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_AUDIO_BCLK), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_AUDIO_LRCLK), MP_ROM_PTR(&pin_GPIO11) }, + + { MP_ROM_QSTR(MP_QSTR_BUTTON_I), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON_J), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON_K), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON_L), MP_ROM_PTR(&pin_GPIO15) }, + + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_TFT_LITE), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_TFT_CS), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_CARD_CS), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_TFT_DC), MP_ROM_PTR(&pin_GPIO22) }, + { MP_ROM_QSTR(MP_QSTR_TFT_RESET), MP_ROM_PTR(&pin_GPIO23) }, + + { MP_ROM_QSTR(MP_QSTR_WHITE_LED), MP_ROM_PTR(&pin_GPIO28) }, + +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From e78143a2f50bb3b15e44193965a9d8184caa9f55 Mon Sep 17 00:00:00 2001 From: Alex <67526318+ajs256@users.noreply.github.com> Date: Sun, 5 Feb 2023 11:18:23 -0800 Subject: [PATCH 49/52] fix copyright header --- ports/raspberrypi/boards/hack_club_sprig/board.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/raspberrypi/boards/hack_club_sprig/board.c b/ports/raspberrypi/boards/hack_club_sprig/board.c index 0169e85e0e..775e6ca5df 100644 --- a/ports/raspberrypi/boards/hack_club_sprig/board.c +++ b/ports/raspberrypi/boards/hack_club_sprig/board.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2021 Scott Shawcroft for Adafruit Industries + * Copyright (c) 2023 ajs256 * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal From abc5eb30d73ef5caf0ea811cc1c8727b081bb04a Mon Sep 17 00:00:00 2001 From: Gregory Neverov <42853258+gneverov@users.noreply.github.com> Date: Mon, 6 Feb 2023 15:07:26 -0800 Subject: [PATCH 50/52] add support for array.extend(iterable) --- py/objarray.c | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/py/objarray.c b/py/objarray.c index a66a73a5ac..763ec15cdb 100644 --- a/py/objarray.c +++ b/py/objarray.c @@ -458,26 +458,32 @@ STATIC mp_obj_t array_extend(mp_obj_t self_in, mp_obj_t arg_in) { // allow to extend by anything that has the buffer protocol (extension to CPython) mp_buffer_info_t arg_bufinfo; - mp_get_buffer_raise(arg_in, &arg_bufinfo, MP_BUFFER_READ); + if (mp_get_buffer(arg_in, &arg_bufinfo, MP_BUFFER_READ)) { + size_t sz = mp_binary_get_size('@', self->typecode, NULL); - size_t sz = mp_binary_get_size('@', self->typecode, NULL); + // convert byte count to element count + size_t len = arg_bufinfo.len / sz; - // convert byte count to element count - size_t len = arg_bufinfo.len / sz; + // make sure we have enough room to extend + // TODO: alloc policy; at the moment we go conservative + if (self->free < len) { + self->items = m_renew(byte, self->items, (self->len + self->free) * sz, (self->len + len) * sz); + self->free = 0; + } else { + self->free -= len; + } - // make sure we have enough room to extend - // TODO: alloc policy; at the moment we go conservative - if (self->free < len) { - self->items = m_renew(byte, self->items, (self->len + self->free) * sz, (self->len + len) * sz); - self->free = 0; + // extend + mp_seq_copy((byte *)self->items + self->len * sz, arg_bufinfo.buf, len * sz, byte); + self->len += len; } else { - self->free -= len; + // Otherwise argument must be an iterable of items to append + mp_obj_t iterable = mp_getiter(arg_in, NULL); + mp_obj_t item; + while ((item = mp_iternext(iterable)) != MP_OBJ_STOP_ITERATION) { + array_append(self_in, item); + } } - - // extend - mp_seq_copy((byte *)self->items + self->len * sz, arg_bufinfo.buf, len * sz, byte); - self->len += len; - return mp_const_none; } STATIC MP_DEFINE_CONST_FUN_OBJ_2(array_extend_obj, array_extend); From 17751ad2830984b0940915af019f93edde8994c6 Mon Sep 17 00:00:00 2001 From: Neradoc Date: Fri, 10 Feb 2023 04:58:37 +0100 Subject: [PATCH 51/52] Update build_board_info.py to sh module 2.0.0 --- tools/build_board_info.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/build_board_info.py b/tools/build_board_info.py index f810d942a7..5209337b95 100755 --- a/tools/build_board_info.py +++ b/tools/build_board_info.py @@ -10,6 +10,7 @@ import subprocess import sys import sh import base64 +from io import StringIO from datetime import date from sh.contrib import git @@ -58,9 +59,13 @@ def get_languages(list_all=False): def get_version_info(): version = None - sha = git("rev-parse", "--short", "HEAD").stdout.decode("utf-8") + buffer = StringIO() + git("rev-parse", "--short", "HEAD", _out=buffer) + sha = buffer.getvalue().strip() try: - version = git("describe", "--tags", "--exact-match").stdout.decode("utf-8").strip() + buffer = StringIO() + git("describe", "--tags", "--exact-match", _out=buffer) + version = buffer.getvalue().strip() except sh.ErrorReturnCode_128: # No exact match pass From 676cbb308db2b8a8da758ecab7f6f4f8ea0fcfa6 Mon Sep 17 00:00:00 2001 From: Pierre Constantineau Date: Mon, 13 Feb 2023 09:52:18 -0600 Subject: [PATCH 52/52] minor update to boards.c to fix mismatched number of LEDs causing LEDs not to be reset --- ports/raspberrypi/boards/jpconstantineau_pykey18/board.c | 2 +- ports/raspberrypi/boards/jpconstantineau_pykey44/board.c | 2 +- ports/raspberrypi/boards/jpconstantineau_pykey87/board.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ports/raspberrypi/boards/jpconstantineau_pykey18/board.c b/ports/raspberrypi/boards/jpconstantineau_pykey18/board.c index 4785f742ec..5b1190727f 100644 --- a/ports/raspberrypi/boards/jpconstantineau_pykey18/board.c +++ b/ports/raspberrypi/boards/jpconstantineau_pykey18/board.c @@ -31,7 +31,7 @@ void reset_board(void) { // turn off any left over LED - board_reset_user_neopixels(&pin_GPIO29, 62); + board_reset_user_neopixels(&pin_GPIO29, 19); } // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/jpconstantineau_pykey44/board.c b/ports/raspberrypi/boards/jpconstantineau_pykey44/board.c index 4785f742ec..4e0aa74450 100644 --- a/ports/raspberrypi/boards/jpconstantineau_pykey44/board.c +++ b/ports/raspberrypi/boards/jpconstantineau_pykey44/board.c @@ -31,7 +31,7 @@ void reset_board(void) { // turn off any left over LED - board_reset_user_neopixels(&pin_GPIO29, 62); + board_reset_user_neopixels(&pin_GPIO29, 45); } // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/jpconstantineau_pykey87/board.c b/ports/raspberrypi/boards/jpconstantineau_pykey87/board.c index 4785f742ec..a77563c663 100644 --- a/ports/raspberrypi/boards/jpconstantineau_pykey87/board.c +++ b/ports/raspberrypi/boards/jpconstantineau_pykey87/board.c @@ -31,7 +31,7 @@ void reset_board(void) { // turn off any left over LED - board_reset_user_neopixels(&pin_GPIO29, 62); + board_reset_user_neopixels(&pin_GPIO29, 88); } // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here.