From dc10e968149f50fbc88158bcb3f78380667abb40 Mon Sep 17 00:00:00 2001 From: Noel Gaetan Date: Sat, 17 Oct 2020 16:54:13 +0200 Subject: [PATCH 001/148] Update CONTRIBUTING.md --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 29db397932..15b4cfc892 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,7 +6,7 @@ SPDX-License-Identifier: MIT # Contributing Please note that this project is released with a -[Contributor Code of Conduct](https://github.com/adafruit/circuitpython/blob/main/CODE_OF_CONDUCT.md). +[Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms. Participation covers any forum used to converse about CircuitPython including unofficial and official spaces. Failure to do so will result in corrective actions such as time out or ban from the project. From 7cf776d39e9c9e4694b65b636f456630b462958c Mon Sep 17 00:00:00 2001 From: Noel Gaetan Date: Sat, 17 Oct 2020 17:11:17 +0200 Subject: [PATCH 002/148] Update CONTRIBUTING.md test fix url 404 --- CONTRIBUTING.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 15b4cfc892..c94e8db8c6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,6 +4,8 @@ SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://g SPDX-License-Identifier: MIT --> + + # Contributing Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). From b4eb27557d98084024e9392dcb64bf9724c04517 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sat, 24 Oct 2020 07:26:01 -0500 Subject: [PATCH 003/148] workflows: Upload stubs to s3 --- .github/workflows/build.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fa576bbf0a..0792d36a01 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -111,11 +111,13 @@ jobs: with: name: mpy-cross.static-x64-windows path: mpy-cross/mpy-cross.static.exe - - name: Upload mpy-cross builds to S3 + - name: Upload stubs and mpy-cross builds to S3 run: | [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static-raspbian s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-raspbian-${{ env.CP_VERSION }} --no-progress --region us-east-1 [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-amd64-linux-${{ env.CP_VERSION }} --no-progress --region us-east-1 [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static.exe s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-x64-windows-${{ env.CP_VERSION }}.exe --no-progress --region us-east-1 + zip -9 circuitpython-stubs.CP_VERSION }}.zip stubs + [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp circuitpython-stubs.zip s3://adafruit-circuit-python/bin/mpy-cross/circuitpython-stubs-${{ env.CP_VERSION }}.zip --no-progress --region us-east-1 env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} From 1117edae63df7b66f1575980bf54d6836f9a8aa8 Mon Sep 17 00:00:00 2001 From: Christian Walther Date: Sat, 24 Oct 2020 17:13:10 +0200 Subject: [PATCH 004/148] Fix erroneous claim of board.I2C() by deinited display. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit At the end of a session that called displayio.release_displays() (and did not initialize a new display), a board.I2C() bus that was previously used by a display would wrongly be considered still in use. While I can’t think of any unrecoverable problem this would cause in the next session, it violates the assumption that a soft reboot resets everything not needed by displays, potentially leading to confusion. By itself, this change does not fix the problem yet - rather, it introduces the same issue as in #3581 for SPI. This needs to be solved in the same way for I2C and SPI. --- shared-module/board/__init__.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-module/board/__init__.c b/shared-module/board/__init__.c index 39b68a0f11..856103b7b6 100644 --- a/shared-module/board/__init__.c +++ b/shared-module/board/__init__.c @@ -139,7 +139,7 @@ void reset_board_busses(void) { bool display_using_i2c = false; #if CIRCUITPY_DISPLAYIO for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { - if (displays[i].i2cdisplay_bus.bus == i2c_singleton) { + if (displays[i].bus_base.type == &displayio_i2cdisplay_type && displays[i].i2cdisplay_bus.bus == i2c_singleton) { display_using_i2c = true; break; } From f4f80e07ca3dc2f5a93484e5342540837a94a505 Mon Sep 17 00:00:00 2001 From: Christian Walther Date: Sat, 24 Oct 2020 17:23:17 +0200 Subject: [PATCH 005/148] Fix lost board.SPI and board.I2C after being used by display. Fixes #3581. Pins were marked as never_reset by common_hal_displayio_fourwire_construct() and common_hal_sharpdisplay_framebuffer_construct(), but these marks were never removed, so at the end of a session after displayio.release_displays(), {spi|i2c}_singleton would be set to NULL but the pins would not be reset. In the next session, board.SPI() and board.I2C() were unable to reconstruct the object because the pins were still in use. For symmetry with creation of the singleton, add deinitialization before setting it to NULL in reset_board_busses(). This makes the pins resettable, so that reset_port(), moved behind it, then resets them. --- main.c | 4 +++- shared-module/board/__init__.c | 14 +++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/main.c b/main.c index b43b3b8c80..80b163f607 100755 --- a/main.c +++ b/main.c @@ -234,10 +234,12 @@ void cleanup_after_vm(supervisor_allocation* heap) { common_hal_canio_reset(); #endif - reset_port(); + // reset_board_busses() first because it may release pins from the never_reset state, so that + // reset_port() can reset them. #if CIRCUITPY_BOARD reset_board_busses(); #endif + reset_port(); reset_board(); reset_status_led(); } diff --git a/shared-module/board/__init__.c b/shared-module/board/__init__.c index 856103b7b6..967b430d2b 100644 --- a/shared-module/board/__init__.c +++ b/shared-module/board/__init__.c @@ -145,8 +145,11 @@ void reset_board_busses(void) { } } #endif - if (!display_using_i2c) { - i2c_singleton = NULL; + if (i2c_singleton != NULL) { + if (!display_using_i2c) { + common_hal_busio_i2c_deinit(i2c_singleton); + i2c_singleton = NULL; + } } #endif #if BOARD_SPI @@ -169,9 +172,10 @@ void reset_board_busses(void) { // make sure SPI lock is not held over a soft reset if (spi_singleton != NULL) { common_hal_busio_spi_unlock(spi_singleton); - } - if (!display_using_spi) { - spi_singleton = NULL; + if (!display_using_spi) { + common_hal_busio_spi_deinit(spi_singleton); + spi_singleton = NULL; + } } #endif #if BOARD_UART From 99a3750a2cfd1da8cdd266ca9a0367f0c3a54092 Mon Sep 17 00:00:00 2001 From: Christian Walther Date: Sat, 24 Oct 2020 17:50:11 +0200 Subject: [PATCH 006/148] Fix lost board.SPI and board.I2C after explicitly deiniting them. After calling board.SPI().deinit(), calling board.SPI() again would return the unusable deinited object and there was no way of getting it back into an initialized state until the end of the session. --- shared-bindings/board/__init__.c | 10 ++++++++-- shared-module/board/__init__.c | 10 ++++------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/shared-bindings/board/__init__.c b/shared-bindings/board/__init__.c index 6837fc41c2..717698408a 100644 --- a/shared-bindings/board/__init__.c +++ b/shared-bindings/board/__init__.c @@ -28,6 +28,12 @@ #include "py/runtime.h" #include "shared-bindings/board/__init__.h" +#if BOARD_I2C +#include "shared-bindings/busio/I2C.h" +#endif +#if BOARD_SPI +#include "shared-bindings/busio/SPI.h" +#endif //| """Board specific pin names //| @@ -45,7 +51,7 @@ #if BOARD_I2C mp_obj_t board_i2c(void) { mp_obj_t singleton = common_hal_board_get_i2c(); - if (singleton != NULL) { + if (singleton != NULL && !common_hal_busio_i2c_deinited(singleton)) { return singleton; } assert_pin_free(DEFAULT_I2C_BUS_SDA); @@ -69,7 +75,7 @@ MP_DEFINE_CONST_FUN_OBJ_0(board_i2c_obj, board_i2c); #if BOARD_SPI mp_obj_t board_spi(void) { mp_obj_t singleton = common_hal_board_get_spi(); - if (singleton != NULL) { + if (singleton != NULL && !common_hal_busio_spi_deinited(singleton)) { return singleton; } assert_pin_free(DEFAULT_SPI_BUS_SCK); diff --git a/shared-module/board/__init__.c b/shared-module/board/__init__.c index 967b430d2b..2f1c34e565 100644 --- a/shared-module/board/__init__.c +++ b/shared-module/board/__init__.c @@ -55,9 +55,8 @@ mp_obj_t common_hal_board_get_i2c(void) { } mp_obj_t common_hal_board_create_i2c(void) { - if (i2c_singleton != NULL) { - return i2c_singleton; - } + // All callers have either already verified this or come so early that it can't be otherwise. + assert(i2c_singleton == NULL || common_hal_busio_i2c_deinited(i2c_singleton)); busio_i2c_obj_t *self = &i2c_obj; self->base.type = &busio_i2c_type; @@ -79,9 +78,8 @@ mp_obj_t common_hal_board_get_spi(void) { } mp_obj_t common_hal_board_create_spi(void) { - if (spi_singleton != NULL) { - return spi_singleton; - } + // All callers have either already verified this or come so early that it can't be otherwise. + assert(spi_singleton == NULL || common_hal_busio_spi_deinited(spi_singleton)); busio_spi_obj_t *self = &spi_obj; self->base.type = &busio_spi_type; From 5deb045a8112100de3cb28fdb7b6c56444663503 Mon Sep 17 00:00:00 2001 From: Gaetan Date: Mon, 26 Oct 2020 23:32:57 +0100 Subject: [PATCH 007/148] Ready to PR * ../../.github/workflows/build.yml + boards/holyiot_nrf52840/board.c + boards/holyiot_nrf52840/mpconfigboard.h + boards/holyiot_nrf52840/mpconfigboard.mk + boards/holyiot_nrf52840/pins.c --- .github/workflows/build.yml | 1 + ports/nrf/boards/holyiot_nrf52840/board.c | 38 ++++++++++++ .../boards/holyiot_nrf52840/mpconfigboard.h | 33 +++++++++++ .../boards/holyiot_nrf52840/mpconfigboard.mk | 8 +++ ports/nrf/boards/holyiot_nrf52840/pins.c | 59 +++++++++++++++++++ 5 files changed, 139 insertions(+) create mode 100644 ports/nrf/boards/holyiot_nrf52840/board.c create mode 100644 ports/nrf/boards/holyiot_nrf52840/mpconfigboard.h create mode 100644 ports/nrf/boards/holyiot_nrf52840/mpconfigboard.mk create mode 100644 ports/nrf/boards/holyiot_nrf52840/pins.c diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index feb6a7f633..cada55aaa4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -214,6 +214,7 @@ jobs: - "hallowing_m0_express" - "hallowing_m4_express" - "hiibot_bluefi" + - "holyiot_nrf52840" - "ikigaisense_vita" - "imxrt1010_evk" - "imxrt1020_evk" diff --git a/ports/nrf/boards/holyiot_nrf52840/board.c b/ports/nrf/boards/holyiot_nrf52840/board.c new file mode 100644 index 0000000000..4421970eef --- /dev/null +++ b/ports/nrf/boards/holyiot_nrf52840/board.c @@ -0,0 +1,38 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2017 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 "boards/board.h" + +void board_init(void) { +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { + +} diff --git a/ports/nrf/boards/holyiot_nrf52840/mpconfigboard.h b/ports/nrf/boards/holyiot_nrf52840/mpconfigboard.h new file mode 100644 index 0000000000..3b64d3a629 --- /dev/null +++ b/ports/nrf/boards/holyiot_nrf52840/mpconfigboard.h @@ -0,0 +1,33 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2016 Glenn Ruben Bakke + * + * + * 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 "nrfx/hal/nrf_gpio.h" + +#define MICROPY_HW_BOARD_NAME "Holyiot nRF52840" +#define MICROPY_HW_MCU_NAME "nRF52840" + +#define MICROPY_HW_LED_STATUS (&pin_P0_19) diff --git a/ports/nrf/boards/holyiot_nrf52840/mpconfigboard.mk b/ports/nrf/boards/holyiot_nrf52840/mpconfigboard.mk new file mode 100644 index 0000000000..d85de75071 --- /dev/null +++ b/ports/nrf/boards/holyiot_nrf52840/mpconfigboard.mk @@ -0,0 +1,8 @@ +USB_VID = 0x239A +USB_PID = 0x80A0 +USB_PRODUCT = "HOLYIOTNRF52840" +USB_MANUFACTURER = "Holyiot" + +MCU_CHIP = nrf52840 + +INTERNAL_FLASH_FILESYSTEM = 1 \ No newline at end of file diff --git a/ports/nrf/boards/holyiot_nrf52840/pins.c b/ports/nrf/boards/holyiot_nrf52840/pins.c new file mode 100644 index 0000000000..4e2593e58f --- /dev/null +++ b/ports/nrf/boards/holyiot_nrf52840/pins.c @@ -0,0 +1,59 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + + { MP_ROM_QSTR(MP_QSTR_P1_10), MP_ROM_PTR(&pin_P0_02) }, + { MP_ROM_QSTR(MP_QSTR_P1_11), MP_ROM_PTR(&pin_P1_11) }, + { MP_ROM_QSTR(MP_QSTR_P1_13), MP_ROM_PTR(&pin_P1_13) }, + { MP_ROM_QSTR(MP_QSTR_P1_15), MP_ROM_PTR(&pin_P1_15) }, + { MP_ROM_QSTR(MP_QSTR_P0_03), MP_ROM_PTR(&pin_P0_03) }, + { MP_ROM_QSTR(MP_QSTR_P0_02), MP_ROM_PTR(&pin_P0_02) }, + { MP_ROM_QSTR(MP_QSTR_P0_28), MP_ROM_PTR(&pin_P0_28) }, + { MP_ROM_QSTR(MP_QSTR_P0_29), MP_ROM_PTR(&pin_P0_29) }, + { MP_ROM_QSTR(MP_QSTR_P0_30), MP_ROM_PTR(&pin_P0_30) }, + { MP_ROM_QSTR(MP_QSTR_P0_31), MP_ROM_PTR(&pin_P0_31) }, + { MP_ROM_QSTR(MP_QSTR_P0_04), MP_ROM_PTR(&pin_P0_04) }, + { MP_ROM_QSTR(MP_QSTR_P0_05), MP_ROM_PTR(&pin_P0_05) }, + { MP_ROM_QSTR(MP_QSTR_P1_14), MP_ROM_PTR(&pin_P1_14) }, + { MP_ROM_QSTR(MP_QSTR_P1_12), MP_ROM_PTR(&pin_P1_12) }, + { MP_ROM_QSTR(MP_QSTR_P0_25), MP_ROM_PTR(&pin_P0_25) }, + { MP_ROM_QSTR(MP_QSTR_P0_11), MP_ROM_PTR(&pin_P0_11) }, + { MP_ROM_QSTR(MP_QSTR_P1_08), MP_ROM_PTR(&pin_P1_08) }, + { MP_ROM_QSTR(MP_QSTR_P0_27), MP_ROM_PTR(&pin_P0_28) }, + { MP_ROM_QSTR(MP_QSTR_P0_08), MP_ROM_PTR(&pin_P0_08) }, + { MP_ROM_QSTR(MP_QSTR_P0_06), MP_ROM_PTR(&pin_P0_06) }, + { MP_ROM_QSTR(MP_QSTR_P0_26), MP_ROM_PTR(&pin_P0_26) }, + + { MP_ROM_QSTR(MP_QSTR_P0_10), MP_ROM_PTR(&pin_P0_10) }, + { MP_ROM_QSTR(MP_QSTR_P0_09), MP_ROM_PTR(&pin_P0_09) }, + { MP_ROM_QSTR(MP_QSTR_P1_06), MP_ROM_PTR(&pin_P1_06) }, + { MP_ROM_QSTR(MP_QSTR_P1_04), MP_ROM_PTR(&pin_P1_04) }, + { MP_ROM_QSTR(MP_QSTR_P1_02), MP_ROM_PTR(&pin_P1_02) }, + { MP_ROM_QSTR(MP_QSTR_P1_01), MP_ROM_PTR(&pin_P1_01) }, + { MP_ROM_QSTR(MP_QSTR_P1_03), MP_ROM_PTR(&pin_P1_03) }, + { MP_ROM_QSTR(MP_QSTR_P1_00), MP_ROM_PTR(&pin_P1_00) }, + { MP_ROM_QSTR(MP_QSTR_P0_22), MP_ROM_PTR(&pin_P0_22) }, + { MP_ROM_QSTR(MP_QSTR_P1_07), MP_ROM_PTR(&pin_P1_07) }, + { MP_ROM_QSTR(MP_QSTR_P1_05), MP_ROM_PTR(&pin_P1_05) }, + { MP_ROM_QSTR(MP_QSTR_P0_24), MP_ROM_PTR(&pin_P0_24) }, + { MP_ROM_QSTR(MP_QSTR_P0_20), MP_ROM_PTR(&pin_P0_20) }, + { MP_ROM_QSTR(MP_QSTR_P0_17), MP_ROM_PTR(&pin_P0_17) }, + { MP_ROM_QSTR(MP_QSTR_P0_15), MP_ROM_PTR(&pin_P0_15) }, + { MP_ROM_QSTR(MP_QSTR_P0_14), MP_ROM_PTR(&pin_P0_14) }, + { MP_ROM_QSTR(MP_QSTR_P0_13), MP_ROM_PTR(&pin_P0_13) }, + { MP_ROM_QSTR(MP_QSTR_P0_16), MP_ROM_PTR(&pin_P0_16) }, + + + { MP_ROM_QSTR(MP_QSTR_P0_07), MP_ROM_PTR(&pin_P0_07) }, + { MP_ROM_QSTR(MP_QSTR_P1_09), MP_ROM_PTR(&pin_P1_09) }, + { MP_ROM_QSTR(MP_QSTR_P0_12), MP_ROM_PTR(&pin_P0_12) }, + { MP_ROM_QSTR(MP_QSTR_P0_23), MP_ROM_PTR(&pin_P0_23) }, + { MP_ROM_QSTR(MP_QSTR_P0_21), MP_ROM_PTR(&pin_P0_21) }, + { MP_ROM_QSTR(MP_QSTR_P0_19), MP_ROM_PTR(&pin_P0_19) }, + + // RESET { MP_ROM_QSTR(MP_QSTR_P0_18), MP_ROM_PTR(&pin_P0_18) }, + +}; + + +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); \ No newline at end of file From cfaa02ef19c2370cfa8dc5d7fc27664f34d9c90c Mon Sep 17 00:00:00 2001 From: Gaetan Date: Mon, 26 Oct 2020 23:36:54 +0100 Subject: [PATCH 008/148] Fix error --- CONTRIBUTING.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c94e8db8c6..15b4cfc892 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,8 +4,6 @@ SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://g SPDX-License-Identifier: MIT --> - - # Contributing Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). From 80029f6929ebbf6c0a02c5320e59220b0501bd55 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Wed, 28 Oct 2020 00:12:13 +0530 Subject: [PATCH 009/148] rotaryio implementation for esp32s2 --- .../common-hal/rotaryio/IncrementalEncoder.c | 115 ++++++++++++++++++ .../common-hal/rotaryio/IncrementalEncoder.h | 41 +++++++ ports/esp32s2/common-hal/rotaryio/__init__.c | 1 + ports/esp32s2/mpconfigport.mk | 2 +- 4 files changed, 158 insertions(+), 1 deletion(-) create mode 100644 ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c create mode 100644 ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.h create mode 100644 ports/esp32s2/common-hal/rotaryio/__init__.c diff --git a/ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c b/ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c new file mode 100644 index 0000000000..bbff363740 --- /dev/null +++ b/ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c @@ -0,0 +1,115 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2018 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 "common-hal/rotaryio/IncrementalEncoder.h" + +#include "py/runtime.h" +#include "supervisor/shared/translate.h" + +#include "driver/pcnt.h" + +static void pcnt_reset(int unit) { + // Initialize PCNT's counter + pcnt_counter_pause(unit); + pcnt_counter_clear(unit); + + // Everything is set up, now go to counting + pcnt_counter_resume(unit); +} + +static void pcnt_init(int unit, rotaryio_incrementalencoder_obj_t* self) { + // Prepare configuration for the PCNT unit + pcnt_config_t pcnt_config = { + // Set PCNT input signal and control GPIOs + .pulse_gpio_num = self->pin_a->number, + .ctrl_gpio_num = self->pin_b->number, + .channel = PCNT_CHANNEL_0, + .unit = unit, + // What to do on the positive / negative edge of pulse input? + .pos_mode = PCNT_COUNT_DEC, // Count up on the positive edge + .neg_mode = PCNT_COUNT_INC, // Keep the counter value on the negative edge + // What to do when control input is low or high? + .lctrl_mode = PCNT_MODE_REVERSE, // Reverse counting direction if low + .hctrl_mode = PCNT_MODE_KEEP, // Keep the primary counter mode if high + }; + // Initialize PCNT unit + pcnt_unit_config(&pcnt_config); + + // Configure channel 1 + pcnt_config.pulse_gpio_num = self->pin_b->number; + pcnt_config.ctrl_gpio_num = self->pin_a->number; + pcnt_config.channel = PCNT_CHANNEL_1; + pcnt_config.pos_mode = PCNT_COUNT_INC; + pcnt_config.neg_mode = PCNT_COUNT_DEC; + pcnt_unit_config(&pcnt_config); + + // Configure and enable the input filter + pcnt_set_filter_value(unit, 100); + pcnt_filter_enable(unit); + + pcnt_reset(unit); +} + +void common_hal_rotaryio_incrementalencoder_construct(rotaryio_incrementalencoder_obj_t* self, + const mcu_pin_obj_t* pin_a, const mcu_pin_obj_t* pin_b) { + claim_pin(pin_a); + claim_pin(pin_b); + + self->pin_a = pin_a; + self->pin_b = pin_b; + + self->position = 0; + + pcnt_init(PCNT_UNIT_0, self); +} + +bool common_hal_rotaryio_incrementalencoder_deinited(rotaryio_incrementalencoder_obj_t* self) { + return self->pin_a == NULL; +} + +void common_hal_rotaryio_incrementalencoder_deinit(rotaryio_incrementalencoder_obj_t* self) { + if (common_hal_rotaryio_incrementalencoder_deinited(self)) { + return; + } + + reset_pin_number(self->pin_a->number); + self->pin_a = NULL; + + reset_pin_number(self->pin_b->number); + self->pin_b = NULL; +} + +mp_int_t common_hal_rotaryio_incrementalencoder_get_position(rotaryio_incrementalencoder_obj_t* self) { + int16_t count = 0; + pcnt_get_counter_value(PCNT_UNIT_0, &count); + return self->position+count; +} + +void common_hal_rotaryio_incrementalencoder_set_position(rotaryio_incrementalencoder_obj_t* self, + mp_int_t new_position) { + self->position = new_position; + pcnt_reset(PCNT_UNIT_0); +} diff --git a/ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.h b/ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.h new file mode 100644 index 0000000000..0cc2830fb7 --- /dev/null +++ b/ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.h @@ -0,0 +1,41 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2018 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. + */ + +#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_ROTARYIO_INCREMENTALENCODER_H +#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_ROTARYIO_INCREMENTALENCODER_H + +#include "common-hal/microcontroller/Pin.h" + +#include "py/obj.h" + +typedef struct { + mp_obj_base_t base; + const mcu_pin_obj_t * pin_a; + const mcu_pin_obj_t * pin_b; + mp_int_t position; +} rotaryio_incrementalencoder_obj_t; + +#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_ROTARYIO_INCREMENTALENCODER_H diff --git a/ports/esp32s2/common-hal/rotaryio/__init__.c b/ports/esp32s2/common-hal/rotaryio/__init__.c new file mode 100644 index 0000000000..0aae79c26a --- /dev/null +++ b/ports/esp32s2/common-hal/rotaryio/__init__.c @@ -0,0 +1 @@ +// No rotaryio module functions. diff --git a/ports/esp32s2/mpconfigport.mk b/ports/esp32s2/mpconfigport.mk index 4e8a7bdef2..dadab37515 100644 --- a/ports/esp32s2/mpconfigport.mk +++ b/ports/esp32s2/mpconfigport.mk @@ -19,7 +19,7 @@ CIRCUITPY_AUDIOIO = 0 CIRCUITPY_COUNTIO = 0 CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_I2CPERIPHERAL = 0 -CIRCUITPY_ROTARYIO = 0 +CIRCUITPY_ROTARYIO = 1 CIRCUITPY_NVM = 0 # We don't have enough endpoints to include MIDI. CIRCUITPY_USB_MIDI = 0 From d0426b3438a934257c5351f7eb2d9cdd79881c03 Mon Sep 17 00:00:00 2001 From: Noel Gaetan Date: Tue, 27 Oct 2020 23:54:46 +0100 Subject: [PATCH 010/148] Update pins.c fix mistake --- ports/nrf/boards/holyiot_nrf52840/pins.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/nrf/boards/holyiot_nrf52840/pins.c b/ports/nrf/boards/holyiot_nrf52840/pins.c index 4e2593e58f..cdec4dfa8e 100644 --- a/ports/nrf/boards/holyiot_nrf52840/pins.c +++ b/ports/nrf/boards/holyiot_nrf52840/pins.c @@ -51,9 +51,9 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_P0_21), MP_ROM_PTR(&pin_P0_21) }, { MP_ROM_QSTR(MP_QSTR_P0_19), MP_ROM_PTR(&pin_P0_19) }, - // RESET { MP_ROM_QSTR(MP_QSTR_P0_18), MP_ROM_PTR(&pin_P0_18) }, + // RESET { MP_ROM_QSTR(MP_QSTR_P0_18), MP_ROM_PTR(&pin_P0_18) } }; -MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); \ No newline at end of file +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From 27827a4fef74dc66996ecb670f01ad5d58500899 Mon Sep 17 00:00:00 2001 From: Gaetan Date: Wed, 28 Oct 2020 00:34:07 +0100 Subject: [PATCH 011/148] =?UTF-8?q?Fix=20EOF=20error=20modifi=C3=A9=C2=A0:?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20mpconfigboard.mk=20modifi=C3=A9?= =?UTF-8?q?=C2=A0:=20=20=20=20=20=20=20=20=20pins.c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ports/nrf/boards/holyiot_nrf52840/mpconfigboard.mk | 2 +- ports/nrf/boards/holyiot_nrf52840/pins.c | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/ports/nrf/boards/holyiot_nrf52840/mpconfigboard.mk b/ports/nrf/boards/holyiot_nrf52840/mpconfigboard.mk index d85de75071..ead2059531 100644 --- a/ports/nrf/boards/holyiot_nrf52840/mpconfigboard.mk +++ b/ports/nrf/boards/holyiot_nrf52840/mpconfigboard.mk @@ -5,4 +5,4 @@ USB_MANUFACTURER = "Holyiot" MCU_CHIP = nrf52840 -INTERNAL_FLASH_FILESYSTEM = 1 \ No newline at end of file +INTERNAL_FLASH_FILESYSTEM = 1 diff --git a/ports/nrf/boards/holyiot_nrf52840/pins.c b/ports/nrf/boards/holyiot_nrf52840/pins.c index 4e2593e58f..604744e0ea 100644 --- a/ports/nrf/boards/holyiot_nrf52840/pins.c +++ b/ports/nrf/boards/holyiot_nrf52840/pins.c @@ -43,7 +43,6 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_P0_13), MP_ROM_PTR(&pin_P0_13) }, { MP_ROM_QSTR(MP_QSTR_P0_16), MP_ROM_PTR(&pin_P0_16) }, - { MP_ROM_QSTR(MP_QSTR_P0_07), MP_ROM_PTR(&pin_P0_07) }, { MP_ROM_QSTR(MP_QSTR_P1_09), MP_ROM_PTR(&pin_P1_09) }, { MP_ROM_QSTR(MP_QSTR_P0_12), MP_ROM_PTR(&pin_P0_12) }, @@ -55,5 +54,4 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { }; - -MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); \ No newline at end of file +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From 9b911b2211715e9da7ae55b691f54fe2f33a4486 Mon Sep 17 00:00:00 2001 From: Gaetan Date: Wed, 28 Oct 2020 00:38:07 +0100 Subject: [PATCH 012/148] =?UTF-8?q?modifi=C3=A9=C2=A0:=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20pins.c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ports/nrf/boards/holyiot_nrf52840/pins.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ports/nrf/boards/holyiot_nrf52840/pins.c b/ports/nrf/boards/holyiot_nrf52840/pins.c index 604744e0ea..8e06675916 100644 --- a/ports/nrf/boards/holyiot_nrf52840/pins.c +++ b/ports/nrf/boards/holyiot_nrf52840/pins.c @@ -50,8 +50,12 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_P0_21), MP_ROM_PTR(&pin_P0_21) }, { MP_ROM_QSTR(MP_QSTR_P0_19), MP_ROM_PTR(&pin_P0_19) }, - // RESET { MP_ROM_QSTR(MP_QSTR_P0_18), MP_ROM_PTR(&pin_P0_18) }, + // RESET { MP_ROM_QSTR(MP_QSTR_P0_18), MP_ROM_PTR(&pin_P0_18) } }; +<<<<<<< HEAD +======= + +>>>>>>> d0426b3438a934257c5351f7eb2d9cdd79881c03 MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From b44011d196a0a7294fca1e1825054761979ba075 Mon Sep 17 00:00:00 2001 From: Gaetan Date: Wed, 28 Oct 2020 01:43:42 +0100 Subject: [PATCH 013/148] fix railing Whitespace pin.c --- ports/nrf/boards/holyiot_nrf52840/pins.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/nrf/boards/holyiot_nrf52840/pins.c b/ports/nrf/boards/holyiot_nrf52840/pins.c index c9e222b671..83be4f0ac7 100644 --- a/ports/nrf/boards/holyiot_nrf52840/pins.c +++ b/ports/nrf/boards/holyiot_nrf52840/pins.c @@ -49,7 +49,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_P0_23), MP_ROM_PTR(&pin_P0_23) }, { MP_ROM_QSTR(MP_QSTR_P0_21), MP_ROM_PTR(&pin_P0_21) }, { MP_ROM_QSTR(MP_QSTR_P0_19), MP_ROM_PTR(&pin_P0_19) }, - + // RESET { MP_ROM_QSTR(MP_QSTR_P0_18), MP_ROM_PTR(&pin_P0_18) } }; From 5e3bfa1956ca4d327fcad23ce508ebbdaeac4d69 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Wed, 28 Oct 2020 20:08:25 +0530 Subject: [PATCH 014/148] countio implementation for esp32s2 --- ports/esp32s2/common-hal/countio/Counter.c | 69 +++++++++++++++++++++ ports/esp32s2/common-hal/countio/Counter.h | 15 +++++ ports/esp32s2/common-hal/countio/__init__.c | 1 + ports/esp32s2/mpconfigport.mk | 2 +- 4 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 ports/esp32s2/common-hal/countio/Counter.c create mode 100644 ports/esp32s2/common-hal/countio/Counter.h create mode 100644 ports/esp32s2/common-hal/countio/__init__.c diff --git a/ports/esp32s2/common-hal/countio/Counter.c b/ports/esp32s2/common-hal/countio/Counter.c new file mode 100644 index 0000000000..6a76a163d7 --- /dev/null +++ b/ports/esp32s2/common-hal/countio/Counter.c @@ -0,0 +1,69 @@ +#include "common-hal/countio/Counter.h" + +#include "py/runtime.h" +#include "supervisor/shared/translate.h" + +#include "driver/pcnt.h" + +static void pcnt_init(countio_counter_obj_t* self) { + int unit = PCNT_UNIT_0; + // Prepare configuration for the PCNT unit + pcnt_config_t pcnt_config = { + // Set PCNT input signal and control GPIOs + .pulse_gpio_num = self->pin->number, + .ctrl_gpio_num = PCNT_PIN_NOT_USED, + .channel = PCNT_CHANNEL_0, + .unit = unit, + // What to do on the positive / negative edge of pulse input? + .pos_mode = PCNT_COUNT_INC, // Count up on the positive edge + .neg_mode = PCNT_COUNT_DIS, // Keep the counter value on the negative edge + }; + // Initialize PCNT unit + pcnt_unit_config(&pcnt_config); + + // Configure and enable the input filter + pcnt_set_filter_value(unit, 100); + pcnt_filter_enable(unit); + + // Initialize PCNT's counter + pcnt_counter_pause(unit); + pcnt_counter_clear(unit); + + // Everything is set up, now go to counting + pcnt_counter_resume(unit); +} + +void common_hal_countio_counter_construct(countio_counter_obj_t* self, + const mcu_pin_obj_t* pin) { + claim_pin(pin); + self->pin = pin; + pcnt_init(self); +} + +bool common_hal_countio_counter_deinited(countio_counter_obj_t* self) { + return self->pin == NULL; +} + +void common_hal_countio_counter_deinit(countio_counter_obj_t* self) { + if (common_hal_countio_counter_deinited(self)) { + return; + } + reset_pin_number(self->pin->number); + self->pin = NULL; +} + +mp_int_t common_hal_countio_counter_get_count(countio_counter_obj_t* self) { + int16_t count; + pcnt_get_counter_value(PCNT_UNIT_0, &count); + return count+self->count; +} + +void common_hal_countio_counter_set_count(countio_counter_obj_t* self, + mp_int_t new_count) { + self->count = new_count; + pcnt_counter_clear(PCNT_UNIT_0); +} + +void common_hal_countio_counter_reset(countio_counter_obj_t* self) { + common_hal_countio_counter_set_count(self, 0); +} diff --git a/ports/esp32s2/common-hal/countio/Counter.h b/ports/esp32s2/common-hal/countio/Counter.h new file mode 100644 index 0000000000..3406f9daaf --- /dev/null +++ b/ports/esp32s2/common-hal/countio/Counter.h @@ -0,0 +1,15 @@ + +#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_COUNTIO_COUNTER_H +#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_COUNTIO_COUNTER_H + +#include "common-hal/microcontroller/Pin.h" + +#include "py/obj.h" + +typedef struct { + mp_obj_base_t base; + const mcu_pin_obj_t * pin; + mp_int_t count; +} countio_counter_obj_t; + +#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_COUNTIO_COUNT_H diff --git a/ports/esp32s2/common-hal/countio/__init__.c b/ports/esp32s2/common-hal/countio/__init__.c new file mode 100644 index 0000000000..b95b20d153 --- /dev/null +++ b/ports/esp32s2/common-hal/countio/__init__.c @@ -0,0 +1 @@ +//No countio module functions diff --git a/ports/esp32s2/mpconfigport.mk b/ports/esp32s2/mpconfigport.mk index c06c89c909..bdb25a87b8 100644 --- a/ports/esp32s2/mpconfigport.mk +++ b/ports/esp32s2/mpconfigport.mk @@ -17,7 +17,7 @@ CIRCUITPY_FULL_BUILD = 1 CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_AUDIOIO = 0 CIRCUITPY_CANIO = 1 -CIRCUITPY_COUNTIO = 0 +CIRCUITPY_COUNTIO = 1 CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_I2CPERIPHERAL = 0 CIRCUITPY_ROTARYIO = 0 From 5ab2f16f64f0935ac8ad6fa776c435d55a3cff1e Mon Sep 17 00:00:00 2001 From: Gaetan Date: Wed, 28 Oct 2020 22:08:10 +0100 Subject: [PATCH 015/148] =?UTF-8?q?Change=20Board=20Name=20to=20ADM=5FB=5F?= =?UTF-8?q?NRF52840=5F1=20edit=20=20=20:=20=20=20=20=20=20=20=20=20.github?= =?UTF-8?q?/workflows/build.yml=20rename=C2=A0:=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?ports/nrf/boards/holyiot=5Fnrf52840/board.c=20->=20ports/nrf/bo?= =?UTF-8?q?ards/ADM=5FB=5FNRF52840=5F1/board.c=20rename=C2=A0:=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20ports/nrf/boards/holyiot=5Fnrf52840/mpconfigboar?= =?UTF-8?q?d.h=20->=20ports/nrf/boards/ADM=5FB=5FNRF52840=5F1/mpconfigboar?= =?UTF-8?q?d.h=20rename=C2=A0:=20=20=20=20=20=20=20=20=20ports/nrf/boards/?= =?UTF-8?q?holyiot=5Fnrf52840/mpconfigboard.mk=20->=20ports/nrf/boards/ADM?= =?UTF-8?q?=5FB=5FNRF52840=5F1/mpconfigboard.mk=20rename=C2=A0:=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20ports/nrf/boards/holyiot=5Fnrf52840/pins.c=20?= =?UTF-8?q?->=20ports/nrf/boards/ADM=5FB=5FNRF52840=5F1/pins.c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 2 +- .../nrf/boards/{holyiot_nrf52840 => ADM_B_NRF52840_1}/board.c | 0 .../{holyiot_nrf52840 => ADM_B_NRF52840_1}/mpconfigboard.h | 2 +- .../{holyiot_nrf52840 => ADM_B_NRF52840_1}/mpconfigboard.mk | 4 ++-- .../nrf/boards/{holyiot_nrf52840 => ADM_B_NRF52840_1}/pins.c | 0 5 files changed, 4 insertions(+), 4 deletions(-) rename ports/nrf/boards/{holyiot_nrf52840 => ADM_B_NRF52840_1}/board.c (100%) rename ports/nrf/boards/{holyiot_nrf52840 => ADM_B_NRF52840_1}/mpconfigboard.h (95%) rename ports/nrf/boards/{holyiot_nrf52840 => ADM_B_NRF52840_1}/mpconfigboard.mk (55%) rename ports/nrf/boards/{holyiot_nrf52840 => ADM_B_NRF52840_1}/pins.c (100%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cada55aaa4..1a967046ca 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -162,6 +162,7 @@ jobs: board: - "8086_commander" - "TG-Watch02A" + - "ADM_B_NRF52840_1" - "aloriumtech_evo_m51" - "aramcon_badge_2019" - "arduino_mkr1300" @@ -214,7 +215,6 @@ jobs: - "hallowing_m0_express" - "hallowing_m4_express" - "hiibot_bluefi" - - "holyiot_nrf52840" - "ikigaisense_vita" - "imxrt1010_evk" - "imxrt1020_evk" diff --git a/ports/nrf/boards/holyiot_nrf52840/board.c b/ports/nrf/boards/ADM_B_NRF52840_1/board.c similarity index 100% rename from ports/nrf/boards/holyiot_nrf52840/board.c rename to ports/nrf/boards/ADM_B_NRF52840_1/board.c diff --git a/ports/nrf/boards/holyiot_nrf52840/mpconfigboard.h b/ports/nrf/boards/ADM_B_NRF52840_1/mpconfigboard.h similarity index 95% rename from ports/nrf/boards/holyiot_nrf52840/mpconfigboard.h rename to ports/nrf/boards/ADM_B_NRF52840_1/mpconfigboard.h index 3b64d3a629..575d09feb5 100644 --- a/ports/nrf/boards/holyiot_nrf52840/mpconfigboard.h +++ b/ports/nrf/boards/ADM_B_NRF52840_1/mpconfigboard.h @@ -27,7 +27,7 @@ #include "nrfx/hal/nrf_gpio.h" -#define MICROPY_HW_BOARD_NAME "Holyiot nRF52840" +#define MICROPY_HW_BOARD_NAME "AtelierDuMaker nRF52840 Breakout" #define MICROPY_HW_MCU_NAME "nRF52840" #define MICROPY_HW_LED_STATUS (&pin_P0_19) diff --git a/ports/nrf/boards/holyiot_nrf52840/mpconfigboard.mk b/ports/nrf/boards/ADM_B_NRF52840_1/mpconfigboard.mk similarity index 55% rename from ports/nrf/boards/holyiot_nrf52840/mpconfigboard.mk rename to ports/nrf/boards/ADM_B_NRF52840_1/mpconfigboard.mk index ead2059531..f3a2e830dd 100644 --- a/ports/nrf/boards/holyiot_nrf52840/mpconfigboard.mk +++ b/ports/nrf/boards/ADM_B_NRF52840_1/mpconfigboard.mk @@ -1,7 +1,7 @@ USB_VID = 0x239A USB_PID = 0x80A0 -USB_PRODUCT = "HOLYIOTNRF52840" -USB_MANUFACTURER = "Holyiot" +USB_PRODUCT = "ADM_B_NRF52840_1" +USB_MANUFACTURER = "AtelierDuMaker" MCU_CHIP = nrf52840 diff --git a/ports/nrf/boards/holyiot_nrf52840/pins.c b/ports/nrf/boards/ADM_B_NRF52840_1/pins.c similarity index 100% rename from ports/nrf/boards/holyiot_nrf52840/pins.c rename to ports/nrf/boards/ADM_B_NRF52840_1/pins.c From 3dcee5be803a4d6bd9f05ecb13608467dc2e3a55 Mon Sep 17 00:00:00 2001 From: Gaetan Date: Wed, 28 Oct 2020 22:38:13 +0100 Subject: [PATCH 016/148] Fix: .github/workflows/build.yml --- .github/workflows/build.yml | 49 ++++++++++++++++++++++++++++++------- 1 file changed, 40 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1a967046ca..2f61b60415 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,7 +28,7 @@ jobs: - name: CircuitPython version run: | git describe --dirty --tags - echo "::set-env name=CP_VERSION::$(git describe --dirty --tags)" + echo >>$GITHUB_ENV CP_VERSION=$(git describe --dirty --tags) - name: Set up Python 3.8 uses: actions/setup-python@v1 with: @@ -36,7 +36,7 @@ jobs: - name: Install deps run: | sudo apt-get install -y eatmydata - sudo eatmydata apt-get install -y gettext librsvg2-bin mingw-w64 + sudo eatmydata apt-get install -y gettext librsvg2-bin mingw-w64 latexmk texlive-fonts-recommended texlive-latex-recommended texlive-latex-extra pip install requests sh click setuptools cpp-coveralls "Sphinx<4" sphinx-rtd-theme recommonmark sphinx-autoapi sphinxcontrib-svg2pdfconverter polib pyyaml astroid isort black awscli - name: Versions run: | @@ -73,17 +73,26 @@ jobs: with: name: stubs path: circuitpython-stubs* - - name: Docs + - name: Test Documentation Build (HTML) run: sphinx-build -E -W -b html -D version=${{ env.CP_VERSION }} -D release=${{ env.CP_VERSION }} . _build/html - uses: actions/upload-artifact@v2 with: name: docs path: _build/html + - name: Test Documentation Build (LaTeX/PDF) + run: | + make latexpdf + - uses: actions/upload-artifact@v2 + with: + name: docs + path: _build/latex - name: Translations run: make check-translate - name: New boards check run: python3 -u ci_new_boards_check.py working-directory: tools + - name: Duplicate USB VID/PID Check + run: python3 -u -m tools.ci_check_duplicate_usb_vid_pid - name: Build mpy-cross.static-raspbian run: make -C mpy-cross -j2 -f Makefile.static-raspbian - uses: actions/upload-artifact@v2 @@ -122,8 +131,8 @@ jobs: run: echo "$GITHUB_CONTEXT" - name: Install dependencies run: | - brew install gettext awscli - echo "::set-env name=PATH::/usr/local/opt/gettext/bin:$PATH" + brew install gettext + echo >>$GITHUB_PATH /usr/local/opt/gettext/bin - name: Versions run: | gcc --version @@ -137,7 +146,7 @@ jobs: - name: CircuitPython version run: | git describe --dirty --tags - echo "::set-env name=CP_VERSION::$(git describe --dirty --tags)" + echo >>$GITHUB_ENV CP_VERSION=$(git describe --dirty --tags) - name: Build mpy-cross run: make -C mpy-cross -j2 - uses: actions/upload-artifact@v2 @@ -161,8 +170,8 @@ jobs: matrix: board: - "8086_commander" - - "TG-Watch02A" - "ADM_B_NRF52840_1" + - "TG-Watch02A" - "aloriumtech_evo_m51" - "aramcon_badge_2019" - "arduino_mkr1300" @@ -171,7 +180,8 @@ jobs: - "arduino_nano_33_iot" - "arduino_zero" - "bast_pro_mini_m0" - - "bdmicro_vina_m0" + - "bdmicro_vina_d21" + - "bdmicro_vina_d51" - "bless_dev_board_multi_sensor" - "blm_badge" - "capablerobot_usbhub" @@ -189,6 +199,8 @@ jobs: - "datum_imu" - "datum_light" - "datum_weather" + - "dynossat_edu_eps" + - "dynossat_edu_obc" - "electronut_labs_blip" - "electronut_labs_papyr" - "escornabot_makech" @@ -202,6 +214,7 @@ jobs: - "feather_m0_rfm69" - "feather_m0_rfm9x" - "feather_m0_supersized" + - "feather_m4_can" - "feather_m4_express" - "feather_m7_1011" - "feather_mimxrt1011" @@ -228,11 +241,13 @@ jobs: - "makerdiary_nrf52840_m2_devkit" - "makerdiary_nrf52840_mdk" - "makerdiary_nrf52840_mdk_usb_dongle" + - "matrixportal_m4" - "meowbit_v121" - "meowmeow" - "metro_m0_express" - "metro_m4_airlift_lite" - "metro_m4_express" + - "metro_m7_1011" - "metro_nrf52840_express" - "mini_sam_m4" - "monster_m4sk" @@ -254,6 +269,7 @@ jobs: - "pca10100" - "pewpew10" - "pewpew_m4" + - "picoplanet" - "pirkey_m0" - "pitaya_go" - "pyb_nano_v2" @@ -267,6 +283,8 @@ jobs: - "pyportal" - "pyportal_titano" - "pyruler" + - "qtpy_m0" + - "qtpy_m0_haxpress" - "raytac_mdbt50q-db-40" - "robohatmm1_m4" - "sam32" @@ -401,9 +419,17 @@ jobs: fail-fast: false matrix: board: + - "adafruit_metro_esp32s2" + - "electroniccats_bastwifi" + - "espressif_kaluga_1" - "espressif_saola_1_wroom" - "espressif_saola_1_wrover" + - "microdev_micro_s2" + - "muselab_nanoesp32_s2" + - "targett_module_clip_wroom" + - "targett_module_clip_wrover" - "unexpectedmaker_feathers2" + - "unexpectedmaker_feathers2_prerelease" steps: - name: Set up Python 3.8 @@ -423,6 +449,11 @@ jobs: with: path: ${{ github.workspace }}/.idf_tools key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/esp32s2/esp-idf/HEAD') }}-20200801 + - name: Clone IDF submodules + run: | + (cd $IDF_PATH && git submodule update --init) + env: + IDF_PATH: ${{ github.workspace }}/ports/esp32s2/esp-idf - name: Install IDF tools run: | $IDF_PATH/tools/idf_tools.py --non-interactive install required @@ -473,4 +504,4 @@ jobs: env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - if: github.event_name == 'push' || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested')) + if: github.event_name == 'push' || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested')) \ No newline at end of file From 34ce8d8642d43397627e6001b221039d7190db5b Mon Sep 17 00:00:00 2001 From: Noel Gaetan Date: Wed, 28 Oct 2020 22:43:54 +0100 Subject: [PATCH 017/148] Update build.yml --- .github/workflows/build.yml | 47 +++++++------------------------------ 1 file changed, 8 insertions(+), 39 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2f61b60415..6619cbdf23 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,7 +28,7 @@ jobs: - name: CircuitPython version run: | git describe --dirty --tags - echo >>$GITHUB_ENV CP_VERSION=$(git describe --dirty --tags) + echo "::set-env name=CP_VERSION::$(git describe --dirty --tags)" - name: Set up Python 3.8 uses: actions/setup-python@v1 with: @@ -36,7 +36,7 @@ jobs: - name: Install deps run: | sudo apt-get install -y eatmydata - sudo eatmydata apt-get install -y gettext librsvg2-bin mingw-w64 latexmk texlive-fonts-recommended texlive-latex-recommended texlive-latex-extra + sudo eatmydata apt-get install -y gettext librsvg2-bin mingw-w64 pip install requests sh click setuptools cpp-coveralls "Sphinx<4" sphinx-rtd-theme recommonmark sphinx-autoapi sphinxcontrib-svg2pdfconverter polib pyyaml astroid isort black awscli - name: Versions run: | @@ -73,26 +73,17 @@ jobs: with: name: stubs path: circuitpython-stubs* - - name: Test Documentation Build (HTML) + - name: Docs run: sphinx-build -E -W -b html -D version=${{ env.CP_VERSION }} -D release=${{ env.CP_VERSION }} . _build/html - uses: actions/upload-artifact@v2 with: name: docs path: _build/html - - name: Test Documentation Build (LaTeX/PDF) - run: | - make latexpdf - - uses: actions/upload-artifact@v2 - with: - name: docs - path: _build/latex - name: Translations run: make check-translate - name: New boards check run: python3 -u ci_new_boards_check.py working-directory: tools - - name: Duplicate USB VID/PID Check - run: python3 -u -m tools.ci_check_duplicate_usb_vid_pid - name: Build mpy-cross.static-raspbian run: make -C mpy-cross -j2 -f Makefile.static-raspbian - uses: actions/upload-artifact@v2 @@ -131,8 +122,8 @@ jobs: run: echo "$GITHUB_CONTEXT" - name: Install dependencies run: | - brew install gettext - echo >>$GITHUB_PATH /usr/local/opt/gettext/bin + brew install gettext awscli + echo "::set-env name=PATH::/usr/local/opt/gettext/bin:$PATH" - name: Versions run: | gcc --version @@ -146,7 +137,7 @@ jobs: - name: CircuitPython version run: | git describe --dirty --tags - echo >>$GITHUB_ENV CP_VERSION=$(git describe --dirty --tags) + echo "::set-env name=CP_VERSION::$(git describe --dirty --tags)" - name: Build mpy-cross run: make -C mpy-cross -j2 - uses: actions/upload-artifact@v2 @@ -180,8 +171,7 @@ jobs: - "arduino_nano_33_iot" - "arduino_zero" - "bast_pro_mini_m0" - - "bdmicro_vina_d21" - - "bdmicro_vina_d51" + - "bdmicro_vina_m0" - "bless_dev_board_multi_sensor" - "blm_badge" - "capablerobot_usbhub" @@ -199,8 +189,6 @@ jobs: - "datum_imu" - "datum_light" - "datum_weather" - - "dynossat_edu_eps" - - "dynossat_edu_obc" - "electronut_labs_blip" - "electronut_labs_papyr" - "escornabot_makech" @@ -214,7 +202,6 @@ jobs: - "feather_m0_rfm69" - "feather_m0_rfm9x" - "feather_m0_supersized" - - "feather_m4_can" - "feather_m4_express" - "feather_m7_1011" - "feather_mimxrt1011" @@ -241,13 +228,11 @@ jobs: - "makerdiary_nrf52840_m2_devkit" - "makerdiary_nrf52840_mdk" - "makerdiary_nrf52840_mdk_usb_dongle" - - "matrixportal_m4" - "meowbit_v121" - "meowmeow" - "metro_m0_express" - "metro_m4_airlift_lite" - "metro_m4_express" - - "metro_m7_1011" - "metro_nrf52840_express" - "mini_sam_m4" - "monster_m4sk" @@ -269,7 +254,6 @@ jobs: - "pca10100" - "pewpew10" - "pewpew_m4" - - "picoplanet" - "pirkey_m0" - "pitaya_go" - "pyb_nano_v2" @@ -283,8 +267,6 @@ jobs: - "pyportal" - "pyportal_titano" - "pyruler" - - "qtpy_m0" - - "qtpy_m0_haxpress" - "raytac_mdbt50q-db-40" - "robohatmm1_m4" - "sam32" @@ -419,17 +401,9 @@ jobs: fail-fast: false matrix: board: - - "adafruit_metro_esp32s2" - - "electroniccats_bastwifi" - - "espressif_kaluga_1" - "espressif_saola_1_wroom" - "espressif_saola_1_wrover" - - "microdev_micro_s2" - - "muselab_nanoesp32_s2" - - "targett_module_clip_wroom" - - "targett_module_clip_wrover" - "unexpectedmaker_feathers2" - - "unexpectedmaker_feathers2_prerelease" steps: - name: Set up Python 3.8 @@ -449,11 +423,6 @@ jobs: with: path: ${{ github.workspace }}/.idf_tools key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/esp32s2/esp-idf/HEAD') }}-20200801 - - name: Clone IDF submodules - run: | - (cd $IDF_PATH && git submodule update --init) - env: - IDF_PATH: ${{ github.workspace }}/ports/esp32s2/esp-idf - name: Install IDF tools run: | $IDF_PATH/tools/idf_tools.py --non-interactive install required @@ -504,4 +473,4 @@ jobs: env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - if: github.event_name == 'push' || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested')) \ No newline at end of file + if: github.event_name == 'push' || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested')) From e83be19d0f43d406c0968eb3903972cf127efb8d Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 28 Oct 2020 17:48:12 -0500 Subject: [PATCH 018/148] actions: Fix location of stubs upload --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0792d36a01..5092e48323 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -117,7 +117,7 @@ jobs: [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-amd64-linux-${{ env.CP_VERSION }} --no-progress --region us-east-1 [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static.exe s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-x64-windows-${{ env.CP_VERSION }}.exe --no-progress --region us-east-1 zip -9 circuitpython-stubs.CP_VERSION }}.zip stubs - [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp circuitpython-stubs.zip s3://adafruit-circuit-python/bin/mpy-cross/circuitpython-stubs-${{ env.CP_VERSION }}.zip --no-progress --region us-east-1 + [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp circuitpython-stubs.zip s3://adafruit-circuit-python/bin/stubs/circuitpython-stubs-${{ env.CP_VERSION }}.zip --no-progress --region us-east-1 env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} From 59b9ca409cc6d1835567f866f9a96c04bc78d2c3 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Wed, 28 Oct 2020 20:33:10 -0400 Subject: [PATCH 019/148] matrixportal ESP TX and RX pins were swapped --- ports/atmel-samd/boards/matrixportal_m4/pins.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/atmel-samd/boards/matrixportal_m4/pins.c b/ports/atmel-samd/boards/matrixportal_m4/pins.c index 34865597b6..1f9956d9ec 100644 --- a/ports/atmel-samd/boards/matrixportal_m4/pins.c +++ b/ports/atmel-samd/boards/matrixportal_m4/pins.c @@ -16,8 +16,8 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_BUSY), MP_ROM_PTR(&pin_PA22) }, { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_RESET), MP_ROM_PTR(&pin_PA21) }, { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_RTS), MP_ROM_PTR(&pin_PA18) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_TX), MP_ROM_PTR(&pin_PA12) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_RX), MP_ROM_PTR(&pin_PA13) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_TX), MP_ROM_PTR(&pin_PA13) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_RX), MP_ROM_PTR(&pin_PA12) }, { MP_OBJ_NEW_QSTR(MP_QSTR_SCL),MP_ROM_PTR(&pin_PB30) }, { MP_OBJ_NEW_QSTR(MP_QSTR_SDA),MP_ROM_PTR(&pin_PB31) }, From ad166ca479f405a9cb43fae9fe7b082d2e6ba19f Mon Sep 17 00:00:00 2001 From: sw23 Date: Thu, 29 Oct 2020 20:15:34 -0400 Subject: [PATCH 020/148] Fixing make stub warnings and mypy issuesmak --- shared-bindings/canio/CAN.c | 8 ++++---- shared-bindings/canio/Listener.c | 2 +- shared-bindings/canio/Match.c | 2 +- shared-bindings/canio/Message.c | 2 +- shared-bindings/canio/RemoteTransmissionRequest.c | 2 +- shared-bindings/displayio/Bitmap.c | 4 ++-- shared-bindings/displayio/Display.c | 2 +- shared-bindings/socketpool/Socket.c | 2 +- shared-bindings/socketpool/SocketPool.c | 2 +- shared-bindings/ssl/SSLContext.c | 2 +- shared-bindings/wifi/Radio.c | 4 ++-- tools/extract_pyi.py | 9 ++++++++- 12 files changed, 24 insertions(+), 17 deletions(-) diff --git a/shared-bindings/canio/CAN.c b/shared-bindings/canio/CAN.c index 4982a97b9d..13066764e3 100644 --- a/shared-bindings/canio/CAN.c +++ b/shared-bindings/canio/CAN.c @@ -49,7 +49,7 @@ //| loopback: bool = False, //| silent: bool = False, //| auto_restart: bool = False, -//| ): +//| ) -> None: //| """A common shared-bus protocol. The rx and tx pins are generally //| connected to a transceiver which controls the H and L pins on a //| shared bus. @@ -171,7 +171,7 @@ STATIC const mp_obj_property_t canio_can_receive_error_count_obj = { (mp_obj_t)mp_const_none}, }; -//| state: State +//| state: BusState //| """The current state of the bus. (read-only)""" STATIC mp_obj_t canio_can_state_get(mp_obj_t self_in) { canio_can_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -291,7 +291,7 @@ STATIC const mp_obj_property_t canio_can_loopback_obj = { }; -//| def send(message: Union[RemoteTransmissionRequest, Message]) -> None: +//| def send(self, message: Union[RemoteTransmissionRequest, Message]) -> None: //| """Send a message on the bus with the given data and id. //| If the message could not be sent due to a full fifo or a bus error condition, RuntimeError is raised. //| """ @@ -352,7 +352,7 @@ STATIC mp_obj_t canio_can_enter(mp_obj_t self_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(canio_can_enter_obj, canio_can_enter); -//| def __exit__(self, unused1, unused2, unused3) -> None: +//| def __exit__(self, unused1: Optional[Type[BaseException]], unused2: Optional[BaseException], unused3: Optional[TracebackType]) -> None: //| """Calls deinit()""" //| ... STATIC mp_obj_t canio_can_exit(size_t num_args, const mp_obj_t args[]) { diff --git a/shared-bindings/canio/Listener.c b/shared-bindings/canio/Listener.c index 93552af814..8a39f0f2ae 100644 --- a/shared-bindings/canio/Listener.c +++ b/shared-bindings/canio/Listener.c @@ -123,7 +123,7 @@ STATIC mp_obj_t canio_listener_enter(mp_obj_t self_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(canio_listener_enter_obj, canio_listener_enter); -//| def __exit__(self, unused1, unused2, unused3) -> None: +//| def __exit__(self, unused1: Optional[Type[BaseException]], unused2: Optional[BaseException], unused3: Optional[TracebackType]) -> None: //| """Calls deinit()""" //| ... STATIC mp_obj_t canio_listener_exit(size_t num_args, const mp_obj_t args[]) { diff --git a/shared-bindings/canio/Match.c b/shared-bindings/canio/Match.c index 3fbc1773e8..6039631fad 100644 --- a/shared-bindings/canio/Match.c +++ b/shared-bindings/canio/Match.c @@ -33,7 +33,7 @@ //| """Describe CAN bus messages to match""" //| //| -//| def __init__(self, id: int, *, mask: Optional[int] = None, extended: bool = False): +//| def __init__(self, id: int, *, mask: Optional[int] = None, extended: bool = False) -> None: //| """Construct a Match with the given properties. //| //| If mask is not None, then the filter is for any id which matches all diff --git a/shared-bindings/canio/Message.c b/shared-bindings/canio/Message.c index e47e997c70..04fa8fc6c2 100644 --- a/shared-bindings/canio/Message.c +++ b/shared-bindings/canio/Message.c @@ -31,7 +31,7 @@ #include "py/runtime.h" //| class Message: -//| def __init__(self, id: int, data: bytes, *, extended: bool = False): +//| def __init__(self, id: int, data: bytes, *, extended: bool = False) -> None: //| """Construct a Message to send on a CAN bus. //| //| :param int id: The numeric ID of the message diff --git a/shared-bindings/canio/RemoteTransmissionRequest.c b/shared-bindings/canio/RemoteTransmissionRequest.c index d762787b18..fcd2590340 100644 --- a/shared-bindings/canio/RemoteTransmissionRequest.c +++ b/shared-bindings/canio/RemoteTransmissionRequest.c @@ -31,7 +31,7 @@ #include "py/runtime.h" //| class RemoteTransmissionRequest: -//| def __init__(self, id: int, length: int, *, extended: bool = False): +//| def __init__(self, id: int, length: int, *, extended: bool = False) -> None: //| """Construct a RemoteTransmissionRequest to send on a CAN bus. //| //| :param int id: The numeric ID of the requested message diff --git a/shared-bindings/displayio/Bitmap.c b/shared-bindings/displayio/Bitmap.c index 5a2fc785f8..b9f06fe143 100644 --- a/shared-bindings/displayio/Bitmap.c +++ b/shared-bindings/displayio/Bitmap.c @@ -172,7 +172,7 @@ STATIC mp_obj_t bitmap_subscr(mp_obj_t self_in, mp_obj_t index_obj, mp_obj_t val return mp_const_none; } -//| def blit(self, x: int, y: int, source_bitmap: bitmap, *, x1: int, y1: int, x2: int, y2: int, skip_index: int) -> None: +//| def blit(self, x: int, y: int, source_bitmap: Bitmap, *, x1: int, y1: int, x2: int, y2: int, skip_index: int) -> None: //| """Inserts the source_bitmap region defined by rectangular boundaries //| (x1,y1) and (x2,y2) into the bitmap at the specified (x,y) location. //| @@ -274,7 +274,7 @@ STATIC mp_obj_t displayio_bitmap_obj_blit(size_t n_args, const mp_obj_t *pos_arg MP_DEFINE_CONST_FUN_OBJ_KW(displayio_bitmap_blit_obj, 4, displayio_bitmap_obj_blit); // `displayio_bitmap_obj_blit` requires at least 4 arguments -//| def fill(self, value: Any) -> None: +//| def fill(self, value: int) -> None: //| """Fills the bitmap with the supplied palette index value.""" //| ... //| diff --git a/shared-bindings/displayio/Display.c b/shared-bindings/displayio/Display.c index e78a893b01..1ed59f2331 100644 --- a/shared-bindings/displayio/Display.c +++ b/shared-bindings/displayio/Display.c @@ -39,7 +39,7 @@ #include "shared-module/displayio/__init__.h" #include "supervisor/shared/translate.h" -//| _DisplayBus = Union[FourWire, ParallelBus, I2CDisplay] +//| _DisplayBus = Union['FourWire', 'ParallelBus', 'I2CDisplay'] //| """:py:class:`FourWire`, :py:class:`ParallelBus` or :py:class:`I2CDisplay`""" //| diff --git a/shared-bindings/socketpool/Socket.c b/shared-bindings/socketpool/Socket.c index e7b31842d2..362e4d7e86 100644 --- a/shared-bindings/socketpool/Socket.c +++ b/shared-bindings/socketpool/Socket.c @@ -161,7 +161,7 @@ STATIC mp_obj_t socketpool_socket_close(mp_obj_t self_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(socketpool_socket_close_obj, socketpool_socket_close); -//| def connect(self, address: tuple) -> None: +//| def connect(self, address: Tuple[str, int]) -> None: //| """Connect a socket to a remote address //| //| :param ~tuple address: tuple of (remote_address, remote_port)""" diff --git a/shared-bindings/socketpool/SocketPool.c b/shared-bindings/socketpool/SocketPool.c index 527cf7e984..b737b5fc2d 100644 --- a/shared-bindings/socketpool/SocketPool.c +++ b/shared-bindings/socketpool/SocketPool.c @@ -82,7 +82,7 @@ STATIC mp_obj_t socketpool_socketpool_socket(size_t n_args, const mp_obj_t *pos_ } MP_DEFINE_CONST_FUN_OBJ_KW(socketpool_socketpool_socket_obj, 1, socketpool_socketpool_socket); -//| def getaddrinfo(host: str, port: int, family: int = 0, type: int = 0, proto: int = 0, flags: int = 0) -> tuple: +//| def getaddrinfo(host: str, port: int, family: int = 0, type: int = 0, proto: int = 0, flags: int = 0) -> Tuple[int, int, int, str, Tuple[str, int]]: //| """Gets the address information for a hostname and port //| //| Returns the appropriate family, socket type, socket protocol and diff --git a/shared-bindings/ssl/SSLContext.c b/shared-bindings/ssl/SSLContext.c index d2c236d3bf..9d4df72619 100644 --- a/shared-bindings/ssl/SSLContext.c +++ b/shared-bindings/ssl/SSLContext.c @@ -51,7 +51,7 @@ STATIC mp_obj_t ssl_sslcontext_make_new(const mp_obj_type_t *type, size_t n_args return MP_OBJ_FROM_PTR(s); } -//| def wrap_socket(sock: socketpool.Socket, *, server_side: bool = False, server_hostname: str = None) -> socketpool.Socket: +//| def wrap_socket(sock: socketpool.Socket, *, server_side: bool = False, server_hostname: Optional[str] = None) -> socketpool.Socket: //| """Wraps the socket into a socket-compatible class that handles SSL negotiation. //| The socket must be of type SOCK_STREAM.""" //| ... diff --git a/shared-bindings/wifi/Radio.c b/shared-bindings/wifi/Radio.c index a274c437e0..a56ca5aaa6 100644 --- a/shared-bindings/wifi/Radio.c +++ b/shared-bindings/wifi/Radio.c @@ -79,7 +79,7 @@ const mp_obj_property_t wifi_radio_mac_address_obj = { }; -//| def start_scanning_networks(self, *, start_channel=1, stop_channel=11) -> Iterable[Network]: +//| def start_scanning_networks(self, *, start_channel: int = 1, stop_channel: int = 11) -> Iterable[Network]: //| """Scans for available wifi networks over the given channel range. Make sure the channels are allowed in your country.""" //| ... //| @@ -283,7 +283,7 @@ const mp_obj_property_t wifi_radio_ap_info_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| def ping(self, ip, *, timeout: float = 0.5) -> float: +//| def ping(self, ip: wifi.Radio, *, timeout: float = 0.5) -> float: //| """Ping an IP to test connectivity. Returns echo time in seconds. //| Returns None when it times out.""" //| ... diff --git a/tools/extract_pyi.py b/tools/extract_pyi.py index 651216e11a..b7ce584a1e 100644 --- a/tools/extract_pyi.py +++ b/tools/extract_pyi.py @@ -17,7 +17,8 @@ import black IMPORTS_IGNORE = frozenset({'int', 'float', 'bool', 'str', 'bytes', 'tuple', 'list', 'set', 'dict', 'bytearray', 'slice', 'file', 'buffer', 'range', 'array', 'struct_time'}) -IMPORTS_TYPING = frozenset({'Any', 'Optional', 'Union', 'Tuple', 'List', 'Sequence', 'NamedTuple', 'Iterable', 'Iterator', 'Callable', 'AnyStr', 'overload'}) +IMPORTS_TYPING = frozenset({'Any', 'Optional', 'Union', 'Tuple', 'List', 'Sequence', 'NamedTuple', 'Iterable', 'Iterator', 'Callable', 'AnyStr', 'overload', 'Type'}) +IMPORTS_TYPES = frozenset({'TracebackType'}) CPY_TYPING = frozenset({'ReadableBuffer', 'WriteableBuffer', 'AudioSample', 'FrameBuffer'}) @@ -63,6 +64,7 @@ def find_stub_issues(tree): def extract_imports(tree): modules = set() typing = set() + types = set() cpy_typing = set() def collect_annotations(anno_tree): @@ -74,6 +76,8 @@ def extract_imports(tree): continue elif node.id in IMPORTS_TYPING: typing.add(node.id) + elif node.id in IMPORTS_TYPES: + types.add(node.id) elif node.id in CPY_TYPING: cpy_typing.add(node.id) elif isinstance(node, ast.Attribute): @@ -94,6 +98,7 @@ def extract_imports(tree): return { "modules": sorted(modules), "typing": sorted(typing), + "types": sorted(types), "cpy_typing": sorted(cpy_typing), } @@ -181,6 +186,8 @@ def convert_folder(top_level, stub_directory): # Add import statements imports = extract_imports(tree) import_lines = ["from __future__ import annotations"] + if imports["types"]: + import_lines.append("from types import " + ", ".join(imports["types"])) if imports["typing"]: import_lines.append("from typing import " + ", ".join(imports["typing"])) if imports["cpy_typing"]: From 9f3a1fe27b9f29771b87a4d5eb1914075d2b1e3a Mon Sep 17 00:00:00 2001 From: sw23 Date: Fri, 30 Oct 2020 01:29:58 -0400 Subject: [PATCH 021/148] Fixing stub for wifi_radio_ping --- shared-bindings/wifi/Radio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/wifi/Radio.c b/shared-bindings/wifi/Radio.c index a56ca5aaa6..e81e8793c4 100644 --- a/shared-bindings/wifi/Radio.c +++ b/shared-bindings/wifi/Radio.c @@ -283,7 +283,7 @@ const mp_obj_property_t wifi_radio_ap_info_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| def ping(self, ip: wifi.Radio, *, timeout: float = 0.5) -> float: +//| def ping(self, ip: ipaddress.IPv4Address, *, timeout: Optional[float] = 0.5) -> float: //| """Ping an IP to test connectivity. Returns echo time in seconds. //| Returns None when it times out.""" //| ... From 6a63d20a5d2e7184bfc5747b465818fb7eee6b49 Mon Sep 17 00:00:00 2001 From: sw23 Date: Fri, 30 Oct 2020 18:56:40 -0400 Subject: [PATCH 022/148] Fixing remaining stub mypy issues + run check-stubs to CI --- .github/workflows/build.yml | 2 +- shared-bindings/ipaddress/IPv4Address.c | 2 +- shared-bindings/socketpool/SocketPool.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 64d43f4d98..8039883e34 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -68,7 +68,7 @@ jobs: run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 --via-mpy -d basics float working-directory: tests - name: Stubs - run: make stubs -j2 + run: make check-stubs -j2 - uses: actions/upload-artifact@v2 with: name: stubs diff --git a/shared-bindings/ipaddress/IPv4Address.c b/shared-bindings/ipaddress/IPv4Address.c index b2a10158ae..e027f32d65 100644 --- a/shared-bindings/ipaddress/IPv4Address.c +++ b/shared-bindings/ipaddress/IPv4Address.c @@ -126,7 +126,7 @@ const mp_obj_property_t ipaddress_ipv4address_version_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| def __eq__(self, other: IPv4Address) -> bool: +//| def __eq__(self, other: object) -> bool: //| """Two Address objects are equal if their addresses and address types are equal.""" //| ... //| diff --git a/shared-bindings/socketpool/SocketPool.c b/shared-bindings/socketpool/SocketPool.c index b737b5fc2d..0cead525f8 100644 --- a/shared-bindings/socketpool/SocketPool.c +++ b/shared-bindings/socketpool/SocketPool.c @@ -58,7 +58,7 @@ STATIC mp_obj_t socketpool_socketpool_make_new(const mp_obj_type_t *type, size_t } -//| def socket(self, family: int = AF_INET, type: int = SOCK_STREAM, proto: int = IPPROTO_TCP) -> None: +//| def socket(self, family: int, type: int, proto: int) -> socketpool.Socket: //| """Create a new socket //| //| :param ~int family: AF_INET or AF_INET6 From 8e72b68e3de90f87261ce289dd7d3a28815cfd0b Mon Sep 17 00:00:00 2001 From: sw23 Date: Fri, 30 Oct 2020 19:16:26 -0400 Subject: [PATCH 023/148] Adding mypy to dep list and clarifying Stubs stage name --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8039883e34..07db88963b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,7 +37,7 @@ jobs: run: | sudo apt-get install -y eatmydata sudo eatmydata apt-get install -y gettext librsvg2-bin mingw-w64 latexmk texlive-fonts-recommended texlive-latex-recommended texlive-latex-extra - pip install requests sh click setuptools cpp-coveralls "Sphinx<4" sphinx-rtd-theme recommonmark sphinx-autoapi sphinxcontrib-svg2pdfconverter polib pyyaml astroid isort black awscli + pip install requests sh click setuptools cpp-coveralls "Sphinx<4" sphinx-rtd-theme recommonmark sphinx-autoapi sphinxcontrib-svg2pdfconverter polib pyyaml astroid isort black awscli mypy - name: Versions run: | gcc --version @@ -67,7 +67,7 @@ jobs: - name: mpy Tests run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 --via-mpy -d basics float working-directory: tests - - name: Stubs + - name: Build and Validate Stubs run: make check-stubs -j2 - uses: actions/upload-artifact@v2 with: From 345d84ffde527b16f50c203f7b6a718886be34f6 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 30 Oct 2020 22:16:12 -0400 Subject: [PATCH 024/148] improve USB CDC disconnect/reconnect checking --- supervisor/serial.h | 1 - supervisor/shared/serial.c | 6 +++--- supervisor/shared/usb/usb.c | 3 --- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/supervisor/serial.h b/supervisor/serial.h index 9c2d44737a..066886303e 100644 --- a/supervisor/serial.h +++ b/supervisor/serial.h @@ -47,5 +47,4 @@ char serial_read(void); bool serial_bytes_available(void); bool serial_connected(void); -extern volatile bool _serial_connected; #endif // MICROPY_INCLUDED_SUPERVISOR_SERIAL_H diff --git a/supervisor/shared/serial.c b/supervisor/shared/serial.c index 91e90671d2..7383cc2282 100644 --- a/supervisor/shared/serial.c +++ b/supervisor/shared/serial.c @@ -47,8 +47,6 @@ busio_uart_obj_t debug_uart; byte buf_array[64]; #endif -volatile bool _serial_connected; - void serial_early_init(void) { #if defined(DEBUG_UART_TX) && defined(DEBUG_UART_RX) debug_uart.base.type = &busio_uart_type; @@ -71,7 +69,9 @@ bool serial_connected(void) { #if defined(DEBUG_UART_TX) && defined(DEBUG_UART_RX) return true; #else - return _serial_connected; + // True if DTR is asserted, and the USB connection is up. + // tud_cdc_get_line_state(): bit 0 is DTR, bit 1 is RTS + return (tud_cdc_get_line_state() & 1) && tud_ready(); #endif } diff --git a/supervisor/shared/usb/usb.c b/supervisor/shared/usb/usb.c index 89fbf56f37..93d3436e9d 100644 --- a/supervisor/shared/usb/usb.c +++ b/supervisor/shared/usb/usb.c @@ -116,7 +116,6 @@ void tud_umount_cb(void) { // remote_wakeup_en : if host allows us to perform remote wakeup // USB Specs: Within 7ms, device must draw an average current less than 2.5 mA from bus void tud_suspend_cb(bool remote_wakeup_en) { - _serial_connected = false; } // Invoked when usb bus is resumed @@ -128,8 +127,6 @@ void tud_resume_cb(void) { void tud_cdc_line_state_cb(uint8_t itf, bool dtr, bool rts) { (void) itf; // interface ID, not used - _serial_connected = dtr; - // DTR = false is counted as disconnected if ( !dtr ) { From 1f179b331750fbe05ccb4caff44e985234c9ee71 Mon Sep 17 00:00:00 2001 From: sw23 Date: Fri, 30 Oct 2020 23:19:27 -0400 Subject: [PATCH 025/148] Adding socket and socketpool class attributes --- shared-bindings/socket/__init__.c | 15 ++++++++------- shared-bindings/socketpool/SocketPool.c | 11 +++++++++-- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/shared-bindings/socket/__init__.c b/shared-bindings/socket/__init__.c index 38840da5ea..2969b37149 100644 --- a/shared-bindings/socket/__init__.c +++ b/shared-bindings/socket/__init__.c @@ -49,7 +49,14 @@ STATIC const mp_obj_type_t socket_type; //| class socket: //| -//| def __init__(self, family: int, type: int, proto: int) -> None: +//| AF_INET = 2 +//| AF_INET6 = 10 +//| SOCK_STREAM = 1 +//| SOCK_DGRAM = 2 +//| SOCK_RAW = 3 +//| IPPROTO_TCP = 6 +//| +//| def __init__(self, family: int = AF_INET, type: int = SOCK_STREAM, proto: int = IPPROTO_TCP) -> None: //| """Create a new socket //| //| :param int family: AF_INET or AF_INET6 @@ -57,12 +64,6 @@ STATIC const mp_obj_type_t socket_type; //| :param int proto: IPPROTO_TCP, IPPROTO_UDP or IPPROTO_RAW (ignored)""" //| ... //| -//| AF_INET: int -//| AF_INET6: int -//| SOCK_STREAM: int -//| SOCK_DGRAM: int -//| SOCK_RAW: int -//| STATIC mp_obj_t socket_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) { mp_arg_check_num(n_args, kw_args, 0, 4, false); diff --git a/shared-bindings/socketpool/SocketPool.c b/shared-bindings/socketpool/SocketPool.c index 0cead525f8..2234f359ef 100644 --- a/shared-bindings/socketpool/SocketPool.c +++ b/shared-bindings/socketpool/SocketPool.c @@ -57,8 +57,14 @@ STATIC mp_obj_t socketpool_socketpool_make_new(const mp_obj_type_t *type, size_t return MP_OBJ_FROM_PTR(s); } - -//| def socket(self, family: int, type: int, proto: int) -> socketpool.Socket: +//| AF_INET = 0 +//| AF_INET6 = 1 +//| SOCK_STREAM = 0 +//| SOCK_DGRAM = 1 +//| SOCK_RAW = 2 +//| IPPROTO_TCP = 6 +//| +//| def socket(self, family: int = AF_INET, type: int = SOCK_STREAM, proto: int = IPPROTO_TCP) -> socketpool.Socket: //| """Create a new socket //| //| :param ~int family: AF_INET or AF_INET6 @@ -66,6 +72,7 @@ STATIC mp_obj_t socketpool_socketpool_make_new(const mp_obj_type_t *type, size_t //| :param ~int proto: IPPROTO_TCP, IPPROTO_UDP or IPPROTO_RAW (ignored)""" //| ... //| + STATIC mp_obj_t socketpool_socketpool_socket(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { mp_arg_check_num(n_args, kw_args, 0, 5, false); From a7616808e951b52e2ced08a7a279a224490ae404 Mon Sep 17 00:00:00 2001 From: "ITACA Innovation S.R.L" <40298126+ITACAInnovation@users.noreply.github.com> Date: Sat, 31 Oct 2020 10:12:49 +0100 Subject: [PATCH 026/148] Updated pinout --- ports/atmel-samd/boards/uchip/pins.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/ports/atmel-samd/boards/uchip/pins.c b/ports/atmel-samd/boards/uchip/pins.c index 856a220742..cfb6432336 100644 --- a/ports/atmel-samd/boards/uchip/pins.c +++ b/ports/atmel-samd/boards/uchip/pins.c @@ -1,14 +1,15 @@ #include "shared-bindings/board/__init__.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { - { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA08) }, - { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA10) }, - { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA09) }, - { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA11) }, - { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA02) }, - { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PA04) }, - { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_PA03) }, - { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_PA05) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA06) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA06) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA08) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA10) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA09) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PA11) }, + { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_PA02) }, + { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_PA03) }, + { MP_ROM_QSTR(MP_QSTR_A8), MP_ROM_PTR(&pin_PA04) }, { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA16) }, { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA08) }, { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA10) }, @@ -19,8 +20,10 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA19) }, { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA22) }, { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA23) }, - { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PA03) }, - { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_PA05) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA31) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA30) }, + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PA02) }, + { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_PA03) }, { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA09) }, { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA08) }, { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA22) }, From 9a8484b853116e6f95f50da6d3bc66323d55ca9f Mon Sep 17 00:00:00 2001 From: "ITACA Innovation S.R.L" <40298126+ITACAInnovation@users.noreply.github.com> Date: Sat, 31 Oct 2020 11:06:56 +0100 Subject: [PATCH 027/148] Update mpconfigboard.h Removed ignore PA30 PA31 in order to allow using them as pinout --- ports/atmel-samd/boards/uchip/mpconfigboard.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/ports/atmel-samd/boards/uchip/mpconfigboard.h b/ports/atmel-samd/boards/uchip/mpconfigboard.h index 1877a41ef9..5d6af4b782 100644 --- a/ports/atmel-samd/boards/uchip/mpconfigboard.h +++ b/ports/atmel-samd/boards/uchip/mpconfigboard.h @@ -16,8 +16,6 @@ #define IGNORE_PIN_PA27 1 #define IGNORE_PIN_PA28 1 -#define IGNORE_PIN_PA30 1 -#define IGNORE_PIN_PA31 1 #define IGNORE_PIN_PB01 1 #define IGNORE_PIN_PB02 1 From 80ad300cad64a7da77d9292dbe5d2b81e458d5dc Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sat, 31 Oct 2020 11:58:28 -0500 Subject: [PATCH 028/148] workflows: Fix typo that broke builds while trying to upload stubs --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 64d43f4d98..00db4f8cde 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -116,7 +116,7 @@ jobs: [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static-raspbian s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-raspbian-${{ env.CP_VERSION }} --no-progress --region us-east-1 [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-amd64-linux-${{ env.CP_VERSION }} --no-progress --region us-east-1 [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static.exe s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-x64-windows-${{ env.CP_VERSION }}.exe --no-progress --region us-east-1 - zip -9 circuitpython-stubs.CP_VERSION }}.zip stubs + zip -9 circuitpython-stubs.${{ env.CP_VERSION }}.zip stubs [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp circuitpython-stubs.zip s3://adafruit-circuit-python/bin/stubs/circuitpython-stubs-${{ env.CP_VERSION }}.zip --no-progress --region us-east-1 env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} From 0c30a26c9bcdfe537262d4ad3ea62b7eaba0c7b8 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Sat, 31 Oct 2020 13:19:13 -0400 Subject: [PATCH 029/148] Update .github/workflows/build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 00db4f8cde..36bf136d4d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -116,7 +116,7 @@ jobs: [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static-raspbian s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-raspbian-${{ env.CP_VERSION }} --no-progress --region us-east-1 [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-amd64-linux-${{ env.CP_VERSION }} --no-progress --region us-east-1 [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static.exe s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-x64-windows-${{ env.CP_VERSION }}.exe --no-progress --region us-east-1 - zip -9 circuitpython-stubs.${{ env.CP_VERSION }}.zip stubs + zip -9 circuitpython-stubs.zip stubs [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp circuitpython-stubs.zip s3://adafruit-circuit-python/bin/stubs/circuitpython-stubs-${{ env.CP_VERSION }}.zip --no-progress --region us-east-1 env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} From 073dc8751c92d943897db9e68b617fe7ba358f00 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Sat, 31 Oct 2020 14:50:13 -0400 Subject: [PATCH 030/148] Use correct stubs directory name The stubs directory is called `circuitpython-stubs`, not `stubs`. --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 36bf136d4d..514fa82da2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -116,7 +116,7 @@ jobs: [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static-raspbian s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-raspbian-${{ env.CP_VERSION }} --no-progress --region us-east-1 [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-amd64-linux-${{ env.CP_VERSION }} --no-progress --region us-east-1 [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static.exe s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-x64-windows-${{ env.CP_VERSION }}.exe --no-progress --region us-east-1 - zip -9 circuitpython-stubs.zip stubs + zip -9 circuitpython-stubs.zip circuitpython-stubs [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp circuitpython-stubs.zip s3://adafruit-circuit-python/bin/stubs/circuitpython-stubs-${{ env.CP_VERSION }}.zip --no-progress --region us-east-1 env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} From 3845db4bb98dbfa0b35b11baaa5d62f9f4266dea Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sat, 31 Oct 2020 20:13:51 -0500 Subject: [PATCH 031/148] Update build.yml Need to request zip to recurse, because it is not the default --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 514fa82da2..b6c80558eb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -116,7 +116,7 @@ jobs: [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static-raspbian s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-raspbian-${{ env.CP_VERSION }} --no-progress --region us-east-1 [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-amd64-linux-${{ env.CP_VERSION }} --no-progress --region us-east-1 [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static.exe s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-x64-windows-${{ env.CP_VERSION }}.exe --no-progress --region us-east-1 - zip -9 circuitpython-stubs.zip circuitpython-stubs + zip -9r circuitpython-stubs.zip circuitpython-stubs [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp circuitpython-stubs.zip s3://adafruit-circuit-python/bin/stubs/circuitpython-stubs-${{ env.CP_VERSION }}.zip --no-progress --region us-east-1 env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} From 1762a36438f7b54536186ab4d3bb11ef77553168 Mon Sep 17 00:00:00 2001 From: Jerry Needell Date: Sun, 1 Nov 2020 05:46:13 -0500 Subject: [PATCH 032/148] restore analogio to feather_m0_rfm9x/rfm69 builds --- ports/atmel-samd/boards/feather_m0_rfm69/mpconfigboard.mk | 2 +- ports/atmel-samd/boards/feather_m0_rfm9x/mpconfigboard.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/atmel-samd/boards/feather_m0_rfm69/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m0_rfm69/mpconfigboard.mk index c33ab07400..d746cdf811 100644 --- a/ports/atmel-samd/boards/feather_m0_rfm69/mpconfigboard.mk +++ b/ports/atmel-samd/boards/feather_m0_rfm69/mpconfigboard.mk @@ -12,7 +12,7 @@ CIRCUITPY_FULL_BUILD = 0 # A number of modules are removed for RFM69 to make room for frozen libraries. # Many I/O functions are not available. -CIRCUITPY_ANALOGIO = 0 +CIRCUITPY_ANALOGIO = 1 CIRCUITPY_PULSEIO = 0 CIRCUITPY_NEOPIXEL_WRITE = 1 CIRCUITPY_ROTARYIO = 0 diff --git a/ports/atmel-samd/boards/feather_m0_rfm9x/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m0_rfm9x/mpconfigboard.mk index 49b0ef5e36..d373346889 100644 --- a/ports/atmel-samd/boards/feather_m0_rfm9x/mpconfigboard.mk +++ b/ports/atmel-samd/boards/feather_m0_rfm9x/mpconfigboard.mk @@ -13,7 +13,7 @@ CIRCUITPY_FULL_BUILD = 0 # A number of modules are removed for RFM9x to make room for frozen libraries. # Many I/O functions are not available. -CIRCUITPY_ANALOGIO = 0 +CIRCUITPY_ANALOGIO = 1 CIRCUITPY_PULSEIO = 0 CIRCUITPY_NEOPIXEL_WRITE = 1 CIRCUITPY_ROTARYIO = 0 From 4438050f794edea5c6a3f919964908800dd6b522 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Sun, 1 Nov 2020 18:00:07 +0530 Subject: [PATCH 033/148] Add pcnt handler --- locale/circuitpython.pot | 9 ++- ports/esp32s2/Makefile | 1 + ports/esp32s2/common-hal/countio/Counter.c | 70 ++++++++++++---------- ports/esp32s2/common-hal/countio/Counter.h | 31 +++++++++- ports/esp32s2/pcnt_handler.c | 67 +++++++++++++++++++++ ports/esp32s2/pcnt_handler.h | 35 +++++++++++ 6 files changed, 177 insertions(+), 36 deletions(-) create mode 100644 ports/esp32s2/pcnt_handler.c create mode 100644 ports/esp32s2/pcnt_handler.h diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 16c3dd973a..1336ab25cd 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-21 20:13-0500\n" +"POT-Creation-Date: 2020-11-01 11:11+0530\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -1109,7 +1109,8 @@ msgid "Invalid phase" msgstr "" #: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c +#: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" msgstr "" @@ -1271,6 +1272,10 @@ msgstr "" msgid "No MOSI Pin" msgstr "" +#: ports/esp32s2/pcnt_handler.c +msgid "No PCNT unit free" +msgstr "" + #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c diff --git a/ports/esp32s2/Makefile b/ports/esp32s2/Makefile index 8d891edd02..6dbbf58d4d 100644 --- a/ports/esp32s2/Makefile +++ b/ports/esp32s2/Makefile @@ -173,6 +173,7 @@ SRC_C += \ background.c \ fatfs_port.c \ mphalport.c \ + pcnt_handler.c \ bindings/espidf/__init__.c \ boards/$(BOARD)/board.c \ boards/$(BOARD)/pins.c \ diff --git a/ports/esp32s2/common-hal/countio/Counter.c b/ports/esp32s2/common-hal/countio/Counter.c index 6a76a163d7..4357624733 100644 --- a/ports/esp32s2/common-hal/countio/Counter.c +++ b/ports/esp32s2/common-hal/countio/Counter.c @@ -1,67 +1,75 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 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 "common-hal/countio/Counter.h" +#include "common-hal/microcontroller/Pin.h" -#include "py/runtime.h" -#include "supervisor/shared/translate.h" +void common_hal_countio_counter_construct(countio_counter_obj_t* self, + const mcu_pin_obj_t* pin) { + claim_pin(pin); -#include "driver/pcnt.h" - -static void pcnt_init(countio_counter_obj_t* self) { - int unit = PCNT_UNIT_0; // Prepare configuration for the PCNT unit pcnt_config_t pcnt_config = { // Set PCNT input signal and control GPIOs - .pulse_gpio_num = self->pin->number, + .pulse_gpio_num = pin->number, .ctrl_gpio_num = PCNT_PIN_NOT_USED, .channel = PCNT_CHANNEL_0, - .unit = unit, // What to do on the positive / negative edge of pulse input? .pos_mode = PCNT_COUNT_INC, // Count up on the positive edge .neg_mode = PCNT_COUNT_DIS, // Keep the counter value on the negative edge }; // Initialize PCNT unit - pcnt_unit_config(&pcnt_config); + pcnt_handler_init(&pcnt_config); - // Configure and enable the input filter - pcnt_set_filter_value(unit, 100); - pcnt_filter_enable(unit); - - // Initialize PCNT's counter - pcnt_counter_pause(unit); - pcnt_counter_clear(unit); - - // Everything is set up, now go to counting - pcnt_counter_resume(unit); -} - -void common_hal_countio_counter_construct(countio_counter_obj_t* self, - const mcu_pin_obj_t* pin) { - claim_pin(pin); - self->pin = pin; - pcnt_init(self); + self->pin = pin->number; + self->unit = pcnt_config.unit; } bool common_hal_countio_counter_deinited(countio_counter_obj_t* self) { - return self->pin == NULL; + return self->unit == PCNT_UNIT_MAX; } void common_hal_countio_counter_deinit(countio_counter_obj_t* self) { if (common_hal_countio_counter_deinited(self)) { return; } - reset_pin_number(self->pin->number); - self->pin = NULL; + reset_pin_number(self->pin); + pcnt_handler_deinit(&self->unit); } mp_int_t common_hal_countio_counter_get_count(countio_counter_obj_t* self) { int16_t count; - pcnt_get_counter_value(PCNT_UNIT_0, &count); + pcnt_get_counter_value(self->unit, &count); return count+self->count; } void common_hal_countio_counter_set_count(countio_counter_obj_t* self, mp_int_t new_count) { self->count = new_count; - pcnt_counter_clear(PCNT_UNIT_0); + pcnt_counter_clear(self->unit); } void common_hal_countio_counter_reset(countio_counter_obj_t* self) { diff --git a/ports/esp32s2/common-hal/countio/Counter.h b/ports/esp32s2/common-hal/countio/Counter.h index 3406f9daaf..63d1eb98b2 100644 --- a/ports/esp32s2/common-hal/countio/Counter.h +++ b/ports/esp32s2/common-hal/countio/Counter.h @@ -1,15 +1,40 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 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_ESP32S2_COMMON_HAL_COUNTIO_COUNTER_H #define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_COUNTIO_COUNTER_H -#include "common-hal/microcontroller/Pin.h" - #include "py/obj.h" +#include "pcnt_handler.h" typedef struct { mp_obj_base_t base; - const mcu_pin_obj_t * pin; + uint8_t pin; mp_int_t count; + pcnt_unit_t unit; } countio_counter_obj_t; #endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_COUNTIO_COUNT_H diff --git a/ports/esp32s2/pcnt_handler.c b/ports/esp32s2/pcnt_handler.c new file mode 100644 index 0000000000..56fb0f21c8 --- /dev/null +++ b/ports/esp32s2/pcnt_handler.c @@ -0,0 +1,67 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 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 "pcnt_handler.h" + +#include "py/runtime.h" +#include "supervisor/shared/translate.h" + +#define PCNT_UNIT_ACTIVE 1 +#define PCNT_UNIT_INACTIVE 0 + +static uint8_t pcnt_state[4]; + +void pcnt_handler_init(pcnt_config_t* pcnt_config) { + // Look for available pcnt unit + for (uint8_t i = 0; i<=3; i++) { + if (pcnt_state[i] == PCNT_UNIT_INACTIVE) { + pcnt_config->unit = (pcnt_unit_t)i; + pcnt_state[i] = PCNT_UNIT_ACTIVE; + break; + } else if (i == 3) { + mp_raise_RuntimeError(translate("No PCNT unit free")); + } + } + + // Initialize PCNT unit + pcnt_unit_config(pcnt_config); + + // Configure and enable the input filter + pcnt_set_filter_value(pcnt_config->unit, 100); + pcnt_filter_enable(pcnt_config->unit); + + // Initialize PCNT's counter + pcnt_counter_pause(pcnt_config->unit); + pcnt_counter_clear(pcnt_config->unit); + + // Everything is set up, now go to counting + pcnt_counter_resume(pcnt_config->unit); +} + +void pcnt_handler_deinit(pcnt_unit_t* unit) { + pcnt_state[*unit] = PCNT_UNIT_INACTIVE; + *unit = PCNT_UNIT_MAX; +} diff --git a/ports/esp32s2/pcnt_handler.h b/ports/esp32s2/pcnt_handler.h new file mode 100644 index 0000000000..4bdaee1b87 --- /dev/null +++ b/ports/esp32s2/pcnt_handler.h @@ -0,0 +1,35 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 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_ESP32S2_PCNT_HANDLER_H +#define MICROPY_INCLUDED_ESP32S2_PCNT_HANDLER_H + +#include "driver/pcnt.h" + +extern void pcnt_handler_init(pcnt_config_t* pcnt_config); +extern void pcnt_handler_deinit(pcnt_unit_t* unit); + +#endif // MICROPY_INCLUDED_ESP32S2_PCNT_HANDLER_H From 856a6d4558d594e690a9e39ba841ef086c37ed9f Mon Sep 17 00:00:00 2001 From: Alvaro Figueroa Date: Sat, 31 Oct 2020 15:51:35 +0000 Subject: [PATCH 034/148] Translated using Weblate (Spanish) Currently translated at 99.2% (838 of 844 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/es/ --- locale/es.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/locale/es.po b/locale/es.po index 348af34067..a750c80554 100644 --- a/locale/es.po +++ b/locale/es.po @@ -8,8 +8,8 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-10-21 20:13-0500\n" -"PO-Revision-Date: 2020-10-27 21:01+0000\n" -"Last-Translator: Adolfo Jayme Barrientos \n" +"PO-Revision-Date: 2020-11-01 16:26+0000\n" +"Last-Translator: Alvaro Figueroa \n" "Language-Team: \n" "Language: es\n" "MIME-Version: 1.0\n" @@ -297,7 +297,7 @@ msgstr "Tipo de dirección fuera de rango" #: ports/esp32s2/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" -msgstr "" +msgstr "Todos los periféricos CAN están en uso" #: ports/esp32s2/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" @@ -427,7 +427,7 @@ msgstr "" #: ports/esp32s2/common-hal/canio/CAN.c msgid "Baudrate not supported by peripheral" -msgstr "" +msgstr "El periférico no maneja el Baudrate" #: shared-module/displayio/Display.c #: shared-module/framebufferio/FramebufferDisplay.c From 7a07e8fa32de376c2f523b6c7d13e1b473198423 Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Fri, 30 Oct 2020 21:04:56 +0000 Subject: [PATCH 035/148] Translated using Weblate (Swedish) Currently translated at 100.0% (844 of 844 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/ --- locale/sv.po | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/locale/sv.po b/locale/sv.po index 53ed60acae..65cd9f6f1f 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: 2020-10-21 20:13-0500\n" -"PO-Revision-Date: 2020-10-26 02:36+0000\n" +"PO-Revision-Date: 2020-11-01 16:26+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" "Language: sv\n" @@ -294,7 +294,7 @@ msgstr "Adresstyp utanför intervallet" #: ports/esp32s2/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" -msgstr "" +msgstr "All I2C-kringutrustning används" #: ports/esp32s2/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" @@ -420,7 +420,7 @@ msgstr "" #: ports/esp32s2/common-hal/canio/CAN.c msgid "Baudrate not supported by peripheral" -msgstr "" +msgstr "Baudrate stöds inte av kringutrustning" #: shared-module/displayio/Display.c #: shared-module/framebufferio/FramebufferDisplay.c @@ -2905,7 +2905,7 @@ msgstr "long int stöds inte i denna build" #: ports/esp32s2/common-hal/canio/CAN.c msgid "loopback + silent mode not supported by peripheral" -msgstr "" +msgstr "loopback + tyst läge stöds inte av kringutrustning" #: py/parse.c msgid "malformed f-string" @@ -2943,11 +2943,11 @@ msgstr "maximal rekursionsdjup överskriden" #: extmod/ulab/code/approx/approx.c msgid "maxiter must be > 0" -msgstr "" +msgstr "maxiter måste vara > 0" #: extmod/ulab/code/approx/approx.c msgid "maxiter should be > 0" -msgstr "" +msgstr "maxiter bör vara > 0" #: py/runtime.c #, c-format @@ -3388,7 +3388,7 @@ msgstr "argumentet sort måste vara en ndarray" #: extmod/ulab/code/numerical/numerical.c msgid "sorted axis can't be longer than 65535" -msgstr "" +msgstr "sorterad axel kan inte vara längre än 65535" #: extmod/ulab/code/filter/filter.c msgid "sos array must be of shape (n_section, 6)" @@ -3522,12 +3522,12 @@ msgstr "tupel/lista har fel längd" #: ports/esp32s2/common-hal/canio/CAN.c #, c-format msgid "twai_driver_install returned esp-idf error #%d" -msgstr "" +msgstr "twai_driver_install returnerade esp-idf-fel #%d" #: ports/esp32s2/common-hal/canio/CAN.c #, c-format msgid "twai_start returned esp-idf error #%d" -msgstr "" +msgstr "twai_start returnerade esp-idf-fel #%d" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c From 72b829dff02cb9b8ebe6e2b47354f06650dbe864 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Sun, 1 Nov 2020 14:52:03 -0500 Subject: [PATCH 036/148] add binascii to most builds --- ports/atmel-samd/mpconfigport.h | 1 + py/circuitpy_mpconfig.h | 10 ++++++++++ py/objmodule.c | 7 ++++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/ports/atmel-samd/mpconfigport.h b/ports/atmel-samd/mpconfigport.h index f7ccff4da2..ed10da9b9d 100644 --- a/ports/atmel-samd/mpconfigport.h +++ b/ports/atmel-samd/mpconfigport.h @@ -47,6 +47,7 @@ // MICROPY_PY_UJSON depends on MICROPY_PY_IO #define MICROPY_PY_IO (0) #define MICROPY_PY_REVERSE_SPECIAL_METHODS (0) +#define MICROPY_PY_UBINASCII (0) #define MICROPY_PY_UJSON (0) #define MICROPY_PY_COLLECTIONS_ORDEREDDICT (0) #define MICROPY_PY_UERRNO_LIST \ diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index 1e01bd9c5e..08efabddb5 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -197,6 +197,9 @@ typedef long mp_off_t; #ifndef MICROPY_PY_COLLECTIONS_ORDEREDDICT #define MICROPY_PY_COLLECTIONS_ORDEREDDICT (CIRCUITPY_FULL_BUILD) #endif +#ifndef MICROPY_PY_UBINASCII +#define MICROPY_PY_UBINASCII (CIRCUITPY_FULL_BUILD) +#endif // Opposite setting is deliberate. #define MICROPY_PY_UERRNO_ERRORCODE (!CIRCUITPY_FULL_BUILD) #ifndef MICROPY_PY_URE @@ -699,6 +702,12 @@ extern const struct _mp_obj_module_t ustack_module; #endif // These modules are not yet in shared-bindings, but we prefer the non-uxxx names. +#if MICROPY_PY_UBINASCII +#define BINASCII_MODULE { MP_ROM_QSTR(MP_QSTR_binascii), MP_ROM_PTR(&mp_module_ubinascii) }, +#else +#define BINASCII_MODULE +#endif + #if MICROPY_PY_UERRNO #define ERRNO_MODULE { MP_ROM_QSTR(MP_QSTR_errno), MP_ROM_PTR(&mp_module_uerrno) }, #else @@ -770,6 +779,7 @@ extern const struct _mp_obj_module_t wifi_module; AUDIOMIXER_MODULE \ AUDIOMP3_MODULE \ AUDIOPWMIO_MODULE \ + BINASCII_MODULE \ BITBANGIO_MODULE \ BLEIO_MODULE \ BOARD_MODULE \ diff --git a/py/objmodule.c b/py/objmodule.c index 757aece046..90796c5357 100644 --- a/py/objmodule.c +++ b/py/objmodule.c @@ -239,7 +239,12 @@ STATIC const mp_rom_map_elem_t mp_builtin_module_table[] = { { MP_ROM_QSTR(MP_QSTR_hashlib), MP_ROM_PTR(&mp_module_uhashlib) }, #endif #if MICROPY_PY_UBINASCII - { MP_ROM_QSTR(MP_QSTR_binascii), MP_ROM_PTR(&mp_module_ubinascii) }, +#if CIRCUITPY +// CircuitPython: Defined in MICROPY_PORT_BUILTIN_MODULES, so not defined here. +// TODO: move to shared-bindings/ +#else + { MP_ROM_QSTR(MP_QSTR_ubinascii), MP_ROM_PTR(&mp_module_ubinascii) }, +#endif #endif #if MICROPY_PY_URANDOM { MP_ROM_QSTR(MP_QSTR_urandom), MP_ROM_PTR(&mp_module_urandom) }, From 4e52757f2653b16b91856df7575ec503c02c5d22 Mon Sep 17 00:00:00 2001 From: "ITACA Innovation S.R.L" <40298126+ITACAInnovation@users.noreply.github.com> Date: Sun, 1 Nov 2020 22:22:55 +0100 Subject: [PATCH 037/148] Update pins.c Added LED, BOOST_EN and VEXT_SELECT pins. --- ports/atmel-samd/boards/uchip/pins.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ports/atmel-samd/boards/uchip/pins.c b/ports/atmel-samd/boards/uchip/pins.c index cfb6432336..2d7eeebe11 100644 --- a/ports/atmel-samd/boards/uchip/pins.c +++ b/ports/atmel-samd/boards/uchip/pins.c @@ -1,6 +1,9 @@ #include "shared-bindings/board/__init__.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_LED_BUILTIN), MP_ROM_PTR(&pin_PA07) }, + { MP_ROM_QSTR(MP_QSTR_BOOST_EN), MP_ROM_PTR(&pin_PA14) }, + { MP_ROM_QSTR(MP_QSTR_VEXT_SELECT), MP_ROM_PTR(&pin_PA15) }, { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA06) }, { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA06) }, { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA08) }, From 041c2a9f6174996a7c841e4ff7a1e158958c9745 Mon Sep 17 00:00:00 2001 From: Brian Dean Date: Mon, 2 Nov 2020 08:35:25 -0500 Subject: [PATCH 038/148] .../boards/bdmicro_vina_d51: PAD updates for better resource flexibility. --- .../boards/bdmicro_vina_d51/mpconfigboard.h | 10 +- .../atmel-samd/boards/bdmicro_vina_d51/pins.c | 118 ++++++++++-------- 2 files changed, 68 insertions(+), 60 deletions(-) diff --git a/ports/atmel-samd/boards/bdmicro_vina_d51/mpconfigboard.h b/ports/atmel-samd/boards/bdmicro_vina_d51/mpconfigboard.h index 6bc9bb7063..8b015df05e 100644 --- a/ports/atmel-samd/boards/bdmicro_vina_d51/mpconfigboard.h +++ b/ports/atmel-samd/boards/bdmicro_vina_d51/mpconfigboard.h @@ -12,14 +12,14 @@ #define BOARD_HAS_CRYSTAL 1 -#define DEFAULT_I2C_BUS_SDA (&pin_PB02) -#define DEFAULT_I2C_BUS_SCL (&pin_PB03) +#define DEFAULT_I2C_BUS_SCL (&pin_PA16) +#define DEFAULT_I2C_BUS_SDA (&pin_PA17) +#define DEFAULT_UART_BUS_RX (&pin_PB20) +#define DEFAULT_UART_BUS_TX (&pin_PB21) #define DEFAULT_SPI_BUS_MISO (&pin_PB23) -#define DEFAULT_UART_BUS_TX (&pin_PB24) -#define DEFAULT_UART_BUS_RX (&pin_PB25) #define DEFAULT_SPI_BUS_MOSI (&pin_PC27) #define DEFAULT_SPI_BUS_SCK (&pin_PC28) -#define MICROPY_HW_LED_STATUS (&pin_PA15) +#define MICROPY_HW_LED_STATUS (&pin_PA23) #define MICROPY_HW_LED_RX (&pin_PC05) #define MICROPY_HW_LED_TX (&pin_PC06) diff --git a/ports/atmel-samd/boards/bdmicro_vina_d51/pins.c b/ports/atmel-samd/boards/bdmicro_vina_d51/pins.c index 931e0328fc..8eeab8a9a5 100644 --- a/ports/atmel-samd/boards/bdmicro_vina_d51/pins.c +++ b/ports/atmel-samd/boards/bdmicro_vina_d51/pins.c @@ -1,64 +1,70 @@ #include "shared-bindings/board/__init__.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { - { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PB08) }, - { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB09) }, - { MP_ROM_QSTR(MP_QSTR_A10), MP_ROM_PTR(&pin_PC00) }, - { MP_ROM_QSTR(MP_QSTR_A11), MP_ROM_PTR(&pin_PC01) }, - { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA04) }, - { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA06) }, - { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA07) }, - { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PB00) }, - { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_PB01) }, - { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_PB05) }, - { MP_ROM_QSTR(MP_QSTR_A8), MP_ROM_PTR(&pin_PB06) }, - { MP_ROM_QSTR(MP_QSTR_A9), MP_ROM_PTR(&pin_PB07) }, - { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PC10) }, - { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PC11) }, - { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA14) }, - { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA13) }, - { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PB14) }, - { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PB15) }, - { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PC20) }, - { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PC21) }, - { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA12) }, - { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PB31) }, - { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA16) }, - { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA17) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA04) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA06) }, + { MP_ROM_QSTR(MP_QSTR_A10), MP_ROM_PTR(&pin_PB07) }, + { MP_ROM_QSTR(MP_QSTR_A11), MP_ROM_PTR(&pin_PC00) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA07) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PB08) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PB09) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PC02) }, + { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_PC03) }, + { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_PB04) }, + { MP_ROM_QSTR(MP_QSTR_A8), MP_ROM_PTR(&pin_PB05) }, + { MP_ROM_QSTR(MP_QSTR_A9), MP_ROM_PTR(&pin_PB06) }, + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PB31) }, + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PC16) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PC13) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA14) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA15) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PB12) }, + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PB13) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PC17) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PC18) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PC19) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PC20) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PC21) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PB18) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PB19) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PC12) }, { MP_ROM_QSTR(MP_QSTR_DAC0), MP_ROM_PTR(&pin_PA02) }, { MP_ROM_QSTR(MP_QSTR_DAC1), MP_ROM_PTR(&pin_PA05) }, - { MP_ROM_QSTR(MP_QSTR_ESP01_EN), MP_ROM_PTR(&pin_PC03) }, + { MP_ROM_QSTR(MP_QSTR_ESP01_EN), MP_ROM_PTR(&pin_PC15) }, + { MP_ROM_QSTR(MP_QSTR_E5), MP_ROM_PTR(&pin_PC15) }, { MP_ROM_QSTR(MP_QSTR_ESP01_GPIO0), MP_ROM_PTR(&pin_PA18) }, - { MP_ROM_QSTR(MP_QSTR_UART3_RTS), MP_ROM_PTR(&pin_PA18) }, + { MP_ROM_QSTR(MP_QSTR_E3), MP_ROM_PTR(&pin_PA18) }, { MP_ROM_QSTR(MP_QSTR_ESP01_GPIO2), MP_ROM_PTR(&pin_PA19) }, - { MP_ROM_QSTR(MP_QSTR_UART3_CTS), MP_ROM_PTR(&pin_PA19) }, - { MP_ROM_QSTR(MP_QSTR_ESP01_RESET), MP_ROM_PTR(&pin_PC02) }, - { MP_ROM_QSTR(MP_QSTR_ESP01_RX), MP_ROM_PTR(&pin_PB21) }, - { MP_ROM_QSTR(MP_QSTR_UART3_RX), MP_ROM_PTR(&pin_PB21) }, - { MP_ROM_QSTR(MP_QSTR_ESP01_TX), MP_ROM_PTR(&pin_PB20) }, - { MP_ROM_QSTR(MP_QSTR_UART3_TX), MP_ROM_PTR(&pin_PB20) }, - { MP_ROM_QSTR(MP_QSTR_I2C_SCL), MP_ROM_PTR(&pin_PB03) }, - { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PB03) }, - { MP_ROM_QSTR(MP_QSTR_I2C_SDA), MP_ROM_PTR(&pin_PB02) }, - { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PB02) }, + { MP_ROM_QSTR(MP_QSTR_E4), MP_ROM_PTR(&pin_PA19) }, + { MP_ROM_QSTR(MP_QSTR_ESP01_RESET), MP_ROM_PTR(&pin_PC14) }, + { MP_ROM_QSTR(MP_QSTR_E6), MP_ROM_PTR(&pin_PC14) }, + { MP_ROM_QSTR(MP_QSTR_ESP01_RX), MP_ROM_PTR(&pin_PA12) }, + { MP_ROM_QSTR(MP_QSTR_UART3_RX), MP_ROM_PTR(&pin_PA12) }, + { MP_ROM_QSTR(MP_QSTR_I2C3_SCL), MP_ROM_PTR(&pin_PA12) }, + { MP_ROM_QSTR(MP_QSTR_E2), MP_ROM_PTR(&pin_PA12) }, + { MP_ROM_QSTR(MP_QSTR_ESP01_TX), MP_ROM_PTR(&pin_PA13) }, + { MP_ROM_QSTR(MP_QSTR_UART3_TX), MP_ROM_PTR(&pin_PA13) }, + { MP_ROM_QSTR(MP_QSTR_I2C3_SDA), MP_ROM_PTR(&pin_PA13) }, + { MP_ROM_QSTR(MP_QSTR_E1), MP_ROM_PTR(&pin_PA13) }, + { MP_ROM_QSTR(MP_QSTR_I2C1_SCL), MP_ROM_PTR(&pin_PA16) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA16) }, + { MP_ROM_QSTR(MP_QSTR_I2C1_SDA), MP_ROM_PTR(&pin_PA17) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA17) }, { MP_ROM_QSTR(MP_QSTR_I2S_FS_0), MP_ROM_PTR(&pin_PA20) }, - { MP_ROM_QSTR(MP_QSTR_I2S_FS_1), MP_ROM_PTR(&pin_PA23) }, { MP_ROM_QSTR(MP_QSTR_I2S_MCK_0), MP_ROM_PTR(&pin_PB17) }, - { MP_ROM_QSTR(MP_QSTR_I2S_MCK_1), MP_ROM_PTR(&pin_PB13) }, { MP_ROM_QSTR(MP_QSTR_I2S_SCK_0), MP_ROM_PTR(&pin_PB16) }, - { MP_ROM_QSTR(MP_QSTR_I2S_SCK_1), MP_ROM_PTR(&pin_PB12) }, { MP_ROM_QSTR(MP_QSTR_I2S_SDI), MP_ROM_PTR(&pin_PA22) }, { MP_ROM_QSTR(MP_QSTR_I2S_SDO), MP_ROM_PTR(&pin_PA21) }, - { MP_ROM_QSTR(MP_QSTR_LED_B), MP_ROM_PTR(&pin_PA15) }, - { MP_ROM_QSTR(MP_QSTR_LED_STATUS), MP_ROM_PTR(&pin_PA15) }, - { MP_ROM_QSTR(MP_QSTR_LED_G), MP_ROM_PTR(&pin_PB18) }, - { MP_ROM_QSTR(MP_QSTR_LED_R), MP_ROM_PTR(&pin_PB19) }, + { MP_ROM_QSTR(MP_QSTR_LED_B), MP_ROM_PTR(&pin_PA23) }, + { MP_ROM_QSTR(MP_QSTR_LED_STATUS), MP_ROM_PTR(&pin_PA23) }, + { MP_ROM_QSTR(MP_QSTR_LED_G), MP_ROM_PTR(&pin_PB15) }, + { MP_ROM_QSTR(MP_QSTR_LED_R), MP_ROM_PTR(&pin_PB14) }, { MP_ROM_QSTR(MP_QSTR_LED_RX), MP_ROM_PTR(&pin_PC05) }, { MP_ROM_QSTR(MP_QSTR_LED_TX), MP_ROM_PTR(&pin_PC06) }, - { MP_ROM_QSTR(MP_QSTR_RS485_RE), MP_ROM_PTR(&pin_PC15) }, - { MP_ROM_QSTR(MP_QSTR_RS485_RX), MP_ROM_PTR(&pin_PC13) }, - { MP_ROM_QSTR(MP_QSTR_RS485_TE), MP_ROM_PTR(&pin_PC14) }, - { MP_ROM_QSTR(MP_QSTR_RS485_TX), MP_ROM_PTR(&pin_PC12) }, + { MP_ROM_QSTR(MP_QSTR_RS485_RE), MP_ROM_PTR(&pin_PB01) }, + { MP_ROM_QSTR(MP_QSTR_RS485_RX), MP_ROM_PTR(&pin_PB03) }, + { MP_ROM_QSTR(MP_QSTR_RS485_TE), MP_ROM_PTR(&pin_PB00) }, + { MP_ROM_QSTR(MP_QSTR_RS485_TX), MP_ROM_PTR(&pin_PB02) }, { MP_ROM_QSTR(MP_QSTR_SPI_MISO), MP_ROM_PTR(&pin_PB23) }, { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PB23) }, { MP_ROM_QSTR(MP_QSTR_SPI_MOSI), MP_ROM_PTR(&pin_PC27) }, @@ -67,14 +73,16 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PC28) }, { MP_ROM_QSTR(MP_QSTR_SPI_SS), MP_ROM_PTR(&pin_PB22) }, { MP_ROM_QSTR(MP_QSTR_SS), MP_ROM_PTR(&pin_PB22) }, - { MP_ROM_QSTR(MP_QSTR_UART1_CTS), MP_ROM_PTR(&pin_PC19) }, - { MP_ROM_QSTR(MP_QSTR_UART1_RTS), MP_ROM_PTR(&pin_PC18) }, - { MP_ROM_QSTR(MP_QSTR_UART1_RX), MP_ROM_PTR(&pin_PC17) }, - { MP_ROM_QSTR(MP_QSTR_UART1_TX), MP_ROM_PTR(&pin_PC16) }, - { MP_ROM_QSTR(MP_QSTR_UART2_RX), MP_ROM_PTR(&pin_PB25) }, - { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PB25) }, - { MP_ROM_QSTR(MP_QSTR_UART2_TX), MP_ROM_PTR(&pin_PB24) }, - { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PB24) }, + { MP_ROM_QSTR(MP_QSTR_UART1_CTS), MP_ROM_PTR(&pin_PC25) }, + { MP_ROM_QSTR(MP_QSTR_UART1_RTS), MP_ROM_PTR(&pin_PC24) }, + { MP_ROM_QSTR(MP_QSTR_UART1_RX), MP_ROM_PTR(&pin_PB24) }, + { MP_ROM_QSTR(MP_QSTR_UART1_TX), MP_ROM_PTR(&pin_PB25) }, + { MP_ROM_QSTR(MP_QSTR_UART2_RX), MP_ROM_PTR(&pin_PB20) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PB20) }, + { MP_ROM_QSTR(MP_QSTR_I2C2_SCL), MP_ROM_PTR(&pin_PB20) }, + { MP_ROM_QSTR(MP_QSTR_UART2_TX), MP_ROM_PTR(&pin_PB21) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PB21) }, + { MP_ROM_QSTR(MP_QSTR_I2C2_SDA), MP_ROM_PTR(&pin_PB21) }, { 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_UART), MP_ROM_PTR(&board_uart_obj) }, From 1f7a3f0dfab05ab9551f0e1ecff9f45805897837 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 2 Nov 2020 15:28:30 -0500 Subject: [PATCH 039/148] Rev C Feather M4 CAN pin changes --- ports/atmel-samd/boards/feather_m4_can/pins.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ports/atmel-samd/boards/feather_m4_can/pins.c b/ports/atmel-samd/boards/feather_m4_can/pins.c index 2b67709f87..0150473301 100644 --- a/ports/atmel-samd/boards/feather_m4_can/pins.c +++ b/ports/atmel-samd/boards/feather_m4_can/pins.c @@ -36,6 +36,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA12) }, { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA13) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA14) }, { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA16) }, { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA18) }, @@ -45,14 +46,17 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA22) }, { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA23) }, - { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PB03) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PB02) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_PB03) }, - { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_PB01) }, - { MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_PB01) }, + { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_PB00) }, + { MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_PB00) }, + + { MP_ROM_QSTR(MP_QSTR_BOOST_ENABLE), MP_ROM_PTR(&pin_PB13) }, { MP_OBJ_NEW_QSTR(MP_QSTR_CAN_RX), MP_ROM_PTR(&pin_PB15) }, { MP_OBJ_NEW_QSTR(MP_QSTR_CAN_TX), MP_ROM_PTR(&pin_PB14) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_CAN_STANDBY), MP_ROM_PTR(&pin_PB13) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_CAN_STANDBY), MP_ROM_PTR(&pin_PB12) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, From 23afe08b6f81b70e2f24c609e6c43b0682aaf30b Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Mon, 2 Nov 2020 17:15:19 -0500 Subject: [PATCH 040/148] Add GPIO reset to end of neopixel-write --- ports/esp32s2/common-hal/neopixel_write/__init__.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ports/esp32s2/common-hal/neopixel_write/__init__.c b/ports/esp32s2/common-hal/neopixel_write/__init__.c index 553cb79f83..63d50bf14a 100644 --- a/ports/esp32s2/common-hal/neopixel_write/__init__.c +++ b/ports/esp32s2/common-hal/neopixel_write/__init__.c @@ -125,4 +125,6 @@ void common_hal_neopixel_write (const digitalio_digitalinout_obj_t* digitalinout // Free channel again esp32s2_peripherals_free_rmt(config.channel); + // Swap pin back to GPIO mode + gpio_set_direction(digitalinout->pin->number, GPIO_MODE_OUTPUT); } From 6c61a53e0fc7a2b56156551a7da07e8734e00a33 Mon Sep 17 00:00:00 2001 From: lady ada Date: Mon, 2 Nov 2020 18:38:23 -0500 Subject: [PATCH 041/148] io naming for gpio (credit to @kattni) --- .../boards/adafruit_metro_esp32s2/pins.c | 70 ++++++++++++------- 1 file changed, 45 insertions(+), 25 deletions(-) diff --git a/ports/esp32s2/boards/adafruit_metro_esp32s2/pins.c b/ports/esp32s2/boards/adafruit_metro_esp32s2/pins.c index 08d2b2a1a3..a7fc8b2d7c 100644 --- a/ports/esp32s2/boards/adafruit_metro_esp32s2/pins.c +++ b/ports/esp32s2/boards/adafruit_metro_esp32s2/pins.c @@ -2,41 +2,61 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO17) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO18) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO1) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO2) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO3) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO4) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO17), MP_ROM_PTR(&pin_GPIO17) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO5) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO5) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO6) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO6) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO7) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO8) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO9) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO10) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO11) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO12) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO13) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO14) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO15) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO16) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO21) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO42) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO18) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO1) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO2) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO3) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO4) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO16) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, { MP_OBJ_NEW_QSTR(MP_QSTR_SDA),MP_ROM_PTR(&pin_GPIO33) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO33),MP_ROM_PTR(&pin_GPIO33) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SCL),MP_ROM_PTR(&pin_GPIO34) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO34),MP_ROM_PTR(&pin_GPIO34) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO36) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_MOSI),MP_ROM_PTR(&pin_GPIO35) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO35),MP_ROM_PTR(&pin_GPIO35) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_MISO),MP_ROM_PTR(&pin_GPIO37) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO37),MP_ROM_PTR(&pin_GPIO37) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_IO42), MP_ROM_PTR(&pin_GPIO42) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO42) }, { MP_OBJ_NEW_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO45) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO45), MP_ROM_PTR(&pin_GPIO45) }, { MP_OBJ_NEW_QSTR(MP_QSTR_DEBUG_RX), MP_ROM_PTR(&pin_GPIO38) }, { MP_OBJ_NEW_QSTR(MP_QSTR_DEBUG_TX), MP_ROM_PTR(&pin_GPIO37) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO36) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MOSI),MP_ROM_PTR(&pin_GPIO35) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MISO),MP_ROM_PTR(&pin_GPIO37) }, - { 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_UART), MP_ROM_PTR(&board_uart_obj) }, From 18838e390a71366ccaa1aaeda8964e65d70fc43f Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 29 Oct 2020 19:38:25 -0700 Subject: [PATCH 042/148] reduce connection footprint and fix recv --- ports/esp32s2/common-hal/socketpool/Socket.c | 22 ++++++------- .../esp32s2/esp-idf-config/sdkconfig.defaults | 33 ++++++++++++------- 2 files changed, 31 insertions(+), 24 deletions(-) diff --git a/ports/esp32s2/common-hal/socketpool/Socket.c b/ports/esp32s2/common-hal/socketpool/Socket.c index 0a994c604e..750415dc7b 100644 --- a/ports/esp32s2/common-hal/socketpool/Socket.c +++ b/ports/esp32s2/common-hal/socketpool/Socket.c @@ -79,15 +79,15 @@ mp_uint_t common_hal_socketpool_socket_send(socketpool_socket_obj_t* self, const mp_uint_t common_hal_socketpool_socket_recv_into(socketpool_socket_obj_t* self, const uint8_t* buf, mp_uint_t len) { size_t received = 0; - ssize_t last_read = 1; + int status = 0; uint64_t start_ticks = supervisor_ticks_ms64(); int sockfd; esp_err_t err = esp_tls_get_conn_sockfd(self->tcp, &sockfd); if (err != ESP_OK) { mp_raise_OSError(MP_EBADF); } - while (received < len && - last_read > 0 && + while (received == 0 && + status >= 0 && (self->timeout_ms == 0 || supervisor_ticks_ms64() - start_ticks <= self->timeout_ms) && !mp_hal_is_interrupted()) { RUN_BACKGROUND_TASKS; @@ -95,27 +95,25 @@ mp_uint_t common_hal_socketpool_socket_recv_into(socketpool_socket_obj_t* self, if (available == 0) { // This reads the raw socket buffer and is used for non-TLS connections // and between encrypted TLS blocks. - int status = lwip_ioctl(sockfd, FIONREAD, &available); - if (status < 0) { - last_read = status; - break; - } + status = lwip_ioctl(sockfd, FIONREAD, &available); } size_t remaining = len - received; if (available > remaining) { available = remaining; } if (available > 0) { - last_read = esp_tls_conn_read(self->tcp, (void*) buf + received, available); - received += last_read; + status = esp_tls_conn_read(self->tcp, (void*) buf + received, available); + if (status > 0) { + received += status; + } } } - if (last_read == 0) { + if (received == 0) { // socket closed common_hal_socketpool_socket_close(self); } - if (last_read < 0) { + if (status < 0) { mp_raise_BrokenPipeError(); } return received; diff --git a/ports/esp32s2/esp-idf-config/sdkconfig.defaults b/ports/esp32s2/esp-idf-config/sdkconfig.defaults index 4094367e0c..37b33fc69e 100644 --- a/ports/esp32s2/esp-idf-config/sdkconfig.defaults +++ b/ports/esp32s2/esp-idf-config/sdkconfig.defaults @@ -135,6 +135,7 @@ CONFIG_COMPILER_STACK_CHECK_MODE_NONE=y # CONFIG_COMPILER_STACK_CHECK_MODE_ALL is not set # CONFIG_COMPILER_WARN_WRITE_STRINGS is not set # CONFIG_COMPILER_DISABLE_GCC8_WARNINGS is not set +# CONFIG_COMPILER_DUMP_RTL_FILES is not set # end of Compiler options # @@ -332,12 +333,13 @@ CONFIG_ESP_TIMER_IMPL_SYSTIMER=y # # Wi-Fi # -CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=10 -CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=32 +CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=4 +CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=8 # CONFIG_ESP32_WIFI_STATIC_TX_BUFFER is not set CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER=y CONFIG_ESP32_WIFI_TX_BUFFER_TYPE=1 -CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=32 +CONFIG_ESP32_WIFI_CACHE_TX_BUFFER_NUM=16 +CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=16 # CONFIG_ESP32_WIFI_CSI_ENABLED is not set CONFIG_ESP32_WIFI_AMPDU_TX_ENABLED=y CONFIG_ESP32_WIFI_TX_BA_WIN=6 @@ -439,7 +441,7 @@ CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES=y # CONFIG_LWIP_L2_TO_L3_COPY is not set # CONFIG_LWIP_IRAM_OPTIMIZATION is not set CONFIG_LWIP_TIMERS_ONDEMAND=y -CONFIG_LWIP_MAX_SOCKETS=10 +CONFIG_LWIP_MAX_SOCKETS=4 # CONFIG_LWIP_USE_ONLY_LWIP_SELECT is not set # CONFIG_LWIP_SO_LINGER is not set CONFIG_LWIP_SO_REUSE=y @@ -459,6 +461,9 @@ CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=32 CONFIG_LWIP_DHCP_DOES_ARP_CHECK=y # CONFIG_LWIP_DHCP_RESTORE_LAST_IP is not set +# +# CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH is not set + # # DHCP server # @@ -474,15 +479,15 @@ CONFIG_LWIP_LOOPBACK_MAX_PBUFS=8 # # TCP # -CONFIG_LWIP_MAX_ACTIVE_TCP=16 -CONFIG_LWIP_MAX_LISTENING_TCP=16 +CONFIG_LWIP_MAX_ACTIVE_TCP=4 +CONFIG_LWIP_MAX_LISTENING_TCP=4 CONFIG_LWIP_TCP_MAXRTX=12 CONFIG_LWIP_TCP_SYNMAXRTX=6 CONFIG_LWIP_TCP_MSS=1440 CONFIG_LWIP_TCP_TMR_INTERVAL=250 CONFIG_LWIP_TCP_MSL=60000 -CONFIG_LWIP_TCP_SND_BUF_DEFAULT=5744 -CONFIG_LWIP_TCP_WND_DEFAULT=5744 +CONFIG_LWIP_TCP_SND_BUF_DEFAULT=2880 +CONFIG_LWIP_TCP_WND_DEFAULT=2880 CONFIG_LWIP_TCP_RECVMBOX_SIZE=6 CONFIG_LWIP_TCP_QUEUE_OOSEQ=y # CONFIG_LWIP_TCP_SACK_OUT is not set @@ -505,6 +510,8 @@ CONFIG_LWIP_TCPIP_TASK_AFFINITY_NO_AFFINITY=y # CONFIG_LWIP_TCPIP_TASK_AFFINITY_CPU0 is not set CONFIG_LWIP_TCPIP_TASK_AFFINITY=0x7FFFFFFF # CONFIG_LWIP_PPP_SUPPORT is not set +CONFIG_LWIP_IPV6_MEMP_NUM_ND6_QUEUE=3 +CONFIG_LWIP_IPV6_ND6_NUM_NEIGHBORS=5 # CONFIG_LWIP_SLIP_SUPPORT is not set # @@ -552,8 +559,10 @@ CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y # CONFIG_MBEDTLS_CUSTOM_MEM_ALLOC is not set CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN=y CONFIG_MBEDTLS_SSL_IN_CONTENT_LEN=16384 -CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=4096 -# CONFIG_MBEDTLS_DYNAMIC_BUFFER is not set +CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=2048 +CONFIG_MBEDTLS_DYNAMIC_BUFFER=y +CONFIG_MBEDTLS_DYNAMIC_FREE_PEER_CERT=y +CONFIG_MBEDTLS_DYNAMIC_FREE_CONFIG_DATA=y # CONFIG_MBEDTLS_DEBUG is not set # @@ -824,8 +833,8 @@ CONFIG_TCP_MAXRTX=12 CONFIG_TCP_SYNMAXRTX=6 CONFIG_TCP_MSS=1440 CONFIG_TCP_MSL=60000 -CONFIG_TCP_SND_BUF_DEFAULT=5744 -CONFIG_TCP_WND_DEFAULT=5744 +CONFIG_TCP_SND_BUF_DEFAULT=2880 +CONFIG_TCP_WND_DEFAULT=2880 CONFIG_TCP_RECVMBOX_SIZE=6 CONFIG_TCP_QUEUE_OOSEQ=y # CONFIG_ESP_TCP_KEEP_CONNECTION_WHEN_IP_CHANGES is not set From 88fcf4ef7e001e547ed94747df5d22b6736c881c Mon Sep 17 00:00:00 2001 From: sw23 Date: Mon, 2 Nov 2020 19:59:07 -0500 Subject: [PATCH 043/148] Removing implementation-specific values for socket/socketpool class attributes --- shared-bindings/socket/__init__.c | 12 ++++++------ shared-bindings/socketpool/SocketPool.c | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/shared-bindings/socket/__init__.c b/shared-bindings/socket/__init__.c index 2969b37149..799bf28afa 100644 --- a/shared-bindings/socket/__init__.c +++ b/shared-bindings/socket/__init__.c @@ -49,12 +49,12 @@ STATIC const mp_obj_type_t socket_type; //| class socket: //| -//| AF_INET = 2 -//| AF_INET6 = 10 -//| SOCK_STREAM = 1 -//| SOCK_DGRAM = 2 -//| SOCK_RAW = 3 -//| IPPROTO_TCP = 6 +//| AF_INET: int +//| AF_INET6: int +//| SOCK_STREAM: int +//| SOCK_DGRAM: int +//| SOCK_RAW: int +//| IPPROTO_TCP: int //| //| def __init__(self, family: int = AF_INET, type: int = SOCK_STREAM, proto: int = IPPROTO_TCP) -> None: //| """Create a new socket diff --git a/shared-bindings/socketpool/SocketPool.c b/shared-bindings/socketpool/SocketPool.c index 2234f359ef..73eeed2652 100644 --- a/shared-bindings/socketpool/SocketPool.c +++ b/shared-bindings/socketpool/SocketPool.c @@ -57,12 +57,12 @@ STATIC mp_obj_t socketpool_socketpool_make_new(const mp_obj_type_t *type, size_t return MP_OBJ_FROM_PTR(s); } -//| AF_INET = 0 -//| AF_INET6 = 1 -//| SOCK_STREAM = 0 -//| SOCK_DGRAM = 1 -//| SOCK_RAW = 2 -//| IPPROTO_TCP = 6 +//| AF_INET: int +//| AF_INET6: int +//| SOCK_STREAM: int +//| SOCK_DGRAM: int +//| SOCK_RAW: int +//| IPPROTO_TCP: int //| //| def socket(self, family: int = AF_INET, type: int = SOCK_STREAM, proto: int = IPPROTO_TCP) -> socketpool.Socket: //| """Create a new socket From 7441344c6f29d9dbf7f8cedef55f394c42916963 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Mon, 2 Nov 2020 17:22:24 -0800 Subject: [PATCH 044/148] Add new config options to default --- ports/esp32s2/esp-idf-config/sdkconfig.defaults | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ports/esp32s2/esp-idf-config/sdkconfig.defaults b/ports/esp32s2/esp-idf-config/sdkconfig.defaults index 37b33fc69e..025b05caa6 100644 --- a/ports/esp32s2/esp-idf-config/sdkconfig.defaults +++ b/ports/esp32s2/esp-idf-config/sdkconfig.defaults @@ -264,6 +264,11 @@ CONFIG_ESP32S2_ALLOW_RTC_FAST_MEM_AS_HEAP=y # CONFIG_PM_ENABLE is not set # end of Power Management +# +# ADC-Calibration +# +# end of ADC-Calibration + # # Common ESP-related # @@ -403,6 +408,7 @@ CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=0 # CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS is not set CONFIG_FREERTOS_CHECK_MUTEX_GIVEN_BY_OWNER=y # CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE is not set +# CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH is not set CONFIG_FREERTOS_DEBUG_OCDAWARE=y # end of FreeRTOS @@ -715,6 +721,7 @@ CONFIG_SPI_FLASH_YIELD_DURING_ERASE=y CONFIG_SPI_FLASH_ERASE_YIELD_DURATION_MS=20 CONFIG_SPI_FLASH_ERASE_YIELD_TICKS=1 CONFIG_SPI_FLASH_WRITE_CHUNK_SIZE=8192 +# CONFIG_SPI_FLASH_SIZE_OVERRIDE is not set # # Auto-detect flash chips From c4521287e39abf92f1833a25f950aa5bd8e4857c Mon Sep 17 00:00:00 2001 From: lady ada Date: Mon, 2 Nov 2020 23:22:53 -0500 Subject: [PATCH 045/148] add rx/tx default uart names --- ports/esp32s2/boards/adafruit_metro_esp32s2/pins.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ports/esp32s2/boards/adafruit_metro_esp32s2/pins.c b/ports/esp32s2/boards/adafruit_metro_esp32s2/pins.c index a7fc8b2d7c..dbd6cfef8d 100644 --- a/ports/esp32s2/boards/adafruit_metro_esp32s2/pins.c +++ b/ports/esp32s2/boards/adafruit_metro_esp32s2/pins.c @@ -19,8 +19,12 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO4) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO5) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO6) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, From 4055c5ac61f824f7f2cfd72e670037af2f601427 Mon Sep 17 00:00:00 2001 From: Ed Hagerty Date: Tue, 3 Nov 2020 17:14:58 +0000 Subject: [PATCH 046/148] Update README.md --- ports/esp32s2/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/esp32s2/README.md b/ports/esp32s2/README.md index f3e678de85..0738d520e7 100644 --- a/ports/esp32s2/README.md +++ b/ports/esp32s2/README.md @@ -30,7 +30,7 @@ Connect these pins using a [USB adapter](https://www.adafruit.com/product/4090) ## Building and flashing ## -Before building or flashing the ESP32-S2, you must [install the esp-idf](https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/get-started/index.html). This must be re-done ever time the esp-idf is updated, but not every time you build. Run `cd ports/esp32s2` from `circuitpython/` to move to the esp32s2 port root, and run: +Before building or flashing the ESP32-S2, you must [install the esp-idf](https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/get-started/index.html). This must be re-done every time the esp-idf is updated, but not every time you build. Run `cd ports/esp32s2` from `circuitpython/` to move to the esp32s2 port root, and run: ``` ./esp-idf/install.sh From ca935c0dafba767f8eae681664972d0f6a0c5507 Mon Sep 17 00:00:00 2001 From: "ITACA Innovation S.R.L" <40298126+ITACAInnovation@users.noreply.github.com> Date: Tue, 3 Nov 2020 21:22:19 +0100 Subject: [PATCH 047/148] Update pins.c Changed builtin to standard --- ports/atmel-samd/boards/uchip/pins.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/atmel-samd/boards/uchip/pins.c b/ports/atmel-samd/boards/uchip/pins.c index 2d7eeebe11..de5508110d 100644 --- a/ports/atmel-samd/boards/uchip/pins.c +++ b/ports/atmel-samd/boards/uchip/pins.c @@ -1,7 +1,7 @@ #include "shared-bindings/board/__init__.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { - { MP_ROM_QSTR(MP_QSTR_LED_BUILTIN), MP_ROM_PTR(&pin_PA07) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PA07) }, { MP_ROM_QSTR(MP_QSTR_BOOST_EN), MP_ROM_PTR(&pin_PA14) }, { MP_ROM_QSTR(MP_QSTR_VEXT_SELECT), MP_ROM_PTR(&pin_PA15) }, { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA06) }, From fe6bfde590fc325c984c679825024241afd23a5f Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Wed, 4 Nov 2020 21:20:24 +0530 Subject: [PATCH 048/148] move pcnt handler --- locale/circuitpython.pot | 10 +++++----- ports/esp32s2/Makefile | 2 +- ports/esp32s2/{ => peripherals}/pcnt_handler.c | 2 +- ports/esp32s2/{ => peripherals}/pcnt_handler.h | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) rename ports/esp32s2/{ => peripherals}/pcnt_handler.c (96%) rename ports/esp32s2/{ => peripherals}/pcnt_handler.h (88%) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 1336ab25cd..b4445abfbf 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-01 11:11+0530\n" +"POT-Creation-Date: 2020-11-04 21:18+0530\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -296,6 +296,10 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "" +#: ports/esp32s2/peripherals/pcnt_handler.c +msgid "All PCNT units in use" +msgstr "" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1272,10 +1276,6 @@ msgstr "" msgid "No MOSI Pin" msgstr "" -#: ports/esp32s2/pcnt_handler.c -msgid "No PCNT unit free" -msgstr "" - #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c diff --git a/ports/esp32s2/Makefile b/ports/esp32s2/Makefile index 6dbbf58d4d..56f0d46a31 100644 --- a/ports/esp32s2/Makefile +++ b/ports/esp32s2/Makefile @@ -173,7 +173,6 @@ SRC_C += \ background.c \ fatfs_port.c \ mphalport.c \ - pcnt_handler.c \ bindings/espidf/__init__.c \ boards/$(BOARD)/board.c \ boards/$(BOARD)/pins.c \ @@ -189,6 +188,7 @@ SRC_C += \ lib/utils/pyexec.c \ lib/utils/stdout_helpers.c \ lib/utils/sys_stdio_mphal.c \ + peripherals/pcnt_handler.c \ peripherals/pins.c \ peripherals/rmt.c \ supervisor/shared/memory.c diff --git a/ports/esp32s2/pcnt_handler.c b/ports/esp32s2/peripherals/pcnt_handler.c similarity index 96% rename from ports/esp32s2/pcnt_handler.c rename to ports/esp32s2/peripherals/pcnt_handler.c index 56fb0f21c8..5a0cc9a7c2 100644 --- a/ports/esp32s2/pcnt_handler.c +++ b/ports/esp32s2/peripherals/pcnt_handler.c @@ -42,7 +42,7 @@ void pcnt_handler_init(pcnt_config_t* pcnt_config) { pcnt_state[i] = PCNT_UNIT_ACTIVE; break; } else if (i == 3) { - mp_raise_RuntimeError(translate("No PCNT unit free")); + mp_raise_RuntimeError(translate("All PCNT units in use")); } } diff --git a/ports/esp32s2/pcnt_handler.h b/ports/esp32s2/peripherals/pcnt_handler.h similarity index 88% rename from ports/esp32s2/pcnt_handler.h rename to ports/esp32s2/peripherals/pcnt_handler.h index 4bdaee1b87..f44ee1f830 100644 --- a/ports/esp32s2/pcnt_handler.h +++ b/ports/esp32s2/peripherals/pcnt_handler.h @@ -24,12 +24,12 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_ESP32S2_PCNT_HANDLER_H -#define MICROPY_INCLUDED_ESP32S2_PCNT_HANDLER_H +#ifndef MICROPY_INCLUDED_ESP32S2_PERIPHERALS_PCNT_HANDLER_H +#define MICROPY_INCLUDED_ESP32S2_PERIPHERALS_PCNT_HANDLER_H #include "driver/pcnt.h" extern void pcnt_handler_init(pcnt_config_t* pcnt_config); extern void pcnt_handler_deinit(pcnt_unit_t* unit); -#endif // MICROPY_INCLUDED_ESP32S2_PCNT_HANDLER_H +#endif // MICROPY_INCLUDED_ESP32S2_PERIPHERALS_PCNT_HANDLER_H From 92cd599ea31482b5462438334ef36ae3cfd9dba8 Mon Sep 17 00:00:00 2001 From: cyz Date: Thu, 5 Nov 2020 09:14:53 +0800 Subject: [PATCH 049/148] Modify the pins of the hiibot_bluefi. --- ports/nrf/boards/hiibot_bluefi/pins.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ports/nrf/boards/hiibot_bluefi/pins.c b/ports/nrf/boards/hiibot_bluefi/pins.c index 340ea948cf..bce4ee52dd 100644 --- a/ports/nrf/boards/hiibot_bluefi/pins.c +++ b/ports/nrf/boards/hiibot_bluefi/pins.c @@ -109,10 +109,10 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_D26), MP_ROM_PTR(&pin_P0_27) }, { MP_ROM_QSTR(MP_QSTR_TFT_DC), MP_ROM_PTR(&pin_P0_27) }, - { MP_ROM_QSTR(MP_QSTR_P27), MP_ROM_PTR(&pin_P1_14) }, - { MP_ROM_QSTR(MP_QSTR_D27), MP_ROM_PTR(&pin_P1_14) }, - { MP_ROM_QSTR(MP_QSTR_TFT_RESET), MP_ROM_PTR(&pin_P1_14) }, - { MP_ROM_QSTR(MP_QSTR_TFT_BACKLIGHT), MP_ROM_PTR(&pin_P1_14) }, + { MP_ROM_QSTR(MP_QSTR_P27), MP_ROM_PTR(&pin_P1_13) }, + { MP_ROM_QSTR(MP_QSTR_D27), MP_ROM_PTR(&pin_P1_13) }, + //{ MP_ROM_QSTR(MP_QSTR_TFT_RESET), MP_ROM_PTR(&pin_P1_13) }, + { MP_ROM_QSTR(MP_QSTR_TFT_BACKLIGHT), MP_ROM_PTR(&pin_P1_13) }, // P28~P33/D28~D33 connecte into QSPI FlashROM (W25Q16JV_IQ) From d8ef9a127b4914f7d9b50131c15e653aef94cb8f Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Thu, 5 Nov 2020 10:10:39 +0530 Subject: [PATCH 050/148] rename pcnt_handler to pcnt --- ports/esp32s2/Makefile | 2 +- ports/esp32s2/common-hal/countio/Counter.c | 5 +++-- ports/esp32s2/common-hal/countio/Counter.h | 2 +- ports/esp32s2/peripherals/{pcnt_handler.c => pcnt.c} | 6 +++--- ports/esp32s2/peripherals/{pcnt_handler.h => pcnt.h} | 4 ++-- 5 files changed, 10 insertions(+), 9 deletions(-) rename ports/esp32s2/peripherals/{pcnt_handler.c => pcnt.c} (94%) rename ports/esp32s2/peripherals/{pcnt_handler.h => pcnt.h} (92%) diff --git a/ports/esp32s2/Makefile b/ports/esp32s2/Makefile index 56f0d46a31..55d6e91d44 100644 --- a/ports/esp32s2/Makefile +++ b/ports/esp32s2/Makefile @@ -188,7 +188,7 @@ SRC_C += \ lib/utils/pyexec.c \ lib/utils/stdout_helpers.c \ lib/utils/sys_stdio_mphal.c \ - peripherals/pcnt_handler.c \ + peripherals/pcnt.c \ peripherals/pins.c \ peripherals/rmt.c \ supervisor/shared/memory.c diff --git a/ports/esp32s2/common-hal/countio/Counter.c b/ports/esp32s2/common-hal/countio/Counter.c index 4357624733..81f9f7ad2a 100644 --- a/ports/esp32s2/common-hal/countio/Counter.c +++ b/ports/esp32s2/common-hal/countio/Counter.c @@ -42,7 +42,8 @@ void common_hal_countio_counter_construct(countio_counter_obj_t* self, .neg_mode = PCNT_COUNT_DIS, // Keep the counter value on the negative edge }; // Initialize PCNT unit - pcnt_handler_init(&pcnt_config); + // This also sets pcnt_config.unit + peripherals_pcnt_init(&pcnt_config); self->pin = pin->number; self->unit = pcnt_config.unit; @@ -57,7 +58,7 @@ void common_hal_countio_counter_deinit(countio_counter_obj_t* self) { return; } reset_pin_number(self->pin); - pcnt_handler_deinit(&self->unit); + peripherals_pcnt_deinit(&self->unit); } mp_int_t common_hal_countio_counter_get_count(countio_counter_obj_t* self) { diff --git a/ports/esp32s2/common-hal/countio/Counter.h b/ports/esp32s2/common-hal/countio/Counter.h index 63d1eb98b2..20fe5b83e6 100644 --- a/ports/esp32s2/common-hal/countio/Counter.h +++ b/ports/esp32s2/common-hal/countio/Counter.h @@ -28,7 +28,7 @@ #define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_COUNTIO_COUNTER_H #include "py/obj.h" -#include "pcnt_handler.h" +#include "peripherals/pcnt.h" typedef struct { mp_obj_base_t base; diff --git a/ports/esp32s2/peripherals/pcnt_handler.c b/ports/esp32s2/peripherals/pcnt.c similarity index 94% rename from ports/esp32s2/peripherals/pcnt_handler.c rename to ports/esp32s2/peripherals/pcnt.c index 5a0cc9a7c2..e7eb32c1d1 100644 --- a/ports/esp32s2/peripherals/pcnt_handler.c +++ b/ports/esp32s2/peripherals/pcnt.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "pcnt_handler.h" +#include "peripherals/pcnt.h" #include "py/runtime.h" #include "supervisor/shared/translate.h" @@ -34,7 +34,7 @@ static uint8_t pcnt_state[4]; -void pcnt_handler_init(pcnt_config_t* pcnt_config) { +void peripherals_pcnt_init(pcnt_config_t* pcnt_config) { // Look for available pcnt unit for (uint8_t i = 0; i<=3; i++) { if (pcnt_state[i] == PCNT_UNIT_INACTIVE) { @@ -61,7 +61,7 @@ void pcnt_handler_init(pcnt_config_t* pcnt_config) { pcnt_counter_resume(pcnt_config->unit); } -void pcnt_handler_deinit(pcnt_unit_t* unit) { +void peripherals_pcnt_deinit(pcnt_unit_t* unit) { pcnt_state[*unit] = PCNT_UNIT_INACTIVE; *unit = PCNT_UNIT_MAX; } diff --git a/ports/esp32s2/peripherals/pcnt_handler.h b/ports/esp32s2/peripherals/pcnt.h similarity index 92% rename from ports/esp32s2/peripherals/pcnt_handler.h rename to ports/esp32s2/peripherals/pcnt.h index f44ee1f830..64072501cb 100644 --- a/ports/esp32s2/peripherals/pcnt_handler.h +++ b/ports/esp32s2/peripherals/pcnt.h @@ -29,7 +29,7 @@ #include "driver/pcnt.h" -extern void pcnt_handler_init(pcnt_config_t* pcnt_config); -extern void pcnt_handler_deinit(pcnt_unit_t* unit); +extern void peripherals_pcnt_init(pcnt_config_t* pcnt_config); +extern void peripherals_pcnt_deinit(pcnt_unit_t* unit); #endif // MICROPY_INCLUDED_ESP32S2_PERIPHERALS_PCNT_HANDLER_H From c2aa54ae661612e68768e10b76fd942af036ecda Mon Sep 17 00:00:00 2001 From: root Date: Thu, 5 Nov 2020 11:10:40 -0600 Subject: [PATCH 051/148] Check for Ctrl-C during sleeps --- ports/esp32s2/supervisor/port.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index 0b9c03f747..2aa01cb152 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -203,7 +203,16 @@ void port_sleep_until_interrupt(void) { if (sleep_time_duration == 0) { return; } - vTaskDelayUntil(&sleep_time_set, sleep_time_duration); + // Need to run in a loop in order to check if CTRL-C was received + TickType_t start_ticks = 0; + while (sleep_time_duration > start_ticks ) { + vTaskDelayUntil(&sleep_time_set, 1); + if ( mp_hal_is_interrupted() ) { + mp_handle_pending(); + } + start_ticks = start_ticks + 1; + } + } From ac8a0faa0d64fd07af65a798c7e1fc5ce4e39df2 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Fri, 6 Nov 2020 01:42:20 +0530 Subject: [PATCH 052/148] update peripherals_pcnt_init() --- ports/esp32s2/common-hal/countio/Counter.c | 14 +++++++++---- ports/esp32s2/peripherals/pcnt.c | 23 +++++++++++----------- ports/esp32s2/peripherals/pcnt.h | 2 +- 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/ports/esp32s2/common-hal/countio/Counter.c b/ports/esp32s2/common-hal/countio/Counter.c index 81f9f7ad2a..fe52d93add 100644 --- a/ports/esp32s2/common-hal/countio/Counter.c +++ b/ports/esp32s2/common-hal/countio/Counter.c @@ -27,12 +27,15 @@ #include "common-hal/countio/Counter.h" #include "common-hal/microcontroller/Pin.h" +#include "py/runtime.h" +#include "supervisor/shared/translate.h" + void common_hal_countio_counter_construct(countio_counter_obj_t* self, const mcu_pin_obj_t* pin) { claim_pin(pin); // Prepare configuration for the PCNT unit - pcnt_config_t pcnt_config = { + const pcnt_config_t pcnt_config = { // Set PCNT input signal and control GPIOs .pulse_gpio_num = pin->number, .ctrl_gpio_num = PCNT_PIN_NOT_USED, @@ -41,12 +44,15 @@ void common_hal_countio_counter_construct(countio_counter_obj_t* self, .pos_mode = PCNT_COUNT_INC, // Count up on the positive edge .neg_mode = PCNT_COUNT_DIS, // Keep the counter value on the negative edge }; + // Initialize PCNT unit - // This also sets pcnt_config.unit - peripherals_pcnt_init(&pcnt_config); + const int8_t unit = peripherals_pcnt_init(pcnt_config); + if (unit == -1) { + mp_raise_RuntimeError(translate("All PCNT units in use")); + } self->pin = pin->number; - self->unit = pcnt_config.unit; + self->unit = (pcnt_unit_t)unit; } bool common_hal_countio_counter_deinited(countio_counter_obj_t* self) { diff --git a/ports/esp32s2/peripherals/pcnt.c b/ports/esp32s2/peripherals/pcnt.c index e7eb32c1d1..555a0ec1d3 100644 --- a/ports/esp32s2/peripherals/pcnt.c +++ b/ports/esp32s2/peripherals/pcnt.c @@ -26,39 +26,38 @@ #include "peripherals/pcnt.h" -#include "py/runtime.h" -#include "supervisor/shared/translate.h" - #define PCNT_UNIT_ACTIVE 1 #define PCNT_UNIT_INACTIVE 0 static uint8_t pcnt_state[4]; -void peripherals_pcnt_init(pcnt_config_t* pcnt_config) { +int peripherals_pcnt_init(pcnt_config_t pcnt_config) { // Look for available pcnt unit for (uint8_t i = 0; i<=3; i++) { if (pcnt_state[i] == PCNT_UNIT_INACTIVE) { - pcnt_config->unit = (pcnt_unit_t)i; + pcnt_config.unit = (pcnt_unit_t)i; pcnt_state[i] = PCNT_UNIT_ACTIVE; break; } else if (i == 3) { - mp_raise_RuntimeError(translate("All PCNT units in use")); + return -1; } } // Initialize PCNT unit - pcnt_unit_config(pcnt_config); + pcnt_unit_config(&pcnt_config); // Configure and enable the input filter - pcnt_set_filter_value(pcnt_config->unit, 100); - pcnt_filter_enable(pcnt_config->unit); + pcnt_set_filter_value(pcnt_config.unit, 100); + pcnt_filter_enable(pcnt_config.unit); // Initialize PCNT's counter - pcnt_counter_pause(pcnt_config->unit); - pcnt_counter_clear(pcnt_config->unit); + pcnt_counter_pause(pcnt_config.unit); + pcnt_counter_clear(pcnt_config.unit); // Everything is set up, now go to counting - pcnt_counter_resume(pcnt_config->unit); + pcnt_counter_resume(pcnt_config.unit); + + return pcnt_config.unit; } void peripherals_pcnt_deinit(pcnt_unit_t* unit) { diff --git a/ports/esp32s2/peripherals/pcnt.h b/ports/esp32s2/peripherals/pcnt.h index 64072501cb..abed80fd0c 100644 --- a/ports/esp32s2/peripherals/pcnt.h +++ b/ports/esp32s2/peripherals/pcnt.h @@ -29,7 +29,7 @@ #include "driver/pcnt.h" -extern void peripherals_pcnt_init(pcnt_config_t* pcnt_config); +extern int peripherals_pcnt_init(pcnt_config_t pcnt_config); extern void peripherals_pcnt_deinit(pcnt_unit_t* unit); #endif // MICROPY_INCLUDED_ESP32S2_PERIPHERALS_PCNT_HANDLER_H From da04efbf2ed205d73de4f0082017ed15c3f59896 Mon Sep 17 00:00:00 2001 From: DavePutz Date: Thu, 5 Nov 2020 14:25:45 -0600 Subject: [PATCH 053/148] Fix missing include in port.c --- ports/esp32s2/supervisor/port.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index 2aa01cb152..5cd6204405 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -30,6 +30,7 @@ #include "supervisor/port.h" #include "boards/board.h" #include "modules/module.h" +#include "py/runtime.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" From 8ce852e6523a51b419a28642732d5ad3813bdb88 Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Wed, 4 Nov 2020 20:02:37 +0000 Subject: [PATCH 054/148] Translated using Weblate (Swedish) Currently translated at 100.0% (844 of 844 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/ --- locale/sv.po | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/locale/sv.po b/locale/sv.po index 65cd9f6f1f..9182a99430 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: 2020-10-21 20:13-0500\n" -"PO-Revision-Date: 2020-11-01 16:26+0000\n" +"PO-Revision-Date: 2020-11-05 20:26+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.3.2-dev\n" +"X-Generator: Weblate 4.3.2\n" #: main.c msgid "" @@ -415,8 +415,8 @@ msgid "" "Auto-reload is on. Simply save files over USB to run them or enter REPL to " "disable.\n" msgstr "" -"Autoladdning är på. Spara bara filer via USB för att köra dem eller ange " -"REPL för att inaktivera.\n" +"Autoladdning är på. Spara filer via USB för att köra dem eller ange REPL för " +"att inaktivera.\n" #: ports/esp32s2/common-hal/canio/CAN.c msgid "Baudrate not supported by peripheral" @@ -2220,7 +2220,7 @@ msgstr "kan bara ha upp till 4 parametrar att Xtensa assembly" #: py/persistentcode.c msgid "can only save bytecode" -msgstr "kan bara spara bytekod" +msgstr "kan bara spara bytecode" #: py/objtype.c msgid "can't add special method to already-subclassed class" From d948e6570f32b08de71b5d088ab445d2de3a7661 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 5 Nov 2020 21:27:21 -0600 Subject: [PATCH 055/148] Changes to handle Ctrl-C during sleep --- ports/esp32s2/supervisor/port.c | 32 ++++++++++++++------------------ ports/esp32s2/supervisor/usb.c | 20 ++++++++++++++++++++ 2 files changed, 34 insertions(+), 18 deletions(-) diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index 2aa01cb152..46de636276 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -30,6 +30,7 @@ #include "supervisor/port.h" #include "boards/board.h" #include "modules/module.h" +#include "py/runtime.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" @@ -54,6 +55,7 @@ uint32_t* heap; uint32_t heap_size; +extern TaskHandle_t xTaskToNotify; STATIC esp_timer_handle_t _tick_timer; @@ -188,34 +190,28 @@ void port_disable_tick(void) { esp_timer_stop(_tick_timer); } -TickType_t sleep_time_set; TickType_t sleep_time_duration; +uint32_t NotifyValue = 0; +BaseType_t notify_wait = 0; + void port_interrupt_after_ticks(uint32_t ticks) { - sleep_time_set = xTaskGetTickCount(); - sleep_time_duration = ticks / portTICK_PERIOD_MS; - // esp_sleep_enable_timer_wakeup(uint64_t time_in_us) + sleep_time_duration = (ticks * 100)/1024; + xTaskToNotify = xTaskGetCurrentTaskHandle(); } void port_sleep_until_interrupt(void) { - // FreeRTOS delay here maybe. - // Light sleep shuts down BLE and wifi. - // esp_light_sleep_start() + if (sleep_time_duration == 0) { return; } - // Need to run in a loop in order to check if CTRL-C was received - TickType_t start_ticks = 0; - while (sleep_time_duration > start_ticks ) { - vTaskDelayUntil(&sleep_time_set, 1); - if ( mp_hal_is_interrupted() ) { - mp_handle_pending(); - } - start_ticks = start_ticks + 1; - } - + notify_wait = xTaskNotifyWait(0x01,0x01,&NotifyValue, + sleep_time_duration ); + if (NotifyValue == 1) { + xTaskToNotify = NULL; + mp_handle_pending(); + } } - // Wrap main in app_main that the IDF expects. extern void main(void); void app_main(void) { diff --git a/ports/esp32s2/supervisor/usb.c b/ports/esp32s2/supervisor/usb.c index 1ad6af0470..86186d36b8 100644 --- a/ports/esp32s2/supervisor/usb.c +++ b/ports/esp32s2/supervisor/usb.c @@ -52,6 +52,8 @@ StackType_t usb_device_stack[USBD_STACK_SIZE]; StaticTask_t usb_device_taskdef; +TaskHandle_t xTaskToNotify = NULL; + // USB Device Driver task // This top level thread process all usb events and invoke callbacks void usb_device_task(void* param) @@ -114,3 +116,21 @@ void init_usb_hardware(void) { usb_device_stack, &usb_device_taskdef); } +/** + * Callback invoked when received an "wanted" char. + * @param itf Interface index (for multiple cdc interfaces) + * @param wanted_char The wanted char (set previously) + */ +void tud_cdc_rx_wanted_cb(uint8_t itf, char wanted_char) +{ + (void) itf; // not used + // Workaround for using lib/utils/interrupt_char.c + // Compare mp_interrupt_char with wanted_char and ignore if not matched + if (mp_interrupt_char == wanted_char) { + tud_cdc_read_flush(); // flush read fifo + mp_keyboard_interrupt(); + if (xTaskToNotify != NULL) { + xTaskNotifyGive(xTaskToNotify); + } + } +} From 93193f2f0b843fc8c052edecd362a1cdd7b30d5d Mon Sep 17 00:00:00 2001 From: sporeball Date: Fri, 6 Nov 2020 19:49:49 +0000 Subject: [PATCH 056/148] Translated using Weblate (Japanese) Currently translated at 71.8% (606 of 844 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ja/ --- locale/ja.po | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/locale/ja.po b/locale/ja.po index ae7e51ba6b..c9a85c1a23 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -8,15 +8,15 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-10-21 20:13-0500\n" -"PO-Revision-Date: 2020-09-25 18:20+0000\n" -"Last-Translator: Taku Fukada \n" +"PO-Revision-Date: 2020-11-06 20:29+0000\n" +"Last-Translator: sporeball \n" "Language-Team: none\n" "Language: ja\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Weblate 4.3-dev\n" +"X-Generator: Weblate 4.3.2\n" #: main.c msgid "" @@ -162,12 +162,12 @@ msgstr "'%s' にはラベルが必要" #: py/emitinlinethumb.c py/emitinlinextensa.c #, c-format msgid "'%s' expects a register" -msgstr "" +msgstr "'%s'にはレジスタが必要" #: py/emitinlinethumb.c #, c-format msgid "'%s' expects a special register" -msgstr "" +msgstr "'%s'には特別レジスタが必要" #: py/emitinlinethumb.c #, c-format @@ -192,7 +192,7 @@ msgstr "" #: py/emitinlinethumb.c #, c-format msgid "'%s' expects {r0, r1, ...}" -msgstr "" +msgstr "'%s'には{r0, r1, ...}が必要" #: py/emitinlinextensa.c #, c-format @@ -246,7 +246,7 @@ msgstr "'data'には整数の引数が必要" #: py/compile.c msgid "'label' requires 1 argument" -msgstr "" +msgstr "'label'には1つの引数が必要" #: py/compile.c msgid "'return' outside function" @@ -296,7 +296,7 @@ msgstr "address_typeが範囲外" #: ports/esp32s2/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" -msgstr "" +msgstr "全てのCAN周辺機器が使用中" #: ports/esp32s2/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" @@ -821,19 +821,19 @@ msgstr "%qが必要" #: shared-bindings/_bleio/CharacteristicBuffer.c #: shared-bindings/_bleio/Descriptor.c shared-bindings/_bleio/PacketBuffer.c msgid "Expected a Characteristic" -msgstr "" +msgstr "Characteristicが必要" #: shared-bindings/_bleio/Adapter.c msgid "Expected a DigitalInOut" -msgstr "" +msgstr "DigitalInOutが必要" #: shared-bindings/_bleio/Characteristic.c msgid "Expected a Service" -msgstr "" +msgstr "Serviceが必要" #: shared-bindings/_bleio/Adapter.c msgid "Expected a UART" -msgstr "" +msgstr "UARTが必要" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c #: shared-bindings/_bleio/Service.c @@ -842,7 +842,7 @@ msgstr "UUIDが必要" #: shared-bindings/_bleio/Adapter.c msgid "Expected an Address" -msgstr "" +msgstr "Addressが必要" #: shared-module/_pixelbuf/PixelBuf.c #, c-format @@ -886,7 +886,7 @@ msgstr "%dバイトのRXバッファの確保に失敗" #: ports/esp32s2/common-hal/wifi/__init__.c msgid "Failed to allocate Wifi memory" -msgstr "" +msgstr "Wi-Fiのメモリの確保に失敗" #: ports/esp32s2/common-hal/wifi/ScannedNetworks.c msgid "Failed to allocate wifi scan memory" @@ -1052,7 +1052,7 @@ msgstr "不正なBMPファイル" #: shared-bindings/wifi/Radio.c msgid "Invalid BSSID" -msgstr "" +msgstr "不正なBSSID" #: ports/esp32s2/common-hal/analogio/AnalogOut.c #: ports/stm/common-hal/analogio/AnalogOut.c @@ -1103,7 +1103,7 @@ msgstr "フォーマットチャンクのサイズが不正" #: ports/esp32s2/common-hal/pwmio/PWMOut.c msgid "Invalid frequency" -msgstr "" +msgstr "不正な周波数" #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Invalid frequency supplied" @@ -1338,11 +1338,11 @@ msgstr "long integerに対応していません" #: ports/esp32s2/common-hal/pwmio/PWMOut.c msgid "No more channels available" -msgstr "" +msgstr "使えるチャネルがもうありません" #: ports/esp32s2/common-hal/pwmio/PWMOut.c msgid "No more timers available" -msgstr "" +msgstr "使えるタイマーがもうありません" #: ports/stm/common-hal/pwmio/PWMOut.c msgid "No more timers available on this pin." @@ -1658,7 +1658,7 @@ msgstr "" #: ports/cxd56/common-hal/camera/Camera.c msgid "Size not supported" -msgstr "" +msgstr "サイズは対応していません" #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." From cb159569c23f71704b1787f8d6cabacedccca958 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Fri, 6 Nov 2020 21:29:26 +0100 Subject: [PATCH 057/148] 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 | 9 +++++++-- locale/el.po | 9 +++++++-- locale/es.po | 9 +++++++-- locale/fil.po | 9 +++++++-- locale/fr.po | 9 +++++++-- 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 | 9 +++++++-- locale/sv.po | 9 +++++++-- locale/zh_Latn_pinyin.po | 9 +++++++-- 16 files changed, 112 insertions(+), 32 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 7debab27ac..3e47dc9a18 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-21 20:13-0500\n" +"POT-Creation-Date: 2020-11-04 21:18+0530\n" "PO-Revision-Date: 2020-10-10 23:51+0000\n" "Last-Translator: oon arfiandwi \n" "Language-Team: LANGUAGE \n" @@ -300,6 +300,10 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "Semua perangkat I2C sedang digunakan" +#: ports/esp32s2/peripherals/pcnt_handler.c +msgid "All PCNT units in use" +msgstr "" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1130,7 +1134,8 @@ msgid "Invalid phase" msgstr "Fase tidak valid" #: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c +#: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" msgstr "Pin tidak valid" diff --git a/locale/cs.po b/locale/cs.po index e4f677d8e2..428d6d1fe6 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-21 20:13-0500\n" +"POT-Creation-Date: 2020-11-04 21:18+0530\n" "PO-Revision-Date: 2020-05-24 03:22+0000\n" "Last-Translator: dronecz \n" "Language-Team: LANGUAGE \n" @@ -300,6 +300,10 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "" +#: ports/esp32s2/peripherals/pcnt_handler.c +msgid "All PCNT units in use" +msgstr "" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1113,7 +1117,8 @@ msgid "Invalid phase" msgstr "" #: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c +#: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index 141a5e8c03..059d726cab 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-21 20:13-0500\n" +"POT-Creation-Date: 2020-11-04 21:18+0530\n" "PO-Revision-Date: 2020-06-16 18:24+0000\n" "Last-Translator: Andreas Buchen \n" "Language: de_DE\n" @@ -299,6 +299,10 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "Alle I2C-Peripheriegeräte sind in Benutzung" +#: ports/esp32s2/peripherals/pcnt_handler.c +msgid "All PCNT units in use" +msgstr "" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1130,7 +1134,8 @@ msgid "Invalid phase" msgstr "Ungültige Phase" #: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c +#: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" msgstr "Ungültiger Pin" diff --git a/locale/el.po b/locale/el.po index cc6da670cd..327f4dbe0f 100644 --- a/locale/el.po +++ b/locale/el.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-21 20:13-0500\n" +"POT-Creation-Date: 2020-11-04 21:18+0530\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -295,6 +295,10 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "" +#: ports/esp32s2/peripherals/pcnt_handler.c +msgid "All PCNT units in use" +msgstr "" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1108,7 +1112,8 @@ msgid "Invalid phase" msgstr "" #: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c +#: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" msgstr "" diff --git a/locale/es.po b/locale/es.po index a750c80554..95d6a92ff5 100644 --- a/locale/es.po +++ b/locale/es.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-21 20:13-0500\n" +"POT-Creation-Date: 2020-11-04 21:18+0530\n" "PO-Revision-Date: 2020-11-01 16:26+0000\n" "Last-Translator: Alvaro Figueroa \n" "Language-Team: \n" @@ -303,6 +303,10 @@ msgstr "Todos los periféricos CAN están en uso" msgid "All I2C peripherals are in use" msgstr "Todos los periféricos I2C están siendo usados" +#: ports/esp32s2/peripherals/pcnt_handler.c +msgid "All PCNT units in use" +msgstr "" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1131,7 +1135,8 @@ msgid "Invalid phase" msgstr "Fase inválida" #: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c +#: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" msgstr "Pin inválido" diff --git a/locale/fil.po b/locale/fil.po index 7bc33dba3e..ce3b5616a3 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-21 20:13-0500\n" +"POT-Creation-Date: 2020-11-04 21:18+0530\n" "PO-Revision-Date: 2018-12-20 22:15-0800\n" "Last-Translator: Timothy \n" "Language-Team: fil\n" @@ -297,6 +297,10 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "Lahat ng I2C peripherals ginagamit" +#: ports/esp32s2/peripherals/pcnt_handler.c +msgid "All PCNT units in use" +msgstr "" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1123,7 +1127,8 @@ msgid "Invalid phase" msgstr "Mali ang phase" #: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c +#: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" msgstr "Mali ang pin" diff --git a/locale/fr.po b/locale/fr.po index 920e22cb0c..94ca1f21cf 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-21 20:13-0500\n" +"POT-Creation-Date: 2020-11-04 21:18+0530\n" "PO-Revision-Date: 2020-10-22 20:48+0000\n" "Last-Translator: Antonin ENFRUN \n" "Language: fr\n" @@ -304,6 +304,10 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "Tous les périphériques I2C sont utilisés" +#: ports/esp32s2/peripherals/pcnt_handler.c +msgid "All PCNT units in use" +msgstr "" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1136,7 +1140,8 @@ msgid "Invalid phase" msgstr "Phase invalide" #: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c +#: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" msgstr "Broche invalide" diff --git a/locale/hi.po b/locale/hi.po index 4966ad8e80..d87a1eb9ce 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-21 20:13-0500\n" +"POT-Creation-Date: 2020-11-04 21:18+0530\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -295,6 +295,10 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "" +#: ports/esp32s2/peripherals/pcnt_handler.c +msgid "All PCNT units in use" +msgstr "" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1108,7 +1112,8 @@ msgid "Invalid phase" msgstr "" #: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c +#: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index 82840c8523..657c581cef 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-21 20:13-0500\n" +"POT-Creation-Date: 2020-11-04 21:18+0530\n" "PO-Revision-Date: 2018-10-02 16:27+0200\n" "Last-Translator: Enrico Paganin \n" "Language-Team: \n" @@ -296,6 +296,10 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "Tutte le periferiche I2C sono in uso" +#: ports/esp32s2/peripherals/pcnt_handler.c +msgid "All PCNT units in use" +msgstr "" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1125,7 +1129,8 @@ msgid "Invalid phase" msgstr "Fase non valida" #: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c +#: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" msgstr "Pin non valido" diff --git a/locale/ja.po b/locale/ja.po index c9a85c1a23..7004c49f30 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-21 20:13-0500\n" +"POT-Creation-Date: 2020-11-04 21:18+0530\n" "PO-Revision-Date: 2020-11-06 20:29+0000\n" "Last-Translator: sporeball \n" "Language-Team: none\n" @@ -302,6 +302,10 @@ msgstr "全てのCAN周辺機器が使用中" msgid "All I2C peripherals are in use" msgstr "全てのI2C周辺機器が使用中" +#: ports/esp32s2/peripherals/pcnt_handler.c +msgid "All PCNT units in use" +msgstr "" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1123,7 +1127,8 @@ msgid "Invalid phase" msgstr "不正なphase" #: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c +#: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" msgstr "不正なピン" diff --git a/locale/ko.po b/locale/ko.po index 858a036c83..4b302f3b9f 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-21 20:13-0500\n" +"POT-Creation-Date: 2020-11-04 21:18+0530\n" "PO-Revision-Date: 2020-10-05 12:12+0000\n" "Last-Translator: Michal Čihař \n" "Language-Team: LANGUAGE \n" @@ -298,6 +298,10 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "사용중인 모든 I2C주변 기기" +#: ports/esp32s2/peripherals/pcnt_handler.c +msgid "All PCNT units in use" +msgstr "" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1113,7 +1117,8 @@ msgid "Invalid phase" msgstr "단계가 잘못되었습니다" #: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c +#: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" msgstr "핀이 잘못되었습니다" diff --git a/locale/nl.po b/locale/nl.po index bf05abb721..6851e6ef32 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-21 20:13-0500\n" +"POT-Creation-Date: 2020-11-04 21:18+0530\n" "PO-Revision-Date: 2020-10-27 16:47+0000\n" "Last-Translator: Jelle Jager \n" "Language-Team: none\n" @@ -300,6 +300,10 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "Alle I2C peripherals zijn in gebruik" +#: ports/esp32s2/peripherals/pcnt_handler.c +msgid "All PCNT units in use" +msgstr "" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1125,7 +1129,8 @@ msgid "Invalid phase" msgstr "Ongeldige fase" #: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c +#: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" msgstr "Ongeldige pin" diff --git a/locale/pl.po b/locale/pl.po index 1dbb0ba12b..54ef4d9185 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-21 20:13-0500\n" +"POT-Creation-Date: 2020-11-04 21:18+0530\n" "PO-Revision-Date: 2020-09-29 01:39+0000\n" "Last-Translator: Maciej Stankiewicz \n" "Language-Team: pl\n" @@ -302,6 +302,10 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "Wszystkie peryferia I2C w użyciu" +#: ports/esp32s2/peripherals/pcnt_handler.c +msgid "All PCNT units in use" +msgstr "" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1123,7 +1127,8 @@ msgid "Invalid phase" msgstr "Zła faza" #: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c +#: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" msgstr "Zła nóżka" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 7ad85e0b78..ac5c7a6678 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-21 20:13-0500\n" +"POT-Creation-Date: 2020-11-04 21:18+0530\n" "PO-Revision-Date: 2020-10-28 21:45+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" @@ -304,6 +304,10 @@ msgstr "Todos os periféricos CAN estão em uso" msgid "All I2C peripherals are in use" msgstr "Todos os periféricos I2C estão em uso" +#: ports/esp32s2/peripherals/pcnt_handler.c +msgid "All PCNT units in use" +msgstr "" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1134,7 +1138,8 @@ msgid "Invalid phase" msgstr "Fase Inválida" #: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c +#: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" msgstr "Pino inválido" diff --git a/locale/sv.po b/locale/sv.po index 9182a99430..d9639aff6e 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-21 20:13-0500\n" +"POT-Creation-Date: 2020-11-04 21:18+0530\n" "PO-Revision-Date: 2020-11-05 20:26+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" @@ -300,6 +300,10 @@ msgstr "All I2C-kringutrustning används" msgid "All I2C peripherals are in use" msgstr "All I2C-kringutrustning används" +#: ports/esp32s2/peripherals/pcnt_handler.c +msgid "All PCNT units in use" +msgstr "" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1123,7 +1127,8 @@ msgid "Invalid phase" msgstr "Ogiltig fas" #: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c +#: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" msgstr "Ogiltig pinne" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 4cc86400d9..c1853a73a5 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-21 20:13-0500\n" +"POT-Creation-Date: 2020-11-04 21:18+0530\n" "PO-Revision-Date: 2020-10-28 21:45+0000\n" "Last-Translator: hexthat \n" "Language-Team: Chinese Hanyu Pinyin\n" @@ -302,6 +302,10 @@ msgstr "suǒ yǒu CAN wài shè dōu zài shǐ yòng zhōng" msgid "All I2C peripherals are in use" msgstr "Suǒyǒu I2C wàiwéi qì zhèngzài shǐyòng" +#: ports/esp32s2/peripherals/pcnt_handler.c +msgid "All PCNT units in use" +msgstr "" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1121,7 +1125,8 @@ msgid "Invalid phase" msgstr "Jiēduàn wúxiào" #: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c +#: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" msgstr "Wúxiào de yǐn jiǎo" From b2e83952c026485866a7b5a830d85850b09abb38 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 6 Nov 2020 15:27:16 -0800 Subject: [PATCH 058/148] Rebrand EInk Portal to MagTag --- .../{adafruit_esp32s2_eink_portal => adafruit_magtag}/board.c | 0 .../mpconfigboard.h | 2 +- .../mpconfigboard.mk | 2 +- .../{adafruit_esp32s2_eink_portal => adafruit_magtag}/pins.c | 0 .../{adafruit_esp32s2_eink_portal => adafruit_magtag}/sdkconfig | 0 5 files changed, 2 insertions(+), 2 deletions(-) rename ports/esp32s2/boards/{adafruit_esp32s2_eink_portal => adafruit_magtag}/board.c (100%) rename ports/esp32s2/boards/{adafruit_esp32s2_eink_portal => adafruit_magtag}/mpconfigboard.h (97%) rename ports/esp32s2/boards/{adafruit_esp32s2_eink_portal => adafruit_magtag}/mpconfigboard.mk (92%) rename ports/esp32s2/boards/{adafruit_esp32s2_eink_portal => adafruit_magtag}/pins.c (100%) rename ports/esp32s2/boards/{adafruit_esp32s2_eink_portal => adafruit_magtag}/sdkconfig (100%) diff --git a/ports/esp32s2/boards/adafruit_esp32s2_eink_portal/board.c b/ports/esp32s2/boards/adafruit_magtag/board.c similarity index 100% rename from ports/esp32s2/boards/adafruit_esp32s2_eink_portal/board.c rename to ports/esp32s2/boards/adafruit_magtag/board.c diff --git a/ports/esp32s2/boards/adafruit_esp32s2_eink_portal/mpconfigboard.h b/ports/esp32s2/boards/adafruit_magtag/mpconfigboard.h similarity index 97% rename from ports/esp32s2/boards/adafruit_esp32s2_eink_portal/mpconfigboard.h rename to ports/esp32s2/boards/adafruit_magtag/mpconfigboard.h index 5a17a0cad1..be376e5a94 100644 --- a/ports/esp32s2/boards/adafruit_esp32s2_eink_portal/mpconfigboard.h +++ b/ports/esp32s2/boards/adafruit_magtag/mpconfigboard.h @@ -26,7 +26,7 @@ //Micropython setup -#define MICROPY_HW_BOARD_NAME "EInk Portal" +#define MICROPY_HW_BOARD_NAME "MagTag" #define MICROPY_HW_MCU_NAME "ESP32S2" #define MICROPY_HW_NEOPIXEL (&pin_GPIO1) diff --git a/ports/esp32s2/boards/adafruit_esp32s2_eink_portal/mpconfigboard.mk b/ports/esp32s2/boards/adafruit_magtag/mpconfigboard.mk similarity index 92% rename from ports/esp32s2/boards/adafruit_esp32s2_eink_portal/mpconfigboard.mk rename to ports/esp32s2/boards/adafruit_magtag/mpconfigboard.mk index 31aff57da4..0a141cbe3e 100644 --- a/ports/esp32s2/boards/adafruit_esp32s2_eink_portal/mpconfigboard.mk +++ b/ports/esp32s2/boards/adafruit_magtag/mpconfigboard.mk @@ -1,6 +1,6 @@ USB_VID = 0x239A USB_PID = 0x80E6 -USB_PRODUCT = "EInk Portal" +USB_PRODUCT = "MagTag" USB_MANUFACTURER = "Adafruit" INTERNAL_FLASH_FILESYSTEM = 1 diff --git a/ports/esp32s2/boards/adafruit_esp32s2_eink_portal/pins.c b/ports/esp32s2/boards/adafruit_magtag/pins.c similarity index 100% rename from ports/esp32s2/boards/adafruit_esp32s2_eink_portal/pins.c rename to ports/esp32s2/boards/adafruit_magtag/pins.c diff --git a/ports/esp32s2/boards/adafruit_esp32s2_eink_portal/sdkconfig b/ports/esp32s2/boards/adafruit_magtag/sdkconfig similarity index 100% rename from ports/esp32s2/boards/adafruit_esp32s2_eink_portal/sdkconfig rename to ports/esp32s2/boards/adafruit_magtag/sdkconfig From 9ef23e8659d4ee58e3158c63f690108b411015a1 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 6 Nov 2020 15:29:58 -0800 Subject: [PATCH 059/148] Fix build board list --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 404d2ea2e5..a2e9e92aba 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -421,7 +421,7 @@ jobs: fail-fast: false matrix: board: - - "adafruit_esp32s2_eink_portal" + - "adafruit_magtag" - "adafruit_metro_esp32s2" - "electroniccats_bastwifi" - "espressif_kaluga_1" From 55e0e2c4ba7dfa1d3e2ba84a4af3b4f132ae1a23 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Sun, 8 Nov 2020 11:12:32 +0530 Subject: [PATCH 060/148] Update rotaryio implementation --- .../common-hal/rotaryio/IncrementalEncoder.c | 79 ++++++------------- .../common-hal/rotaryio/IncrementalEncoder.h | 9 +-- 2 files changed, 29 insertions(+), 59 deletions(-) diff --git a/ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c b/ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c index bbff363740..25529ac723 100644 --- a/ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c +++ b/ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2018 Scott Shawcroft for Adafruit Industries + * Copyright (c) 2020 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 @@ -25,29 +25,22 @@ */ #include "common-hal/rotaryio/IncrementalEncoder.h" +#include "common-hal/microcontroller/Pin.h" #include "py/runtime.h" #include "supervisor/shared/translate.h" -#include "driver/pcnt.h" +void common_hal_rotaryio_incrementalencoder_construct(rotaryio_incrementalencoder_obj_t* self, + const mcu_pin_obj_t* pin_a, const mcu_pin_obj_t* pin_b) { + claim_pin(pin_a); + claim_pin(pin_b); -static void pcnt_reset(int unit) { - // Initialize PCNT's counter - pcnt_counter_pause(unit); - pcnt_counter_clear(unit); - - // Everything is set up, now go to counting - pcnt_counter_resume(unit); -} - -static void pcnt_init(int unit, rotaryio_incrementalencoder_obj_t* self) { // Prepare configuration for the PCNT unit - pcnt_config_t pcnt_config = { + const pcnt_config_t pcnt_config = { // Set PCNT input signal and control GPIOs - .pulse_gpio_num = self->pin_a->number, - .ctrl_gpio_num = self->pin_b->number, + .pulse_gpio_num = pin_a->number, + .ctrl_gpio_num = pin_b->number, .channel = PCNT_CHANNEL_0, - .unit = unit, // What to do on the positive / negative edge of pulse input? .pos_mode = PCNT_COUNT_DEC, // Count up on the positive edge .neg_mode = PCNT_COUNT_INC, // Keep the counter value on the negative edge @@ -55,61 +48,39 @@ static void pcnt_init(int unit, rotaryio_incrementalencoder_obj_t* self) { .lctrl_mode = PCNT_MODE_REVERSE, // Reverse counting direction if low .hctrl_mode = PCNT_MODE_KEEP, // Keep the primary counter mode if high }; - // Initialize PCNT unit - pcnt_unit_config(&pcnt_config); - // Configure channel 1 - pcnt_config.pulse_gpio_num = self->pin_b->number; - pcnt_config.ctrl_gpio_num = self->pin_a->number; - pcnt_config.channel = PCNT_CHANNEL_1; - pcnt_config.pos_mode = PCNT_COUNT_INC; - pcnt_config.neg_mode = PCNT_COUNT_DEC; - pcnt_unit_config(&pcnt_config); + // Initialize PCNT unit + const int8_t unit = peripherals_pcnt_init(pcnt_config); + if (unit == -1) { + mp_raise_RuntimeError(translate("All PCNT units in use")); + } - // Configure and enable the input filter - pcnt_set_filter_value(unit, 100); - pcnt_filter_enable(unit); - - pcnt_reset(unit); -} - -void common_hal_rotaryio_incrementalencoder_construct(rotaryio_incrementalencoder_obj_t* self, - const mcu_pin_obj_t* pin_a, const mcu_pin_obj_t* pin_b) { - claim_pin(pin_a); - claim_pin(pin_b); - - self->pin_a = pin_a; - self->pin_b = pin_b; - - self->position = 0; - - pcnt_init(PCNT_UNIT_0, self); + self->pin_a = pin_a->number; + self->pin_b = pin_b->number; + self->unit = (pcnt_unit_t)unit; } bool common_hal_rotaryio_incrementalencoder_deinited(rotaryio_incrementalencoder_obj_t* self) { - return self->pin_a == NULL; + return self->unit == PCNT_UNIT_MAX; } void common_hal_rotaryio_incrementalencoder_deinit(rotaryio_incrementalencoder_obj_t* self) { if (common_hal_rotaryio_incrementalencoder_deinited(self)) { return; } - - reset_pin_number(self->pin_a->number); - self->pin_a = NULL; - - reset_pin_number(self->pin_b->number); - self->pin_b = NULL; + reset_pin_number(self->pin_a); + reset_pin_number(self->pin_b); + peripherals_pcnt_deinit(&self->unit); } mp_int_t common_hal_rotaryio_incrementalencoder_get_position(rotaryio_incrementalencoder_obj_t* self) { - int16_t count = 0; - pcnt_get_counter_value(PCNT_UNIT_0, &count); - return self->position+count; + int16_t count; + pcnt_get_counter_value(self->unit, &count); + return (count/2)+self->position; } void common_hal_rotaryio_incrementalencoder_set_position(rotaryio_incrementalencoder_obj_t* self, mp_int_t new_position) { self->position = new_position; - pcnt_reset(PCNT_UNIT_0); + pcnt_counter_clear(self->unit); } diff --git a/ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.h b/ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.h index 0cc2830fb7..8a717b7b5d 100644 --- a/ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.h +++ b/ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2018 Scott Shawcroft for Adafruit Industries + * Copyright (c) 2020 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 @@ -27,15 +27,14 @@ #ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_ROTARYIO_INCREMENTALENCODER_H #define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_ROTARYIO_INCREMENTALENCODER_H -#include "common-hal/microcontroller/Pin.h" - #include "py/obj.h" +#include "peripherals/pcnt.h" typedef struct { mp_obj_base_t base; - const mcu_pin_obj_t * pin_a; - const mcu_pin_obj_t * pin_b; + uint8_t pin_a, pin_b; mp_int_t position; + pcnt_unit_t unit; } rotaryio_incrementalencoder_obj_t; #endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_ROTARYIO_INCREMENTALENCODER_H From 7ba2c5772ccbe48c5c52d62493f9c899a1d0963a Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Sun, 8 Nov 2020 11:18:05 +0530 Subject: [PATCH 061/148] Update license --- ports/esp32s2/common-hal/touchio/TouchIn.c | 2 +- ports/esp32s2/common-hal/touchio/TouchIn.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/esp32s2/common-hal/touchio/TouchIn.c b/ports/esp32s2/common-hal/touchio/TouchIn.c index 3e3e4b5511..b44234775e 100644 --- a/ports/esp32s2/common-hal/touchio/TouchIn.c +++ b/ports/esp32s2/common-hal/touchio/TouchIn.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2016 Scott Shawcroft for Adafruit Industries + * Copyright (c) 2020 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 diff --git a/ports/esp32s2/common-hal/touchio/TouchIn.h b/ports/esp32s2/common-hal/touchio/TouchIn.h index 585bb37bf1..91de209316 100644 --- a/ports/esp32s2/common-hal/touchio/TouchIn.h +++ b/ports/esp32s2/common-hal/touchio/TouchIn.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2016 Scott Shawcroft + * Copyright (c) 2020 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 From 5505a3649fe56738321e2138aa918d05d63da6b4 Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Sat, 7 Nov 2020 10:04:39 +0000 Subject: [PATCH 062/148] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (845 of 845 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 ac5c7a6678..99f090dbd2 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: 2020-11-04 21:18+0530\n" -"PO-Revision-Date: 2020-10-28 21:45+0000\n" +"PO-Revision-Date: 2020-11-08 10:26+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.3.2-dev\n" +"X-Generator: Weblate 4.3.2\n" #: main.c msgid "" @@ -306,7 +306,7 @@ msgstr "Todos os periféricos I2C estão em uso" #: ports/esp32s2/peripherals/pcnt_handler.c msgid "All PCNT units in use" -msgstr "" +msgstr "Todas as unidades PCNT estão em uso" #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c From 9adb77a2d0179f89c7402451f6b25be74629ffbd Mon Sep 17 00:00:00 2001 From: foamyguy Date: Sun, 8 Nov 2020 19:28:46 -0600 Subject: [PATCH 063/148] set moved true when unhiding tilegrid --- shared-module/displayio/TileGrid.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/shared-module/displayio/TileGrid.c b/shared-module/displayio/TileGrid.c index e3642107f8..e8050a5397 100644 --- a/shared-module/displayio/TileGrid.c +++ b/shared-module/displayio/TileGrid.c @@ -83,10 +83,16 @@ bool common_hal_displayio_tilegrid_get_hidden(displayio_tilegrid_t* self) { void common_hal_displayio_tilegrid_set_hidden(displayio_tilegrid_t* self, bool hidden) { self->hidden = hidden; + if(!hidden){ + self->moved = true; + } } void displayio_tilegrid_set_hidden_by_parent(displayio_tilegrid_t *self, bool hidden) { self->hidden_by_parent = hidden; + if(!hidden){ + self->moved = true; + } } bool displayio_tilegrid_get_previous_area(displayio_tilegrid_t *self, displayio_area_t* area) { From 0ff20cdd85d742c2668b044474b2ddc29546fc9c Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 9 Nov 2020 08:27:20 -0600 Subject: [PATCH 064/148] RGBMatrix: Detect invalid bit_depth selection Closes: #3650 --- shared-bindings/rgbmatrix/RGBMatrix.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/shared-bindings/rgbmatrix/RGBMatrix.c b/shared-bindings/rgbmatrix/RGBMatrix.c index 753c1c9203..5f5ea4fae7 100644 --- a/shared-bindings/rgbmatrix/RGBMatrix.c +++ b/shared-bindings/rgbmatrix/RGBMatrix.c @@ -197,6 +197,11 @@ STATIC mp_obj_t rgbmatrix_rgbmatrix_make_new(const mp_obj_type_t *type, size_t n uint8_t clock_pin = validate_pin(args[ARG_clock_pin].u_obj); uint8_t latch_pin = validate_pin(args[ARG_latch_pin].u_obj); uint8_t output_enable_pin = validate_pin(args[ARG_output_enable_pin].u_obj); + int bit_depth = args[ARG_bit_depth].u_int; + + if (bit_depth <= 0 || bit_depth > 6) { + mp_raise_ValueError_varg(translate("Bit depth must be from 1 to 6 inclusive, not %d"), bit_depth); + } validate_pins(MP_QSTR_rgb_pins, rgb_pins, MP_ARRAY_SIZE(self->rgb_pins), args[ARG_rgb_list].u_obj, &rgb_count); validate_pins(MP_QSTR_addr_pins, addr_pins, MP_ARRAY_SIZE(self->addr_pins), args[ARG_addr_list].u_obj, &addr_count); @@ -229,7 +234,7 @@ STATIC mp_obj_t rgbmatrix_rgbmatrix_make_new(const mp_obj_type_t *type, size_t n common_hal_rgbmatrix_rgbmatrix_construct(self, args[ARG_width].u_int, - args[ARG_bit_depth].u_int, + bit_depth, rgb_count, rgb_pins, addr_count, addr_pins, clock_pin, latch_pin, output_enable_pin, From 5554c27600291786c5f09b1671ef5e29eae22619 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 9 Nov 2020 09:49:43 -0600 Subject: [PATCH 065/148] make translate --- locale/circuitpython.pot | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index a5581e7fa7..3fb2f0719b 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-15 16:06+0530\n" +"POT-Creation-Date: 2020-11-09 09:49-0600\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -416,6 +416,11 @@ msgstr "" msgid "Bit clock and word select must share a clock unit" msgstr "" +#: shared-bindings/rgbmatrix/RGBMatrix.c +#, c-format +msgid "Bit depth must be from 1 to 6 inclusive, not %d" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." msgstr "" @@ -2863,14 +2868,6 @@ msgstr "" msgid "maximum recursion depth exceeded" msgstr "" -#: extmod/ulab/code/approx/approx.c -msgid "maxiter must be > 0" -msgstr "" - -#: extmod/ulab/code/approx/approx.c -msgid "maxiter should be > 0" -msgstr "" - #: py/runtime.c #, c-format msgid "memory allocation failed, allocating %u bytes" @@ -3303,10 +3300,6 @@ msgstr "" msgid "sort argument must be an ndarray" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "sorted axis can't be longer than 65535" -msgstr "" - #: extmod/ulab/code/filter/filter.c msgid "sos array must be of shape (n_section, 6)" msgstr "" From d1f15d314bd630b073c70c093053c16ac34131bb Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Mon, 9 Nov 2020 15:03:22 -0800 Subject: [PATCH 066/148] Rename to include display details --- .github/workflows/build.yml | 2 +- .../{adafruit_magtag => adafruit_magtag_2.9_grayscale}/board.c | 0 .../mpconfigboard.h | 0 .../mpconfigboard.mk | 0 .../{adafruit_magtag => adafruit_magtag_2.9_grayscale}/pins.c | 0 .../sdkconfig | 0 6 files changed, 1 insertion(+), 1 deletion(-) rename ports/esp32s2/boards/{adafruit_magtag => adafruit_magtag_2.9_grayscale}/board.c (100%) rename ports/esp32s2/boards/{adafruit_magtag => adafruit_magtag_2.9_grayscale}/mpconfigboard.h (100%) rename ports/esp32s2/boards/{adafruit_magtag => adafruit_magtag_2.9_grayscale}/mpconfigboard.mk (100%) rename ports/esp32s2/boards/{adafruit_magtag => adafruit_magtag_2.9_grayscale}/pins.c (100%) rename ports/esp32s2/boards/{adafruit_magtag => adafruit_magtag_2.9_grayscale}/sdkconfig (100%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a2e9e92aba..c83f37e6ed 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -421,7 +421,7 @@ jobs: fail-fast: false matrix: board: - - "adafruit_magtag" + - "adafruit_magtag_2.9_grayscale" - "adafruit_metro_esp32s2" - "electroniccats_bastwifi" - "espressif_kaluga_1" diff --git a/ports/esp32s2/boards/adafruit_magtag/board.c b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/board.c similarity index 100% rename from ports/esp32s2/boards/adafruit_magtag/board.c rename to ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/board.c diff --git a/ports/esp32s2/boards/adafruit_magtag/mpconfigboard.h b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h similarity index 100% rename from ports/esp32s2/boards/adafruit_magtag/mpconfigboard.h rename to ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h diff --git a/ports/esp32s2/boards/adafruit_magtag/mpconfigboard.mk b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.mk similarity index 100% rename from ports/esp32s2/boards/adafruit_magtag/mpconfigboard.mk rename to ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.mk diff --git a/ports/esp32s2/boards/adafruit_magtag/pins.c b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/pins.c similarity index 100% rename from ports/esp32s2/boards/adafruit_magtag/pins.c rename to ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/pins.c diff --git a/ports/esp32s2/boards/adafruit_magtag/sdkconfig b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/sdkconfig similarity index 100% rename from ports/esp32s2/boards/adafruit_magtag/sdkconfig rename to ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/sdkconfig From 46c9b28dd880d4e2e2764ab67f64356b175f5f98 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Mon, 9 Nov 2020 18:14:31 -0600 Subject: [PATCH 067/148] use full_change instead of moved --- shared-module/displayio/TileGrid.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared-module/displayio/TileGrid.c b/shared-module/displayio/TileGrid.c index e8050a5397..19ea10e552 100644 --- a/shared-module/displayio/TileGrid.c +++ b/shared-module/displayio/TileGrid.c @@ -84,14 +84,14 @@ bool common_hal_displayio_tilegrid_get_hidden(displayio_tilegrid_t* self) { void common_hal_displayio_tilegrid_set_hidden(displayio_tilegrid_t* self, bool hidden) { self->hidden = hidden; if(!hidden){ - self->moved = true; + self->full_change = true; } } void displayio_tilegrid_set_hidden_by_parent(displayio_tilegrid_t *self, bool hidden) { self->hidden_by_parent = hidden; if(!hidden){ - self->moved = true; + self->full_change = true; } } From 6c59836c5db03744d7dbef01c2323989d13ef02a Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Tue, 10 Nov 2020 16:32:46 +0530 Subject: [PATCH 068/148] watchdog implementation for esp32s2 --- locale/circuitpython.pot | 15 +++- .../common-hal/microcontroller/__init__.c | 11 +++ .../common-hal/watchdog/WatchDogMode.c | 1 + .../common-hal/watchdog/WatchDogTimer.c | 86 +++++++++++++++++++ .../common-hal/watchdog/WatchDogTimer.h | 44 ++++++++++ ports/esp32s2/common-hal/watchdog/__init__.c | 1 + ports/esp32s2/mpconfigport.mk | 1 + 7 files changed, 157 insertions(+), 2 deletions(-) create mode 100644 ports/esp32s2/common-hal/watchdog/WatchDogMode.c create mode 100644 ports/esp32s2/common-hal/watchdog/WatchDogTimer.c create mode 100644 ports/esp32s2/common-hal/watchdog/WatchDogTimer.h create mode 100644 ports/esp32s2/common-hal/watchdog/__init__.c diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index b4445abfbf..7a39e9a327 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-04 21:18+0530\n" +"POT-Creation-Date: 2020-11-10 15:30+0530\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -296,7 +296,8 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "" -#: ports/esp32s2/peripherals/pcnt_handler.c +#: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "" @@ -992,6 +993,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "Initialization failed due to lack of memory" +msgstr "" + #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" msgstr "" @@ -3201,6 +3206,7 @@ msgstr "" msgid "pow() with 3 arguments requires integers" msgstr "" +#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h @@ -3416,6 +3422,7 @@ msgstr "" msgid "time.struct_time() takes a 9-sequence" msgstr "" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "" @@ -3599,6 +3606,10 @@ msgstr "" msgid "vectors must have same lengths" msgstr "" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "watchdog not initialized" +msgstr "" + #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" msgstr "" diff --git a/ports/esp32s2/common-hal/microcontroller/__init__.c b/ports/esp32s2/common-hal/microcontroller/__init__.c index 6b2e18673d..e5cfc7eef0 100644 --- a/ports/esp32s2/common-hal/microcontroller/__init__.c +++ b/ports/esp32s2/common-hal/microcontroller/__init__.c @@ -85,6 +85,17 @@ const mcu_processor_obj_t common_hal_mcu_processor_obj = { }, }; +#if CIRCUITPY_WATCHDOG +// The singleton watchdog.WatchDogTimer object. +watchdog_watchdogtimer_obj_t common_hal_mcu_watchdogtimer_obj = { + .base = { + .type = &watchdog_watchdogtimer_type, + }, + .timeout = 0.0f, + .mode = WATCHDOGMODE_NONE, +}; +#endif + // This maps MCU pin names to pin objects. STATIC const mp_rom_map_elem_t mcu_pin_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_GPIO0), MP_ROM_PTR(&pin_GPIO0) }, diff --git a/ports/esp32s2/common-hal/watchdog/WatchDogMode.c b/ports/esp32s2/common-hal/watchdog/WatchDogMode.c new file mode 100644 index 0000000000..fc4e0e008c --- /dev/null +++ b/ports/esp32s2/common-hal/watchdog/WatchDogMode.c @@ -0,0 +1 @@ +// No watchdog module functions. diff --git a/ports/esp32s2/common-hal/watchdog/WatchDogTimer.c b/ports/esp32s2/common-hal/watchdog/WatchDogTimer.c new file mode 100644 index 0000000000..59b9dafcf0 --- /dev/null +++ b/ports/esp32s2/common-hal/watchdog/WatchDogTimer.c @@ -0,0 +1,86 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 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/runtime.h" +#include "common-hal/watchdog/WatchDogTimer.h" + +#include "shared-bindings/microcontroller/__init__.h" + +#include "esp_task_wdt.h" + +void esp_task_wdt_isr_user_handler(void) { + +} + +void common_hal_watchdog_feed(watchdog_watchdogtimer_obj_t *self) { + if (esp_task_wdt_reset() != ESP_OK) { + mp_raise_RuntimeError(translate("watchdog not initialized")); + } +} + +void common_hal_watchdog_deinit(watchdog_watchdogtimer_obj_t *self) { + if (esp_task_wdt_deinit() == ESP_OK) { + self->mode = WATCHDOGMODE_NONE; + } +} + +void watchdog_reset(void) { + common_hal_watchdog_deinit(&common_hal_mcu_watchdogtimer_obj); +} + +static void wdt_config(watchdog_watchdogtimer_obj_t *self) { + // enable panic hanler in WATCHDOGMODE_RESET mode + // initialize Task Watchdog Timer (TWDT) + if (esp_task_wdt_init((uint32_t)self->timeout, (self->mode == WATCHDOGMODE_RESET)) != ESP_OK) { + mp_raise_RuntimeError(translate("Initialization failed due to lack of memory")); + } + esp_task_wdt_add(NULL); +} + +mp_float_t common_hal_watchdog_get_timeout(watchdog_watchdogtimer_obj_t *self) { + return self->timeout; +} + +void common_hal_watchdog_set_timeout(watchdog_watchdogtimer_obj_t *self, mp_float_t new_timeout) { + if ((uint64_t)new_timeout > UINT32_MAX) { + mp_raise_ValueError(translate("timeout duration exceeded the maximum supported value")); + } + if ((uint32_t)self->timeout != (uint32_t)new_timeout) { + self->timeout = new_timeout; + wdt_config(self); + } +} + +watchdog_watchdogmode_t common_hal_watchdog_get_mode(watchdog_watchdogtimer_obj_t *self) { + return self->mode; +} + +void common_hal_watchdog_set_mode(watchdog_watchdogtimer_obj_t *self, watchdog_watchdogmode_t new_mode) { + if (self->mode != new_mode) { + self->mode = new_mode; + wdt_config(self); + } +} diff --git a/ports/esp32s2/common-hal/watchdog/WatchDogTimer.h b/ports/esp32s2/common-hal/watchdog/WatchDogTimer.h new file mode 100644 index 0000000000..05e0e954d2 --- /dev/null +++ b/ports/esp32s2/common-hal/watchdog/WatchDogTimer.h @@ -0,0 +1,44 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 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_ESP32S2_COMMON_HAL_WATCHDOG_WATCHDOGTIMER_H +#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_WATCHDOG_WATCHDOGTIMER_H + +#include "py/obj.h" +#include "shared-bindings/watchdog/WatchDogMode.h" +#include "shared-bindings/watchdog/WatchDogTimer.h" + +struct _watchdog_watchdogtimer_obj_t { + mp_obj_base_t base; + mp_float_t timeout; + watchdog_watchdogmode_t mode; +}; + +// This needs to be called in order to disable the watchdog if it's set to +// "RAISE". If set to "RESET", then the watchdog cannot be reset. +void watchdog_reset(void); + +#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_WATCHDOG_WATCHDOGTIMER_H diff --git a/ports/esp32s2/common-hal/watchdog/__init__.c b/ports/esp32s2/common-hal/watchdog/__init__.c new file mode 100644 index 0000000000..fc4e0e008c --- /dev/null +++ b/ports/esp32s2/common-hal/watchdog/__init__.c @@ -0,0 +1 @@ +// No watchdog module functions. diff --git a/ports/esp32s2/mpconfigport.mk b/ports/esp32s2/mpconfigport.mk index 4579b95ab6..335d2caf72 100644 --- a/ports/esp32s2/mpconfigport.mk +++ b/ports/esp32s2/mpconfigport.mk @@ -25,6 +25,7 @@ CIRCUITPY_NVM = 0 # We don't have enough endpoints to include MIDI. CIRCUITPY_USB_MIDI = 0 CIRCUITPY_WIFI = 1 +CIRCUITPY_WATCHDOG ?= 1 CIRCUITPY_ESPIDF = 1 ifndef CIRCUITPY_TOUCHIO_USE_NATIVE From b293aa7e0961f907ff49c28e3a169112cd1d0b3e Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 10 Nov 2020 09:12:16 -0600 Subject: [PATCH 069/148] protomatter: Update to upstream tag 1.0.10 Among other things this fixes a problem with blanking the display and Closes #3664. --- lib/protomatter | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/protomatter b/lib/protomatter index de6b7704c5..902c16f491 160000 --- a/lib/protomatter +++ b/lib/protomatter @@ -1 +1 @@ -Subproject commit de6b7704c530d886ad8dfa0fa1864764d86117ee +Subproject commit 902c16f49197a8baf5e71ec924a812a86e733a74 From 2d8ebfcf633a0e744e49fe14cc0025d8d7d348fc Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 10 Nov 2020 10:41:10 -0600 Subject: [PATCH 070/148] esp32s2: Correct port_stack_get_top() Closes #3649 --- ports/esp32s2/supervisor/port.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index 0b9c03f747..a25bcce00a 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -148,7 +148,18 @@ uint32_t *port_stack_get_limit(void) { } uint32_t *port_stack_get_top(void) { - return port_stack_get_limit() + CONFIG_ESP_MAIN_TASK_STACK_SIZE / (sizeof(uint32_t) / sizeof(StackType_t)); + // The sizeof-arithmetic is so that the pointer arithmetic is done on units + // of uint32_t instead of units of StackType_t. StackType_t is an alias + // for a byte sized type. + // + // The main stack is bigger than CONFIG_ESP_MAIN_TASK_STACK_SIZE -- an + // "extra" size is added to it (TASK_EXTRA_STACK_SIZE). This total size is + // available as ESP_TASK_MAIN_STACK. Presumably TASK_EXTRA_STACK_SIZE is + // additional stack that can be used by the esp-idf runtime. But what's + // important for us is that some very outermost stack frames, such as + // pyexec_friendly_repl, could lie inside the "extra" area and be invisible + // to the garbage collector. + return port_stack_get_limit() + ESP_TASK_MAIN_STACK / (sizeof(uint32_t) / sizeof(StackType_t)); } supervisor_allocation _fixed_stack; From 44425b8d94d25709cb874b35f74a31da95bbfa38 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 10 Nov 2020 11:32:59 -0600 Subject: [PATCH 071/148] Requested review changes made --- ports/esp32s2/supervisor/port.c | 13 ++++++------- ports/esp32s2/supervisor/usb.c | 8 +++++--- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index 46de636276..4b9a4f7eff 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -55,8 +55,7 @@ uint32_t* heap; uint32_t heap_size; -extern TaskHandle_t xTaskToNotify; - +extern TaskHandle_t sleeping_circuitpython_task; STATIC esp_timer_handle_t _tick_timer; extern void esp_restart(void) NORETURN; @@ -191,23 +190,23 @@ void port_disable_tick(void) { } TickType_t sleep_time_duration; -uint32_t NotifyValue = 0; -BaseType_t notify_wait = 0; void port_interrupt_after_ticks(uint32_t ticks) { sleep_time_duration = (ticks * 100)/1024; - xTaskToNotify = xTaskGetCurrentTaskHandle(); + sleeping_circuitpython_task = xTaskGetCurrentTaskHandle(); } void port_sleep_until_interrupt(void) { + uint32_t NotifyValue = 0; + if (sleep_time_duration == 0) { return; } - notify_wait = xTaskNotifyWait(0x01,0x01,&NotifyValue, + xTaskNotifyWait(0x01,0x01,&NotifyValue, sleep_time_duration ); if (NotifyValue == 1) { - xTaskToNotify = NULL; + sleeping_circuitpython_task = NULL; mp_handle_pending(); } } diff --git a/ports/esp32s2/supervisor/usb.c b/ports/esp32s2/supervisor/usb.c index 86186d36b8..2bfcdfb125 100644 --- a/ports/esp32s2/supervisor/usb.c +++ b/ports/esp32s2/supervisor/usb.c @@ -52,7 +52,7 @@ StackType_t usb_device_stack[USBD_STACK_SIZE]; StaticTask_t usb_device_taskdef; -TaskHandle_t xTaskToNotify = NULL; +TaskHandle_t sleeping_circuitpython_task = NULL; // USB Device Driver task // This top level thread process all usb events and invoke callbacks @@ -129,8 +129,10 @@ void tud_cdc_rx_wanted_cb(uint8_t itf, char wanted_char) if (mp_interrupt_char == wanted_char) { tud_cdc_read_flush(); // flush read fifo mp_keyboard_interrupt(); - if (xTaskToNotify != NULL) { - xTaskNotifyGive(xTaskToNotify); + // CircuitPython's VM is run in a separate FreeRTOS task from TinyUSB. + // So, we must notify the other task when a CTRL-C is received. + if (sleeping_circuitpython_task != NULL) { + xTaskNotifyGive(sleeping_circuitpython_task); } } } From fe7ed999393e369243319c48453cc2f7add3e7f0 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 10 Nov 2020 12:45:39 -0600 Subject: [PATCH 072/148] Split out extern declare to ports/esp32s2/supervisor/esp_port.h --- ports/esp32s2/supervisor/esp_port.h | 35 +++++++++++++++++++++++++++++ ports/esp32s2/supervisor/port.c | 3 ++- 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 ports/esp32s2/supervisor/esp_port.h diff --git a/ports/esp32s2/supervisor/esp_port.h b/ports/esp32s2/supervisor/esp_port.h new file mode 100644 index 0000000000..1164666cda --- /dev/null +++ b/ports/esp32s2/supervisor/esp_port.h @@ -0,0 +1,35 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Lucian Copeland 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. + */ + +#ifndef MICROPY_INCLUDED_ESP32S2_SUPERVISOR_PORT_H +#define MICROPY_INCLUDED_ESP32S2_SUPERVISOR_PORT_H + +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" + +extern TaskHandle_t sleeping_circuitpython_task; + +#endif // MICROPY_INCLUDED_ESP32S2_SUPERVISOR_PORT_H diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index 4b9a4f7eff..0ac2236d31 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -31,6 +31,7 @@ #include "boards/board.h" #include "modules/module.h" #include "py/runtime.h" +#include "supervisor/esp_port.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" @@ -55,7 +56,7 @@ uint32_t* heap; uint32_t heap_size; -extern TaskHandle_t sleeping_circuitpython_task; + STATIC esp_timer_handle_t _tick_timer; extern void esp_restart(void) NORETURN; From 10e8b8cf456b36b6e1e1582601a3fc437727cec5 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Wed, 11 Nov 2020 00:24:01 +0530 Subject: [PATCH 073/148] move port specific check --- ports/nrf/common-hal/watchdog/WatchDogTimer.c | 3 +++ shared-bindings/watchdog/WatchDogTimer.c | 7 +------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/ports/nrf/common-hal/watchdog/WatchDogTimer.c b/ports/nrf/common-hal/watchdog/WatchDogTimer.c index bec0ac4732..539b43e762 100644 --- a/ports/nrf/common-hal/watchdog/WatchDogTimer.c +++ b/ports/nrf/common-hal/watchdog/WatchDogTimer.c @@ -93,6 +93,9 @@ void common_hal_watchdog_feed(watchdog_watchdogtimer_obj_t *self) { } void common_hal_watchdog_deinit(watchdog_watchdogtimer_obj_t *self) { + if (self->mode == WATCHDOGMODE_RESET) { + mp_raise_NotImplementedError(translate("WatchDogTimer cannot be deinitialized once mode is set to RESET")); + } if (timer) { timer_free(); } diff --git a/shared-bindings/watchdog/WatchDogTimer.c b/shared-bindings/watchdog/WatchDogTimer.c index 09219f7109..575021a219 100644 --- a/shared-bindings/watchdog/WatchDogTimer.c +++ b/shared-bindings/watchdog/WatchDogTimer.c @@ -66,6 +66,7 @@ STATIC mp_obj_t watchdog_watchdogtimer_feed(mp_obj_t self_in) { if (current_mode == WATCHDOGMODE_NONE) { mp_raise_ValueError(translate("WatchDogTimer is not currently running")); } + common_hal_watchdog_feed(self); return mp_const_none; } @@ -78,12 +79,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(watchdog_watchdogtimer_feed_obj, watchdog_watch //| STATIC mp_obj_t watchdog_watchdogtimer_deinit(mp_obj_t self_in) { watchdog_watchdogtimer_obj_t *self = MP_OBJ_TO_PTR(self_in); - watchdog_watchdogmode_t current_mode = common_hal_watchdog_get_mode(self); - - if (current_mode == WATCHDOGMODE_RESET) { - mp_raise_NotImplementedError(translate("WatchDogTimer cannot be deinitialized once mode is set to RESET")); - } - common_hal_watchdog_deinit(self); return mp_const_none; } From 1192eebcdf3fbfa383a868d3a349535858e3e0e3 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Tue, 10 Nov 2020 14:12:44 -0600 Subject: [PATCH 074/148] adding spi and i2c to board for um feather s2 --- .../boards/unexpectedmaker_feathers2/mpconfigboard.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h b/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h index 5a885f29ce..b320fdc8de 100644 --- a/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h +++ b/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h @@ -37,3 +37,10 @@ // #define MICROPY_HW_APA102_MOSI (&pin_GPIO40) // #define MICROPY_HW_APA102_SCK (&pin_GPIO45) + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO9) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO8) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO36) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO35) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO37) \ No newline at end of file From b8f83643b532cfbd76b93f8a88dcf599f6e43c68 Mon Sep 17 00:00:00 2001 From: Szymon Jakubiak Date: Tue, 10 Nov 2020 20:52:38 +0000 Subject: [PATCH 075/148] Translated using Weblate (Polish) Currently translated at 70.7% (598 of 845 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pl/ --- locale/pl.po | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/locale/pl.po b/locale/pl.po index 54ef4d9185..e3081544c0 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -7,8 +7,8 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-04 21:18+0530\n" -"PO-Revision-Date: 2020-09-29 01:39+0000\n" -"Last-Translator: Maciej Stankiewicz \n" +"PO-Revision-Date: 2020-11-10 20:52+0000\n" +"Last-Translator: Szymon Jakubiak \n" "Language-Team: pl\n" "Language: pl\n" "MIME-Version: 1.0\n" @@ -16,7 +16,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " "|| n%100>=20) ? 1 : 2;\n" -"X-Generator: Weblate 4.3-dev\n" +"X-Generator: Weblate 4.4-dev\n" #: main.c msgid "" @@ -76,7 +76,7 @@ msgstr "%q poza zakresem" #: py/obj.c msgid "%q indices must be integers, not %q" -msgstr "" +msgstr "%q indeksy muszą być liczbami typu int, a nie %q" #: shared-bindings/vectorio/Polygon.c msgid "%q list must be a list" @@ -104,7 +104,7 @@ msgstr "%q poza zakresem" #: ports/atmel-samd/common-hal/microcontroller/Pin.c msgid "%q pin invalid" -msgstr "" +msgstr "%q nieprawidłowy pin" #: shared-bindings/fontio/BuiltinFont.c msgid "%q should be an int" From b9294818da33853088957d913ef497db92584c18 Mon Sep 17 00:00:00 2001 From: Maciej Stankiewicz Date: Tue, 10 Nov 2020 20:50:02 +0000 Subject: [PATCH 076/148] Translated using Weblate (Polish) Currently translated at 70.7% (598 of 845 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pl/ --- locale/pl.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locale/pl.po b/locale/pl.po index e3081544c0..ae532a73f3 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -8,7 +8,7 @@ msgstr "" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-04 21:18+0530\n" "PO-Revision-Date: 2020-11-10 20:52+0000\n" -"Last-Translator: Szymon Jakubiak \n" +"Last-Translator: Maciej Stankiewicz \n" "Language-Team: pl\n" "Language: pl\n" "MIME-Version: 1.0\n" @@ -1206,7 +1206,7 @@ msgstr "" #: shared-module/displayio/Group.c msgid "Layer must be a Group or TileGrid subclass." -msgstr "Layer musi dziedziczyć z Group albo TileGrid" +msgstr "Layer musi dziedziczyć z Group albo TileGrid." #: py/objslice.c msgid "Length must be an int" From a1276be482e46c08f4ad189f9c22ee724d9d82de Mon Sep 17 00:00:00 2001 From: Maciej Stankiewicz Date: Tue, 10 Nov 2020 21:06:44 +0000 Subject: [PATCH 077/148] Translated using Weblate (Polish) Currently translated at 71.5% (605 of 845 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pl/ --- locale/pl.po | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/locale/pl.po b/locale/pl.po index ae532a73f3..fbae676954 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-04 21:18+0530\n" -"PO-Revision-Date: 2020-11-10 20:52+0000\n" +"PO-Revision-Date: 2020-11-10 21:10+0000\n" "Last-Translator: Maciej Stankiewicz \n" "Language-Team: pl\n" "Language: pl\n" @@ -104,7 +104,7 @@ msgstr "%q poza zakresem" #: ports/atmel-samd/common-hal/microcontroller/Pin.c msgid "%q pin invalid" -msgstr "%q nieprawidłowy pin" +msgstr "nieprawidłowy pin %q" #: shared-bindings/fontio/BuiltinFont.c msgid "%q should be an int" @@ -254,7 +254,7 @@ msgstr "'return' poza funkcją" #: py/compile.c msgid "'yield from' inside async function" -msgstr "" +msgstr "'yield from' wewnątrz funkcji asynchronicznej" #: py/compile.c msgid "'yield' outside function" @@ -283,7 +283,7 @@ msgstr "Kanał przerwań sprzętowych w użyciu" #: ports/esp32s2/common-hal/analogio/AnalogIn.c msgid "ADC2 is being used by WiFi" -msgstr "" +msgstr "ADC2 jest używany przez WiFi" #: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c #, c-format @@ -1033,7 +1033,7 @@ msgstr "Błąd wewnętrzny #%d" #: shared-bindings/sdioio/SDCard.c msgid "Invalid %q" -msgstr "" +msgstr "Nieprawidłowe %q" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c @@ -1107,7 +1107,7 @@ msgstr "Zła wielkość fragmentu formatu" #: ports/esp32s2/common-hal/pwmio/PWMOut.c msgid "Invalid frequency" -msgstr "" +msgstr "Nieprawidłowa częstotliwość" #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Invalid frequency supplied" @@ -1344,7 +1344,7 @@ msgstr "" #: ports/esp32s2/common-hal/pwmio/PWMOut.c msgid "No more channels available" -msgstr "" +msgstr "Brak dostępnych kanałów" #: ports/esp32s2/common-hal/pwmio/PWMOut.c msgid "No more timers available" @@ -1436,7 +1436,7 @@ msgstr "" #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" -msgstr "" +msgstr "W danym momencie przezroczysty może być tylko jeden kolor" #: shared-bindings/ipaddress/__init__.c msgid "Only raw int supported for ip" @@ -1505,7 +1505,7 @@ msgstr "Oraz moduły w systemie plików\n" #: shared-module/vectorio/Polygon.c msgid "Polygon needs at least 3 points" -msgstr "" +msgstr "Wielokąt musi mieć co najmniej 3 punkty" #: ports/esp32s2/common-hal/pulseio/PulseOut.c msgid "" From 8373146c56707102626e6d51d98bd87cdd43ba27 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Tue, 10 Nov 2020 15:29:17 -0600 Subject: [PATCH 078/148] newline end of file --- ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h b/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h index b320fdc8de..ec49fcadf1 100644 --- a/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h +++ b/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h @@ -43,4 +43,4 @@ #define DEFAULT_SPI_BUS_SCK (&pin_GPIO36) #define DEFAULT_SPI_BUS_MOSI (&pin_GPIO35) -#define DEFAULT_SPI_BUS_MISO (&pin_GPIO37) \ No newline at end of file +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO37) From 9da99675b162742c0ecbd0995ce35e62204be3b1 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 10 Nov 2020 16:44:09 -0800 Subject: [PATCH 079/148] Correct display sequence format docs --- shared-bindings/displayio/Display.c | 22 ++++++++++++---------- shared-bindings/displayio/EPaperDisplay.c | 11 ++++++----- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/shared-bindings/displayio/Display.c b/shared-bindings/displayio/Display.c index 1ed59f2331..8d1a888fe7 100644 --- a/shared-bindings/displayio/Display.c +++ b/shared-bindings/displayio/Display.c @@ -58,24 +58,26 @@ //| r"""Create a Display object on the given display bus (`FourWire`, `ParallelBus` or `I2CDisplay`). //| //| The ``init_sequence`` is bitpacked to minimize the ram impact. Every command begins with a -//| command byte followed by a byte to determine the parameter count and if a delay is need after. -//| When the top bit of the second byte is 1, the next byte will be the delay time in milliseconds. -//| The remaining 7 bits are the parameter count excluding any delay byte. The third through final -//| bytes are the remaining command parameters. The next byte will begin a new command definition. -//| Here is a portion of ILI9341 init code: +//| command byte followed by a byte to determine the parameter count and delay. When the top bit +//| of the second byte is 1 (0x80), a delay will occur after the command parameters are sent. +//| The remaining 7 bits are the parameter count excluding any delay byte. The bytes following +//| are the parameters. When the delay bit is set, a single byte after the parameters specifies +//| the delay duration in milliseconds. The value 0xff will lead to an extra long 500 ms delay +//| instead of 255 ms. The next byte will begin a new command definition. +//| Here is an example: //| //| .. code-block:: python //| //| init_sequence = (b"\xe1\x0f\x00\x0E\x14\x03\x11\x07\x31\xC1\x48\x08\x0F\x0C\x31\x36\x0F" # Set Gamma //| b"\x11\x80\x78"# Exit Sleep then delay 0x78 (120ms) -//| b"\x29\x80\x78"# Display on then delay 0x78 (120ms) +//| b"\x29\x81\xaa\x78"# Display on then delay 0x78 (120ms) //| ) //| display = displayio.Display(display_bus, init_sequence, width=320, height=240) //| -//| The first command is 0xe1 with 15 (0xf) parameters following. The second and third are 0x11 and -//| 0x29 respectively with delays (0x80) of 120ms (0x78) and no parameters. Multiple byte literals -//| (b"") are merged together on load. The parens are needed to allow byte literals on subsequent -//| lines. +//| The first command is 0xe1 with 15 (0xf) parameters following. The second is 0x11 with 0 +//| parameters and a 120ms (0x78) delay. The third command is 0x29 with one parameter 0xaa and a +//| 120ms delay (0x78). Multiple byte literals (b"") are merged together on load. The parens +//| are needed to allow byte literals on subsequent lines. //| //| The initialization sequence should always leave the display memory access inline with the scan //| of the display to minimize tearing artifacts. diff --git a/shared-bindings/displayio/EPaperDisplay.c b/shared-bindings/displayio/EPaperDisplay.c index e0326d9c82..8518e37143 100644 --- a/shared-bindings/displayio/EPaperDisplay.c +++ b/shared-bindings/displayio/EPaperDisplay.c @@ -65,11 +65,12 @@ //| """Create a EPaperDisplay object on the given display bus (`displayio.FourWire` or `displayio.ParallelBus`). //| //| The ``start_sequence`` and ``stop_sequence`` are bitpacked to minimize the ram impact. Every -//| command begins with a command byte followed by a byte to determine the parameter count and if -//| a delay is need after. When the top bit of the second byte is 1, the next byte will be the -//| delay time in milliseconds. The remaining 7 bits are the parameter count excluding any delay -//| byte. The third through final bytes are the remaining command parameters. The next byte will -//| begin a new command definition. +//| command begins with a command byte followed by a byte to determine the parameter count and +//| delay. When the top bit of the second byte is 1 (0x80), a delay will occur after the command +//| parameters are sent. The remaining 7 bits are the parameter count excluding any delay +//| byte. The bytes following are the parameters. When the delay bit is set, a single byte after +//| the parameters specifies the delay duration in milliseconds. The value 0xff will lead to an +//| extra long 500 ms delay instead of 255 ms. The next byte will begin a new command definition. //| //| :param display_bus: The bus that the display is connected to //| :type _DisplayBus: displayio.FourWire or displayio.ParallelBus From f9842566d8c5fe88cda2e153f1beb897aaca993a Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Wed, 11 Nov 2020 10:22:48 +0530 Subject: [PATCH 080/148] Add default pin definitions --- .../boards/microdev_micro_s2/mpconfigboard.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h b/ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h index b87b5dfa08..272ab20fa5 100644 --- a/ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h +++ b/ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h @@ -25,7 +25,6 @@ */ //Micropython setup - #define MICROPY_HW_BOARD_NAME "microS2" #define MICROPY_HW_MCU_NAME "ESP32S2" @@ -33,8 +32,20 @@ #define MICROPY_HW_BUTTON (&pin_GPIO0) #define MICROPY_HW_NEOPIXEL (&pin_GPIO33) +// Default bus pins +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO1) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO2) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO36) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO35) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO37) + +#define DEFAULT_UART_BUS_TX (&pin_GPIO43) +#define DEFAULT_UART_BUS_RX (&pin_GPIO44) + #define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) +// Explanation of how a user got into safe mode. #define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") #define AUTORESET_DELAY_MS 500 From 118ca7cff44bc3aa50e57915e691e1b8c2f4e563 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Wed, 11 Nov 2020 06:56:57 -0600 Subject: [PATCH 081/148] adding default uart pins --- ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h b/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h index ec49fcadf1..b68a31b9e5 100644 --- a/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h +++ b/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h @@ -44,3 +44,6 @@ #define DEFAULT_SPI_BUS_SCK (&pin_GPIO36) #define DEFAULT_SPI_BUS_MOSI (&pin_GPIO35) #define DEFAULT_SPI_BUS_MISO (&pin_GPIO37) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO44) +#define DEFAULT_UART_BUS_TX (&pin_GPIO43) From 9817672df7905a63ac168afd1792a46196864209 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Wed, 11 Nov 2020 14:06:34 -0500 Subject: [PATCH 082/148] make translate on 6.0.x --- locale/circuitpython.pot | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 3fb2f0719b..931ae6a423 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-09 09:49-0600\n" +"POT-Creation-Date: 2020-11-11 14:06-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -2868,6 +2868,14 @@ msgstr "" msgid "maximum recursion depth exceeded" msgstr "" +#: extmod/ulab/code/approx/approx.c +msgid "maxiter must be > 0" +msgstr "" + +#: extmod/ulab/code/approx/approx.c +msgid "maxiter should be > 0" +msgstr "" + #: py/runtime.c #, c-format msgid "memory allocation failed, allocating %u bytes" @@ -3300,6 +3308,10 @@ msgstr "" msgid "sort argument must be an ndarray" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "sorted axis can't be longer than 65535" +msgstr "" + #: extmod/ulab/code/filter/filter.c msgid "sos array must be of shape (n_section, 6)" msgstr "" From 53e9c7b3bc0b1162028789445c2e430c06507a50 Mon Sep 17 00:00:00 2001 From: Maciej Stankiewicz Date: Tue, 10 Nov 2020 21:19:44 +0000 Subject: [PATCH 083/148] Translated using Weblate (Polish) Currently translated at 72.1% (610 of 845 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pl/ --- locale/pl.po | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/locale/pl.po b/locale/pl.po index fbae676954..1b0b41fdf3 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-04 21:18+0530\n" -"PO-Revision-Date: 2020-11-10 21:10+0000\n" +"PO-Revision-Date: 2020-11-11 19:13+0000\n" "Last-Translator: Maciej Stankiewicz \n" "Language-Team: pl\n" "Language: pl\n" @@ -1817,7 +1817,7 @@ msgstr "" #: ports/stm/common-hal/busio/UART.c msgid "UART write error" -msgstr "" +msgstr "Błąd zapisu UART" #: shared-module/usb_hid/Device.c msgid "USB Busy" @@ -2014,7 +2014,7 @@ msgstr "__init__() powinien zwracać None" #: py/objtype.c msgid "__init__() should return None, not '%q'" -msgstr "" +msgstr "__init__() powinno zwrócić None, a nie '%q'" #: py/objobject.c msgid "__new__ arg must be a user-type" @@ -3057,11 +3057,11 @@ msgstr "nie dość argumentów przy formatowaniu" #: extmod/ulab/code/poly/poly.c msgid "number of arguments must be 2, or 3" -msgstr "" +msgstr "liczba argumentów musi wynosić 2 lub 3" #: extmod/ulab/code/ulab_create.c msgid "number of points must be at least 2" -msgstr "" +msgstr "liczba punktów musi wynosić co najmniej 2" #: py/obj.c msgid "object '%q' is not a tuple or list" @@ -3374,7 +3374,7 @@ msgstr "" #: shared-bindings/displayio/Bitmap.c msgid "source palette too large" -msgstr "" +msgstr "źródłowa paleta jest zbyt duża" #: py/objstr.c msgid "start/end indices" From c96a86bd8a23cf5d238fabc83790d48b39fccd2c Mon Sep 17 00:00:00 2001 From: hexthat Date: Wed, 11 Nov 2020 08:03:23 +0000 Subject: [PATCH 084/148] Translated using Weblate (Chinese (Pinyin)) Currently translated at 100.0% (845 of 845 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/zh_Latn/ --- locale/zh_Latn_pinyin.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index c1853a73a5..4d45f65bd7 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-04 21:18+0530\n" -"PO-Revision-Date: 2020-10-28 21:45+0000\n" +"PO-Revision-Date: 2020-11-11 19:13+0000\n" "Last-Translator: hexthat \n" "Language-Team: Chinese Hanyu Pinyin\n" "Language: zh_Latn_pinyin\n" @@ -15,7 +15,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Weblate 4.3.2-dev\n" +"X-Generator: Weblate 4.4-dev\n" #: main.c msgid "" @@ -304,7 +304,7 @@ msgstr "Suǒyǒu I2C wàiwéi qì zhèngzài shǐyòng" #: ports/esp32s2/peripherals/pcnt_handler.c msgid "All PCNT units in use" -msgstr "" +msgstr "suǒ yǒu zhèng zài shǐ yòng zhōng de PCNT dān yuán" #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c From ff411802374d4a77b0bc76da0e4fa31076c0182e Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Thu, 12 Nov 2020 16:30:30 +0530 Subject: [PATCH 085/148] pcnt reset on reload --- ports/esp32s2/peripherals/pcnt.c | 18 ++++++++++-------- ports/esp32s2/peripherals/pcnt.h | 1 + ports/esp32s2/supervisor/port.c | 5 +++++ 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/ports/esp32s2/peripherals/pcnt.c b/ports/esp32s2/peripherals/pcnt.c index 555a0ec1d3..dd24569bef 100644 --- a/ports/esp32s2/peripherals/pcnt.c +++ b/ports/esp32s2/peripherals/pcnt.c @@ -29,14 +29,20 @@ #define PCNT_UNIT_ACTIVE 1 #define PCNT_UNIT_INACTIVE 0 -static uint8_t pcnt_state[4]; +static uint8_t pcnt_unit_state[4]; + +void peripherals_pcnt_reset(void) { + for (uint8_t i = 0; i<=3; i++) { + pcnt_unit_state[i] = PCNT_UNIT_INACTIVE; + } +} int peripherals_pcnt_init(pcnt_config_t pcnt_config) { // Look for available pcnt unit for (uint8_t i = 0; i<=3; i++) { - if (pcnt_state[i] == PCNT_UNIT_INACTIVE) { + if (pcnt_unit_state[i] == PCNT_UNIT_INACTIVE) { pcnt_config.unit = (pcnt_unit_t)i; - pcnt_state[i] = PCNT_UNIT_ACTIVE; + pcnt_unit_state[i] = PCNT_UNIT_ACTIVE; break; } else if (i == 3) { return -1; @@ -46,10 +52,6 @@ int peripherals_pcnt_init(pcnt_config_t pcnt_config) { // Initialize PCNT unit pcnt_unit_config(&pcnt_config); - // Configure and enable the input filter - pcnt_set_filter_value(pcnt_config.unit, 100); - pcnt_filter_enable(pcnt_config.unit); - // Initialize PCNT's counter pcnt_counter_pause(pcnt_config.unit); pcnt_counter_clear(pcnt_config.unit); @@ -61,6 +63,6 @@ int peripherals_pcnt_init(pcnt_config_t pcnt_config) { } void peripherals_pcnt_deinit(pcnt_unit_t* unit) { - pcnt_state[*unit] = PCNT_UNIT_INACTIVE; + pcnt_unit_state[*unit] = PCNT_UNIT_INACTIVE; *unit = PCNT_UNIT_MAX; } diff --git a/ports/esp32s2/peripherals/pcnt.h b/ports/esp32s2/peripherals/pcnt.h index abed80fd0c..4fce13f4d6 100644 --- a/ports/esp32s2/peripherals/pcnt.h +++ b/ports/esp32s2/peripherals/pcnt.h @@ -31,5 +31,6 @@ extern int peripherals_pcnt_init(pcnt_config_t pcnt_config); extern void peripherals_pcnt_deinit(pcnt_unit_t* unit); +extern void peripherals_pcnt_reset(void); #endif // MICROPY_INCLUDED_ESP32S2_PERIPHERALS_PCNT_HANDLER_H diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index 3ea1fafbb8..ef032c4a76 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -49,6 +49,7 @@ #include "shared-bindings/rtc/__init__.h" #include "peripherals/rmt.h" +#include "peripherals/pcnt.h" #include "components/heap/include/esp_heap_caps.h" #include "components/soc/soc/esp32s2/include/soc/cache_memory.h" @@ -117,6 +118,10 @@ void reset_port(void) { uart_reset(); #endif +#if defined(CIRCUITPY_COUNTIO) || defined(CIRCUITPY_ROTARYIO) + peripherals_pcnt_reset(); +#endif + #if CIRCUITPY_RTC rtc_reset(); #endif From 9774736a50577fe9ae1426d95fc3bea5751411fc Mon Sep 17 00:00:00 2001 From: Enrique Casado Date: Thu, 12 Nov 2020 12:30:34 +0100 Subject: [PATCH 086/148] Rename pins to make them the same as the Arduino core --- .../boards/dynossat_edu_eps/mpconfigboard.mk | 3 ++- ports/atmel-samd/boards/dynossat_edu_eps/pins.c | 17 ++++++++++++----- ports/atmel-samd/boards/dynossat_edu_obc/pins.c | 4 ++++ 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/ports/atmel-samd/boards/dynossat_edu_eps/mpconfigboard.mk b/ports/atmel-samd/boards/dynossat_edu_eps/mpconfigboard.mk index 3c0cc07bea..61fafe8e9d 100644 --- a/ports/atmel-samd/boards/dynossat_edu_eps/mpconfigboard.mk +++ b/ports/atmel-samd/boards/dynossat_edu_eps/mpconfigboard.mk @@ -15,8 +15,9 @@ LONGINT_IMPL = MPZ CIRCUITPY_BITBANGIO = 0 CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_COUNTIO = 0 -CIRCUITPY_I2CPERIPHERAL = 0 +CIRCUITPY_I2CPERIPHERAL = 1 CIRCUITPY_VECTORIO = 0 +CIRCUITPY_TOUCHIO = 0 CFLAGS_INLINE_LIMIT = 60 diff --git a/ports/atmel-samd/boards/dynossat_edu_eps/pins.c b/ports/atmel-samd/boards/dynossat_edu_eps/pins.c index a910311d4a..f960e6bb0e 100644 --- a/ports/atmel-samd/boards/dynossat_edu_eps/pins.c +++ b/ports/atmel-samd/boards/dynossat_edu_eps/pins.c @@ -4,17 +4,17 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PB11) }, { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA12) }, { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PB10) }, - { MP_ROM_QSTR(MP_QSTR_D30), MP_ROM_PTR(&pin_PA30) }, - { MP_ROM_QSTR(MP_QSTR_D31), MP_ROM_PTR(&pin_PA31) }, + { MP_ROM_QSTR(MP_QSTR_D26), MP_ROM_PTR(&pin_PA30) }, + { MP_ROM_QSTR(MP_QSTR_D27), MP_ROM_PTR(&pin_PA31) }, { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA17) }, { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA07) }, { MP_ROM_QSTR(MP_QSTR_OVTEMP), MP_ROM_PTR(&pin_PA07) }, { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA16) }, { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA08) }, { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA09) }, - { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA11) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA11) }, { MP_ROM_QSTR(MP_QSTR_SAT_RESET), MP_ROM_PTR(&pin_PA11) }, - { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA10) }, + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA10) }, { MP_ROM_QSTR(MP_QSTR_SAT_PWR_ENABLE), MP_ROM_PTR(&pin_PA10) }, { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA19) }, { MP_ROM_QSTR(MP_QSTR_INT_IMU_OBC), MP_ROM_PTR(&pin_PA19) }, @@ -22,10 +22,17 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_PWRMON_SDA), MP_ROM_PTR(&pin_PA04) }, { MP_ROM_QSTR(MP_QSTR_PWRMON_SCL), MP_ROM_PTR(&pin_PA05) }, { MP_ROM_QSTR(MP_QSTR_PWRMON_ALERT), MP_ROM_PTR(&pin_PB03) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PB09) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB02) }, + { MP_ROM_QSTR(MP_QSTR_V_3V3_MEAS), MP_ROM_PTR(&pin_PB09) }, + { MP_ROM_QSTR(MP_QSTR_V_5V_MEAS), MP_ROM_PTR(&pin_PB02) }, + { MP_ROM_QSTR(MP_QSTR_FLASH_SCK), MP_ROM_PTR(&pin_PA23) }, + { MP_ROM_QSTR(MP_QSTR_FLASH_MOSI), MP_ROM_PTR(&pin_PA22) }, + { MP_ROM_QSTR(MP_QSTR_FLASH_MISO), MP_ROM_PTR(&pin_PA21) }, + { MP_ROM_QSTR(MP_QSTR_FLASH_CS), MP_ROM_PTR(&pin_PA20) }, { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA06) }, { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA06) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, - { MP_ROM_QSTR(MP_QSTR_I2C_MONITOR), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, }; diff --git a/ports/atmel-samd/boards/dynossat_edu_obc/pins.c b/ports/atmel-samd/boards/dynossat_edu_obc/pins.c index a560360f7d..8cc58d92c0 100644 --- a/ports/atmel-samd/boards/dynossat_edu_obc/pins.c +++ b/ports/atmel-samd/boards/dynossat_edu_obc/pins.c @@ -26,12 +26,16 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PB07) }, { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PB06) }, { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PB30) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA12) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA15) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PB00) }, { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA08) }, { MP_ROM_QSTR(MP_QSTR_D32), MP_ROM_PTR(&pin_PA30) }, { MP_ROM_QSTR(MP_QSTR_D33), MP_ROM_PTR(&pin_PA31) }, { MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_PB22) }, { MP_ROM_QSTR(MP_QSTR_INT_IMU), MP_ROM_PTR(&pin_PA12) }, { MP_ROM_QSTR(MP_QSTR_SAT_POWER), MP_ROM_PTR(&pin_PA15) }, + { MP_ROM_QSTR(MP_QSTR_OVTEMP), MP_ROM_PTR(&pin_PB00) }, { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA08) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, From aa68b172232f6c817d0f2d3888abd38ada966a36 Mon Sep 17 00:00:00 2001 From: Enrique Casado Date: Thu, 12 Nov 2020 13:26:26 +0100 Subject: [PATCH 087/148] Freed some more space --- ports/atmel-samd/boards/dynossat_edu_eps/mpconfigboard.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ports/atmel-samd/boards/dynossat_edu_eps/mpconfigboard.mk b/ports/atmel-samd/boards/dynossat_edu_eps/mpconfigboard.mk index 61fafe8e9d..6d2c1379df 100644 --- a/ports/atmel-samd/boards/dynossat_edu_eps/mpconfigboard.mk +++ b/ports/atmel-samd/boards/dynossat_edu_eps/mpconfigboard.mk @@ -12,12 +12,15 @@ EXTERNAL_FLASH_DEVICE_COUNT = 1 EXTERNAL_FLASH_DEVICES = "GD25Q32C" LONGINT_IMPL = MPZ +CIRCUITPY_FULLBUILD = 0 CIRCUITPY_BITBANGIO = 0 CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_COUNTIO = 0 CIRCUITPY_I2CPERIPHERAL = 1 CIRCUITPY_VECTORIO = 0 +CIRCUITPY_DISPLAYIO = 0 CIRCUITPY_TOUCHIO = 0 +CIRCUITPY_ROTARYIO = 0 CFLAGS_INLINE_LIMIT = 60 From f4b10879fbe6e8efb6ba62219f93fff84c383c1b Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 12 Nov 2020 11:48:01 -0800 Subject: [PATCH 088/148] Change creation date back. --- locale/circuitpython.pot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 931ae6a423..60d05888fc 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-11 14:06-0500\n" +"POT-Creation-Date: 2020-11-04 21:18+0530\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" From 2f2fe10e12ba61e3a7f5b1548d89c7d294ce2d22 Mon Sep 17 00:00:00 2001 From: sporeball Date: Wed, 11 Nov 2020 23:14:48 +0000 Subject: [PATCH 089/148] Translated using Weblate (Japanese) Currently translated at 71.8% (607 of 845 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ja/ --- locale/ja.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/ja.po b/locale/ja.po index 7004c49f30..4432095553 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-04 21:18+0530\n" -"PO-Revision-Date: 2020-11-06 20:29+0000\n" +"PO-Revision-Date: 2020-11-12 22:51+0000\n" "Last-Translator: sporeball \n" "Language-Team: none\n" "Language: ja\n" @@ -16,7 +16,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Weblate 4.3.2\n" +"X-Generator: Weblate 4.4-dev\n" #: main.c msgid "" @@ -2786,7 +2786,7 @@ msgstr "" #: shared-bindings/wifi/Radio.c msgid "invalid hostname" -msgstr "" +msgstr "不正なホスト名" #: extmod/modussl_axtls.c msgid "invalid key" From 1145fcaf3efa0ac073ae29e902a8dd5d48a1530d Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Thu, 12 Nov 2020 23:52:01 +0100 Subject: [PATCH 090/148] 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 | 5 +++++ locale/cs.po | 5 +++++ locale/de_DE.po | 5 +++++ locale/el.po | 5 +++++ locale/es.po | 5 +++++ locale/fil.po | 5 +++++ locale/fr.po | 5 +++++ locale/hi.po | 5 +++++ locale/it_IT.po | 5 +++++ locale/ja.po | 5 +++++ locale/ko.po | 5 +++++ locale/nl.po | 5 +++++ locale/pl.po | 5 +++++ locale/pt_BR.po | 5 +++++ locale/sv.po | 5 +++++ locale/zh_Latn_pinyin.po | 5 +++++ 16 files changed, 80 insertions(+) diff --git a/locale/ID.po b/locale/ID.po index 3e47dc9a18..90e416b3b9 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -435,6 +435,11 @@ msgstr "Di bawah frame rate minimum" msgid "Bit clock and word select must share a clock unit" msgstr "Bit clock dan word harus memiliki kesamaan pada clock unit" +#: shared-bindings/rgbmatrix/RGBMatrix.c +#, c-format +msgid "Bit depth must be from 1 to 6 inclusive, not %d" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." msgstr "Kedalaman bit harus kelipatan 8." diff --git a/locale/cs.po b/locale/cs.po index 428d6d1fe6..f02d31e4dd 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -433,6 +433,11 @@ msgstr "" msgid "Bit clock and word select must share a clock unit" msgstr "" +#: shared-bindings/rgbmatrix/RGBMatrix.c +#, c-format +msgid "Bit depth must be from 1 to 6 inclusive, not %d" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index 059d726cab..c2cb265508 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -436,6 +436,11 @@ msgstr "Unterhalb der minimalen Frame Rate" msgid "Bit clock and word select must share a clock unit" msgstr "Bit clock und word select müssen eine clock unit teilen" +#: shared-bindings/rgbmatrix/RGBMatrix.c +#, c-format +msgid "Bit depth must be from 1 to 6 inclusive, not %d" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." msgstr "Bit depth muss ein Vielfaches von 8 sein." diff --git a/locale/el.po b/locale/el.po index 327f4dbe0f..4d7bff1930 100644 --- a/locale/el.po +++ b/locale/el.po @@ -428,6 +428,11 @@ msgstr "" msgid "Bit clock and word select must share a clock unit" msgstr "" +#: shared-bindings/rgbmatrix/RGBMatrix.c +#, c-format +msgid "Bit depth must be from 1 to 6 inclusive, not %d" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." msgstr "" diff --git a/locale/es.po b/locale/es.po index 95d6a92ff5..ed7431eb7c 100644 --- a/locale/es.po +++ b/locale/es.po @@ -442,6 +442,11 @@ msgstr "Por debajo de taza mínima de refrescamiento" msgid "Bit clock and word select must share a clock unit" msgstr "Bit clock y word select deben compartir una unidad de reloj" +#: shared-bindings/rgbmatrix/RGBMatrix.c +#, c-format +msgid "Bit depth must be from 1 to 6 inclusive, not %d" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." msgstr "Bits depth debe ser múltiplo de 8." diff --git a/locale/fil.po b/locale/fil.po index ce3b5616a3..93f41a88eb 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -433,6 +433,11 @@ msgstr "" msgid "Bit clock and word select must share a clock unit" msgstr "Ang bit clock at word select dapat makibahagi sa isang clock unit" +#: shared-bindings/rgbmatrix/RGBMatrix.c +#, c-format +msgid "Bit depth must be from 1 to 6 inclusive, not %d" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." msgstr "Bit depth ay dapat multiple ng 8." diff --git a/locale/fr.po b/locale/fr.po index 94ca1f21cf..ff15b527e6 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -442,6 +442,11 @@ msgstr "Inférieur à la fréquence d'images minimale" msgid "Bit clock and word select must share a clock unit" msgstr "'bit clock' et 'word select' doivent partager une horloge" +#: shared-bindings/rgbmatrix/RGBMatrix.c +#, c-format +msgid "Bit depth must be from 1 to 6 inclusive, not %d" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." msgstr "La profondeur de bit doit être un multiple de 8." diff --git a/locale/hi.po b/locale/hi.po index d87a1eb9ce..aea2b3f0c4 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -428,6 +428,11 @@ msgstr "" msgid "Bit clock and word select must share a clock unit" msgstr "" +#: shared-bindings/rgbmatrix/RGBMatrix.c +#, c-format +msgid "Bit depth must be from 1 to 6 inclusive, not %d" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index 657c581cef..603cf9fd08 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -433,6 +433,11 @@ msgid "Bit clock and word select must share a clock unit" msgstr "" "Clock di bit e selezione parola devono condividere la stessa unità di clock" +#: shared-bindings/rgbmatrix/RGBMatrix.c +#, c-format +msgid "Bit depth must be from 1 to 6 inclusive, not %d" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." msgstr "La profondità di bit deve essere multipla di 8." diff --git a/locale/ja.po b/locale/ja.po index 4432095553..80486dc210 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -437,6 +437,11 @@ msgstr "最低のフレームレート未満" msgid "Bit clock and word select must share a clock unit" msgstr "bit clockとword selectはクロックユニットを共有しなければなりません" +#: shared-bindings/rgbmatrix/RGBMatrix.c +#, c-format +msgid "Bit depth must be from 1 to 6 inclusive, not %d" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." msgstr "ビット深度は8の倍数でなければなりません" diff --git a/locale/ko.po b/locale/ko.po index 4b302f3b9f..c9215fb85e 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -433,6 +433,11 @@ msgstr "" msgid "Bit clock and word select must share a clock unit" msgstr "" +#: shared-bindings/rgbmatrix/RGBMatrix.c +#, c-format +msgid "Bit depth must be from 1 to 6 inclusive, not %d" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." msgstr "" diff --git a/locale/nl.po b/locale/nl.po index 6851e6ef32..cfe2193bba 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -435,6 +435,11 @@ msgstr "Onder de minimum frame rate" msgid "Bit clock and word select must share a clock unit" msgstr "Bit clock en word select moeten een clock eenheid delen" +#: shared-bindings/rgbmatrix/RGBMatrix.c +#, c-format +msgid "Bit depth must be from 1 to 6 inclusive, not %d" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." msgstr "Bit diepte moet een meervoud van 8 zijn." diff --git a/locale/pl.po b/locale/pl.po index 1b0b41fdf3..623acd4c56 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -437,6 +437,11 @@ msgstr "" msgid "Bit clock and word select must share a clock unit" msgstr "Zegar bitowy i wybór słowa muszą współdzielić jednostkę zegara" +#: shared-bindings/rgbmatrix/RGBMatrix.c +#, c-format +msgid "Bit depth must be from 1 to 6 inclusive, not %d" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." msgstr "Głębia musi być wielokrotnością 8." diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 99f090dbd2..67b3dc8a7d 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -443,6 +443,11 @@ msgstr "" "O clock de bits e a seleção de palavras devem compartilhar uma unidade de " "clock" +#: shared-bindings/rgbmatrix/RGBMatrix.c +#, c-format +msgid "Bit depth must be from 1 to 6 inclusive, not %d" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." msgstr "A profundidade de bits deve ser o múltiplo de 8." diff --git a/locale/sv.po b/locale/sv.po index d9639aff6e..be7eb08946 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -435,6 +435,11 @@ msgstr "Under minsta bildfrekvens" msgid "Bit clock and word select must share a clock unit" msgstr "Bitklocka och ordval måste dela en klockenhet" +#: shared-bindings/rgbmatrix/RGBMatrix.c +#, c-format +msgid "Bit depth must be from 1 to 6 inclusive, not %d" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." msgstr "Bitdjup måste vara multipel av 8." diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 4d45f65bd7..4ac1c3e1ee 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -437,6 +437,11 @@ msgstr "Dī yú zuìdī zhèng sùlǜ" msgid "Bit clock and word select must share a clock unit" msgstr "Bǐtè shízhōng hé dānzì xuǎnzé bìxū gòngxiǎng shízhōng dānwèi" +#: shared-bindings/rgbmatrix/RGBMatrix.c +#, c-format +msgid "Bit depth must be from 1 to 6 inclusive, not %d" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." msgstr "Bǐtè shēndù bìxū shì 8 bèi yǐshàng." From 0f7081781e8a45da513b371978a354ea8734cc31 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 12 Nov 2020 20:40:09 -0600 Subject: [PATCH 091/148] esp32s2: wifi: fix several debug-build errors Closes #3688 With this change, I don't get the ESP_ERROR_CHECK failed repeatedly running code that imports wifi. (I'm not getting a successful connection but that's probably my own fault, such as a secrets problem) --- ports/esp32s2/common-hal/wifi/__init__.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/esp32s2/common-hal/wifi/__init__.c b/ports/esp32s2/common-hal/wifi/__init__.c index 833ef0623f..2eb3719b4d 100644 --- a/ports/esp32s2/common-hal/wifi/__init__.c +++ b/ports/esp32s2/common-hal/wifi/__init__.c @@ -143,8 +143,8 @@ void wifi_reset(void) { radio->handler_instance_got_ip)); ESP_ERROR_CHECK(esp_wifi_deinit()); esp_netif_destroy(radio->netif); + ESP_ERROR_CHECK(esp_event_loop_delete_default()); radio->netif = NULL; - ESP_ERROR_CHECK(esp_netif_deinit()); } void ipaddress_ipaddress_to_esp_idf(mp_obj_t ip_address, ip_addr_t* esp_ip_address) { From 8d4296f96430795936a22769da35732e5342b25c Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 10 Nov 2020 18:02:16 -0800 Subject: [PATCH 092/148] Add board.DISPLAY to MagTag. Fix luma computation * Initialize the EPaper display on the MagTag at start. * Tweak the display send to take a const buffer. * Correct Luma math * Multiply the blue component, not add. * Add all of the components together before dividing. This reduces the impact of truncated division. --- .../adafruit_magtag_2.9_grayscale/board.c | 122 ++++++++++++++++++ .../adafruit_magtag_2.9_grayscale/pins.c | 4 + .../common-hal/displayio/ParallelBus.c | 3 +- shared-bindings/displayio/EPaperDisplay.h | 2 +- shared-bindings/displayio/FourWire.h | 3 +- shared-bindings/displayio/I2CDisplay.h | 3 +- shared-bindings/displayio/ParallelBus.h | 3 +- shared-bindings/displayio/__init__.h | 3 +- shared-module/displayio/ColorConverter.c | 2 +- shared-module/displayio/EPaperDisplay.c | 14 +- shared-module/displayio/EPaperDisplay.h | 4 +- shared-module/displayio/FourWire.c | 3 +- shared-module/displayio/I2CDisplay.c | 3 +- 13 files changed, 152 insertions(+), 17 deletions(-) diff --git a/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/board.c b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/board.c index 9f708874bf..ecd44e423c 100644 --- a/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/board.c +++ b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/board.c @@ -26,7 +26,83 @@ #include "boards/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 "supervisor/shared/board.h" + +#define DELAY 0x80 + +// This is an ILO373 control chip. The display is a 2.9" grayscale EInk. + +const uint8_t display_start_sequence[] = { + 0x01, 5, 0x03, 0x00, 0x2b, 0x2b, 0x13, // power setting + 0x06, 3, 0x17, 0x17, 0x17, // booster soft start + 0x04, DELAY, 200, // power on and wait 200 ms + 0x00, 1, 0x7f, // panel setting + 0x50, 1, 0x97, // CDI setting + 0x30, 1, 0x3c, // PLL set to 50 Hx (M = 7, N = 4) + 0x61, 3, 0x80, 0x01, 0x28, // Resolution + 0x82, DELAY | 1, 0x12, 50, // VCM DC and delay 50ms + + // Look up tables for voltage sequence for pixel transition + // Common voltage + 0x20, 0x2a, + 0x00, 0x0a, 0x00, 0x00, 0x00, 0x01, + 0x60, 0x14, 0x14, 0x00, 0x00, 0x01, + 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x13, 0x0a, 0x01, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + + // White to white + 0x21, 0x2a, + 0x40, 0x0a, 0x00, 0x00, 0x00, 0x01, + 0x90, 0x14, 0x14, 0x00, 0x00, 0x01, + 0x10, 0x14, 0x0a, 0x00, 0x00, 0x01, + 0xa0, 0x13, 0x01, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + + // Black to white + 0x22, 0x2a, + 0x40, 0x0a, 0x00, 0x00, 0x00, 0x01, + 0x90, 0x14, 0x14, 0x00, 0x00, 0x01, + 0x00, 0x14, 0x0a, 0x00, 0x00, 0x01, + 0x99, 0x0c, 0x01, 0x03, 0x04, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + + // White to black + 0x23, 0x2a, + 0x40, 0x0a, 0x00, 0x00, 0x00, 0x01, + 0x90, 0x14, 0x14, 0x00, 0x00, 0x01, + 0x00, 0x14, 0x0a, 0x00, 0x00, 0x01, + 0x99, 0x0b, 0x04, 0x04, 0x01, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + + // Black to black + 0x24, 0x2a, + 0x80, 0x0a, 0x00, 0x00, 0x00, 0x01, + 0x90, 0x14, 0x14, 0x00, 0x00, 0x01, + 0x20, 0x14, 0x0a, 0x00, 0x00, 0x01, + 0x50, 0x13, 0x01, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +const uint8_t display_stop_sequence[] = { + 0x50, 0x01, 0x17, // CDI Setting + 0x82, 0x01, 0x00, // VCM DC to -0.1V + 0x02, 0x00 // Power off +}; void board_init(void) { // USB @@ -36,6 +112,52 @@ void board_init(void) { // Debug UART common_hal_never_reset_pin(&pin_GPIO43); common_hal_never_reset_pin(&pin_GPIO44); + + 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_GPIO7, // EPD_DC Command or data + &pin_GPIO8, // EPD_CS Chip select + &pin_GPIO6, // EPD_RST Reset + 4000000, // Baudrate + 0, // Polarity + 0); // Phase + + displayio_epaperdisplay_obj_t* display = &displays[0].epaper_display; + display->base.type = &displayio_epaperdisplay_type; + common_hal_displayio_epaperdisplay_construct( + display, + bus, + display_start_sequence, sizeof(display_start_sequence), + display_stop_sequence, sizeof(display_stop_sequence), + 296, // width + 128, // height + 160, // ram_width + 296, // ram_height + 0, // colstart + 0, // rowstart + 270, // rotation + NO_COMMAND, // set_column_window_command + NO_COMMAND, // set_row_window_command + NO_COMMAND, // set_current_column_command + NO_COMMAND, // set_current_row_command + 0x10, // write_black_ram_command + false, // black_bits_inverted + 0x13, // write_color_ram_command + false, // color_bits_inverted + 0x000000, // highlight_color + 0x12, // refresh_display_command + 1.0, // refresh_time + &pin_GPIO5, // busy_pin + false, // busy_state + 5.0, // seconds_per_frame + false, // always_toggle_chip_select + true); // grayscale } bool board_requests_safe_mode(void) { diff --git a/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/pins.c b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/pins.c index 65bc3fb53b..40c9e91e4d 100644 --- a/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/pins.c +++ b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/pins.c @@ -1,5 +1,7 @@ #include "shared-bindings/board/__init__.h" +#include "shared-module/displayio/__init__.h" + STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO10) }, { MP_ROM_QSTR(MP_QSTR_AD1), MP_ROM_PTR(&pin_GPIO18) }, @@ -37,5 +39,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { 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].epaper_display)} }; MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); diff --git a/ports/esp32s2/common-hal/displayio/ParallelBus.c b/ports/esp32s2/common-hal/displayio/ParallelBus.c index 314b72ff73..d0c98f3611 100644 --- a/ports/esp32s2/common-hal/displayio/ParallelBus.c +++ b/ports/esp32s2/common-hal/displayio/ParallelBus.c @@ -57,7 +57,8 @@ bool common_hal_displayio_parallelbus_begin_transaction(mp_obj_t obj) { return false; } -void common_hal_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type, display_chip_select_behavior_t chip_select, uint8_t *data, uint32_t data_length) { +void common_hal_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type, + display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length) { } diff --git a/shared-bindings/displayio/EPaperDisplay.h b/shared-bindings/displayio/EPaperDisplay.h index 352de899a9..9a2d93bac0 100644 --- a/shared-bindings/displayio/EPaperDisplay.h +++ b/shared-bindings/displayio/EPaperDisplay.h @@ -39,7 +39,7 @@ extern const mp_obj_type_t displayio_epaperdisplay_type; #define NO_COMMAND 0x100 void common_hal_displayio_epaperdisplay_construct(displayio_epaperdisplay_obj_t* self, - mp_obj_t bus, uint8_t* start_sequence, uint16_t start_sequence_len, uint8_t* stop_sequence, uint16_t stop_sequence_len, + mp_obj_t bus, const uint8_t* start_sequence, uint16_t start_sequence_len, const uint8_t* stop_sequence, uint16_t stop_sequence_len, uint16_t width, uint16_t height, uint16_t ram_width, uint16_t ram_height, int16_t colstart, int16_t rowstart, uint16_t rotation, uint16_t set_column_window_command, uint16_t set_row_window_command, uint16_t set_current_column_command, uint16_t set_current_row_command, diff --git a/shared-bindings/displayio/FourWire.h b/shared-bindings/displayio/FourWire.h index ac186d2c3e..6f6b528e72 100644 --- a/shared-bindings/displayio/FourWire.h +++ b/shared-bindings/displayio/FourWire.h @@ -48,7 +48,8 @@ bool common_hal_displayio_fourwire_bus_free(mp_obj_t self); bool common_hal_displayio_fourwire_begin_transaction(mp_obj_t self); -void common_hal_displayio_fourwire_send(mp_obj_t self, display_byte_type_t byte_type, display_chip_select_behavior_t chip_select, uint8_t *data, uint32_t data_length); +void common_hal_displayio_fourwire_send(mp_obj_t self, display_byte_type_t byte_type, + display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length); void common_hal_displayio_fourwire_end_transaction(mp_obj_t self); diff --git a/shared-bindings/displayio/I2CDisplay.h b/shared-bindings/displayio/I2CDisplay.h index bae53c4914..37520202e4 100644 --- a/shared-bindings/displayio/I2CDisplay.h +++ b/shared-bindings/displayio/I2CDisplay.h @@ -44,7 +44,8 @@ bool common_hal_displayio_i2cdisplay_bus_free(mp_obj_t self); bool common_hal_displayio_i2cdisplay_begin_transaction(mp_obj_t self); -void common_hal_displayio_i2cdisplay_send(mp_obj_t self, display_byte_type_t byte_type, display_chip_select_behavior_t chip_select, uint8_t *data, uint32_t data_length); +void common_hal_displayio_i2cdisplay_send(mp_obj_t self, display_byte_type_t byte_type, + display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length); void common_hal_displayio_i2cdisplay_end_transaction(mp_obj_t self); diff --git a/shared-bindings/displayio/ParallelBus.h b/shared-bindings/displayio/ParallelBus.h index be2aef7d44..1e74e3a0ac 100644 --- a/shared-bindings/displayio/ParallelBus.h +++ b/shared-bindings/displayio/ParallelBus.h @@ -46,7 +46,8 @@ bool common_hal_displayio_parallelbus_bus_free(mp_obj_t self); bool common_hal_displayio_parallelbus_begin_transaction(mp_obj_t self); -void common_hal_displayio_parallelbus_send(mp_obj_t self, display_byte_type_t byte_type, display_chip_select_behavior_t chip_select, uint8_t *data, uint32_t data_length); +void common_hal_displayio_parallelbus_send(mp_obj_t self, display_byte_type_t byte_type, + display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length); void common_hal_displayio_parallelbus_end_transaction(mp_obj_t self); diff --git a/shared-bindings/displayio/__init__.h b/shared-bindings/displayio/__init__.h index a7748d029a..4fc666c598 100644 --- a/shared-bindings/displayio/__init__.h +++ b/shared-bindings/displayio/__init__.h @@ -42,7 +42,8 @@ typedef enum { typedef bool (*display_bus_bus_reset)(mp_obj_t bus); typedef bool (*display_bus_bus_free)(mp_obj_t bus); typedef bool (*display_bus_begin_transaction)(mp_obj_t bus); -typedef void (*display_bus_send)(mp_obj_t bus, display_byte_type_t byte_type, display_chip_select_behavior_t chip_select, uint8_t *data, uint32_t data_length); +typedef void (*display_bus_send)(mp_obj_t bus, display_byte_type_t byte_type, + display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length); typedef void (*display_bus_end_transaction)(mp_obj_t bus); void common_hal_displayio_release_displays(void); diff --git a/shared-module/displayio/ColorConverter.c b/shared-module/displayio/ColorConverter.c index 03ec99ceb1..80558d037a 100644 --- a/shared-module/displayio/ColorConverter.c +++ b/shared-module/displayio/ColorConverter.c @@ -55,7 +55,7 @@ uint8_t displayio_colorconverter_compute_luma(uint32_t color_rgb888) { uint32_t r8 = (color_rgb888 >> 16); uint32_t g8 = (color_rgb888 >> 8) & 0xff; uint32_t b8 = color_rgb888 & 0xff; - return (r8 * 19) / 255 + (g8 * 182) / 255 + (b8 + 54) / 255; + return (r8 * 19 + g8 * 182 + b8 * 54) / 255; } uint8_t displayio_colorconverter_compute_chroma(uint32_t color_rgb888) { diff --git a/shared-module/displayio/EPaperDisplay.c b/shared-module/displayio/EPaperDisplay.c index 514b99a13b..acca92ac15 100644 --- a/shared-module/displayio/EPaperDisplay.c +++ b/shared-module/displayio/EPaperDisplay.c @@ -43,7 +43,8 @@ #include void common_hal_displayio_epaperdisplay_construct(displayio_epaperdisplay_obj_t* self, - mp_obj_t bus, uint8_t* start_sequence, uint16_t start_sequence_len, uint8_t* stop_sequence, uint16_t stop_sequence_len, + mp_obj_t bus, const uint8_t* start_sequence, uint16_t start_sequence_len, + const uint8_t* stop_sequence, uint16_t stop_sequence_len, uint16_t width, uint16_t height, uint16_t ram_width, uint16_t ram_height, int16_t colstart, int16_t rowstart, uint16_t rotation, uint16_t set_column_window_command, uint16_t set_row_window_command, @@ -133,14 +134,15 @@ STATIC void wait_for_busy(displayio_epaperdisplay_obj_t* self) { } } -STATIC void send_command_sequence(displayio_epaperdisplay_obj_t* self, bool should_wait_for_busy, uint8_t* sequence, uint32_t sequence_len) { +STATIC void send_command_sequence(displayio_epaperdisplay_obj_t* self, + bool should_wait_for_busy, const uint8_t* sequence, uint32_t sequence_len) { uint32_t i = 0; while (i < sequence_len) { - uint8_t *cmd = sequence + i; + const uint8_t *cmd = sequence + i; uint8_t data_size = *(cmd + 1); bool delay = (data_size & DELAY) != 0; data_size &= ~DELAY; - uint8_t *data = cmd + 2; + const uint8_t *data = cmd + 2; displayio_display_core_begin_transaction(&self->core); self->core.send(self->core.bus, DISPLAY_COMMAND, self->chip_select, cmd, 1); self->core.send(self->core.bus, DISPLAY_DATA, self->chip_select, data, data_size); @@ -375,8 +377,8 @@ void release_epaperdisplay(displayio_epaperdisplay_obj_t* self) { void displayio_epaperdisplay_collect_ptrs(displayio_epaperdisplay_obj_t* self) { displayio_display_core_collect_ptrs(&self->core); - gc_collect_ptr(self->start_sequence); - gc_collect_ptr(self->stop_sequence); + gc_collect_ptr((void *) self->start_sequence); + gc_collect_ptr((void *) self->stop_sequence); } bool maybe_refresh_epaperdisplay(void) { diff --git a/shared-module/displayio/EPaperDisplay.h b/shared-module/displayio/EPaperDisplay.h index 4103fe5fce..d0668ff444 100644 --- a/shared-module/displayio/EPaperDisplay.h +++ b/shared-module/displayio/EPaperDisplay.h @@ -38,9 +38,9 @@ typedef struct { displayio_display_core_t core; digitalio_digitalinout_obj_t busy; uint32_t milliseconds_per_frame; - uint8_t* start_sequence; + const uint8_t* start_sequence; uint32_t start_sequence_len; - uint8_t* stop_sequence; + const uint8_t* stop_sequence; uint32_t stop_sequence_len; uint16_t refresh_time; uint16_t set_column_window_command; diff --git a/shared-module/displayio/FourWire.c b/shared-module/displayio/FourWire.c index 8c56d7ab60..06f8a84e35 100644 --- a/shared-module/displayio/FourWire.c +++ b/shared-module/displayio/FourWire.c @@ -113,7 +113,8 @@ bool common_hal_displayio_fourwire_begin_transaction(mp_obj_t obj) { return true; } -void common_hal_displayio_fourwire_send(mp_obj_t obj, display_byte_type_t data_type, display_chip_select_behavior_t chip_select, uint8_t *data, uint32_t data_length) { +void common_hal_displayio_fourwire_send(mp_obj_t obj, display_byte_type_t data_type, + display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length) { displayio_fourwire_obj_t* self = MP_OBJ_TO_PTR(obj); common_hal_digitalio_digitalinout_set_value(&self->command, data_type == DISPLAY_DATA); if (chip_select == CHIP_SELECT_TOGGLE_EVERY_BYTE) { diff --git a/shared-module/displayio/I2CDisplay.c b/shared-module/displayio/I2CDisplay.c index 5bd03dcd65..cc811e83d7 100644 --- a/shared-module/displayio/I2CDisplay.c +++ b/shared-module/displayio/I2CDisplay.c @@ -103,7 +103,8 @@ bool common_hal_displayio_i2cdisplay_begin_transaction(mp_obj_t obj) { return common_hal_busio_i2c_try_lock(self->bus); } -void common_hal_displayio_i2cdisplay_send(mp_obj_t obj, display_byte_type_t data_type, display_chip_select_behavior_t chip_select, uint8_t *data, uint32_t data_length) { +void common_hal_displayio_i2cdisplay_send(mp_obj_t obj, display_byte_type_t data_type, + display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length) { displayio_i2cdisplay_obj_t* self = MP_OBJ_TO_PTR(obj); if (data_type == DISPLAY_COMMAND) { uint8_t command_bytes[2 * data_length]; From 78ccac930fbcb3dddd3a1a79809a2ec371d34c6a Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 11 Nov 2020 16:53:45 -0800 Subject: [PATCH 093/148] Add .busy property to EPaperDisplay --- shared-bindings/displayio/EPaperDisplay.c | 18 ++++++++++++++++++ shared-bindings/displayio/EPaperDisplay.h | 1 + shared-module/displayio/EPaperDisplay.c | 5 +++++ 3 files changed, 24 insertions(+) diff --git a/shared-bindings/displayio/EPaperDisplay.c b/shared-bindings/displayio/EPaperDisplay.c index 8518e37143..ebff640085 100644 --- a/shared-bindings/displayio/EPaperDisplay.c +++ b/shared-bindings/displayio/EPaperDisplay.c @@ -245,6 +245,23 @@ const mp_obj_property_t displayio_epaperdisplay_time_to_refresh_obj = { (mp_obj_t)&mp_const_none_obj}, }; +//| busy: bool +//| """True when the display is refreshing. This uses the ``busy_pin`` when available or the +//| ``refresh_time`` otherwise.""" +//| +STATIC mp_obj_t displayio_epaperdisplay_obj_get_busy(mp_obj_t self_in) { + displayio_epaperdisplay_obj_t *self = native_display(self_in); + return mp_obj_new_bool(common_hal_displayio_epaperdisplay_get_busy(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(displayio_epaperdisplay_get_busy_obj, displayio_epaperdisplay_obj_get_busy); + +const mp_obj_property_t displayio_epaperdisplay_busy_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&displayio_epaperdisplay_get_busy_obj, + (mp_obj_t)&mp_const_none_obj, + (mp_obj_t)&mp_const_none_obj}, +}; + //| width: int //| """Gets the width of the display in pixels""" //| @@ -301,6 +318,7 @@ STATIC const mp_rom_map_elem_t displayio_epaperdisplay_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&displayio_epaperdisplay_width_obj) }, { MP_ROM_QSTR(MP_QSTR_height), MP_ROM_PTR(&displayio_epaperdisplay_height_obj) }, { MP_ROM_QSTR(MP_QSTR_bus), MP_ROM_PTR(&displayio_epaperdisplay_bus_obj) }, + { MP_ROM_QSTR(MP_QSTR_busy), MP_ROM_PTR(&displayio_epaperdisplay_busy_obj) }, { MP_ROM_QSTR(MP_QSTR_time_to_refresh), MP_ROM_PTR(&displayio_epaperdisplay_time_to_refresh_obj) }, }; STATIC MP_DEFINE_CONST_DICT(displayio_epaperdisplay_locals_dict, displayio_epaperdisplay_locals_dict_table); diff --git a/shared-bindings/displayio/EPaperDisplay.h b/shared-bindings/displayio/EPaperDisplay.h index 9a2d93bac0..f785203a41 100644 --- a/shared-bindings/displayio/EPaperDisplay.h +++ b/shared-bindings/displayio/EPaperDisplay.h @@ -52,6 +52,7 @@ bool common_hal_displayio_epaperdisplay_show(displayio_epaperdisplay_obj_t* self // Returns time in milliseconds. uint32_t common_hal_displayio_epaperdisplay_get_time_to_refresh(displayio_epaperdisplay_obj_t* self); +bool common_hal_displayio_epaperdisplay_get_busy(displayio_epaperdisplay_obj_t* self); uint16_t common_hal_displayio_epaperdisplay_get_width(displayio_epaperdisplay_obj_t* self); uint16_t common_hal_displayio_epaperdisplay_get_height(displayio_epaperdisplay_obj_t* self); diff --git a/shared-module/displayio/EPaperDisplay.c b/shared-module/displayio/EPaperDisplay.c index acca92ac15..1b285b4b1d 100644 --- a/shared-module/displayio/EPaperDisplay.c +++ b/shared-module/displayio/EPaperDisplay.c @@ -360,6 +360,11 @@ void displayio_epaperdisplay_background(displayio_epaperdisplay_obj_t* self) { } } +bool common_hal_displayio_epaperdisplay_get_busy(displayio_epaperdisplay_obj_t* self) { + displayio_epaperdisplay_background(self); + return self->refreshing; +} + void release_epaperdisplay(displayio_epaperdisplay_obj_t* self) { if (self->refreshing) { wait_for_busy(self); From 68eb809fbf5cafdabb20c090b98aefb1628e3552 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 12 Nov 2020 12:39:31 -0800 Subject: [PATCH 094/148] Update parallel bus signatures --- ports/atmel-samd/common-hal/displayio/ParallelBus.c | 3 ++- ports/mimxrt10xx/common-hal/displayio/ParallelBus.c | 3 ++- ports/nrf/common-hal/displayio/ParallelBus.c | 3 ++- ports/stm/common-hal/displayio/ParallelBus.c | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ports/atmel-samd/common-hal/displayio/ParallelBus.c b/ports/atmel-samd/common-hal/displayio/ParallelBus.c index 405c08c64a..f10dd2993b 100644 --- a/ports/atmel-samd/common-hal/displayio/ParallelBus.c +++ b/ports/atmel-samd/common-hal/displayio/ParallelBus.c @@ -129,7 +129,8 @@ bool common_hal_displayio_parallelbus_begin_transaction(mp_obj_t obj) { return true; } -void common_hal_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type, display_chip_select_behavior_t chip_select, uint8_t *data, uint32_t data_length) { +void common_hal_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type, + display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length) { displayio_parallelbus_obj_t* self = MP_OBJ_TO_PTR(obj); common_hal_digitalio_digitalinout_set_value(&self->command, byte_type == DISPLAY_DATA); uint32_t* clear_write = (uint32_t*) &self->write_group->OUTCLR.reg; diff --git a/ports/mimxrt10xx/common-hal/displayio/ParallelBus.c b/ports/mimxrt10xx/common-hal/displayio/ParallelBus.c index 87a72d0f33..0fdf4413b6 100644 --- a/ports/mimxrt10xx/common-hal/displayio/ParallelBus.c +++ b/ports/mimxrt10xx/common-hal/displayio/ParallelBus.c @@ -57,7 +57,8 @@ bool common_hal_displayio_parallelbus_begin_transaction(mp_obj_t obj) { return false; } -void common_hal_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type, display_chip_select_behavior_t chip_select, uint8_t *data, uint32_t data_length) { +void common_hal_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type, + display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length) { } diff --git a/ports/nrf/common-hal/displayio/ParallelBus.c b/ports/nrf/common-hal/displayio/ParallelBus.c index f13e03163f..31ee1f48e4 100644 --- a/ports/nrf/common-hal/displayio/ParallelBus.c +++ b/ports/nrf/common-hal/displayio/ParallelBus.c @@ -141,7 +141,8 @@ bool common_hal_displayio_parallelbus_begin_transaction(mp_obj_t obj) { } // This ignores chip_select behaviour because data is clocked in by the write line toggling. -void common_hal_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type, display_chip_select_behavior_t chip_select, uint8_t *data, uint32_t data_length) { +void common_hal_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type, + display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length) { displayio_parallelbus_obj_t* self = MP_OBJ_TO_PTR(obj); common_hal_digitalio_digitalinout_set_value(&self->command, byte_type == DISPLAY_DATA); uint32_t* clear_write = (uint32_t*) &self->write_group->OUTCLR; diff --git a/ports/stm/common-hal/displayio/ParallelBus.c b/ports/stm/common-hal/displayio/ParallelBus.c index 314b72ff73..fd07d38af4 100644 --- a/ports/stm/common-hal/displayio/ParallelBus.c +++ b/ports/stm/common-hal/displayio/ParallelBus.c @@ -57,7 +57,8 @@ bool common_hal_displayio_parallelbus_begin_transaction(mp_obj_t obj) { return false; } -void common_hal_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type, display_chip_select_behavior_t chip_select, uint8_t *data, uint32_t data_length) { +void common_hal_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type, + display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length) { } From bda3267432aee57e704a20308b724369cceeb6ca Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 13 Nov 2020 18:33:02 -0800 Subject: [PATCH 095/148] Save flash space * No weak link for modules. It only impacts _os and _time and is already disabled for non-full builds. * Turn off PA00 and PA01 because they are the crystal on the Metro M0 Express. * Change ejected default to false to move it to BSS. It is set on USB connection anyway. * Set sinc_filter to const. Doesn't help flash but keeps it out of RAM. --- ports/atmel-samd/boards/metro_m0_express/mpconfigboard.h | 4 ++++ ports/atmel-samd/common-hal/audiobusio/PDMIn.c | 2 +- py/circuitpy_mpconfig.h | 2 +- supervisor/shared/usb/usb_msc_flash.c | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ports/atmel-samd/boards/metro_m0_express/mpconfigboard.h b/ports/atmel-samd/boards/metro_m0_express/mpconfigboard.h index 04565feb40..d48c596ace 100644 --- a/ports/atmel-samd/boards/metro_m0_express/mpconfigboard.h +++ b/ports/atmel-samd/boards/metro_m0_express/mpconfigboard.h @@ -33,6 +33,10 @@ #define DEFAULT_UART_BUS_RX (&pin_PA11) #define DEFAULT_UART_BUS_TX (&pin_PA10) +// These pins are connected to the external crystal. +#define IGNORE_PIN_PA00 1 +#define IGNORE_PIN_PA01 1 + // USB is always used internally so skip the pin objects for it. #define IGNORE_PIN_PA24 1 #define IGNORE_PIN_PA25 1 diff --git a/ports/atmel-samd/common-hal/audiobusio/PDMIn.c b/ports/atmel-samd/common-hal/audiobusio/PDMIn.c index 21474ab3b1..3c9ec05c25 100644 --- a/ports/atmel-samd/common-hal/audiobusio/PDMIn.c +++ b/ports/atmel-samd/common-hal/audiobusio/PDMIn.c @@ -326,7 +326,7 @@ static void setup_dma(audiobusio_pdmin_obj_t* self, uint32_t length, // higher sample rate than specified. Then after the audio is // recorded, a more expensive filter non-real-time filter could be // used to down-sample and low-pass. -uint16_t sinc_filter [OVERSAMPLING] = { +const uint16_t sinc_filter [OVERSAMPLING] = { 0, 2, 9, 21, 39, 63, 94, 132, 179, 236, 302, 379, 467, 565, 674, 792, 920, 1055, 1196, 1341, 1487, 1633, 1776, 1913, diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index 08efabddb5..85e152670a 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -186,7 +186,7 @@ typedef long mp_off_t; #define MICROPY_CPYTHON_COMPAT (CIRCUITPY_FULL_BUILD) #define MICROPY_PY_BUILTINS_POW3 (CIRCUITPY_FULL_BUILD) #define MICROPY_COMP_FSTRING_LITERAL (MICROPY_CPYTHON_COMPAT) -#define MICROPY_MODULE_WEAK_LINKS (CIRCUITPY_FULL_BUILD) +#define MICROPY_MODULE_WEAK_LINKS (0) #define MICROPY_PY_ALL_SPECIAL_METHODS (CIRCUITPY_FULL_BUILD) #define MICROPY_PY_BUILTINS_COMPLEX (CIRCUITPY_FULL_BUILD) #define MICROPY_PY_BUILTINS_FROZENSET (CIRCUITPY_FULL_BUILD) diff --git a/supervisor/shared/usb/usb_msc_flash.c b/supervisor/shared/usb/usb_msc_flash.c index 7532b6aead..b39f60dcd2 100644 --- a/supervisor/shared/usb/usb_msc_flash.c +++ b/supervisor/shared/usb/usb_msc_flash.c @@ -39,7 +39,7 @@ #define MSC_FLASH_BLOCK_SIZE 512 -static bool ejected[1] = {true}; +static bool ejected[1] = {false}; void usb_msc_mount(void) { // Reset the ejection tracking every time we're plugged into USB. This allows for us to battery From 146adca060d7abc76149c88c7cdd2d401f799efa Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Sat, 14 Nov 2020 11:41:14 +0530 Subject: [PATCH 096/148] Add watchdog mode raise --- ports/esp32s2/common-hal/watchdog/WatchDogTimer.c | 9 ++++++++- ports/esp32s2/common-hal/watchdog/WatchDogTimer.h | 3 +-- ports/esp32s2/supervisor/port.c | 5 +++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/ports/esp32s2/common-hal/watchdog/WatchDogTimer.c b/ports/esp32s2/common-hal/watchdog/WatchDogTimer.c index 59b9dafcf0..b51a391b7f 100644 --- a/ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +++ b/ports/esp32s2/common-hal/watchdog/WatchDogTimer.c @@ -27,12 +27,19 @@ #include "py/runtime.h" #include "common-hal/watchdog/WatchDogTimer.h" +#include "shared-bindings/watchdog/__init__.h" #include "shared-bindings/microcontroller/__init__.h" #include "esp_task_wdt.h" void esp_task_wdt_isr_user_handler(void) { - + mp_obj_exception_clear_traceback(MP_OBJ_FROM_PTR(&mp_watchdog_timeout_exception)); + MP_STATE_VM(mp_pending_exception) = &mp_watchdog_timeout_exception; +#if MICROPY_ENABLE_SCHEDULER + if (MP_STATE_VM(sched_state) == MP_SCHED_IDLE) { + MP_STATE_VM(sched_state) = MP_SCHED_PENDING; + } +#endif } void common_hal_watchdog_feed(watchdog_watchdogtimer_obj_t *self) { diff --git a/ports/esp32s2/common-hal/watchdog/WatchDogTimer.h b/ports/esp32s2/common-hal/watchdog/WatchDogTimer.h index 05e0e954d2..04d9aeee6c 100644 --- a/ports/esp32s2/common-hal/watchdog/WatchDogTimer.h +++ b/ports/esp32s2/common-hal/watchdog/WatchDogTimer.h @@ -37,8 +37,7 @@ struct _watchdog_watchdogtimer_obj_t { watchdog_watchdogmode_t mode; }; -// This needs to be called in order to disable the watchdog if it's set to -// "RAISE". If set to "RESET", then the watchdog cannot be reset. +// This needs to be called in order to disable the watchdog void watchdog_reset(void); #endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_WATCHDOG_WATCHDOGTIMER_H diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index 0b9c03f747..1b6f5ef7cb 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -41,6 +41,7 @@ #include "common-hal/busio/UART.h" #include "common-hal/pulseio/PulseIn.h" #include "common-hal/pwmio/PWMOut.h" +#include "common-hal/watchdog/WatchDogTimer.h" #include "common-hal/wifi/__init__.h" #include "supervisor/memory.h" #include "supervisor/shared/tick.h" @@ -119,6 +120,10 @@ void reset_port(void) { rtc_reset(); #endif +#if CIRCUITPY_WATCHDOG + watchdog_reset(); +#endif + #if CIRCUITPY_WIFI wifi_reset(); #endif From 231e3d362dae1988d5103b1042957ae793599d8b Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sat, 14 Nov 2020 10:16:39 -0600 Subject: [PATCH 097/148] esp32s2: Update esp-idf submodule to include fix for #3424 This re-points the submodule to my personal fork of esp-idf. Users may need to `git submodule sync` in their existing trees when this change occurs. Adds just the following commit in esp-idf: > esp_crt_bundle: Allow verify_callback to correct BADCERT_BAD_MD --- .gitmodules | 2 +- ports/esp32s2/esp-idf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index f66ce8aafa..aaa66caf71 100644 --- a/.gitmodules +++ b/.gitmodules @@ -152,4 +152,4 @@ url = https://github.com/adafruit/Adafruit_CircuitPython_RFM69.git [submodule "ports/esp32s2/esp-idf"] path = ports/esp32s2/esp-idf - url = https://github.com/espressif/esp-idf.git + url = https://github.com/jepler/esp-idf.git diff --git a/ports/esp32s2/esp-idf b/ports/esp32s2/esp-idf index 8bc19ba893..d06744f5ef 160000 --- a/ports/esp32s2/esp-idf +++ b/ports/esp32s2/esp-idf @@ -1 +1 @@ -Subproject commit 8bc19ba893e5544d571a753d82b44a84799b94b1 +Subproject commit d06744f5efc382c61cbad8758107cec308feef09 From 6c3c076cc110d935f0f8406de81007563994e553 Mon Sep 17 00:00:00 2001 From: RubenD Date: Fri, 13 Nov 2020 23:49:31 +0000 Subject: [PATCH 098/148] Translated using Weblate (Spanish) Currently translated at 99.2% (840 of 846 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/es/ --- locale/es.po | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/locale/es.po b/locale/es.po index ed7431eb7c..c5e2ad75f0 100644 --- a/locale/es.po +++ b/locale/es.po @@ -8,15 +8,15 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-04 21:18+0530\n" -"PO-Revision-Date: 2020-11-01 16:26+0000\n" -"Last-Translator: Alvaro Figueroa \n" +"PO-Revision-Date: 2020-11-15 16:28+0000\n" +"Last-Translator: RubenD \n" "Language-Team: \n" "Language: es\n" "MIME-Version: 1.0\n" "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.3.2-dev\n" +"X-Generator: Weblate 4.4-dev\n" #: main.c msgid "" @@ -305,7 +305,7 @@ msgstr "Todos los periféricos I2C están siendo usados" #: ports/esp32s2/peripherals/pcnt_handler.c msgid "All PCNT units in use" -msgstr "" +msgstr "Todas las unidades PCNT en uso" #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c @@ -445,7 +445,7 @@ msgstr "Bit clock y word select deben compartir una unidad de reloj" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "Bit depth must be from 1 to 6 inclusive, not %d" -msgstr "" +msgstr "Bit depth tiene que ser de 1 a 6 inclusivo, no %d" #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." From 76d60ba95bb79e0a553fd6f9dcb5cb25806ada2f Mon Sep 17 00:00:00 2001 From: Antonin ENFRUN Date: Fri, 13 Nov 2020 07:56:16 +0000 Subject: [PATCH 099/148] Translated using Weblate (French) Currently translated at 100.0% (846 of 846 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/fr/ --- locale/fr.po | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/locale/fr.po b/locale/fr.po index ff15b527e6..5d4ca75d5c 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -8,14 +8,14 @@ msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-04 21:18+0530\n" -"PO-Revision-Date: 2020-10-22 20:48+0000\n" +"PO-Revision-Date: 2020-11-15 16:28+0000\n" "Last-Translator: Antonin ENFRUN \n" "Language: fr\n" "MIME-Version: 1.0\n" "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.3.1\n" +"X-Generator: Weblate 4.4-dev\n" #: main.c msgid "" @@ -298,7 +298,7 @@ msgstr "Type d'adresse hors plage" #: ports/esp32s2/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" -msgstr "" +msgstr "Tous les périphériques CAN sont utilisés" #: ports/esp32s2/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" @@ -306,7 +306,7 @@ msgstr "Tous les périphériques I2C sont utilisés" #: ports/esp32s2/peripherals/pcnt_handler.c msgid "All PCNT units in use" -msgstr "" +msgstr "Toutes les unités PCNT sont utilisées" #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c @@ -431,7 +431,7 @@ msgstr "" #: ports/esp32s2/common-hal/canio/CAN.c msgid "Baudrate not supported by peripheral" -msgstr "" +msgstr "Baudrate non prise en charge par le périphérique" #: shared-module/displayio/Display.c #: shared-module/framebufferio/FramebufferDisplay.c @@ -445,7 +445,7 @@ msgstr "'bit clock' et 'word select' doivent partager une horloge" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "Bit depth must be from 1 to 6 inclusive, not %d" -msgstr "" +msgstr "Bit depth doit être compris entre 1 et 6 inclus, et non %d" #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." @@ -2953,7 +2953,7 @@ msgstr "entiers longs non supportés dans cette build" #: ports/esp32s2/common-hal/canio/CAN.c msgid "loopback + silent mode not supported by peripheral" -msgstr "" +msgstr "loopback + silent mode non pris en charge par le périphérique" #: py/parse.c msgid "malformed f-string" @@ -2991,11 +2991,11 @@ msgstr "profondeur maximale de récursivité dépassée" #: extmod/ulab/code/approx/approx.c msgid "maxiter must be > 0" -msgstr "" +msgstr "maxiter doit être > 0" #: extmod/ulab/code/approx/approx.c msgid "maxiter should be > 0" -msgstr "" +msgstr "maxiter devrait être > 0" #: py/runtime.c #, c-format @@ -3440,7 +3440,7 @@ msgstr "l'argument de «sort» doit être un ndarray" #: extmod/ulab/code/numerical/numerical.c msgid "sorted axis can't be longer than 65535" -msgstr "" +msgstr "sorted axis ne peut pas dépasser 65535" #: extmod/ulab/code/filter/filter.c msgid "sos array must be of shape (n_section, 6)" @@ -3575,12 +3575,12 @@ msgstr "tuple/liste a une mauvaise longueur" #: ports/esp32s2/common-hal/canio/CAN.c #, c-format msgid "twai_driver_install returned esp-idf error #%d" -msgstr "" +msgstr "twai_driver_install a renvoyé l'erreur esp-idf #%d" #: ports/esp32s2/common-hal/canio/CAN.c #, c-format msgid "twai_start returned esp-idf error #%d" -msgstr "" +msgstr "twai_start a renvoyé l'erreur esp-idf #%d" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c From 8218eb2ddf92d979b16391a9a5400ab8a5ce2e67 Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Fri, 13 Nov 2020 19:51:22 +0000 Subject: [PATCH 100/148] Translated using Weblate (Swedish) Currently translated at 100.0% (846 of 846 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/ --- locale/sv.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/locale/sv.po b/locale/sv.po index be7eb08946..1a603e4961 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: 2020-11-04 21:18+0530\n" -"PO-Revision-Date: 2020-11-05 20:26+0000\n" +"PO-Revision-Date: 2020-11-15 16:28+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.3.2\n" +"X-Generator: Weblate 4.4-dev\n" #: main.c msgid "" @@ -302,7 +302,7 @@ msgstr "All I2C-kringutrustning används" #: ports/esp32s2/peripherals/pcnt_handler.c msgid "All PCNT units in use" -msgstr "" +msgstr "Alla PCNT-enheter används" #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c @@ -438,7 +438,7 @@ msgstr "Bitklocka och ordval måste dela en klockenhet" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "Bit depth must be from 1 to 6 inclusive, not %d" -msgstr "" +msgstr "Bitdjup måste vara inom 1 till 6, inte %d" #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." From 64725190f47fbe3d2b4e54b0e58c485949878a89 Mon Sep 17 00:00:00 2001 From: hexthat Date: Sat, 14 Nov 2020 15:43:32 +0000 Subject: [PATCH 101/148] Translated using Weblate (Chinese (Pinyin)) Currently translated at 100.0% (846 of 846 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/zh_Latn/ --- locale/zh_Latn_pinyin.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 4ac1c3e1ee..2731ec4f5e 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-04 21:18+0530\n" -"PO-Revision-Date: 2020-11-11 19:13+0000\n" +"PO-Revision-Date: 2020-11-15 16:28+0000\n" "Last-Translator: hexthat \n" "Language-Team: Chinese Hanyu Pinyin\n" "Language: zh_Latn_pinyin\n" @@ -440,7 +440,7 @@ msgstr "Bǐtè shízhōng hé dānzì xuǎnzé bìxū gòngxiǎng shízhōng dā #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "Bit depth must be from 1 to 6 inclusive, not %d" -msgstr "" +msgstr "wèi shēn dù bì xū bāo hán 1 dào 6, ér bù shì %d" #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." From c4917cdabd97c016a46b6193e93b274573d94193 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Mon, 16 Nov 2020 00:11:00 +0530 Subject: [PATCH 102/148] frequencyio implementation for esp32s2 --- .../common-hal/frequencyio/FrequencyIn.c | 158 ++++++++++++++++++ .../common-hal/frequencyio/FrequencyIn.h | 43 +++++ .../esp32s2/common-hal/frequencyio/__init__.c | 1 + ports/esp32s2/mpconfigport.mk | 2 +- 4 files changed, 203 insertions(+), 1 deletion(-) create mode 100644 ports/esp32s2/common-hal/frequencyio/FrequencyIn.c create mode 100644 ports/esp32s2/common-hal/frequencyio/FrequencyIn.h create mode 100644 ports/esp32s2/common-hal/frequencyio/__init__.c diff --git a/ports/esp32s2/common-hal/frequencyio/FrequencyIn.c b/ports/esp32s2/common-hal/frequencyio/FrequencyIn.c new file mode 100644 index 0000000000..fce1d34d87 --- /dev/null +++ b/ports/esp32s2/common-hal/frequencyio/FrequencyIn.c @@ -0,0 +1,158 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 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 "shared-bindings/frequencyio/FrequencyIn.h" + +#include + +#include "py/runtime.h" + +#include "supervisor/shared/tick.h" +#include "shared-bindings/time/__init__.h" + +#include "common-hal/microcontroller/Pin.h" + +static void frequencyin_interrupt_handler(void *self_in) { + frequencyio_frequencyin_obj_t* self = self_in; + // get counter value + int16_t count; + pcnt_get_counter_value(self->unit, &count); + self->frequency = count / 2.0 / self->capture_period; + + // reset counter + pcnt_counter_clear(self->unit); +} + +static void init_timer(frequencyio_frequencyin_obj_t* self, uint16_t capture_period) { + // Prepare configuration for the timer module + timer_config_t config = { + .alarm_en = true, + .counter_en = false, + .intr_type = TIMER_INTR_LEVEL, + .counter_dir = TIMER_COUNT_UP, + .auto_reload = true, + .divider = 80 // 1 us per tick + }; + + // Initialize timer module + timer_init(TIMER_GROUP_0, TIMER_0, &config); + timer_set_counter_value(TIMER_GROUP_0, TIMER_0, 0); + timer_set_alarm_value(TIMER_GROUP_0, TIMER_0, capture_period * 1000000); + timer_enable_intr(TIMER_GROUP_0, TIMER_0); + timer_isr_register(TIMER_GROUP_0, TIMER_0, &frequencyin_interrupt_handler, (void *)self, 0, &self->handle); + + // Start timer + timer_start(TIMER_GROUP_0, TIMER_0); +} + +void common_hal_frequencyio_frequencyin_construct(frequencyio_frequencyin_obj_t* self, + const mcu_pin_obj_t* pin, const uint16_t capture_period) { + if ((capture_period == 0) || (capture_period > 500)) { + mp_raise_ValueError(translate("Invalid capture period. Valid range: 1 - 500")); + } + + // Prepare configuration for the PCNT unit + const pcnt_config_t pcnt_config = { + // Set PCNT input signal and control GPIOs + .pulse_gpio_num = pin->number, + .ctrl_gpio_num = PCNT_PIN_NOT_USED, + .channel = PCNT_CHANNEL_0, + .lctrl_mode = PCNT_MODE_DISABLE, + .hctrl_mode = PCNT_MODE_KEEP, + .pos_mode = PCNT_COUNT_INC, // count both rising and falling edges + .neg_mode = PCNT_COUNT_INC, + .counter_h_lim = 0, + .counter_l_lim = 0, + }; + + // Initialize PCNT unit + const int8_t unit = peripherals_pcnt_init(pcnt_config); + if (unit == -1) { + mp_raise_RuntimeError(translate("All PCNT units in use")); + } + + // set the GPIO back to high-impedance, as pcnt_unit_config sets it as pull-up + gpio_set_pull_mode(pin->number, GPIO_FLOATING); + + // initialize timer + init_timer(self, capture_period); + + self->pin = pin->number; + self->unit = (pcnt_unit_t)unit; + self->capture_period = capture_period; + + claim_pin(pin); +} + +bool common_hal_frequencyio_frequencyin_deinited(frequencyio_frequencyin_obj_t* self) { + return self->unit == PCNT_UNIT_MAX; +} + +void common_hal_frequencyio_frequencyin_deinit(frequencyio_frequencyin_obj_t* self) { + if (common_hal_frequencyio_frequencyin_deinited(self)) { + return; + } + reset_pin_number(self->pin); + peripherals_pcnt_deinit(&self->unit); + if (self->handle) { + timer_deinit(TIMER_GROUP_0, TIMER_0); + esp_intr_free(self->handle); + self->handle = NULL; + } +} + +uint32_t common_hal_frequencyio_frequencyin_get_item(frequencyio_frequencyin_obj_t* self) { + return (1000 / (self->capture_period / self->frequency)); +} + +void common_hal_frequencyio_frequencyin_pause(frequencyio_frequencyin_obj_t* self) { + pcnt_counter_pause(self->unit); + timer_pause(TIMER_GROUP_0, TIMER_0); +} + +void common_hal_frequencyio_frequencyin_resume(frequencyio_frequencyin_obj_t* self) { + pcnt_counter_resume(self->unit); + timer_start(TIMER_GROUP_0, TIMER_0); +} + +void common_hal_frequencyio_frequencyin_clear(frequencyio_frequencyin_obj_t* self) { + self->frequency = 0; + pcnt_counter_clear(self->unit); + timer_set_counter_value(TIMER_GROUP_0, TIMER_0, 0); +} + +uint16_t common_hal_frequencyio_frequencyin_get_capture_period(frequencyio_frequencyin_obj_t *self) { + return self->capture_period; +} + +void common_hal_frequencyio_frequencyin_set_capture_period(frequencyio_frequencyin_obj_t *self, uint16_t capture_period) { + if ((capture_period == 0) || (capture_period > 500)) { + mp_raise_ValueError(translate("Invalid capture period. Valid range: 1 - 500")); + } + self->capture_period = capture_period; + common_hal_frequencyio_frequencyin_clear(self); + timer_set_alarm_value(TIMER_GROUP_0, TIMER_0, capture_period * 1000000); +} diff --git a/ports/esp32s2/common-hal/frequencyio/FrequencyIn.h b/ports/esp32s2/common-hal/frequencyio/FrequencyIn.h new file mode 100644 index 0000000000..01e617d13a --- /dev/null +++ b/ports/esp32s2/common-hal/frequencyio/FrequencyIn.h @@ -0,0 +1,43 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 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_ESP32S2_COMMON_HAL_FREQUENCYIO_FREQUENCYIN_H +#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_FREQUENCYIO_FREQUENCYIN_H + +#include "py/obj.h" +#include "driver/timer.h" +#include "peripherals/pcnt.h" + +typedef struct { + mp_obj_base_t base; + pcnt_unit_t unit; + intr_handle_t handle; + uint8_t pin; + uint32_t frequency; + uint16_t capture_period; +} frequencyio_frequencyin_obj_t; + +#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_FREQUENCYIO_FREQUENCYIN_H diff --git a/ports/esp32s2/common-hal/frequencyio/__init__.c b/ports/esp32s2/common-hal/frequencyio/__init__.c new file mode 100644 index 0000000000..487814bd07 --- /dev/null +++ b/ports/esp32s2/common-hal/frequencyio/__init__.c @@ -0,0 +1 @@ +// No ferquencyio module functions. diff --git a/ports/esp32s2/mpconfigport.mk b/ports/esp32s2/mpconfigport.mk index 4579b95ab6..a84965a6a1 100644 --- a/ports/esp32s2/mpconfigport.mk +++ b/ports/esp32s2/mpconfigport.mk @@ -18,7 +18,7 @@ CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_AUDIOIO = 0 CIRCUITPY_CANIO = 1 CIRCUITPY_COUNTIO = 1 -CIRCUITPY_FREQUENCYIO = 0 +CIRCUITPY_FREQUENCYIO = 1 CIRCUITPY_I2CPERIPHERAL = 0 CIRCUITPY_ROTARYIO = 1 CIRCUITPY_NVM = 0 From d4ab00f734203d358299508c01378d97ddf9d40f Mon Sep 17 00:00:00 2001 From: BennyE Date: Mon, 16 Nov 2020 00:31:06 +0100 Subject: [PATCH 103/148] Set station mode early to avoid SoftAP on startup --- ports/esp32s2/common-hal/wifi/Radio.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ports/esp32s2/common-hal/wifi/Radio.c b/ports/esp32s2/common-hal/wifi/Radio.c index 275bae31af..1945da207b 100644 --- a/ports/esp32s2/common-hal/wifi/Radio.c +++ b/ports/esp32s2/common-hal/wifi/Radio.c @@ -72,6 +72,8 @@ void common_hal_wifi_radio_set_enabled(wifi_radio_obj_t *self, bool enabled) { return; } if (!self->started && enabled) { + // esp_wifi_start() would default to soft-AP, thus setting it to station + ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA)); ESP_ERROR_CHECK(esp_wifi_start()); self->started = true; return; From 2bec02738fb7eacaaea710bd448b98a418eb2693 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Mon, 16 Nov 2020 11:44:11 +0530 Subject: [PATCH 104/148] move interrupt handler to iram --- ports/esp32s2/common-hal/frequencyio/FrequencyIn.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ports/esp32s2/common-hal/frequencyio/FrequencyIn.c b/ports/esp32s2/common-hal/frequencyio/FrequencyIn.c index fce1d34d87..ec7ebb21ac 100644 --- a/ports/esp32s2/common-hal/frequencyio/FrequencyIn.c +++ b/ports/esp32s2/common-hal/frequencyio/FrequencyIn.c @@ -35,7 +35,7 @@ #include "common-hal/microcontroller/Pin.h" -static void frequencyin_interrupt_handler(void *self_in) { +static void IRAM_ATTR frequencyin_interrupt_handler(void *self_in) { frequencyio_frequencyin_obj_t* self = self_in; // get counter value int16_t count; @@ -44,6 +44,10 @@ static void frequencyin_interrupt_handler(void *self_in) { // reset counter pcnt_counter_clear(self->unit); + + // reset interrupt + TIMERG0.int_clr.t0 = 1; + TIMERG0.hw_timer[0].config.alarm_en = 1; } static void init_timer(frequencyio_frequencyin_obj_t* self, uint16_t capture_period) { @@ -62,7 +66,7 @@ static void init_timer(frequencyio_frequencyin_obj_t* self, uint16_t capture_per timer_set_counter_value(TIMER_GROUP_0, TIMER_0, 0); timer_set_alarm_value(TIMER_GROUP_0, TIMER_0, capture_period * 1000000); timer_enable_intr(TIMER_GROUP_0, TIMER_0); - timer_isr_register(TIMER_GROUP_0, TIMER_0, &frequencyin_interrupt_handler, (void *)self, 0, &self->handle); + timer_isr_register(TIMER_GROUP_0, TIMER_0, frequencyin_interrupt_handler, (void *)self, ESP_INTR_FLAG_IRAM, &self->handle); // Start timer timer_start(TIMER_GROUP_0, TIMER_0); From f2824f6a68b3d326e0f4a137880e08147a0074d2 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Mon, 16 Nov 2020 12:55:55 +0530 Subject: [PATCH 105/148] update frequency measurement --- ports/esp32s2/common-hal/frequencyio/FrequencyIn.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ports/esp32s2/common-hal/frequencyio/FrequencyIn.c b/ports/esp32s2/common-hal/frequencyio/FrequencyIn.c index ec7ebb21ac..bdbe782add 100644 --- a/ports/esp32s2/common-hal/frequencyio/FrequencyIn.c +++ b/ports/esp32s2/common-hal/frequencyio/FrequencyIn.c @@ -84,12 +84,9 @@ void common_hal_frequencyio_frequencyin_construct(frequencyio_frequencyin_obj_t* .pulse_gpio_num = pin->number, .ctrl_gpio_num = PCNT_PIN_NOT_USED, .channel = PCNT_CHANNEL_0, - .lctrl_mode = PCNT_MODE_DISABLE, - .hctrl_mode = PCNT_MODE_KEEP, + // What to do on the positive / negative edge of pulse input? .pos_mode = PCNT_COUNT_INC, // count both rising and falling edges .neg_mode = PCNT_COUNT_INC, - .counter_h_lim = 0, - .counter_l_lim = 0, }; // Initialize PCNT unit @@ -129,7 +126,7 @@ void common_hal_frequencyio_frequencyin_deinit(frequencyio_frequencyin_obj_t* se } uint32_t common_hal_frequencyio_frequencyin_get_item(frequencyio_frequencyin_obj_t* self) { - return (1000 / (self->capture_period / self->frequency)); + return self->frequency; } void common_hal_frequencyio_frequencyin_pause(frequencyio_frequencyin_obj_t* self) { From 0cd951fb73198f5c3dd03ea0463382edac0d3d4d Mon Sep 17 00:00:00 2001 From: root Date: Mon, 16 Nov 2020 10:36:05 -0600 Subject: [PATCH 106/148] Prevent exceptions from accumulating in REPL --- py/obj.c | 1 + 1 file changed, 1 insertion(+) diff --git a/py/obj.c b/py/obj.c index 9dc0cf4749..315e816e0b 100644 --- a/py/obj.c +++ b/py/obj.c @@ -125,6 +125,7 @@ void mp_obj_print_exception(const mp_print_t *print, mp_obj_t exc) { mp_printf(print, decompressed_block, block); } } + mp_obj_exception_clear_traceback(exc); } } mp_obj_print_helper(print, exc, PRINT_EXC); From 18e463cca538ed80f03ce9eda0e2ff757f1ba8f4 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Mon, 16 Nov 2020 23:32:22 +0530 Subject: [PATCH 107/148] add pcnt overflow handler & clean-up --- .../common-hal/frequencyio/FrequencyIn.c | 91 +++++++++++-------- .../common-hal/frequencyio/FrequencyIn.h | 3 +- 2 files changed, 57 insertions(+), 37 deletions(-) diff --git a/ports/esp32s2/common-hal/frequencyio/FrequencyIn.c b/ports/esp32s2/common-hal/frequencyio/FrequencyIn.c index bdbe782add..20d744139d 100644 --- a/ports/esp32s2/common-hal/frequencyio/FrequencyIn.c +++ b/ports/esp32s2/common-hal/frequencyio/FrequencyIn.c @@ -26,16 +26,21 @@ #include "shared-bindings/frequencyio/FrequencyIn.h" -#include - #include "py/runtime.h" -#include "supervisor/shared/tick.h" -#include "shared-bindings/time/__init__.h" +static void IRAM_ATTR pcnt_overflow_handler(void *self_in) { + frequencyio_frequencyin_obj_t* self = self_in; + // reset counter + pcnt_counter_clear(self->unit); -#include "common-hal/microcontroller/Pin.h" + // increase multiplier + self->multiplier++; -static void IRAM_ATTR frequencyin_interrupt_handler(void *self_in) { + // reset interrupt + PCNT.int_clr.val = BIT(self->unit); +} + +static void IRAM_ATTR timer_interrupt_handler(void *self_in) { frequencyio_frequencyin_obj_t* self = self_in; // get counter value int16_t count; @@ -50,9 +55,41 @@ static void IRAM_ATTR frequencyin_interrupt_handler(void *self_in) { TIMERG0.hw_timer[0].config.alarm_en = 1; } -static void init_timer(frequencyio_frequencyin_obj_t* self, uint16_t capture_period) { +static void init_pcnt(frequencyio_frequencyin_obj_t* self) { + // Prepare configuration for the PCNT unit + const pcnt_config_t pcnt_config = { + // Set PCNT input signal and control GPIOs + .pulse_gpio_num = self->pin, + .ctrl_gpio_num = PCNT_PIN_NOT_USED, + .channel = PCNT_CHANNEL_0, + // What to do on the positive / negative edge of pulse input? + .pos_mode = PCNT_COUNT_INC, // count both rising and falling edges + .neg_mode = PCNT_COUNT_INC, + // Set counter limit + .counter_h_lim = INT16_MAX, + .counter_l_lim = 0, + }; + + // Initialize PCNT unit + const int8_t unit = peripherals_pcnt_init(pcnt_config); + if (unit == -1) { + mp_raise_RuntimeError(translate("All PCNT units in use")); + } + + // set the GPIO back to high-impedance, as pcnt_unit_config sets it as pull-up + gpio_set_pull_mode(self->pin, GPIO_FLOATING); + + self->unit = (pcnt_unit_t)unit; + + // enable pcnt interrupt + pcnt_event_enable(self->unit, PCNT_EVT_H_LIM); + pcnt_isr_register(pcnt_overflow_handler, (void *)self, ESP_INTR_FLAG_IRAM, &self->handle); + pcnt_intr_enable(self->unit); +} + +static void init_timer(frequencyio_frequencyin_obj_t* self) { // Prepare configuration for the timer module - timer_config_t config = { + const timer_config_t config = { .alarm_en = true, .counter_en = false, .intr_type = TIMER_INTR_LEVEL, @@ -64,9 +101,9 @@ static void init_timer(frequencyio_frequencyin_obj_t* self, uint16_t capture_per // Initialize timer module timer_init(TIMER_GROUP_0, TIMER_0, &config); timer_set_counter_value(TIMER_GROUP_0, TIMER_0, 0); - timer_set_alarm_value(TIMER_GROUP_0, TIMER_0, capture_period * 1000000); + timer_set_alarm_value(TIMER_GROUP_0, TIMER_0, self->capture_period * 1000000); + timer_isr_register(TIMER_GROUP_0, TIMER_0, timer_interrupt_handler, (void *)self, ESP_INTR_FLAG_IRAM, &self->handle); timer_enable_intr(TIMER_GROUP_0, TIMER_0); - timer_isr_register(TIMER_GROUP_0, TIMER_0, frequencyin_interrupt_handler, (void *)self, ESP_INTR_FLAG_IRAM, &self->handle); // Start timer timer_start(TIMER_GROUP_0, TIMER_0); @@ -78,33 +115,15 @@ void common_hal_frequencyio_frequencyin_construct(frequencyio_frequencyin_obj_t* mp_raise_ValueError(translate("Invalid capture period. Valid range: 1 - 500")); } - // Prepare configuration for the PCNT unit - const pcnt_config_t pcnt_config = { - // Set PCNT input signal and control GPIOs - .pulse_gpio_num = pin->number, - .ctrl_gpio_num = PCNT_PIN_NOT_USED, - .channel = PCNT_CHANNEL_0, - // What to do on the positive / negative edge of pulse input? - .pos_mode = PCNT_COUNT_INC, // count both rising and falling edges - .neg_mode = PCNT_COUNT_INC, - }; - - // Initialize PCNT unit - const int8_t unit = peripherals_pcnt_init(pcnt_config); - if (unit == -1) { - mp_raise_RuntimeError(translate("All PCNT units in use")); - } - - // set the GPIO back to high-impedance, as pcnt_unit_config sets it as pull-up - gpio_set_pull_mode(pin->number, GPIO_FLOATING); - - // initialize timer - init_timer(self, capture_period); - self->pin = pin->number; - self->unit = (pcnt_unit_t)unit; + self->handle = NULL; + self->multiplier = 0; self->capture_period = capture_period; + // initialize pcnt and timer + init_pcnt(self); + init_timer(self); + claim_pin(pin); } @@ -118,15 +137,15 @@ void common_hal_frequencyio_frequencyin_deinit(frequencyio_frequencyin_obj_t* se } reset_pin_number(self->pin); peripherals_pcnt_deinit(&self->unit); + timer_deinit(TIMER_GROUP_0, TIMER_0); if (self->handle) { - timer_deinit(TIMER_GROUP_0, TIMER_0); esp_intr_free(self->handle); self->handle = NULL; } } uint32_t common_hal_frequencyio_frequencyin_get_item(frequencyio_frequencyin_obj_t* self) { - return self->frequency; + return (self->frequency + (self->multiplier * INT16_MAX)); } void common_hal_frequencyio_frequencyin_pause(frequencyio_frequencyin_obj_t* self) { diff --git a/ports/esp32s2/common-hal/frequencyio/FrequencyIn.h b/ports/esp32s2/common-hal/frequencyio/FrequencyIn.h index 01e617d13a..ce3bf8f2f9 100644 --- a/ports/esp32s2/common-hal/frequencyio/FrequencyIn.h +++ b/ports/esp32s2/common-hal/frequencyio/FrequencyIn.h @@ -36,7 +36,8 @@ typedef struct { pcnt_unit_t unit; intr_handle_t handle; uint8_t pin; - uint32_t frequency; + uint8_t multiplier; + uint16_t frequency; uint16_t capture_period; } frequencyio_frequencyin_obj_t; From 9c4b6c34b8cfacdc86074df261a4eac0fc23b129 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 16 Nov 2020 16:03:29 -0600 Subject: [PATCH 108/148] see what happens if workflows move to ubuntu 20.04 --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c83f37e6ed..bd0dea5cf8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,7 +14,7 @@ on: jobs: test: - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 steps: - name: Dump GitHub context env: @@ -165,7 +165,7 @@ jobs: build-arm: - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 needs: test strategy: fail-fast: false @@ -368,7 +368,7 @@ jobs: if: github.event_name == 'push' || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested')) build-riscv: - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 needs: test strategy: fail-fast: false From 3b27810a3ab6c15d0612b986e6f6086aecccdbcb Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Tue, 17 Nov 2020 00:02:02 +0100 Subject: [PATCH 109/148] 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 | 15 +++++++++++++-- locale/cs.po | 15 +++++++++++++-- locale/de_DE.po | 15 +++++++++++++-- locale/el.po | 15 +++++++++++++-- locale/es.po | 15 +++++++++++++-- locale/fil.po | 15 +++++++++++++-- locale/fr.po | 15 +++++++++++++-- locale/hi.po | 15 +++++++++++++-- locale/it_IT.po | 15 +++++++++++++-- locale/ja.po | 15 +++++++++++++-- locale/ko.po | 15 +++++++++++++-- locale/nl.po | 15 +++++++++++++-- locale/pl.po | 15 +++++++++++++-- locale/pt_BR.po | 15 +++++++++++++-- locale/sv.po | 15 +++++++++++++-- locale/zh_Latn_pinyin.po | 15 +++++++++++++-- 16 files changed, 208 insertions(+), 32 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 90e416b3b9..d6672b1e40 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-04 21:18+0530\n" +"POT-Creation-Date: 2020-11-10 15:30+0530\n" "PO-Revision-Date: 2020-10-10 23:51+0000\n" "Last-Translator: oon arfiandwi \n" "Language-Team: LANGUAGE \n" @@ -300,7 +300,8 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "Semua perangkat I2C sedang digunakan" -#: ports/esp32s2/peripherals/pcnt_handler.c +#: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "" @@ -1018,6 +1019,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "Ukuran penyangga salah" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "Initialization failed due to lack of memory" +msgstr "" + #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" msgstr "" @@ -3254,6 +3259,7 @@ msgstr "" msgid "pow() with 3 arguments requires integers" msgstr "" +#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h @@ -3469,6 +3475,7 @@ msgstr "" msgid "time.struct_time() takes a 9-sequence" msgstr "" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "" @@ -3653,6 +3660,10 @@ msgstr "" msgid "vectors must have same lengths" msgstr "" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "watchdog not initialized" +msgstr "" + #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" msgstr "" diff --git a/locale/cs.po b/locale/cs.po index f02d31e4dd..bde3a20b87 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-04 21:18+0530\n" +"POT-Creation-Date: 2020-11-10 15:30+0530\n" "PO-Revision-Date: 2020-05-24 03:22+0000\n" "Last-Translator: dronecz \n" "Language-Team: LANGUAGE \n" @@ -300,7 +300,8 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "" -#: ports/esp32s2/peripherals/pcnt_handler.c +#: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "" @@ -1001,6 +1002,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "Initialization failed due to lack of memory" +msgstr "" + #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" msgstr "" @@ -3210,6 +3215,7 @@ msgstr "" msgid "pow() with 3 arguments requires integers" msgstr "" +#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h @@ -3425,6 +3431,7 @@ msgstr "" msgid "time.struct_time() takes a 9-sequence" msgstr "" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "" @@ -3608,6 +3615,10 @@ msgstr "" msgid "vectors must have same lengths" msgstr "" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "watchdog not initialized" +msgstr "" + #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index c2cb265508..dabc486595 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-04 21:18+0530\n" +"POT-Creation-Date: 2020-11-10 15:30+0530\n" "PO-Revision-Date: 2020-06-16 18:24+0000\n" "Last-Translator: Andreas Buchen \n" "Language: de_DE\n" @@ -299,7 +299,8 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "Alle I2C-Peripheriegeräte sind in Benutzung" -#: ports/esp32s2/peripherals/pcnt_handler.c +#: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "" @@ -1018,6 +1019,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "Inkorrekte Puffergröße" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "Initialization failed due to lack of memory" +msgstr "" + #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" msgstr "" @@ -3293,6 +3298,7 @@ msgstr "pow() drittes Argument darf nicht 0 sein" msgid "pow() with 3 arguments requires integers" msgstr "pow () mit 3 Argumenten erfordert Integer" +#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h @@ -3511,6 +3517,7 @@ msgstr "threshold muss im Intervall 0-65536 liegen" msgid "time.struct_time() takes a 9-sequence" msgstr "time.struct_time() nimmt eine 9-Sequenz an" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "Das Zeitlimit hat den maximal zulässigen Wert überschritten" @@ -3698,6 +3705,10 @@ msgstr "value_count muss größer als 0 sein" msgid "vectors must have same lengths" msgstr "Vektoren müssen die selbe Länge haben" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "watchdog not initialized" +msgstr "" + #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" msgstr "" diff --git a/locale/el.po b/locale/el.po index 4d7bff1930..0d35c20ceb 100644 --- a/locale/el.po +++ b/locale/el.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-04 21:18+0530\n" +"POT-Creation-Date: 2020-11-10 15:30+0530\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -295,7 +295,8 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "" -#: ports/esp32s2/peripherals/pcnt_handler.c +#: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "" @@ -996,6 +997,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "Initialization failed due to lack of memory" +msgstr "" + #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" msgstr "" @@ -3205,6 +3210,7 @@ msgstr "" msgid "pow() with 3 arguments requires integers" msgstr "" +#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h @@ -3420,6 +3426,7 @@ msgstr "" msgid "time.struct_time() takes a 9-sequence" msgstr "" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "" @@ -3603,6 +3610,10 @@ msgstr "" msgid "vectors must have same lengths" msgstr "" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "watchdog not initialized" +msgstr "" + #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" msgstr "" diff --git a/locale/es.po b/locale/es.po index c5e2ad75f0..bdb4b68a5d 100644 --- a/locale/es.po +++ b/locale/es.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-04 21:18+0530\n" +"POT-Creation-Date: 2020-11-10 15:30+0530\n" "PO-Revision-Date: 2020-11-15 16:28+0000\n" "Last-Translator: RubenD \n" "Language-Team: \n" @@ -303,7 +303,8 @@ msgstr "Todos los periféricos CAN están en uso" msgid "All I2C peripherals are in use" msgstr "Todos los periféricos I2C están siendo usados" -#: ports/esp32s2/peripherals/pcnt_handler.c +#: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "Todas las unidades PCNT en uso" @@ -1019,6 +1020,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "Tamaño incorrecto del buffer" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "Initialization failed due to lack of memory" +msgstr "" + #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" msgstr "La entrada está durando mucho tiempo" @@ -3281,6 +3286,7 @@ msgstr "el 3er argumento de pow() no puede ser 0" msgid "pow() with 3 arguments requires integers" msgstr "pow() con 3 argumentos requiere enteros" +#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h @@ -3498,6 +3504,7 @@ msgstr "limite debe ser en el rango 0-65536" msgid "time.struct_time() takes a 9-sequence" msgstr "time.struct_time() toma un sequencio 9" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "" @@ -3682,6 +3689,10 @@ msgstr "value_count debe ser > 0" msgid "vectors must have same lengths" msgstr "los vectores deben tener el mismo tamaño" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "watchdog not initialized" +msgstr "" + #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" msgstr "el tiempo de espera del perro guardián debe ser mayor a 0" diff --git a/locale/fil.po b/locale/fil.po index 93f41a88eb..c74e13c6c8 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-04 21:18+0530\n" +"POT-Creation-Date: 2020-11-10 15:30+0530\n" "PO-Revision-Date: 2018-12-20 22:15-0800\n" "Last-Translator: Timothy \n" "Language-Team: fil\n" @@ -297,7 +297,8 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "Lahat ng I2C peripherals ginagamit" -#: ports/esp32s2/peripherals/pcnt_handler.c +#: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "" @@ -1011,6 +1012,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "Initialization failed due to lack of memory" +msgstr "" + #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" msgstr "" @@ -3256,6 +3261,7 @@ msgstr "pow() 3rd argument ay hindi maaring 0" msgid "pow() with 3 arguments requires integers" msgstr "pow() na may 3 argumento kailangan ng integers" +#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h @@ -3474,6 +3480,7 @@ msgstr "ang threshold ay dapat sa range 0-65536" msgid "time.struct_time() takes a 9-sequence" msgstr "time.struct_time() kumukuha ng 9-sequence" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "" @@ -3658,6 +3665,10 @@ msgstr "" msgid "vectors must have same lengths" msgstr "" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "watchdog not initialized" +msgstr "" + #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" msgstr "" diff --git a/locale/fr.po b/locale/fr.po index 5d4ca75d5c..a15bbb8d50 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-04 21:18+0530\n" +"POT-Creation-Date: 2020-11-10 15:30+0530\n" "PO-Revision-Date: 2020-11-15 16:28+0000\n" "Last-Translator: Antonin ENFRUN \n" "Language: fr\n" @@ -304,7 +304,8 @@ msgstr "Tous les périphériques CAN sont utilisés" msgid "All I2C peripherals are in use" msgstr "Tous les périphériques I2C sont utilisés" -#: ports/esp32s2/peripherals/pcnt_handler.c +#: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "Toutes les unités PCNT sont utilisées" @@ -1024,6 +1025,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "Taille de tampon incorrecte" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "Initialization failed due to lack of memory" +msgstr "" + #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" msgstr "L'entrée prend trop de temps" @@ -3305,6 +3310,7 @@ msgstr "le 3e argument de pow() ne peut être 0" msgid "pow() with 3 arguments requires integers" msgstr "pow() avec 3 arguments nécessite des entiers" +#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h @@ -3523,6 +3529,7 @@ msgstr "le seuil doit être dans la gamme 0-65536" msgid "time.struct_time() takes a 9-sequence" msgstr "time.struct_time() prend une séquence de longueur 9" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "le délai d'expiration a dépassé la valeur maximale prise en charge" @@ -3706,6 +3713,10 @@ msgstr "'value_count' doit être > 0" msgid "vectors must have same lengths" msgstr "les vecteurs doivent avoir la même longueur" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "watchdog not initialized" +msgstr "" + #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" msgstr "watchdog timeout doit être supérieur à 0" diff --git a/locale/hi.po b/locale/hi.po index aea2b3f0c4..6c49e1f01f 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-04 21:18+0530\n" +"POT-Creation-Date: 2020-11-10 15:30+0530\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -295,7 +295,8 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "" -#: ports/esp32s2/peripherals/pcnt_handler.c +#: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "" @@ -996,6 +997,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "Initialization failed due to lack of memory" +msgstr "" + #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" msgstr "" @@ -3205,6 +3210,7 @@ msgstr "" msgid "pow() with 3 arguments requires integers" msgstr "" +#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h @@ -3420,6 +3426,7 @@ msgstr "" msgid "time.struct_time() takes a 9-sequence" msgstr "" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "" @@ -3603,6 +3610,10 @@ msgstr "" msgid "vectors must have same lengths" msgstr "" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "watchdog not initialized" +msgstr "" + #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index 603cf9fd08..fc0f016752 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-04 21:18+0530\n" +"POT-Creation-Date: 2020-11-10 15:30+0530\n" "PO-Revision-Date: 2018-10-02 16:27+0200\n" "Last-Translator: Enrico Paganin \n" "Language-Team: \n" @@ -296,7 +296,8 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "Tutte le periferiche I2C sono in uso" -#: ports/esp32s2/peripherals/pcnt_handler.c +#: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "" @@ -1011,6 +1012,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "Initialization failed due to lack of memory" +msgstr "" + #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" msgstr "" @@ -3263,6 +3268,7 @@ msgstr "il terzo argomento di pow() non può essere 0" msgid "pow() with 3 arguments requires integers" msgstr "pow() con 3 argomenti richiede interi" +#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h @@ -3481,6 +3487,7 @@ msgstr "la soglia deve essere nell'intervallo 0-65536" msgid "time.struct_time() takes a 9-sequence" msgstr "" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "" @@ -3665,6 +3672,10 @@ msgstr "" msgid "vectors must have same lengths" msgstr "" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "watchdog not initialized" +msgstr "" + #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" msgstr "" diff --git a/locale/ja.po b/locale/ja.po index 80486dc210..f3dfc6c900 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-04 21:18+0530\n" +"POT-Creation-Date: 2020-11-10 15:30+0530\n" "PO-Revision-Date: 2020-11-12 22:51+0000\n" "Last-Translator: sporeball \n" "Language-Team: none\n" @@ -302,7 +302,8 @@ msgstr "全てのCAN周辺機器が使用中" msgid "All I2C peripherals are in use" msgstr "全てのI2C周辺機器が使用中" -#: ports/esp32s2/peripherals/pcnt_handler.c +#: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "" @@ -1011,6 +1012,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "バッファサイズが正しくありません" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "Initialization failed due to lack of memory" +msgstr "" + #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" msgstr "" @@ -3237,6 +3242,7 @@ msgstr "pow()の3つ目の引数は0にできません" msgid "pow() with 3 arguments requires integers" msgstr "pow()の第3引数には整数が必要" +#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h @@ -3453,6 +3459,7 @@ msgstr "threshouldは0から65536まで" msgid "time.struct_time() takes a 9-sequence" msgstr "time.struct_time()は9要素のシーケンスを受け取ります" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "タイムアウト長は対応する最大値を超えています" @@ -3636,6 +3643,10 @@ msgstr "value_countは0より大きくなければなりません" msgid "vectors must have same lengths" msgstr "" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "watchdog not initialized" +msgstr "" + #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" msgstr "watchdogのtimeoutは0以上でなければなりません" diff --git a/locale/ko.po b/locale/ko.po index c9215fb85e..bfa49ab70c 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-04 21:18+0530\n" +"POT-Creation-Date: 2020-11-10 15:30+0530\n" "PO-Revision-Date: 2020-10-05 12:12+0000\n" "Last-Translator: Michal Čihař \n" "Language-Team: LANGUAGE \n" @@ -298,7 +298,8 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "사용중인 모든 I2C주변 기기" -#: ports/esp32s2/peripherals/pcnt_handler.c +#: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "" @@ -1001,6 +1002,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "Initialization failed due to lack of memory" +msgstr "" + #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" msgstr "" @@ -3211,6 +3216,7 @@ msgstr "" msgid "pow() with 3 arguments requires integers" msgstr "" +#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h @@ -3426,6 +3432,7 @@ msgstr "" msgid "time.struct_time() takes a 9-sequence" msgstr "" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "" @@ -3609,6 +3616,10 @@ msgstr "" msgid "vectors must have same lengths" msgstr "" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "watchdog not initialized" +msgstr "" + #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index cfe2193bba..7625cdb26b 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-04 21:18+0530\n" +"POT-Creation-Date: 2020-11-10 15:30+0530\n" "PO-Revision-Date: 2020-10-27 16:47+0000\n" "Last-Translator: Jelle Jager \n" "Language-Team: none\n" @@ -300,7 +300,8 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "Alle I2C peripherals zijn in gebruik" -#: ports/esp32s2/peripherals/pcnt_handler.c +#: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "" @@ -1013,6 +1014,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "Incorrecte buffer grootte" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "Initialization failed due to lack of memory" +msgstr "" + #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" msgstr "Invoer duurt te lang" @@ -3270,6 +3275,7 @@ msgstr "derde argument van pow() mag geen 0 zijn" msgid "pow() with 3 arguments requires integers" msgstr "pow() met 3 argumenten vereist integers" +#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h @@ -3487,6 +3493,7 @@ msgstr "drempelwaarde moet in het bereik 0-65536 liggen" msgid "time.struct_time() takes a 9-sequence" msgstr "time.struct_time() accepteert een 9-rij" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "time-outduur is groter dan de ondersteunde maximale waarde" @@ -3670,6 +3677,10 @@ msgstr "value_count moet groter dan 0 zijn" msgid "vectors must have same lengths" msgstr "vectoren moeten van gelijke lengte zijn" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "watchdog not initialized" +msgstr "" + #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" msgstr "watchdog time-out moet groter zijn dan 0" diff --git a/locale/pl.po b/locale/pl.po index 623acd4c56..f04887e682 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-04 21:18+0530\n" +"POT-Creation-Date: 2020-11-10 15:30+0530\n" "PO-Revision-Date: 2020-11-11 19:13+0000\n" "Last-Translator: Maciej Stankiewicz \n" "Language-Team: pl\n" @@ -302,7 +302,8 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "Wszystkie peryferia I2C w użyciu" -#: ports/esp32s2/peripherals/pcnt_handler.c +#: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "" @@ -1011,6 +1012,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "Niewłaściwa wielkość bufora" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "Initialization failed due to lack of memory" +msgstr "" + #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" msgstr "" @@ -3229,6 +3234,7 @@ msgstr "trzeci argument pow() nie może być 0" msgid "pow() with 3 arguments requires integers" msgstr "trzyargumentowe pow() wymaga liczb całkowitych" +#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h @@ -3445,6 +3451,7 @@ msgstr "threshold musi być w zakresie 0-65536" msgid "time.struct_time() takes a 9-sequence" msgstr "time.struct_time() wymaga 9-elementowej sekwencji" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "" @@ -3628,6 +3635,10 @@ msgstr "value_count musi być > 0" msgid "vectors must have same lengths" msgstr "wektory muszą mieć identyczną długość" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "watchdog not initialized" +msgstr "" + #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" msgstr "" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 67b3dc8a7d..4918689795 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-04 21:18+0530\n" +"POT-Creation-Date: 2020-11-10 15:30+0530\n" "PO-Revision-Date: 2020-11-08 10:26+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" @@ -304,7 +304,8 @@ msgstr "Todos os periféricos CAN estão em uso" msgid "All I2C peripherals are in use" msgstr "Todos os periféricos I2C estão em uso" -#: ports/esp32s2/peripherals/pcnt_handler.c +#: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "Todas as unidades PCNT estão em uso" @@ -1022,6 +1023,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "O tamanho do buffer está incorreto" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "Initialization failed due to lack of memory" +msgstr "" + #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" msgstr "A entrada está demorando demais" @@ -3296,6 +3301,7 @@ msgstr "O terceiro argumento pow() não pode ser 0" msgid "pow() with 3 arguments requires integers" msgstr "o pow() com 3 argumentos requer números inteiros" +#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h @@ -3513,6 +3519,7 @@ msgstr "Limite deve estar no alcance de 0-65536" msgid "time.struct_time() takes a 9-sequence" msgstr "time.struct_time() leva uma sequência com 9" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "a duração do tempo limite excedeu o valor máximo suportado" @@ -3696,6 +3703,10 @@ msgstr "o value_count deve ser > 0" msgid "vectors must have same lengths" msgstr "os vetores devem ter os mesmos comprimentos" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "watchdog not initialized" +msgstr "" + #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" msgstr "o tempo limite do watchdog deve ser maior que 0" diff --git a/locale/sv.po b/locale/sv.po index 1a603e4961..55e6368ae5 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-04 21:18+0530\n" +"POT-Creation-Date: 2020-11-10 15:30+0530\n" "PO-Revision-Date: 2020-11-15 16:28+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" @@ -300,7 +300,8 @@ msgstr "All I2C-kringutrustning används" msgid "All I2C peripherals are in use" msgstr "All I2C-kringutrustning används" -#: ports/esp32s2/peripherals/pcnt_handler.c +#: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "Alla PCNT-enheter används" @@ -1011,6 +1012,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "Fel buffertstorlek" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "Initialization failed due to lack of memory" +msgstr "" + #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" msgstr "Indata tar för lång tid" @@ -3263,6 +3268,7 @@ msgstr "pow() 3: e argument kan inte vara 0" msgid "pow() with 3 arguments requires integers" msgstr "pow() med 3 argument kräver heltal" +#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h @@ -3480,6 +3486,7 @@ msgstr "tröskelvärdet måste ligga i intervallet 0-65536" msgid "time.struct_time() takes a 9-sequence" msgstr "time.struct_time() kräver en 9-sekvens" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "timeout-längd överskred det maximala värde som stöds" @@ -3663,6 +3670,10 @@ msgstr "value_count måste vara > 0" msgid "vectors must have same lengths" msgstr "vektorer måste ha samma längd" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "watchdog not initialized" +msgstr "" + #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" msgstr "watchdog timeout måste vara större än 0" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 2731ec4f5e..dd44aab939 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-04 21:18+0530\n" +"POT-Creation-Date: 2020-11-10 15:30+0530\n" "PO-Revision-Date: 2020-11-15 16:28+0000\n" "Last-Translator: hexthat \n" "Language-Team: Chinese Hanyu Pinyin\n" @@ -302,7 +302,8 @@ msgstr "suǒ yǒu CAN wài shè dōu zài shǐ yòng zhōng" msgid "All I2C peripherals are in use" msgstr "Suǒyǒu I2C wàiwéi qì zhèngzài shǐyòng" -#: ports/esp32s2/peripherals/pcnt_handler.c +#: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "suǒ yǒu zhèng zài shǐ yòng zhōng de PCNT dān yuán" @@ -1009,6 +1010,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "Huǎnchōng qū dàxiǎo bù zhèngquè" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "Initialization failed due to lack of memory" +msgstr "" + #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" msgstr "Shūrù shíjiānguò zhǎng" @@ -3252,6 +3257,7 @@ msgstr "pow() 3 cān shǔ bùnéng wéi 0" msgid "pow() with 3 arguments requires integers" msgstr "pow() yǒu 3 cānshù xūyào zhěngshù" +#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h @@ -3469,6 +3475,7 @@ msgstr "yùzhí bìxū zài fànwéi 0-65536" msgid "time.struct_time() takes a 9-sequence" msgstr "time.struct_time() xūyào 9 xùliè" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "chāoshí shíjiān chāoguò zuìdà zhīchí zhí" @@ -3652,6 +3659,10 @@ msgstr "zhí jìshù bìxū wèi > 0" msgid "vectors must have same lengths" msgstr "xiàngliàng bìxū jùyǒu xiāngtóng de chángdù" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "watchdog not initialized" +msgstr "" + #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" msgstr "kān mén gǒu chāoshí bìxū dàyú 0" From 7750b4d6712b410bd8ccc498e571297b4628884a Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 17 Nov 2020 07:37:07 -0600 Subject: [PATCH 110/148] actions: Disable pagination of 'aws' commands An anticipatory workaround for https://docs.aws.amazon.com/cli/latest/userguide/cliv2-migration.html#cliv2-migration-output-pager --- .github/workflows/build.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bd0dea5cf8..9c3c87b586 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -119,6 +119,7 @@ jobs: zip -9r circuitpython-stubs.zip circuitpython-stubs [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp circuitpython-stubs.zip s3://adafruit-circuit-python/bin/stubs/circuitpython-stubs-${{ env.CP_VERSION }}.zip --no-progress --region us-east-1 env: + AWS_PAGER: '' AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} if: github.event_name == 'push' || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested')) @@ -159,6 +160,7 @@ jobs: run: | [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross-macos-catalina-${{ env.CP_VERSION }} --no-progress --region us-east-1 env: + AWS_PAGER: '' AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} if: github.event_name == 'push' || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested')) @@ -363,6 +365,7 @@ jobs: - name: Upload to S3 run: "[ -z \"$AWS_ACCESS_KEY_ID\" ] || aws s3 cp bin/ s3://adafruit-circuit-python/bin/ --recursive --no-progress --region us-east-1" env: + AWS_PAGER: '' AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} if: github.event_name == 'push' || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested')) @@ -411,6 +414,7 @@ jobs: - name: Upload to S3 run: "[ -z \"$AWS_ACCESS_KEY_ID\" ] || aws s3 cp bin/ s3://adafruit-circuit-python/bin/ --recursive --no-progress --region us-east-1" env: + AWS_PAGER: '' AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} if: github.event_name == 'push' || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested')) @@ -505,6 +509,7 @@ jobs: - name: Upload to S3 run: "[ -z \"$AWS_ACCESS_KEY_ID\" ] || aws s3 cp bin/ s3://adafruit-circuit-python/bin/ --recursive --no-progress --region us-east-1" env: + AWS_PAGER: '' AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} if: github.event_name == 'push' || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested')) From a0d305042c335d55176a8f6951572b1a1b7629ba Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 17 Nov 2020 09:01:50 -0600 Subject: [PATCH 111/148] fix ubuntu-latest stragglers --- .github/workflows/build.yml | 2 +- .github/workflows/create_website_pr.yml | 2 +- .github/workflows/pre-commit.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9c3c87b586..f3e728a05c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -419,7 +419,7 @@ jobs: AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} if: github.event_name == 'push' || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested')) build-xtensa: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 needs: test strategy: fail-fast: false diff --git a/.github/workflows/create_website_pr.yml b/.github/workflows/create_website_pr.yml index 71959ffdcd..c8aca30e4a 100644 --- a/.github/workflows/create_website_pr.yml +++ b/.github/workflows/create_website_pr.yml @@ -10,7 +10,7 @@ on: jobs: website: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: Dump GitHub context env: diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index eac9bfe096..8caf56d268 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -11,7 +11,7 @@ on: jobs: pre-commit: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v1 - uses: actions/setup-python@v1 From 1bc770c3dc308b91184e8cab52f6f4cabdda99fc Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 17 Nov 2020 17:31:54 -0600 Subject: [PATCH 112/148] esp32s2: PulseIn: Fix supervisor tick enabling Before, there were two problems: * Even if a pulsein was never constructed, supervisor_disable_tick would occur during restart. This could cancel out a supervisor_enable_tick from someplace else, with unexpected results. * If two or more pulseins were constructed, each one would enable ticks, but only the last one deinited (or the reset routine) would disable, leaving ticks running indefinitely. In my testing, it seemed that this led to the board sometimes stopping when it should have auto-reloaded. --- ports/esp32s2/common-hal/pulseio/PulseIn.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ports/esp32s2/common-hal/pulseio/PulseIn.c b/ports/esp32s2/common-hal/pulseio/PulseIn.c index f7429ec12c..9feeea1479 100644 --- a/ports/esp32s2/common-hal/pulseio/PulseIn.c +++ b/ports/esp32s2/common-hal/pulseio/PulseIn.c @@ -77,7 +77,9 @@ void pulsein_reset(void) { for (size_t i = 0; i < RMT_CHANNEL_MAX; i++) { handles[i] = NULL; } - supervisor_disable_tick(); + if (refcount != 0) { + supervisor_disable_tick(); + } refcount = 0; } @@ -122,8 +124,10 @@ void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t* self, const mcu // start RMT RX, and enable ticks so the core doesn't turn off. rmt_rx_start(channel, true); - supervisor_enable_tick(); refcount++; + if (refcount == 1) { + supervisor_enable_tick(); + } } bool common_hal_pulseio_pulsein_deinited(pulseio_pulsein_obj_t* self) { From 9206925bf8d2e3d8220b59200ee50c3e4c8a64d2 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 17 Nov 2020 17:45:12 -0600 Subject: [PATCH 113/148] esp32s2: port_get_raw_ticks: Use a more efficient, monotonic routine While trying to debug #3572, I noticed that I would frequently break in the midst of gettimeofday and that the routine get_adjusted_boot_time had to take and release locks. Furthermore, we don't want "adjusted" boot time, which could go forwards or backwards depending on the adjustment (such as setting the clock used by gettimeofday() to the network time) --- ports/esp32s2/supervisor/port.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index 47d0c7f463..876ad739d6 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -191,14 +191,14 @@ uint32_t port_get_saved_word(void) { } uint64_t port_get_raw_ticks(uint8_t* subticks) { - struct timeval tv_now; - gettimeofday(&tv_now, NULL); - // convert usec back to ticks - uint64_t all_subticks = (uint64_t)(tv_now.tv_usec * 2) / 71; + // Convert microseconds to subticks of 1/32768 seconds + // 32768/1000000 = 64/15625 in lowest terms + // this arithmetic overflows after 570 years + int64_t all_subticks = esp_timer_get_time() * 512 / 15625; if (subticks != NULL) { *subticks = all_subticks % 32; } - return (uint64_t)tv_now.tv_sec * 1024L + all_subticks / 32; + return all_subticks / 32; } // Enable 1/1024 second tick. From 8ae7b996278f379b6d40b2d3cf9729b5be53abd9 Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Mon, 16 Nov 2020 23:32:22 +0000 Subject: [PATCH 114/148] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (848 of 848 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 4918689795..4cf204ae81 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: 2020-11-10 15:30+0530\n" -"PO-Revision-Date: 2020-11-08 10:26+0000\n" +"PO-Revision-Date: 2020-11-18 00:28+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.3.2\n" +"X-Generator: Weblate 4.4-dev\n" #: main.c msgid "" @@ -447,7 +447,7 @@ msgstr "" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "Bit depth must be from 1 to 6 inclusive, not %d" -msgstr "" +msgstr "A profundidade dos bits deve ser de 1 até 6 inclusive, porém não %d" #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." @@ -1025,7 +1025,7 @@ msgstr "O tamanho do buffer está incorreto" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "Initialization failed due to lack of memory" -msgstr "" +msgstr "A inicialização falhou devido à falta de memória" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" @@ -3705,7 +3705,7 @@ msgstr "os vetores devem ter os mesmos comprimentos" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "watchdog not initialized" -msgstr "" +msgstr "o watchdog não foi inicializado" #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" From ff987e7496152c3175608570d90f36753b4c4670 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Wed, 18 Nov 2020 12:16:14 +0530 Subject: [PATCH 115/148] add timer peripheral --- ports/esp32s2/Makefile | 1 + ports/esp32s2/peripherals/timer.c | 73 +++++++++++++++++++++++++++++++ ports/esp32s2/peripherals/timer.h | 41 +++++++++++++++++ ports/esp32s2/supervisor/port.c | 23 ++++++---- 4 files changed, 129 insertions(+), 9 deletions(-) create mode 100644 ports/esp32s2/peripherals/timer.c create mode 100644 ports/esp32s2/peripherals/timer.h diff --git a/ports/esp32s2/Makefile b/ports/esp32s2/Makefile index 55d6e91d44..931e4d0639 100644 --- a/ports/esp32s2/Makefile +++ b/ports/esp32s2/Makefile @@ -188,6 +188,7 @@ SRC_C += \ lib/utils/pyexec.c \ lib/utils/stdout_helpers.c \ lib/utils/sys_stdio_mphal.c \ + peripherals/timer.c \ peripherals/pcnt.c \ peripherals/pins.c \ peripherals/rmt.c \ diff --git a/ports/esp32s2/peripherals/timer.c b/ports/esp32s2/peripherals/timer.c new file mode 100644 index 0000000000..3aee33dc50 --- /dev/null +++ b/ports/esp32s2/peripherals/timer.c @@ -0,0 +1,73 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 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 "peripherals/timer.h" + +#define TIMER_FREE 1 +#define TIMER_BUSY 0 + +static uint8_t timer_state[2][2]; + +void peripherals_timer_reset(void) { + timer_index_t timer; + for (uint8_t i = 0; i < 2; i++) { + for (uint8_t j = 0; j < 2; j++) { + if (timer_state[i][j] == TIMER_BUSY) { + timer.idx = (timer_idx_t)j; + timer.group = (timer_group_t)i; + timer_state[i][j] = TIMER_FREE; + peripherals_timer_deinit(&timer); + } + } + } +} + +void peripherals_timer_init(const timer_config_t * config, timer_index_t * timer) { + // get free timer + for (uint8_t i = 0; i < 2; i++) { + for (uint8_t j = 0; j < 2; j++) { + if (timer_state[i][j] == TIMER_FREE) { + timer->idx = (timer_idx_t)j; + timer->group = (timer_group_t)i; + timer_state[i][j] = TIMER_BUSY; + goto init_timer; + } else if (i == 1 && j == 1) { + timer->idx = TIMER_MAX; + timer->group = TIMER_GROUP_MAX; + return; + } + } + } + +init_timer: + // initialize timer module + timer_init(timer->group, timer->idx, config); + timer_set_counter_value(timer->group, timer->idx, 0); +} + +void peripherals_timer_deinit(timer_index_t * timer) { + timer_deinit(timer->group, timer->idx); +} diff --git a/ports/esp32s2/peripherals/timer.h b/ports/esp32s2/peripherals/timer.h new file mode 100644 index 0000000000..8c9ebd91c9 --- /dev/null +++ b/ports/esp32s2/peripherals/timer.h @@ -0,0 +1,41 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 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_ESP32S2_PERIPHERALS_TIMER_HANDLER_H +#define MICROPY_INCLUDED_ESP32S2_PERIPHERALS_TIMER_HANDLER_H + +#include "driver/timer.h" + +typedef struct { + timer_idx_t idx; + timer_group_t group; +} timer_index_t; + +extern void peripherals_timer_init(const timer_config_t * config, timer_index_t * timer); +extern void peripherals_timer_deinit(timer_index_t * timer); +extern void peripherals_timer_reset(void); + +#endif // MICROPY_INCLUDED_ESP32S2_PERIPHERALS_TIMER_HANDLER_H diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index ef032c4a76..4bf792516d 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -50,6 +50,7 @@ #include "peripherals/rmt.h" #include "peripherals/pcnt.h" +#include "peripherals/timer.h" #include "components/heap/include/esp_heap_caps.h" #include "components/soc/soc/esp32s2/include/soc/cache_memory.h" @@ -103,15 +104,6 @@ void reset_port(void) { analogout_reset(); #endif -#if CIRCUITPY_PULSEIO - esp32s2_peripherals_rmt_reset(); - pulsein_reset(); -#endif - -#if CIRCUITPY_PWMIO - pwmout_reset(); -#endif - #if CIRCUITPY_BUSIO i2c_reset(); spi_reset(); @@ -122,6 +114,19 @@ void reset_port(void) { peripherals_pcnt_reset(); #endif +#if CIRCUITPY_FREQUENCYIO + peripherals_timer_reset(); +#endif + +#if CIRCUITPY_PULSEIO + esp32s2_peripherals_rmt_reset(); + pulsein_reset(); +#endif + +#if CIRCUITPY_PWMIO + pwmout_reset(); +#endif + #if CIRCUITPY_RTC rtc_reset(); #endif From c457d373e18a5bcadec44e0815bea8b9beb30a97 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Wed, 18 Nov 2020 12:24:48 +0530 Subject: [PATCH 116/148] update init_timer & frequency calculation --- .../common-hal/frequencyio/FrequencyIn.c | 55 ++++++++++++------- .../common-hal/frequencyio/FrequencyIn.h | 5 +- 2 files changed, 38 insertions(+), 22 deletions(-) diff --git a/ports/esp32s2/common-hal/frequencyio/FrequencyIn.c b/ports/esp32s2/common-hal/frequencyio/FrequencyIn.c index 20d744139d..12d612abb0 100644 --- a/ports/esp32s2/common-hal/frequencyio/FrequencyIn.c +++ b/ports/esp32s2/common-hal/frequencyio/FrequencyIn.c @@ -29,7 +29,7 @@ #include "py/runtime.h" static void IRAM_ATTR pcnt_overflow_handler(void *self_in) { - frequencyio_frequencyin_obj_t* self = self_in; + frequencyio_frequencyin_obj_t * self = self_in; // reset counter pcnt_counter_clear(self->unit); @@ -41,18 +41,26 @@ static void IRAM_ATTR pcnt_overflow_handler(void *self_in) { } static void IRAM_ATTR timer_interrupt_handler(void *self_in) { - frequencyio_frequencyin_obj_t* self = self_in; + frequencyio_frequencyin_obj_t * self = self_in; // get counter value int16_t count; pcnt_get_counter_value(self->unit, &count); - self->frequency = count / 2.0 / self->capture_period; + self->frequency = ((count / 2.0) + (self->multiplier * INT16_MAX / 4.0)) / (self->capture_period); + + // reset multiplier + self->multiplier = 0; // reset counter pcnt_counter_clear(self->unit); // reset interrupt - TIMERG0.int_clr.t0 = 1; - TIMERG0.hw_timer[0].config.alarm_en = 1; + timg_dev_t *device = self->timer.group ? &(TIMERG1) : &(TIMERG0); + if (self->timer.idx) { + device->int_clr.t1 = 1; + } else { + device->int_clr.t0 = 1; + } + device->hw_timer[self->timer.idx].config.alarm_en = 1; } static void init_pcnt(frequencyio_frequencyin_obj_t* self) { @@ -70,7 +78,7 @@ static void init_pcnt(frequencyio_frequencyin_obj_t* self) { .counter_l_lim = 0, }; - // Initialize PCNT unit + // initialize PCNT const int8_t unit = peripherals_pcnt_init(pcnt_config); if (unit == -1) { mp_raise_RuntimeError(translate("All PCNT units in use")); @@ -98,15 +106,22 @@ static void init_timer(frequencyio_frequencyin_obj_t* self) { .divider = 80 // 1 us per tick }; - // Initialize timer module - timer_init(TIMER_GROUP_0, TIMER_0, &config); - timer_set_counter_value(TIMER_GROUP_0, TIMER_0, 0); - timer_set_alarm_value(TIMER_GROUP_0, TIMER_0, self->capture_period * 1000000); - timer_isr_register(TIMER_GROUP_0, TIMER_0, timer_interrupt_handler, (void *)self, ESP_INTR_FLAG_IRAM, &self->handle); - timer_enable_intr(TIMER_GROUP_0, TIMER_0); + // initialize Timer + peripherals_timer_init(&config, &self->timer); + if (self->timer.idx == TIMER_MAX || self->timer.group == TIMER_GROUP_MAX) { + mp_raise_RuntimeError(translate("All timers in use")); + } - // Start timer - timer_start(TIMER_GROUP_0, TIMER_0); + timer_idx_t idx = self->timer.idx; + timer_group_t group = self->timer.group; + + // enable timer interrupt + timer_set_alarm_value(group, idx, self->capture_period * 1000000); + timer_isr_register(group, idx, timer_interrupt_handler, (void *)self, ESP_INTR_FLAG_IRAM, &self->handle); + timer_enable_intr(group, idx); + + // start timer + timer_start(self->timer.group, self->timer.idx); } void common_hal_frequencyio_frequencyin_construct(frequencyio_frequencyin_obj_t* self, @@ -137,7 +152,7 @@ void common_hal_frequencyio_frequencyin_deinit(frequencyio_frequencyin_obj_t* se } reset_pin_number(self->pin); peripherals_pcnt_deinit(&self->unit); - timer_deinit(TIMER_GROUP_0, TIMER_0); + peripherals_timer_deinit(&self->timer); if (self->handle) { esp_intr_free(self->handle); self->handle = NULL; @@ -145,23 +160,23 @@ void common_hal_frequencyio_frequencyin_deinit(frequencyio_frequencyin_obj_t* se } uint32_t common_hal_frequencyio_frequencyin_get_item(frequencyio_frequencyin_obj_t* self) { - return (self->frequency + (self->multiplier * INT16_MAX)); + return self->frequency; } void common_hal_frequencyio_frequencyin_pause(frequencyio_frequencyin_obj_t* self) { pcnt_counter_pause(self->unit); - timer_pause(TIMER_GROUP_0, TIMER_0); + timer_pause(self->timer.group, self->timer.idx); } void common_hal_frequencyio_frequencyin_resume(frequencyio_frequencyin_obj_t* self) { pcnt_counter_resume(self->unit); - timer_start(TIMER_GROUP_0, TIMER_0); + timer_start(self->timer.group, self->timer.idx); } void common_hal_frequencyio_frequencyin_clear(frequencyio_frequencyin_obj_t* self) { self->frequency = 0; pcnt_counter_clear(self->unit); - timer_set_counter_value(TIMER_GROUP_0, TIMER_0, 0); + timer_set_counter_value(self->timer.group, self->timer.idx, 0); } uint16_t common_hal_frequencyio_frequencyin_get_capture_period(frequencyio_frequencyin_obj_t *self) { @@ -174,5 +189,5 @@ void common_hal_frequencyio_frequencyin_set_capture_period(frequencyio_frequency } self->capture_period = capture_period; common_hal_frequencyio_frequencyin_clear(self); - timer_set_alarm_value(TIMER_GROUP_0, TIMER_0, capture_period * 1000000); + timer_set_alarm_value(self->timer.group, self->timer.idx, capture_period * 1000000); } diff --git a/ports/esp32s2/common-hal/frequencyio/FrequencyIn.h b/ports/esp32s2/common-hal/frequencyio/FrequencyIn.h index ce3bf8f2f9..cf9d2ae538 100644 --- a/ports/esp32s2/common-hal/frequencyio/FrequencyIn.h +++ b/ports/esp32s2/common-hal/frequencyio/FrequencyIn.h @@ -28,16 +28,17 @@ #define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_FREQUENCYIO_FREQUENCYIN_H #include "py/obj.h" -#include "driver/timer.h" #include "peripherals/pcnt.h" +#include "peripherals/timer.h" typedef struct { mp_obj_base_t base; pcnt_unit_t unit; + timer_index_t timer; intr_handle_t handle; uint8_t pin; uint8_t multiplier; - uint16_t frequency; + uint32_t frequency; uint16_t capture_period; } frequencyio_frequencyin_obj_t; From 83d790ad8f7838d70269d0f0add6de1199198227 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 18 Nov 2020 17:45:42 -0600 Subject: [PATCH 117/148] esp32s2: don't delete the event loop .. it seems to make the esp-idf grumpy. --- ports/esp32s2/common-hal/wifi/__init__.c | 1 - 1 file changed, 1 deletion(-) diff --git a/ports/esp32s2/common-hal/wifi/__init__.c b/ports/esp32s2/common-hal/wifi/__init__.c index 2eb3719b4d..1b244dd2ff 100644 --- a/ports/esp32s2/common-hal/wifi/__init__.c +++ b/ports/esp32s2/common-hal/wifi/__init__.c @@ -143,7 +143,6 @@ void wifi_reset(void) { radio->handler_instance_got_ip)); ESP_ERROR_CHECK(esp_wifi_deinit()); esp_netif_destroy(radio->netif); - ESP_ERROR_CHECK(esp_event_loop_delete_default()); radio->netif = NULL; } From f61f8f999b5eeb8a545f5cea13b30ac5b3aeb04a Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 18 Nov 2020 18:06:31 -0600 Subject: [PATCH 118/148] EPaperDisplay: add rotation property untested, because I don't want to mess my magtag demo up :) but it builds --- shared-bindings/displayio/EPaperDisplay.c | 24 +++++++++++++++++++++++ shared-bindings/displayio/EPaperDisplay.h | 2 ++ shared-module/displayio/EPaperDisplay.c | 23 ++++++++++++++++++++++ 3 files changed, 49 insertions(+) diff --git a/shared-bindings/displayio/EPaperDisplay.c b/shared-bindings/displayio/EPaperDisplay.c index ebff640085..4f5c47acab 100644 --- a/shared-bindings/displayio/EPaperDisplay.c +++ b/shared-bindings/displayio/EPaperDisplay.c @@ -294,6 +294,29 @@ const mp_obj_property_t displayio_epaperdisplay_height_obj = { (mp_obj_t)&mp_const_none_obj}, }; +//| rotation: int +//| """The rotation of the display as an int in degrees.""" +//| +STATIC mp_obj_t displayio_epaperdisplay_obj_get_rotation(mp_obj_t self_in) { + displayio_epaperdisplay_obj_t *self = native_display(self_in); + return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_epaperdisplay_get_rotation(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(displayio_epaperdisplay_get_rotation_obj, displayio_epaperdisplay_obj_get_rotation); +STATIC mp_obj_t displayio_epaperdisplay_obj_set_rotation(mp_obj_t self_in, mp_obj_t value) { + displayio_epaperdisplay_obj_t *self = native_display(self_in); + common_hal_displayio_epaperdisplay_set_rotation(self, mp_obj_get_int(value)); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(displayio_epaperdisplay_set_rotation_obj, displayio_epaperdisplay_obj_set_rotation); + + +const mp_obj_property_t displayio_epaperdisplay_rotation_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&displayio_epaperdisplay_get_rotation_obj, + (mp_obj_t)&displayio_epaperdisplay_set_rotation_obj, + (mp_obj_t)&mp_const_none_obj}, +}; + //| bus: _DisplayBus //| """The bus being used by the display""" //| @@ -317,6 +340,7 @@ STATIC const mp_rom_map_elem_t displayio_epaperdisplay_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&displayio_epaperdisplay_width_obj) }, { MP_ROM_QSTR(MP_QSTR_height), MP_ROM_PTR(&displayio_epaperdisplay_height_obj) }, + { MP_ROM_QSTR(MP_QSTR_rotation), MP_ROM_PTR(&displayio_epaperdisplay_rotation_obj) }, { MP_ROM_QSTR(MP_QSTR_bus), MP_ROM_PTR(&displayio_epaperdisplay_bus_obj) }, { MP_ROM_QSTR(MP_QSTR_busy), MP_ROM_PTR(&displayio_epaperdisplay_busy_obj) }, { MP_ROM_QSTR(MP_QSTR_time_to_refresh), MP_ROM_PTR(&displayio_epaperdisplay_time_to_refresh_obj) }, diff --git a/shared-bindings/displayio/EPaperDisplay.h b/shared-bindings/displayio/EPaperDisplay.h index f785203a41..14d4f6aa9a 100644 --- a/shared-bindings/displayio/EPaperDisplay.h +++ b/shared-bindings/displayio/EPaperDisplay.h @@ -56,6 +56,8 @@ bool common_hal_displayio_epaperdisplay_get_busy(displayio_epaperdisplay_obj_t* uint16_t common_hal_displayio_epaperdisplay_get_width(displayio_epaperdisplay_obj_t* self); uint16_t common_hal_displayio_epaperdisplay_get_height(displayio_epaperdisplay_obj_t* self); +uint16_t common_hal_displayio_epaperdisplay_get_rotation(displayio_epaperdisplay_obj_t* self); +void common_hal_displayio_epaperdisplay_set_rotation(displayio_epaperdisplay_obj_t* self, int rotation); mp_obj_t common_hal_displayio_epaperdisplay_get_bus(displayio_epaperdisplay_obj_t* self); diff --git a/shared-module/displayio/EPaperDisplay.c b/shared-module/displayio/EPaperDisplay.c index 1b285b4b1d..3fb37ff219 100644 --- a/shared-module/displayio/EPaperDisplay.c +++ b/shared-module/displayio/EPaperDisplay.c @@ -198,6 +198,29 @@ mp_obj_t common_hal_displayio_epaperdisplay_get_bus(displayio_epaperdisplay_obj_ return self->core.bus; } +void common_hal_displayio_epaperdisplay_set_rotation(displayio_epaperdisplay_obj_t* self, int rotation){ + bool transposed = (self->core.rotation == 90 || self->core.rotation == 270); + bool will_transposed = (rotation == 90 || rotation == 270); + if(transposed != will_transposed) { + int tmp = self->core.width; + self->core.width = self->core.height; + self->core.height = tmp; + } + displayio_display_core_set_rotation(&self->core, rotation); + if (self == &displays[0].epaper_display) { + supervisor_stop_terminal(); + supervisor_start_terminal(self->core.width, self->core.height); + } + if (self->core.current_group != NULL) { + displayio_group_update_transform(self->core.current_group, &self->core.transform); + } +} + +uint16_t common_hal_displayio_epaperdisplay_get_rotation(displayio_epaperdisplay_obj_t* self){ + return self->core.rotation; +} + + bool displayio_epaperdisplay_refresh_area(displayio_epaperdisplay_obj_t* self, const displayio_area_t* area) { uint16_t buffer_size = 128; // In uint32_ts From 2463a6d6ac3fb53fa471c77bc585c8ef350d2b96 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 18 Nov 2020 16:28:21 -0800 Subject: [PATCH 119/148] Fix Palette grayscale for EInk. It needs to do the bitmasking that was only added to ColorConverter in #3611 --- shared-module/displayio/Palette.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shared-module/displayio/Palette.c b/shared-module/displayio/Palette.c index facb1fa732..ba5ff665c9 100644 --- a/shared-module/displayio/Palette.c +++ b/shared-module/displayio/Palette.c @@ -83,7 +83,8 @@ bool displayio_palette_get_color(displayio_palette_t *self, const _displayio_col uint8_t pixel_hue = self->colors[palette_index].hue; displayio_colorconverter_compute_tricolor(colorspace, pixel_hue, luma, color); } else if (colorspace->grayscale) { - *color = self->colors[palette_index].luma >> (8 - colorspace->depth); + size_t bitmask = (1 << colorspace->depth) - 1; + *color = (self->colors[palette_index].luma >> colorspace->grayscale_bit) & bitmask; } else { uint16_t packed = self->colors[palette_index].rgb565; if (colorspace->reverse_bytes_in_word) { From b98835a1d787f3d1e20eb29bf65ca8cf41d9abf0 Mon Sep 17 00:00:00 2001 From: hexthat Date: Wed, 18 Nov 2020 01:12:46 +0000 Subject: [PATCH 120/148] Translated using Weblate (Chinese (Pinyin)) Currently translated at 100.0% (848 of 848 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/zh_Latn/ --- locale/zh_Latn_pinyin.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index dd44aab939..e94ae8173f 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-10 15:30+0530\n" -"PO-Revision-Date: 2020-11-15 16:28+0000\n" +"PO-Revision-Date: 2020-11-19 01:28+0000\n" "Last-Translator: hexthat \n" "Language-Team: Chinese Hanyu Pinyin\n" "Language: zh_Latn_pinyin\n" @@ -1012,7 +1012,7 @@ msgstr "Huǎnchōng qū dàxiǎo bù zhèngquè" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "Initialization failed due to lack of memory" -msgstr "" +msgstr "yóu yú nèi cún bù zú, chū shǐ huà shī bài" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" @@ -3661,7 +3661,7 @@ msgstr "xiàngliàng bìxū jùyǒu xiāngtóng de chángdù" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "watchdog not initialized" -msgstr "" +msgstr "wèi chū shǐ huà jiān shì qì" #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" From b9bec87f2930787cb1d2f3baea8284985a0062d5 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 18 Nov 2020 17:38:06 -0800 Subject: [PATCH 121/148] Update build board info. * Don't add full urls because they are too large. * Remove the unstable version when it starts with the current version. --- tools/build_board_info.py | 135 +++++++++++++++++++------------------- 1 file changed, 69 insertions(+), 66 deletions(-) diff --git a/tools/build_board_info.py b/tools/build_board_info.py index f83282ea9d..ce9d45fe2f 100644 --- a/tools/build_board_info.py +++ b/tools/build_board_info.py @@ -19,20 +19,24 @@ import shared_bindings_matrix sys.path.append("adabot") import adabot.github_requests as github -SUPPORTED_PORTS = ["atmel-samd", "cxd56", "esp32s2", "litex", "mimxrt10xx", "nrf", "stm"] +SUPPORTED_PORTS = [ + "atmel-samd", + "cxd56", + "esp32s2", + "litex", + "mimxrt10xx", + "nrf", + "stm", +] -BIN = ('bin',) -UF2 = ('uf2',) -BIN_UF2 = ('bin', 'uf2') -HEX = ('hex',) -HEX_UF2 = ('hex', 'uf2') -SPK = ('spk',) -DFU = ('dfu',) -BIN_DFU = ('bin', 'dfu') - -# Example: -# https://downloads.circuitpython.org/bin/trinket_m0/en_US/adafruit-circuitpython-trinket_m0-en_US-5.0.0-rc.0.uf2 -DOWNLOAD_BASE_URL = "https://downloads.circuitpython.org/bin" +BIN = ("bin",) +UF2 = ("uf2",) +BIN_UF2 = ("bin", "uf2") +HEX = ("hex",) +HEX_UF2 = ("hex", "uf2") +SPK = ("spk",) +DFU = ("dfu",) +BIN_DFU = ("bin", "dfu") # Default extensions extension_by_port = { @@ -42,7 +46,7 @@ extension_by_port = { "cxd56": SPK, "mimxrt10xx": HEX_UF2, "litex": DFU, - "esp32s2": BIN_UF2 + "esp32s2": BIN_UF2, } # Per board overrides @@ -57,26 +61,28 @@ extension_by_board = { "feather_m0_rfm69": BIN_UF2, "feather_m0_rfm9x": BIN_UF2, "uchip": BIN_UF2, - # nRF52840 dev kits that may not have UF2 bootloaders, "makerdiary_nrf52840_mdk": HEX, "makerdiary_nrf52840_mdk_usb_dongle": HEX_UF2, "pca10056": BIN_UF2, "pca10059": BIN_UF2, "electronut_labs_blip": HEX, - # stm32 - "meowbit_v121": UF2 + "meowbit_v121": UF2, } aliases_by_board = { - "circuitplayground_express": ["circuitplayground_express_4h", "circuitplayground_express_digikey_pycon2019"], + "circuitplayground_express": [ + "circuitplayground_express_4h", + "circuitplayground_express_digikey_pycon2019", + ], "pybadge": ["edgebadge"], "pyportal": ["pyportal_pynt"], "gemma_m0": ["gemma_m0_pycon2018"], - "pewpew10": ["pewpew13"] + "pewpew10": ["pewpew13"], } + def get_languages(): languages = [] for f in os.scandir("../locale"): @@ -84,6 +90,7 @@ def get_languages(): languages.append(f.name[:-3]) return languages + def get_board_mapping(): boards = {} for port in SUPPORTED_PORTS: @@ -95,23 +102,30 @@ def get_board_mapping(): extensions = extension_by_port[port] extensions = extension_by_board.get(board_path.name, extensions) aliases = aliases_by_board.get(board_path.name, []) - boards[board_id] = {"port": port, - "extensions": extensions, - "download_count": 0, - "aliases": aliases} + boards[board_id] = { + "port": port, + "extensions": extensions, + "download_count": 0, + "aliases": aliases, + } for alias in aliases: - boards[alias] = {"port": port, - "extensions": extensions, - "download_count": 0, - "alias": True, - "aliases": []} + boards[alias] = { + "port": port, + "extensions": extensions, + "download_count": 0, + "alias": True, + "aliases": [], + } return boards + def get_version_info(): version = None sha = git("rev-parse", "--short", "HEAD").stdout.decode("utf-8") try: - version = git("describe", "--tags", "--exact-match").stdout.decode("utf-8").strip() + version = ( + git("describe", "--tags", "--exact-match").stdout.decode("utf-8").strip() + ) except sh.ErrorReturnCode_128: # No exact match pass @@ -120,10 +134,11 @@ def get_version_info(): sha = os.environ["GITHUB_SHA"] if not version: - version="{}-{}".format(date.today().strftime("%Y%m%d"), sha[:7]) + version = "{}-{}".format(date.today().strftime("%Y%m%d"), sha[:7]) return sha, version + def get_current_info(): response = github.get("/repos/adafruit/circuitpython-org/git/refs/heads/master") if not response.ok: @@ -131,7 +146,9 @@ def get_current_info(): raise RuntimeError("cannot get master sha") commit_sha = response.json()["object"]["sha"] - response = github.get("/repos/adafruit/circuitpython-org/contents/_data/files.json?ref=" + commit_sha) + response = github.get( + "/repos/adafruit/circuitpython-org/contents/_data/files.json?ref=" + commit_sha + ) if not response.ok: print(response.text) raise RuntimeError("cannot get previous files.json") @@ -145,6 +162,7 @@ def get_current_info(): current_info[info["id"]] = info return git_info, current_info + def create_pr(changes, updated, git_info, user): commit_sha, original_blob_sha = git_info branch_name = "new_release_" + changes["new_release"] @@ -158,7 +176,7 @@ def create_pr(changes, updated, git_info, user): updated_list.append(info) updated = json.dumps(updated_list, sort_keys=True, indent=1).encode("utf-8") + b"\n" - #print(updated.decode("utf-8")) + # print(updated.decode("utf-8")) pr_title = "Automated website update for release {}".format(changes["new_release"]) boards = "" if changes["new_boards"]: @@ -167,16 +185,13 @@ def create_pr(changes, updated, git_info, user): if changes["new_languages"]: languages = "New languages:\n* " + "\n* ".join(changes["new_languages"]) message = "Automated website update for release {} by Blinka.\n\n{}\n\n{}\n".format( - changes["new_release"], - boards, - languages + changes["new_release"], boards, languages ) - create_branch = { - "ref": "refs/heads/" + branch_name, - "sha": commit_sha - } - response = github.post("/repos/{}/circuitpython-org/git/refs".format(user), json=create_branch) + create_branch = {"ref": "refs/heads/" + branch_name, "sha": commit_sha} + response = github.post( + "/repos/{}/circuitpython-org/git/refs".format(user), json=create_branch + ) if not response.ok and response.json()["message"] != "Reference already exists": print("unable to create branch") print(response.text) @@ -186,10 +201,13 @@ def create_pr(changes, updated, git_info, user): "message": message, "content": base64.b64encode(updated).decode("utf-8"), "sha": original_blob_sha, - "branch": branch_name + "branch": branch_name, } - response = github.put("/repos/{}/circuitpython-org/contents/_data/files.json".format(user), json=update_file) + response = github.put( + "/repos/{}/circuitpython-org/contents/_data/files.json".format(user), + json=update_file, + ) if not response.ok: print("unable to post new file") print(response.text) @@ -199,7 +217,7 @@ def create_pr(changes, updated, git_info, user): "head": user + ":" + branch_name, "base": "master", "body": message, - "maintainer_can_modify": True + "maintainer_can_modify": True, } response = github.post("/repos/adafruit/circuitpython-org/pulls", json=pr_info) if not response.ok: @@ -220,17 +238,14 @@ def print_active_user(): print("Not logged in") return None + def generate_download_info(): boards = {} errors = [] new_tag = os.environ["RELEASE_TAG"] - changes = { - "new_release": new_tag, - "new_boards": [], - "new_languages": [] - } + changes = {"new_release": new_tag, "new_boards": [], "new_languages": []} user = print_active_user() @@ -254,8 +269,9 @@ def generate_download_info(): info = current_info[board] for version in info["versions"]: previous_releases.add(version["version"]) - previous_languages.update(version["files"].keys()) - if version["stable"] == new_stable: + if version["stable"] == new_stable or ( + new_stable and version["version"].startswith(this_version) + ): info["versions"].remove(version) board_mapping = get_board_mapping() @@ -272,29 +288,15 @@ def generate_download_info(): alias_info = board_mapping[alias] if alias not in current_info: changes["new_boards"].append(alias) - current_info[alias] = {"downloads": 0, - "versions": []} + current_info[alias] = {"downloads": 0, "versions": []} new_version = { "stable": new_stable, "version": new_tag, "modules": support_matrix.get(alias, "[]"), - "files": {}, "languages": languages, - "extensions": board_info["extensions"] + "extensions": board_info["extensions"], } - for language in languages: - files = [] - new_version["files"][language] = files - for extension in board_info["extensions"]: - files.append( - "{base_url}/{alias}/{language}/adafruit-circuitpython-{alias}-{language}-{tag}.{extension}" - .format( - base_url=DOWNLOAD_BASE_URL, - tag=new_tag, - alias=alias, - language=language, - extension=extension)) current_info[alias]["downloads"] = alias_info["download_count"] current_info[alias]["versions"].append(new_version) @@ -305,6 +307,7 @@ def generate_download_info(): else: print("No new release to update") + if __name__ == "__main__": if "RELEASE_TAG" in os.environ and os.environ["RELEASE_TAG"]: generate_download_info() From 9a642fc0490c22b60460bcca8dec3b0b93344d81 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 18 Nov 2020 20:37:26 -0600 Subject: [PATCH 122/148] samd21: Enable terse error reporting on resource constrained chip family This reclaims over 1kB of flash space by simplifying certain exception messages. e.g., it will no longer display the requested/actual length when a fixed list/tuple of N items is needed: if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { mp_raise_ValueError(translate("tuple/list has wrong length")); } else { mp_raise_ValueError_varg(translate("requested length %d but object has length %d"), (int)len, (int)seq_len); Other chip families including samd51 keep their current error reporting capabilities. --- ports/atmel-samd/mpconfigport.h | 1 + py/circuitpy_mpconfig.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/ports/atmel-samd/mpconfigport.h b/ports/atmel-samd/mpconfigport.h index ed10da9b9d..3069def33b 100644 --- a/ports/atmel-samd/mpconfigport.h +++ b/ports/atmel-samd/mpconfigport.h @@ -42,6 +42,7 @@ #define CIRCUITPY_MCU_FAMILY samd21 #define MICROPY_PY_SYS_PLATFORM "Atmel SAMD21" #define SPI_FLASH_MAX_BAUDRATE 8000000 +#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_TERSE) #define MICROPY_PY_BUILTINS_NOTIMPLEMENTED (0) #define MICROPY_PY_FUNCTION_ATTRS (0) // MICROPY_PY_UJSON depends on MICROPY_PY_IO diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index 85e152670a..4c2e33be01 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -64,7 +64,9 @@ #define MICROPY_ENABLE_FINALISER (1) #define MICROPY_ENABLE_GC (1) #define MICROPY_ENABLE_SOURCE_LINE (1) +#ifndef MICROPY_ERROR_REPORTING #define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_NORMAL) +#endif #define MICROPY_FLOAT_HIGH_QUALITY_HASH (0) #define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT) #define MICROPY_GC_ALLOC_THRESHOLD (0) From 76d4824728c6dc99d9bfed48a41933fa48c8bbf7 Mon Sep 17 00:00:00 2001 From: Kamil Tomaszewski Date: Thu, 19 Nov 2020 15:04:52 +0100 Subject: [PATCH 123/148] spresense: Return fixed stack --- ports/cxd56/supervisor/port.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ports/cxd56/supervisor/port.c b/ports/cxd56/supervisor/port.c index 92d335cd59..086c2d198e 100644 --- a/ports/cxd56/supervisor/port.c +++ b/ports/cxd56/supervisor/port.c @@ -98,8 +98,12 @@ void reset_to_bootloader(void) { } } +supervisor_allocation _fixed_stack; + supervisor_allocation* port_fixed_stack(void) { - return NULL; + _fixed_stack.ptr = port_stack_get_limit(); + _fixed_stack.length = (port_stack_get_top() - port_stack_get_limit()) * sizeof(uint32_t); + return &_fixed_stack; } uint32_t *port_stack_get_limit(void) { From dd108b755dc2bb886df14c9fcfcd4f09be61f2d4 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 19 Nov 2020 11:36:02 -0600 Subject: [PATCH 124/148] esp32s2: initialize event loop ane netif only once deinitting these seems to cause problems. --- ports/esp32s2/common-hal/wifi/__init__.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ports/esp32s2/common-hal/wifi/__init__.c b/ports/esp32s2/common-hal/wifi/__init__.c index 1b244dd2ff..f53e68fc28 100644 --- a/ports/esp32s2/common-hal/wifi/__init__.c +++ b/ports/esp32s2/common-hal/wifi/__init__.c @@ -88,14 +88,17 @@ static void event_handler(void* arg, esp_event_base_t event_base, } } -static bool wifi_inited; +static bool wifi_inited, wifi_ever_inited; void common_hal_wifi_init(void) { wifi_inited = true; common_hal_wifi_radio_obj.base.type = &wifi_radio_type; - ESP_ERROR_CHECK(esp_netif_init()); - ESP_ERROR_CHECK(esp_event_loop_create_default()); + if (!wifi_ever_inited) { + ESP_ERROR_CHECK(esp_netif_init()); + ESP_ERROR_CHECK(esp_event_loop_create_default()); + } + wifi_ever_inited = true; wifi_radio_obj_t* self = &common_hal_wifi_radio_obj; self->netif = esp_netif_create_default_wifi_sta(); From 331aa6e59fd36b52afb4119068d0baa99c85ea3c Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 19 Nov 2020 11:43:18 -0600 Subject: [PATCH 125/148] displayio: When the display is tall, move blinka above the text This makes a more useful display on the portrait magtag, allowing 21 characters across instead of just 18. There are 20 full rows of text, instead of 21. The total number of characters increases slightly from 378 to 420. For comparison, the Commodore VIC 20 had 22 rows of 23 characters for a total of 506 characters. :-P --- supervisor/shared/display.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/supervisor/shared/display.c b/supervisor/shared/display.c index afb3f3a9a6..a9ae258842 100644 --- a/supervisor/shared/display.c +++ b/supervisor/shared/display.c @@ -60,18 +60,21 @@ void supervisor_start_terminal(uint16_t width_px, uint16_t height_px) { #if CIRCUITPY_TERMINALIO displayio_tilegrid_t* grid = &supervisor_terminal_text_grid; - uint16_t width_in_tiles = (width_px - blinka_bitmap.width) / grid->tile_width; + bool tall = height_px > width_px; + uint16_t terminal_width_px = tall ? width_px : width_px - blinka_bitmap.width; + uint16_t terminal_height_px = tall ? height_px - blinka_bitmap.height : height_px ; + uint16_t width_in_tiles = terminal_width_px / grid->tile_width; // determine scale based on h if (width_in_tiles < 80) { scale = 1; } - width_in_tiles = (width_px - blinka_bitmap.width * scale) / (grid->tile_width * scale); + width_in_tiles = terminal_width_px / (grid->tile_width * scale); if (width_in_tiles < 1) { width_in_tiles = 1; } - uint16_t height_in_tiles = height_px / (grid->tile_height * scale); - uint16_t remaining_pixels = height_px % (grid->tile_height * scale); + uint16_t height_in_tiles = terminal_height_px / (grid->tile_height * scale); + uint16_t remaining_pixels = tall ? 0 : terminal_height_px % (grid->tile_height * scale); if (height_in_tiles < 1 || remaining_pixels > 0) { height_in_tiles += 1; } @@ -91,7 +94,8 @@ void supervisor_start_terminal(uint16_t width_px, uint16_t height_px) { if (tiles == NULL) { return; } - grid->y = 0; + grid->y = tall ? blinka_bitmap.height : 0; + grid->x = tall ? 0 : blinka_bitmap.width; grid->top_left_y = 0; if (remaining_pixels > 0) { grid->y -= (grid->tile_height - remaining_pixels); From 0556f9f851f0bd5fdb392b925af1076affbf5e00 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 19 Nov 2020 15:12:56 -0600 Subject: [PATCH 126/148] Revert "samd21: Enable terse error reporting on resource constrained chip family" This reverts commit 9a642fc0490c22b60460bcca8dec3b0b93344d81. --- ports/atmel-samd/mpconfigport.h | 1 - py/circuitpy_mpconfig.h | 2 -- 2 files changed, 3 deletions(-) diff --git a/ports/atmel-samd/mpconfigport.h b/ports/atmel-samd/mpconfigport.h index 3069def33b..ed10da9b9d 100644 --- a/ports/atmel-samd/mpconfigport.h +++ b/ports/atmel-samd/mpconfigport.h @@ -42,7 +42,6 @@ #define CIRCUITPY_MCU_FAMILY samd21 #define MICROPY_PY_SYS_PLATFORM "Atmel SAMD21" #define SPI_FLASH_MAX_BAUDRATE 8000000 -#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_TERSE) #define MICROPY_PY_BUILTINS_NOTIMPLEMENTED (0) #define MICROPY_PY_FUNCTION_ATTRS (0) // MICROPY_PY_UJSON depends on MICROPY_PY_IO diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index 4c2e33be01..85e152670a 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -64,9 +64,7 @@ #define MICROPY_ENABLE_FINALISER (1) #define MICROPY_ENABLE_GC (1) #define MICROPY_ENABLE_SOURCE_LINE (1) -#ifndef MICROPY_ERROR_REPORTING #define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_NORMAL) -#endif #define MICROPY_FLOAT_HIGH_QUALITY_HASH (0) #define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT) #define MICROPY_GC_ALLOC_THRESHOLD (0) From d5f6748d1bea832c6f483ca8b0095e776eaca2df Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 19 Nov 2020 16:12:53 -0600 Subject: [PATCH 127/148] Use mp_raise instead of nlr_raise(new_exception) where possible This saves a bit of code space --- extmod/machine_mem.c | 2 +- extmod/moduheapq.c | 2 +- extmod/vfs_posix_file.c | 2 +- py/bc.c | 4 ++-- py/objstr.c | 6 ++---- 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/extmod/machine_mem.c b/extmod/machine_mem.c index 6c6e110631..8944c3a666 100644 --- a/extmod/machine_mem.c +++ b/extmod/machine_mem.c @@ -21,7 +21,7 @@ STATIC uintptr_t machine_mem_get_addr(mp_obj_t addr_o, uint align) { uintptr_t addr = mp_obj_int_get_truncated(addr_o); if ((addr & (align - 1)) != 0) { - nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError, translate("address %08x is not aligned to %d bytes"), addr, align)); + mp_raise_ValueError_varg(translate("address %08x is not aligned to %d bytes"), addr, align); } return addr; } diff --git a/extmod/moduheapq.c b/extmod/moduheapq.c index bc4b97ff5b..50fe6c0513 100644 --- a/extmod/moduheapq.c +++ b/extmod/moduheapq.c @@ -62,7 +62,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_uheapq_heappush_obj, mod_uheapq_heappush); STATIC mp_obj_t mod_uheapq_heappop(mp_obj_t heap_in) { mp_obj_list_t *heap = get_heap(heap_in); if (heap->len == 0) { - nlr_raise(mp_obj_new_exception_msg(&mp_type_IndexError, translate("empty heap"))); + mp_raise_IndexError(translate("empty heap")); } mp_obj_t item = heap->items[0]; heap->len -= 1; diff --git a/extmod/vfs_posix_file.c b/extmod/vfs_posix_file.c index 3f887785e7..593b8d6a29 100644 --- a/extmod/vfs_posix_file.c +++ b/extmod/vfs_posix_file.c @@ -24,7 +24,7 @@ typedef struct _mp_obj_vfs_posix_file_t { #ifdef MICROPY_CPYTHON_COMPAT STATIC void check_fd_is_open(const mp_obj_vfs_posix_file_t *o) { if (o->fd < 0) { - nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, translate("I/O operation on closed file"))); + mp_raise_ValueError(translate("I/O operation on closed file")); } } #else diff --git a/py/bc.c b/py/bc.c index 6406713385..01131cb4c0 100644 --- a/py/bc.c +++ b/py/bc.c @@ -214,8 +214,8 @@ void mp_setup_code_state(mp_code_state_t *code_state, size_t n_args, size_t n_kw #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_TypeError(translate("unexpected keyword argument")); #else - nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_TypeError, - translate("unexpected keyword argument '%q'"), MP_OBJ_QSTR_VALUE(wanted_arg_name))); + mp_raise_TypeError_varg( + translate("unexpected keyword argument '%q'"), MP_OBJ_QSTR_VALUE(wanted_arg_name)); #endif } mp_obj_dict_store(dict, kwargs[2 * i], kwargs[2 * i + 1]); diff --git a/py/objstr.c b/py/objstr.c index edb562df27..6a03f5fc3e 100644 --- a/py/objstr.c +++ b/py/objstr.c @@ -2134,10 +2134,8 @@ STATIC NORETURN void bad_implicit_conversion(mp_obj_t self_in) { mp_raise_TypeError(translate("can't convert to str implicitly")); } else { const qstr src_name = mp_obj_get_type_qstr(self_in); - nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_TypeError, - translate("can't convert '%q' object to %q implicitly"), - src_name, src_name == MP_QSTR_str ? MP_QSTR_bytes : MP_QSTR_str)); - } + mp_raise_TypeError_varg(translate("can't convert '%q' object to %q implicitly"), + src_name, src_name == MP_QSTR_str ? MP_QSTR_bytes : MP_QSTR_str); } // use this if you will anyway convert the string to a qstr From c06fc8e02dc7c17e827e3fe736dc7226d7819452 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 19 Nov 2020 16:13:54 -0600 Subject: [PATCH 128/148] Introduce, use mp_raise_arg1 This raises an exception with a given object value. Saves a bit of code size. --- extmod/modure.c | 6 +++--- extmod/moduzlib.c | 2 +- ports/unix/modjni.c | 4 ++-- py/modsys.c | 2 +- py/objdict.c | 6 +++--- py/objset.c | 2 +- py/objstr.c | 2 +- py/pystack.c | 4 ++-- py/runtime.c | 8 ++++++-- py/runtime.h | 1 + 10 files changed, 21 insertions(+), 16 deletions(-) diff --git a/extmod/modure.c b/extmod/modure.c index a20f3ee429..bb54bc732f 100644 --- a/extmod/modure.c +++ b/extmod/modure.c @@ -43,7 +43,7 @@ STATIC mp_obj_t match_group(mp_obj_t self_in, mp_obj_t no_in) { mp_obj_match_t *self = MP_OBJ_TO_PTR(self_in); mp_int_t no = mp_obj_get_int(no_in); if (no < 0 || no >= self->num_matches) { - nlr_raise(mp_obj_new_exception_arg1(&mp_type_IndexError, no_in)); + mp_raise_arg1(&mp_type_IndexError, no_in); } const char *start = self->caps[no * 2]; @@ -82,7 +82,7 @@ STATIC void match_span_helper(size_t n_args, const mp_obj_t *args, mp_obj_t span if (n_args == 2) { no = mp_obj_get_int(args[1]); if (no < 0 || no >= self->num_matches) { - nlr_raise(mp_obj_new_exception_arg1(&mp_type_IndexError, args[1])); + mp_raise_arg1(&mp_type_IndexError, args[1]); } } @@ -326,7 +326,7 @@ STATIC mp_obj_t re_sub_helper(mp_obj_t self_in, size_t n_args, const mp_obj_t *a } if (match_no >= (unsigned int)match->num_matches) { - nlr_raise(mp_obj_new_exception_arg1(&mp_type_IndexError, MP_OBJ_NEW_SMALL_INT(match_no))); + mp_raise_arg1(&mp_type_IndexError, MP_OBJ_NEW_SMALL_INT(match_no)); } const char *start_match = match->caps[match_no * 2]; diff --git a/extmod/moduzlib.c b/extmod/moduzlib.c index 8422e75983..b344f96429 100644 --- a/extmod/moduzlib.c +++ b/extmod/moduzlib.c @@ -179,7 +179,7 @@ STATIC mp_obj_t mod_uzlib_decompress(size_t n_args, const mp_obj_t *args) { return res; error: - nlr_raise(mp_obj_new_exception_arg1(&mp_type_ValueError, MP_OBJ_NEW_SMALL_INT(st))); + mp_raise_arg1(&mp_type_ValueError, MP_OBJ_NEW_SMALL_INT(st)); } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_uzlib_decompress_obj, 1, 3, mod_uzlib_decompress); diff --git a/ports/unix/modjni.c b/ports/unix/modjni.c index 8ec5ae54d9..82d1ccd559 100644 --- a/ports/unix/modjni.c +++ b/ports/unix/modjni.c @@ -102,9 +102,9 @@ STATIC void check_exception(void) { mp_obj_t py_e = new_jobject(exc); JJ1(ExceptionClear); if (JJ(IsInstanceOf, exc, IndexException_class)) { - nlr_raise(mp_obj_new_exception_arg1(&mp_type_IndexError, py_e)); + mp_raise_arg1(&mp_type_IndexError, py_e); } - nlr_raise(mp_obj_new_exception_arg1(&mp_type_Exception, py_e)); + mp_raise_arg1(&mp_type_Exception, py_e); } } diff --git a/py/modsys.c b/py/modsys.c index a1d2cf831c..31f28a36fa 100644 --- a/py/modsys.c +++ b/py/modsys.c @@ -96,7 +96,7 @@ STATIC mp_obj_t mp_sys_exit(size_t n_args, const mp_obj_t *args) { if (n_args == 0) { exc = mp_obj_new_exception(&mp_type_SystemExit); } else { - exc = mp_obj_new_exception_arg1(&mp_type_SystemExit, args[0]); + mp_raise_arg1(&mp_type_SystemExit, args[0]); } nlr_raise(exc); } diff --git a/py/objdict.c b/py/objdict.c index 63fd86f357..098aec5d2f 100644 --- a/py/objdict.c +++ b/py/objdict.c @@ -169,7 +169,7 @@ mp_obj_t mp_obj_dict_get(mp_obj_t self_in, mp_obj_t index) { mp_obj_dict_t *self = MP_OBJ_TO_PTR(self_in); mp_map_elem_t *elem = mp_map_lookup(&self->map, index, MP_MAP_LOOKUP); if (elem == NULL) { - nlr_raise(mp_obj_new_exception_arg1(&mp_type_KeyError, index)); + mp_raise_arg1(&mp_type_KeyError, index); } else { return elem->value; } @@ -185,7 +185,7 @@ STATIC mp_obj_t dict_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) { mp_obj_dict_t *self = MP_OBJ_TO_PTR(self_in); mp_map_elem_t *elem = mp_map_lookup(&self->map, index, MP_MAP_LOOKUP); if (elem == NULL) { - nlr_raise(mp_obj_new_exception_arg1(&mp_type_KeyError, index)); + mp_raise_arg1(&mp_type_KeyError, index); } else { return elem->value; } @@ -272,7 +272,7 @@ STATIC mp_obj_t dict_get_helper(size_t n_args, const mp_obj_t *args, mp_map_look if (elem == NULL || elem->value == MP_OBJ_NULL) { if (n_args == 2) { if (lookup_kind == MP_MAP_LOOKUP_REMOVE_IF_FOUND) { - nlr_raise(mp_obj_new_exception_arg1(&mp_type_KeyError, args[1])); + mp_raise_arg1(&mp_type_KeyError, args[1]); } else { value = mp_const_none; } diff --git a/py/objset.c b/py/objset.c index 45b5c12606..c5d54aede5 100644 --- a/py/objset.c +++ b/py/objset.c @@ -378,7 +378,7 @@ STATIC mp_obj_t set_remove(mp_obj_t self_in, mp_obj_t item) { check_set(self_in); mp_obj_set_t *self = MP_OBJ_TO_PTR(self_in); if (mp_set_lookup(&self->set, item, MP_MAP_LOOKUP_REMOVE_IF_FOUND) == MP_OBJ_NULL) { - nlr_raise(mp_obj_new_exception_arg1(&mp_type_KeyError, item)); + mp_raise_arg1(&mp_type_KeyError, item); } return mp_const_none; } diff --git a/py/objstr.c b/py/objstr.c index 6a03f5fc3e..34ccab86d6 100644 --- a/py/objstr.c +++ b/py/objstr.c @@ -1087,7 +1087,7 @@ STATIC vstr_t mp_obj_str_format_helper(const char *str, const char *top, int *ar field_name = lookup; mp_map_elem_t *key_elem = mp_map_lookup(kwargs, field_q, MP_MAP_LOOKUP); if (key_elem == NULL) { - nlr_raise(mp_obj_new_exception_arg1(&mp_type_KeyError, field_q)); + mp_raise_arg1(&mp_type_KeyError, field_q); } arg = key_elem->value; } diff --git a/py/pystack.c b/py/pystack.c index f79ea92101..0def75b109 100644 --- a/py/pystack.c +++ b/py/pystack.c @@ -43,8 +43,8 @@ void *mp_pystack_alloc(size_t n_bytes) { #endif if (MP_STATE_THREAD(pystack_cur) + n_bytes > MP_STATE_THREAD(pystack_end)) { // out of memory in the pystack - nlr_raise(mp_obj_new_exception_arg1(&mp_type_RuntimeError, - MP_OBJ_NEW_QSTR(MP_QSTR_pystack_space_exhausted))); + mp_raise_arg1(&mp_type_RuntimeError, + MP_OBJ_NEW_QSTR(MP_QSTR_pystack_space_exhausted)); } void *ptr = MP_STATE_THREAD(pystack_cur); MP_STATE_THREAD(pystack_cur) += n_bytes; diff --git a/py/runtime.c b/py/runtime.c index e63e2337d9..3745e16e30 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -1514,6 +1514,10 @@ NORETURN void m_malloc_fail(size_t num_bytes) { translate("memory allocation failed, allocating %u bytes"), (uint)num_bytes); } +NORETURN void mp_raise_arg1(const mp_obj_type_t *exc_type, mp_obj_t arg) { + nlr_raise(mp_obj_new_exception_arg1(exc_type, arg)); +} + NORETURN void mp_raise_msg(const mp_obj_type_t *exc_type, const compressed_string_t *msg) { if (msg == NULL) { nlr_raise(mp_obj_new_exception(exc_type)); @@ -1580,7 +1584,7 @@ NORETURN void mp_raise_TypeError_varg(const compressed_string_t *fmt, ...) { } NORETURN void mp_raise_OSError(int errno_) { - nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(errno_))); + mp_raise_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(errno_)); } NORETURN void mp_raise_OSError_msg(const compressed_string_t *msg) { @@ -1607,7 +1611,7 @@ NORETURN void mp_raise_ConnectionError(const compressed_string_t *msg) { } NORETURN void mp_raise_BrokenPipeError(void) { - nlr_raise(mp_obj_new_exception_arg1(&mp_type_BrokenPipeError, MP_OBJ_NEW_SMALL_INT(MP_EPIPE))); + mp_raise_arg1(&mp_type_BrokenPipeError, MP_OBJ_NEW_SMALL_INT(MP_EPIPE)); } NORETURN void mp_raise_NotImplementedError(const compressed_string_t *msg) { diff --git a/py/runtime.h b/py/runtime.h index ad7d0feaba..5e8fda35c1 100644 --- a/py/runtime.h +++ b/py/runtime.h @@ -150,6 +150,7 @@ mp_obj_t mp_import_name(qstr name, mp_obj_t fromlist, mp_obj_t level); mp_obj_t mp_import_from(mp_obj_t module, qstr name); void mp_import_all(mp_obj_t module); +NORETURN void mp_raise_arg1(const mp_obj_type_t *exc_type, mp_obj_t arg); NORETURN void mp_raise_msg(const mp_obj_type_t *exc_type, const compressed_string_t *msg); NORETURN void mp_raise_msg_varg(const mp_obj_type_t *exc_type, const compressed_string_t *fmt, ...); NORETURN void mp_raise_msg_vlist(const mp_obj_type_t *exc_type, const compressed_string_t *fmt, va_list argptr); From b2b8520880e9d458adbd279a34b831f8d6b68d40 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 19 Nov 2020 16:18:52 -0600 Subject: [PATCH 129/148] Always use preprocessor for MICROPY_ERROR_REPORTING This ensures that only the translate("") alternative that will be used is seen after preprocessing. Improves the quality of the Huffman encoding and reduces binary size slightly. Also makes one "enhanced" error message only occur when ERROR_REPORTING_DETAILED: Instead of the word-for-word python3 error message "Type object has no attribute '%q'", the message will be "'type' object has no attribute '%q'". Also reduces binary size. (that's rolled into this commit as it was right next to a change to use the preprocessor for MICROPY_ERROR_REPORTING) Note that the odd semicolon after "value_error:" in parsenum.c is necessary due to a detail of the C grammar, in which a declaration cannot follow a label directly. --- py/argcheck.c | 18 ++++---- py/builtinimport.c | 12 +++--- py/compile.c | 12 +++--- py/modbuiltins.c | 6 +-- py/modsys.c | 4 +- py/obj.c | 66 ++++++++++++++-------------- py/objnamedtuple.c | 20 ++++----- py/objstr.c | 105 +++++++++++++++++++++++---------------------- py/objtype.c | 24 +++++------ py/parsenum.c | 10 ++--- py/runtime.c | 76 ++++++++++++++++---------------- 11 files changed, 178 insertions(+), 175 deletions(-) diff --git a/py/argcheck.c b/py/argcheck.c index 9341c02a6c..af5c81bf37 100644 --- a/py/argcheck.c +++ b/py/argcheck.c @@ -99,12 +99,12 @@ void mp_arg_parse_all(size_t n_pos, const mp_obj_t *pos, mp_map_t *kws, size_t n mp_map_elem_t *kw = mp_map_lookup(kws, MP_OBJ_NEW_QSTR(allowed[i].qst), MP_MAP_LOOKUP); if (kw == NULL) { if (allowed[i].flags & MP_ARG_REQUIRED) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_arg_error_terse_mismatch(); - } else { + #else mp_raise_TypeError_varg( translate("'%q' argument required"), allowed[i].qst); - } + #endif } out_vals[i] = allowed[i].defval; continue; @@ -124,20 +124,20 @@ void mp_arg_parse_all(size_t n_pos, const mp_obj_t *pos, mp_map_t *kws, size_t n } if (pos_found < n_pos) { extra_positional: - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_arg_error_terse_mismatch(); - } else { + #else // TODO better error message mp_raise_TypeError(translate("extra positional arguments given")); - } + #endif } if (kws_found < kws->used) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_arg_error_terse_mismatch(); - } else { + #else // TODO better error message mp_raise_TypeError(translate("extra keyword arguments given")); - } + #endif } } diff --git a/py/builtinimport.c b/py/builtinimport.c index 47ffab5196..c4768cc777 100644 --- a/py/builtinimport.c +++ b/py/builtinimport.c @@ -426,12 +426,12 @@ mp_obj_t mp_builtin___import__(size_t n_args, const mp_obj_t *args) { mp_module_call_init(mod_name, module_obj); } else { // couldn't find the file, so fail - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_ImportError(translate("module not found")); - } else { + #else mp_raise_msg_varg(&mp_type_ImportError, translate("no module named '%q'"), mod_name); - } + #endif } } else { // found the file, so get the module @@ -538,12 +538,12 @@ mp_obj_t mp_builtin___import__(size_t n_args, const mp_obj_t *args) { #endif // Couldn't find the module, so fail - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_msg(&mp_type_ImportError, translate("module not found")); - } else { + #else nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ImportError, translate("no module named '%q'"), module_name_qstr)); - } + #endif } #endif // MICROPY_ENABLE_EXTERNAL_IMPORT diff --git a/py/compile.c b/py/compile.c index 04bcf5bc14..b4d81ed445 100644 --- a/py/compile.c +++ b/py/compile.c @@ -2486,21 +2486,21 @@ STATIC void compile_atom_brace(compiler_t *comp, mp_parse_node_struct_t *pns) { compile_node(comp, pn_i); if (is_dict) { if (!is_key_value) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE compile_syntax_error(comp, (mp_parse_node_t)pns, translate("invalid syntax")); - } else { + #else compile_syntax_error(comp, (mp_parse_node_t)pns, translate("expecting key:value for dict")); - } + #endif return; } EMIT(store_map); } else { if (is_key_value) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE compile_syntax_error(comp, (mp_parse_node_t)pns, translate("invalid syntax")); - } else { + #else compile_syntax_error(comp, (mp_parse_node_t)pns, translate("expecting just a value for set")); - } + #endif return; } } diff --git a/py/modbuiltins.c b/py/modbuiltins.c index 41e1d4e488..fe3c366eec 100644 --- a/py/modbuiltins.c +++ b/py/modbuiltins.c @@ -346,12 +346,12 @@ STATIC mp_obj_t mp_builtin_ord(mp_obj_t o_in) { } } - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_TypeError(translate("ord expects a character")); - } else { + #else mp_raise_TypeError_varg( translate("ord() expected a character, but string of length %d found"), (int)len); - } + #endif } MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_ord_obj, mp_builtin_ord); diff --git a/py/modsys.c b/py/modsys.c index 31f28a36fa..81628683d8 100644 --- a/py/modsys.c +++ b/py/modsys.c @@ -92,13 +92,11 @@ STATIC const MP_DEFINE_STR_OBJ(platform_obj, MICROPY_PY_SYS_PLATFORM); // exit([retval]): raise SystemExit, with optional argument given to the exception STATIC mp_obj_t mp_sys_exit(size_t n_args, const mp_obj_t *args) { - mp_obj_t exc; if (n_args == 0) { - exc = mp_obj_new_exception(&mp_type_SystemExit); + nlr_raise(mp_obj_new_exception(&mp_type_SystemExit)); } else { mp_raise_arg1(&mp_type_SystemExit, args[0]); } - nlr_raise(exc); } MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_sys_exit_obj, 0, 1, mp_sys_exit); diff --git a/py/obj.c b/py/obj.c index 315e816e0b..d8e34746ca 100644 --- a/py/obj.c +++ b/py/obj.c @@ -262,12 +262,12 @@ mp_int_t mp_obj_get_int(mp_const_obj_t arg) { } else if (MP_OBJ_IS_TYPE(arg, &mp_type_int)) { return mp_obj_int_get_checked(arg); } else { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_TypeError_varg(translate("can't convert to %q"), MP_QSTR_int); - } else { + #else mp_raise_TypeError_varg( translate("can't convert %q to %q"), mp_obj_get_type_qstr(arg), MP_QSTR_int); - } + #endif } } @@ -325,12 +325,12 @@ mp_float_t mp_obj_get_float(mp_obj_t arg) { mp_float_t val; if (!mp_obj_get_float_maybe(arg, &val)) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_TypeError_varg(translate("can't convert to %q"), MP_QSTR_float); - } else { + #else mp_raise_TypeError_varg( translate("can't convert %q to %q"), mp_obj_get_type_qstr(arg), MP_QSTR_float); - } + #endif } return val; @@ -358,12 +358,12 @@ void mp_obj_get_complex(mp_obj_t arg, mp_float_t *real, mp_float_t *imag) { } else if (MP_OBJ_IS_TYPE(arg, &mp_type_complex)) { mp_obj_complex_get(arg, real, imag); } else { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_TypeError_varg(translate("can't convert to %q"), MP_QSTR_complex); - } else { + #else mp_raise_TypeError_varg( translate("can't convert %q to %q"), mp_obj_get_type_qstr(arg), MP_QSTR_complex); - } + #endif } } #endif @@ -376,12 +376,12 @@ void mp_obj_get_array(mp_obj_t o, size_t *len, mp_obj_t **items) { } else if (MP_OBJ_IS_TYPE(o, &mp_type_list)) { mp_obj_list_get(o, len, items); } else { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_TypeError(translate("expected tuple/list")); - } else { + #else mp_raise_TypeError_varg( translate("object '%q' is not a tuple or list"), mp_obj_get_type_qstr(o)); - } + #endif } } @@ -390,12 +390,12 @@ void mp_obj_get_array_fixed_n(mp_obj_t o, size_t len, mp_obj_t **items) { size_t seq_len; mp_obj_get_array(o, &seq_len, items); if (seq_len != len) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_ValueError(translate("tuple/list has wrong length")); - } else { + #else mp_raise_ValueError_varg(translate("requested length %d but object has length %d"), (int)len, (int)seq_len); - } + #endif } } @@ -405,13 +405,13 @@ size_t mp_get_index(const mp_obj_type_t *type, size_t len, mp_obj_t index, bool if (MP_OBJ_IS_SMALL_INT(index)) { i = MP_OBJ_SMALL_INT_VALUE(index); } else if (!mp_obj_get_int_maybe(index, &i)) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_TypeError(translate("indices must be integers")); - } else { + #else mp_raise_TypeError_varg( translate("%q indices must be integers, not %q"), type->name, mp_obj_get_type_qstr(index)); - } + #endif } if (i < 0) { @@ -425,12 +425,12 @@ size_t mp_get_index(const mp_obj_type_t *type, size_t len, mp_obj_t index, bool } } else { if (i < 0 || (mp_uint_t)i >= len) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_IndexError(translate("index out of range")); - } else { + #else mp_raise_msg_varg(&mp_type_IndexError, translate("%q index out of range"), type->name); - } + #endif } } @@ -460,12 +460,12 @@ mp_obj_t mp_obj_id(mp_obj_t o_in) { mp_obj_t mp_obj_len(mp_obj_t o_in) { mp_obj_t len = mp_obj_len_maybe(o_in); if (len == MP_OBJ_NULL) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_TypeError(translate("object has no len")); - } else { + #else mp_raise_TypeError_varg( translate("object of type '%q' has no len()"), mp_obj_get_type_qstr(o_in)); - } + #endif } else { return len; } @@ -503,26 +503,26 @@ mp_obj_t mp_obj_subscr(mp_obj_t base, mp_obj_t index, mp_obj_t value) { } } if (value == MP_OBJ_NULL) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_TypeError(translate("object does not support item deletion")); - } else { + #else mp_raise_TypeError_varg( translate("'%q' object does not support item deletion"), mp_obj_get_type_qstr(base)); - } + #endif } else if (value == MP_OBJ_SENTINEL) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_TypeError(translate("object is not subscriptable")); - } else { + #else mp_raise_TypeError_varg( translate("'%q' object is not subscriptable"), mp_obj_get_type_qstr(base)); - } + #endif } else { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_TypeError(translate("object does not support item assignment")); - } else { + #else mp_raise_TypeError_varg( translate("'%q' object does not support item assignment"), mp_obj_get_type_qstr(base)); - } + #endif } } diff --git a/py/objnamedtuple.c b/py/objnamedtuple.c index ab2f2f3c00..8b595da571 100644 --- a/py/objnamedtuple.c +++ b/py/objnamedtuple.c @@ -102,17 +102,17 @@ mp_obj_t namedtuple_make_new(const mp_obj_type_t *type_in, size_t n_args, const n_kw = kw_args->used; } if (n_args + n_kw != num_fields) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_arg_error_terse_mismatch(); - } else if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_NORMAL) { + #elif MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_NORMAL mp_raise_TypeError_varg( translate("function takes %d positional arguments but %d were given"), num_fields, n_args + n_kw); - } else if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_DETAILED) { + #else mp_raise_TypeError_varg( translate("%q() takes %d positional arguments but %d were given"), type->base.name, num_fields, n_args + n_kw); - } + #endif } // Create a tuple and set the type to this namedtuple @@ -128,20 +128,20 @@ mp_obj_t namedtuple_make_new(const mp_obj_type_t *type_in, size_t n_args, const qstr kw = mp_obj_str_get_qstr(kw_args->table[i].key); size_t id = mp_obj_namedtuple_find_field(type, kw); if (id == (size_t)-1) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_arg_error_terse_mismatch(); - } else { + #else mp_raise_TypeError_varg( translate("unexpected keyword argument '%q'"), kw); - } + #endif } if (tuple->items[id] != MP_OBJ_NULL) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_arg_error_terse_mismatch(); - } else { + #else mp_raise_TypeError_varg( translate("function got multiple values for argument '%q'"), kw); - } + #endif } tuple->items[id] = kw_args->table[i].value; } diff --git a/py/objstr.c b/py/objstr.c index 34ccab86d6..1a59aeaecd 100644 --- a/py/objstr.c +++ b/py/objstr.c @@ -971,11 +971,11 @@ STATIC vstr_t mp_obj_str_format_helper(const char *str, const char *top, int *ar vstr_add_byte(&vstr, '}'); continue; } - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE terse_str_format_value_error(); - } else { + #else mp_raise_ValueError(translate("single '}' encountered in format string")); - } + #endif } if (*str != '{') { vstr_add_byte(&vstr, *str); @@ -1010,18 +1010,18 @@ STATIC vstr_t mp_obj_str_format_helper(const char *str, const char *top, int *ar if (str < top && (*str == 'r' || *str == 's')) { conversion = *str++; } else { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE terse_str_format_value_error(); - } else if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_NORMAL) { + #elif MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_NORMAL mp_raise_ValueError(translate("bad conversion specifier")); - } else { + #else if (str >= top) { mp_raise_ValueError( translate("end of format while looking for conversion specifier")); } else { mp_raise_ValueError_varg(translate("unknown conversion specifier %c"), *str); } - } + #endif } } @@ -1047,18 +1047,18 @@ STATIC vstr_t mp_obj_str_format_helper(const char *str, const char *top, int *ar } } if (str >= top) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE terse_str_format_value_error(); - } else { + #else mp_raise_ValueError(translate("unmatched '{' in format")); - } + #endif } if (*str != '}') { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { - terse_str_format_value_error(); - } else { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE +:w + #else mp_raise_ValueError(translate("expected ':' after format specifier")); - } + #endif } mp_obj_t arg = mp_const_none; @@ -1067,12 +1067,12 @@ STATIC vstr_t mp_obj_str_format_helper(const char *str, const char *top, int *ar int index = 0; if (MP_LIKELY(unichar_isdigit(*field_name))) { if (*arg_i > 0) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE terse_str_format_value_error(); - } else { + #else mp_raise_ValueError( translate("can't switch from automatic field numbering to manual field specification")); - } + #endif } field_name = str_to_int(field_name, field_name_top, &index); if ((uint)index >= n_args - 1) { @@ -1096,12 +1096,12 @@ STATIC vstr_t mp_obj_str_format_helper(const char *str, const char *top, int *ar } } else { if (*arg_i < 0) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE terse_str_format_value_error(); - } else { + #else mp_raise_ValueError( translate("can't switch from manual field specification to automatic field numbering")); - } + #endif } if ((uint)*arg_i >= n_args - 1) { mp_raise_IndexError_varg(translate("%q index out of range"), MP_QSTR_tuple); @@ -1189,11 +1189,11 @@ STATIC vstr_t mp_obj_str_format_helper(const char *str, const char *top, int *ar type = *s++; } if (*s) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE terse_str_format_value_error(); - } else { + #else mp_raise_ValueError(translate("invalid format specifier")); - } + #endif } vstr_clear(&format_spec_vstr); } @@ -1210,19 +1210,19 @@ STATIC vstr_t mp_obj_str_format_helper(const char *str, const char *top, int *ar if (flags & (PF_FLAG_SHOW_SIGN | PF_FLAG_SPACE_SIGN)) { if (type == 's') { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE terse_str_format_value_error(); - } else { + #else mp_raise_ValueError(translate("sign not allowed in string format specifier")); - } + #endif } if (type == 'c') { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE terse_str_format_value_error(); - } else { + #else mp_raise_ValueError( translate("sign not allowed with integer format specifier 'c'")); - } + #endif } } @@ -1276,13 +1276,13 @@ STATIC vstr_t mp_obj_str_format_helper(const char *str, const char *top, int *ar break; default: - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE terse_str_format_value_error(); - } else { + #else mp_raise_ValueError_varg( translate("unknown format code '%c' for object of type '%q'"), type, mp_obj_get_type_qstr(arg)); - } + #endif } } @@ -1348,24 +1348,24 @@ STATIC vstr_t mp_obj_str_format_helper(const char *str, const char *top, int *ar #endif default: - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE terse_str_format_value_error(); - } else { + #else mp_raise_ValueError_varg( translate("unknown format code '%c' for object of type '%q'"), type, mp_obj_get_type_qstr(arg)); - } + #endif } } else { // arg doesn't look like a number if (align == '=') { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE terse_str_format_value_error(); - } else { + #else mp_raise_ValueError( translate("'=' alignment not allowed in string format specifier")); - } + #endif } switch (type) { @@ -1384,13 +1384,13 @@ STATIC vstr_t mp_obj_str_format_helper(const char *str, const char *top, int *ar } default: - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE terse_str_format_value_error(); - } else { + #else mp_raise_ValueError_varg( translate("unknown format code '%c' for object of type '%q'"), type, mp_obj_get_type_qstr(arg)); - } + #endif } } } @@ -1442,11 +1442,11 @@ STATIC mp_obj_t str_modulo_format(mp_obj_t pattern, size_t n_args, const mp_obj_ const byte *key = ++str; while (*str != ')') { if (str >= top) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE terse_str_format_value_error(); - } else { + #else mp_raise_ValueError(translate("incomplete format key")); - } + #endif } ++str; } @@ -1500,11 +1500,11 @@ STATIC mp_obj_t str_modulo_format(mp_obj_t pattern, size_t n_args, const mp_obj_ if (str >= top) { incomplete_format: - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE terse_str_format_value_error(); - } else { + #else mp_raise_ValueError(translate("incomplete format")); - } + #endif } // Tuple value lookup @@ -1587,13 +1587,13 @@ not_enough_args: break; default: - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE terse_str_format_value_error(); - } else { + #else mp_raise_ValueError_varg( translate("unsupported format character '%c' (0x%x) at index %d"), *str, *str, str - start_str); - } + #endif } } @@ -2130,12 +2130,13 @@ bool mp_obj_str_equal(mp_obj_t s1, mp_obj_t s2) { } STATIC NORETURN void bad_implicit_conversion(mp_obj_t self_in) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_TypeError(translate("can't convert to str implicitly")); - } else { + #else const qstr src_name = mp_obj_get_type_qstr(self_in); mp_raise_TypeError_varg(translate("can't convert '%q' object to %q implicitly"), src_name, src_name == MP_QSTR_str ? MP_QSTR_bytes : MP_QSTR_str); + #endif } // use this if you will anyway convert the string to a qstr diff --git a/py/objtype.c b/py/objtype.c index ccd014c335..1254b015c9 100644 --- a/py/objtype.c +++ b/py/objtype.c @@ -373,12 +373,12 @@ mp_obj_t mp_obj_instance_make_new(const mp_obj_type_t *self, size_t n_args, cons m_del(mp_obj_t, args2, 2 + n_args + 2 * n_kw); } if (init_ret != mp_const_none) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_TypeError(translate("__init__() should return None")); - } else { + #else mp_raise_TypeError_varg(translate("__init__() should return None, not '%q'"), mp_obj_get_type_qstr(init_ret)); - } + #endif } } @@ -888,12 +888,12 @@ mp_obj_t mp_obj_instance_call(mp_obj_t self_in, size_t n_args, size_t n_kw, cons mp_obj_t member[2] = {MP_OBJ_NULL, MP_OBJ_NULL}; mp_obj_t call = mp_obj_instance_get_call(self_in, member); if (call == MP_OBJ_NULL) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_TypeError(translate("object not callable")); - } else { + #else mp_raise_TypeError_varg(translate("'%q' object is not callable"), mp_obj_get_type_qstr(self_in)); - } + #endif } mp_obj_instance_t *self = MP_OBJ_TO_PTR(self_in); if (call == MP_OBJ_SENTINEL) { @@ -1024,11 +1024,11 @@ STATIC mp_obj_t type_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp mp_obj_type_t *self = MP_OBJ_TO_PTR(self_in); if (self->make_new == NULL) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_TypeError(translate("cannot create instance")); - } else { + #else mp_raise_TypeError_varg(translate("cannot create '%q' instances"), self->name); - } + #endif } // create a map directly from the given args array and make a new instance @@ -1134,12 +1134,12 @@ mp_obj_t mp_obj_new_type(qstr name, mp_obj_t bases_tuple, mp_obj_t locals_dict) mp_obj_type_t *t = MP_OBJ_TO_PTR(bases_items[i]); // TODO: Verify with CPy, tested on function type if (t->make_new == NULL) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_TypeError(translate("type is not an acceptable base type")); - } else { + #else mp_raise_TypeError_varg( translate("type '%q' is not an acceptable base type"), t->name); - } + #endif } #if ENABLE_SPECIAL_ACCESSORS if (mp_obj_is_instance_type(t)) { diff --git a/py/parsenum.c b/py/parsenum.c index da63825e4b..a72829b203 100644 --- a/py/parsenum.c +++ b/py/parsenum.c @@ -145,16 +145,16 @@ overflow: goto have_ret_val; } -value_error: - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { +value_error: ; + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_obj_t exc = mp_obj_new_exception_msg(&mp_type_ValueError, translate("invalid syntax for integer")); raise_exc(exc, lex); - } else if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_NORMAL) { + #elif MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_NORMAL mp_obj_t exc = mp_obj_new_exception_msg_varg(&mp_type_ValueError, translate("invalid syntax for integer with base %d"), base); raise_exc(exc, lex); - } else { + #else vstr_t vstr; mp_print_t print; vstr_init_print(&vstr, 50, &print); @@ -163,7 +163,7 @@ value_error: mp_obj_t exc = mp_obj_new_exception_arg1(&mp_type_ValueError, mp_obj_new_str_from_vstr(&mp_type_str, &vstr)); raise_exc(exc, lex); - } + #endif } typedef enum { diff --git a/py/runtime.c b/py/runtime.c index 3745e16e30..a3acb954a6 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -177,12 +177,12 @@ mp_obj_t mp_load_global(qstr qst) { #endif elem = mp_map_lookup((mp_map_t*)&mp_module_builtins_globals.map, MP_OBJ_NEW_QSTR(qst), MP_MAP_LOOKUP); if (elem == NULL) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_msg(&mp_type_NameError, translate("name not defined")); - } else { + #else nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_NameError, translate("name '%q' is not defined"), qst)); - } + #endif } } return elem->value; @@ -275,13 +275,13 @@ mp_obj_t mp_unary_op(mp_unary_op_t op, mp_obj_t arg) { return result; } } - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_TypeError(translate("unsupported type for operator")); - } else { + #else mp_raise_TypeError_varg( translate("unsupported type for %q: '%q'"), mp_unary_op_method_name[op], mp_obj_get_type_qstr(arg)); - } + #endif } } @@ -582,13 +582,13 @@ generic_binary_op: } unsupported_op: - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_TypeError(translate("unsupported type for operator")); - } else { + #else mp_raise_TypeError_varg( translate("unsupported types for %q: '%q', '%q'"), mp_binary_op_method_name[op], mp_obj_get_type_qstr(lhs), mp_obj_get_type_qstr(rhs)); - } + #endif zero_division: mp_raise_msg(&mp_type_ZeroDivisionError, translate("division by zero")); @@ -624,11 +624,11 @@ mp_obj_t mp_call_function_n_kw(mp_obj_t fun_in, size_t n_args, size_t n_kw, cons return type->call(fun_in, n_args, n_kw, args); } - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_TypeError(translate("object not callable")); - } else { + #else mp_raise_TypeError_varg(translate("'%q' object is not callable"), mp_obj_get_type_qstr(fun_in)); - } + #endif } // args contains: fun self/NULL arg(0) ... arg(n_args-2) arg(n_args-1) kw_key(0) kw_val(0) ... kw_key(n_kw-1) kw_val(n_kw-1) @@ -852,19 +852,19 @@ void mp_unpack_sequence(mp_obj_t seq_in, size_t num, mp_obj_t *items) { return; too_short: - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_ValueError(translate("wrong number of values to unpack")); - } else { + #else mp_raise_ValueError_varg(translate("need more than %d values to unpack"), (int)seq_len); - } + #endif too_long: - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_ValueError(translate("wrong number of values to unpack")); - } else { + #else mp_raise_ValueError_varg(translate("too many values to unpack (expected %d)"), (int)num); - } + #endif } // unpacked items are stored in reverse order into the array pointed to by items @@ -916,12 +916,12 @@ void mp_unpack_ex(mp_obj_t seq_in, size_t num_in, mp_obj_t *items) { return; too_short: - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_ValueError(translate("wrong number of values to unpack")); - } else { + #else mp_raise_ValueError_varg(translate("need more than %d values to unpack"), (int)seq_len); - } + #endif } mp_obj_t mp_load_attr(mp_obj_t base, qstr attr) { @@ -1094,9 +1094,9 @@ void mp_load_method(mp_obj_t base, qstr attr, mp_obj_t *dest) { if (dest[0] == MP_OBJ_NULL) { // no attribute/method called attr - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_AttributeError(translate("no such attribute")); - } else { + #elif MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_DETAILED // following CPython, we give a more detailed error message for type objects if (MP_OBJ_IS_TYPE(base, &mp_type_type)) { nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_AttributeError, @@ -1107,7 +1107,11 @@ void mp_load_method(mp_obj_t base, qstr attr, mp_obj_t *dest) { translate("'%q' object has no attribute '%q'"), mp_obj_get_type_qstr(base), attr)); } - } + #else + nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_AttributeError, + translate("'%q' object has no attribute '%q'"), + mp_obj_get_type_qstr(base), attr)); + #endif } } @@ -1168,13 +1172,13 @@ void mp_store_attr(mp_obj_t base, qstr attr, mp_obj_t value) { } #endif } - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_AttributeError(translate("no such attribute")); - } else { + #else nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_AttributeError, translate("'%q' object cannot assign attribute '%q'"), mp_obj_get_type_qstr(base), attr)); - } + #endif } mp_obj_t mp_getiter(mp_obj_t o_in, mp_obj_iter_buf_t *iter_buf) { @@ -1209,12 +1213,12 @@ mp_obj_t mp_getiter(mp_obj_t o_in, mp_obj_iter_buf_t *iter_buf) { } // object not iterable - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_TypeError(translate("object not iterable")); - } else { + #else mp_raise_TypeError_varg( translate("'%q' object is not iterable"), mp_obj_get_type_qstr(o_in)); - } + #endif } // may return MP_OBJ_STOP_ITERATION as an optimisation instead of raise StopIteration() @@ -1231,12 +1235,12 @@ mp_obj_t mp_iternext_allow_raise(mp_obj_t o_in) { // __next__ exists, call it and return its result return mp_call_method_n_kw(0, 0, dest); } else { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_TypeError(translate("object not an iterator")); - } else { + #else mp_raise_TypeError_varg(translate("'%q' object is not an iterator"), mp_obj_get_type_qstr(o_in)); - } + #endif } } } @@ -1267,12 +1271,12 @@ mp_obj_t mp_iternext(mp_obj_t o_in) { } } } else { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_TypeError(translate("object not an iterator")); - } else { + #else mp_raise_TypeError_varg(translate("'%q' object is not an iterator"), mp_obj_get_type_qstr(o_in)); - } + #endif } } } From aaca3eccf12d4b6ea6e294af81c8d19ad330be0c Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 19 Nov 2020 16:19:37 -0600 Subject: [PATCH 130/148] samd: PDMIn: Reduce code unrolling on samd21 only Instead of unrolling the code 16 times, unroll it 4 times and loop over it 4 times. This gives the same 16 iterations, but at an expense of less flash space. --- ports/atmel-samd/common-hal/audiobusio/PDMIn.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ports/atmel-samd/common-hal/audiobusio/PDMIn.c b/ports/atmel-samd/common-hal/audiobusio/PDMIn.c index 3c9ec05c25..8911aef2f1 100644 --- a/ports/atmel-samd/common-hal/audiobusio/PDMIn.c +++ b/ports/atmel-samd/common-hal/audiobusio/PDMIn.c @@ -337,7 +337,11 @@ const uint16_t sinc_filter [OVERSAMPLING] = { 94, 63, 39, 21, 9, 2, 0, 0 }; -#define REPEAT_16_TIMES(X) X X X X X X X X X X X X X X X X +#ifdef SAMD21 +#define REPEAT_16_TIMES(X) do { for(uint8_t j=0; j<4; j++) { X X X X } } while (0) +#else +#define REPEAT_16_TIMES(X) do { X X X X X X X X X X X X X X X X } while(0) +#endif static uint16_t filter_sample(uint32_t pdm_samples[4]) { uint16_t running_sum = 0; @@ -354,7 +358,7 @@ static uint16_t filter_sample(uint32_t pdm_samples[4]) { filter_ptr++; pdm_sample <<= 1; } - ) + ); } return running_sum; } From 982bce7259a9bbf7493f86258fc3395f31081648 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 19 Nov 2020 16:23:35 -0600 Subject: [PATCH 131/148] py.mk: allow translation to be overriden in GNUmakefile I like to use local makefile overrides, in the file GNUmakefile (or, on case-sensitive systems, makefile) to set compilation choices. However, writing TRANSLATION := de_DE include Makefile did not work, because py.mk would override the TRANSLATION := specified in an earlier part of the makefiles (but not from the commandline). By using ?= instead of := the local makefile override works, but when TRANSLATION is not specified it continues to work as before. --- py/py.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/py/py.mk b/py/py.mk index acf5d127bc..eeb3b8650f 100644 --- a/py/py.mk +++ b/py/py.mk @@ -7,7 +7,7 @@ HEADER_BUILD = $(BUILD)/genhdr # file containing qstr defs for the core Python bit PY_QSTR_DEFS = $(PY_SRC)/qstrdefs.h -TRANSLATION := en_US +TRANSLATION ?= en_US # If qstr autogeneration is not disabled we specify the output header # for all collected qstrings. From 17a8bafe0513c81565d25a6633808c639d5fa1f6 Mon Sep 17 00:00:00 2001 From: BennyE Date: Thu, 19 Nov 2020 23:39:48 +0100 Subject: [PATCH 132/148] Choose best AP in range if no channel/bssid given --- ports/esp32s2/common-hal/wifi/Radio.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ports/esp32s2/common-hal/wifi/Radio.c b/ports/esp32s2/common-hal/wifi/Radio.c index 1945da207b..61c95dea82 100644 --- a/ports/esp32s2/common-hal/wifi/Radio.c +++ b/ports/esp32s2/common-hal/wifi/Radio.c @@ -142,6 +142,11 @@ wifi_radio_error_t common_hal_wifi_radio_connect(wifi_radio_obj_t *self, uint8_t } else { config->sta.bssid_set = 0; } + // if channel and bssid both not set, do a full scan instead of fast scan + // this will ensure that the best AP is chosen automatically + if ((self->sta.bssid_set == 0) && (self->sta.channel == NULL)) { + config.scan_method = WIFI_ALL_CHANNEL_SCAN; + } esp_wifi_set_config(ESP_IF_WIFI_STA, config); self->starting_retries = 5; self->retries_left = 5; From 6760cdf678061abeaf2627e5903c8601eee6fc66 Mon Sep 17 00:00:00 2001 From: BennyE Date: Fri, 20 Nov 2020 00:11:17 +0100 Subject: [PATCH 133/148] Let connect() choose strongest AP if channel and BSSID are not given --- ports/esp32s2/common-hal/wifi/Radio.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ports/esp32s2/common-hal/wifi/Radio.c b/ports/esp32s2/common-hal/wifi/Radio.c index 61c95dea82..bcbca0ec7c 100644 --- a/ports/esp32s2/common-hal/wifi/Radio.c +++ b/ports/esp32s2/common-hal/wifi/Radio.c @@ -142,10 +142,10 @@ wifi_radio_error_t common_hal_wifi_radio_connect(wifi_radio_obj_t *self, uint8_t } else { config->sta.bssid_set = 0; } - // if channel and bssid both not set, do a full scan instead of fast scan - // this will ensure that the best AP is chosen automatically - if ((self->sta.bssid_set == 0) && (self->sta.channel == NULL)) { - config.scan_method = WIFI_ALL_CHANNEL_SCAN; + // If channel is 0 (default/unset) and BSSID is not given, do a full scan instead of fast scan + // This will ensure that the best AP in range is chosen automatically + if ((config->sta.bssid_set == 0) && (config->sta.channel == 0)) { + config->sta.scan_method = WIFI_ALL_CHANNEL_SCAN; } esp_wifi_set_config(ESP_IF_WIFI_STA, config); self->starting_retries = 5; From 2773f534c946df46da5ba87c0968b5e4912a6b2b Mon Sep 17 00:00:00 2001 From: BennyE Date: Fri, 20 Nov 2020 09:40:32 +0100 Subject: [PATCH 134/148] Update ports/esp32s2/common-hal/wifi/Radio.c adding suggested changes --- ports/esp32s2/common-hal/wifi/Radio.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ports/esp32s2/common-hal/wifi/Radio.c b/ports/esp32s2/common-hal/wifi/Radio.c index bcbca0ec7c..f7c431a56b 100644 --- a/ports/esp32s2/common-hal/wifi/Radio.c +++ b/ports/esp32s2/common-hal/wifi/Radio.c @@ -146,6 +146,8 @@ wifi_radio_error_t common_hal_wifi_radio_connect(wifi_radio_obj_t *self, uint8_t // This will ensure that the best AP in range is chosen automatically if ((config->sta.bssid_set == 0) && (config->sta.channel == 0)) { config->sta.scan_method = WIFI_ALL_CHANNEL_SCAN; + } else { + config->sta.scan_method = WIFI_FAST_SCAN; } esp_wifi_set_config(ESP_IF_WIFI_STA, config); self->starting_retries = 5; From 0a06530d52524c76a026ed843165fa79a0526c1b Mon Sep 17 00:00:00 2001 From: Seth Kerr Date: Fri, 20 Nov 2020 15:06:57 -0500 Subject: [PATCH 135/148] adding CP-Sapling --- ports/atmel-samd/boards/CP_Sapling_m0/board.c | 40 +++++++++++++ .../boards/CP_Sapling_m0/mpconfigboard.h | 57 +++++++++++++++++++ .../boards/CP_Sapling_m0/mpconfigboard.mk | 24 ++++++++ ports/atmel-samd/boards/CP_Sapling_m0/pins.c | 38 +++++++++++++ 4 files changed, 159 insertions(+) create mode 100644 ports/atmel-samd/boards/CP_Sapling_m0/board.c create mode 100644 ports/atmel-samd/boards/CP_Sapling_m0/mpconfigboard.h create mode 100644 ports/atmel-samd/boards/CP_Sapling_m0/mpconfigboard.mk create mode 100644 ports/atmel-samd/boards/CP_Sapling_m0/pins.c diff --git a/ports/atmel-samd/boards/CP_Sapling_m0/board.c b/ports/atmel-samd/boards/CP_Sapling_m0/board.c new file mode 100644 index 0000000000..b745bd9060 --- /dev/null +++ b/ports/atmel-samd/boards/CP_Sapling_m0/board.c @@ -0,0 +1,40 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2017 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 "boards/board.h" +#include "common-hal/microcontroller/Pin.h" +#include "supervisor/shared/board.h" +#include "hal/include/hal_gpio.h" + +void board_init(void) { +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { +} diff --git a/ports/atmel-samd/boards/CP_Sapling_m0/mpconfigboard.h b/ports/atmel-samd/boards/CP_Sapling_m0/mpconfigboard.h new file mode 100644 index 0000000000..c67f022eb8 --- /dev/null +++ b/ports/atmel-samd/boards/CP_Sapling_m0/mpconfigboard.h @@ -0,0 +1,57 @@ +#define MICROPY_HW_BOARD_NAME "CP Sapling M0" +#define MICROPY_HW_MCU_NAME "samd21e18" + +#define MICROPY_HW_NEOPIXEL (&pin_PA15) + +#define MICROPY_PORT_A (0) +#define MICROPY_PORT_B (0) +#define MICROPY_PORT_C (0) + +#define IGNORE_PIN_PA02 1 +#define IGNORE_PIN_PA03 1 +#define IGNORE_PIN_PA04 1 +#define IGNORE_PIN_PA05 1 +#define IGNORE_PIN_PA06 1 +#define IGNORE_PIN_PA07 1 +#define IGNORE_PIN_PA12 1 +#define IGNORE_PIN_PA13 1 +#define IGNORE_PIN_PA14 1 +#define IGNORE_PIN_PA20 1 +#define IGNORE_PIN_PA21 1 +// USB is always used internally so skip the pin objects for it. +#define IGNORE_PIN_PA24 1 +#define IGNORE_PIN_PA25 1 +#define IGNORE_PIN_PA27 1 +#define IGNORE_PIN_PA28 1 +#define IGNORE_PIN_PA30 1 +#define IGNORE_PIN_PA31 1 +#define IGNORE_PIN_PB01 1 +#define IGNORE_PIN_PB02 1 +#define IGNORE_PIN_PB03 1 +#define IGNORE_PIN_PB04 1 +#define IGNORE_PIN_PB05 1 +#define IGNORE_PIN_PB06 1 +#define IGNORE_PIN_PB07 1 +#define IGNORE_PIN_PB08 1 +#define IGNORE_PIN_PB09 1 +#define IGNORE_PIN_PB10 1 +#define IGNORE_PIN_PB11 1 +#define IGNORE_PIN_PB12 1 +#define IGNORE_PIN_PB13 1 +#define IGNORE_PIN_PB14 1 +#define IGNORE_PIN_PB15 1 +#define IGNORE_PIN_PB16 1 +#define IGNORE_PIN_PB17 1 +#define IGNORE_PIN_PB22 1 +#define IGNORE_PIN_PB23 1 +#define IGNORE_PIN_PB30 1 +#define IGNORE_PIN_PB31 1 +#define IGNORE_PIN_PB00 1 + +#define DEFAULT_I2C_BUS_SCL (&pin_PA09) +#define DEFAULT_I2C_BUS_SDA (&pin_PA08) + +#define DEFAULT_SPI_BUS_SS (&pin_PA22) +#define DEFAULT_SPI_BUS_SCK (&pin_PA19) +#define DEFAULT_SPI_BUS_MOSI (&pin_PA18) +#define DEFAULT_SPI_BUS_MISO (&pin_PA17) diff --git a/ports/atmel-samd/boards/CP_Sapling_m0/mpconfigboard.mk b/ports/atmel-samd/boards/CP_Sapling_m0/mpconfigboard.mk new file mode 100644 index 0000000000..861a0a5f7d --- /dev/null +++ b/ports/atmel-samd/boards/CP_Sapling_m0/mpconfigboard.mk @@ -0,0 +1,24 @@ +USB_VID = 0x1209 +USB_PID = 0x4DDD +USB_PRODUCT = "CP Sapling" +USB_MANUFACTURER = "Oak Development Technologies" + +CHIP_VARIANT = SAMD21E18A +CHIP_FAMILY = samd21 + +INTERNAL_FLASH_FILESYSTEM = 1 +LONGINT_IMPL = NONE +CIRCUITPY_FULL_BUILD = 0 + +SUPEROPT_GC = 0 + +CFLAGS_BOARD = --param max-inline-insns-auto=15 +ifeq ($(TRANSLATION), zh_Latn_pinyin) +RELEASE_NEEDS_CLEAN_BUILD = 1 +CFLAGS_INLINE_LIMIT = 35 +endif +ifeq ($(TRANSLATION), de_DE) +RELEASE_NEEDS_CLEAN_BUILD = 1 +CFLAGS_INLINE_LIMIT = 35 +SUPEROPT_VM = 0 +endif diff --git a/ports/atmel-samd/boards/CP_Sapling_m0/pins.c b/ports/atmel-samd/boards/CP_Sapling_m0/pins.c new file mode 100644 index 0000000000..ccffe2b3a1 --- /dev/null +++ b/ports/atmel-samd/boards/CP_Sapling_m0/pins.c @@ -0,0 +1,38 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_global_dict_table[] = { + + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA08) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA08) }, + + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA00) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA00) }, + + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA01) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PA01) }, + + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA09) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA09) }, + + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA22) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA22) }, + { MP_ROM_QSTR(MP_QSTR_SS), MP_ROM_PTR(&pin_PA22) }, + + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA19) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA19) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA19) }, + + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA17) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA17) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA17) }, + + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA18) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA18) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA18) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA15) }, + + { 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_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); From b69bbfa3d6dbbe86216f4ea72df54cfd24612fe0 Mon Sep 17 00:00:00 2001 From: Seth Kerr Date: Fri, 20 Nov 2020 15:17:44 -0500 Subject: [PATCH 136/148] fixed issues with trailing whitespace check --- ports/atmel-samd/boards/CP_Sapling_m0/board.c | 2 +- ports/atmel-samd/boards/CP_Sapling_m0/pins.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ports/atmel-samd/boards/CP_Sapling_m0/board.c b/ports/atmel-samd/boards/CP_Sapling_m0/board.c index b745bd9060..ce56366762 100644 --- a/ports/atmel-samd/boards/CP_Sapling_m0/board.c +++ b/ports/atmel-samd/boards/CP_Sapling_m0/board.c @@ -29,7 +29,7 @@ #include "supervisor/shared/board.h" #include "hal/include/hal_gpio.h" -void board_init(void) { +void board_init(void) { } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/CP_Sapling_m0/pins.c b/ports/atmel-samd/boards/CP_Sapling_m0/pins.c index ccffe2b3a1..d527aaddcb 100644 --- a/ports/atmel-samd/boards/CP_Sapling_m0/pins.c +++ b/ports/atmel-samd/boards/CP_Sapling_m0/pins.c @@ -7,7 +7,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA00) }, { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA00) }, - + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA01) }, { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PA01) }, @@ -31,7 +31,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA18) }, { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA15) }, - + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, }; From 29e91424d483f0b427957be1c859f7f758f6fbea Mon Sep 17 00:00:00 2001 From: Seth Kerr Date: Fri, 20 Nov 2020 15:29:35 -0500 Subject: [PATCH 137/148] removing cp sapling temporarily to read --- ports/atmel-samd/boards/CP_Sapling_m0/board.c | 40 ------------- .../boards/CP_Sapling_m0/mpconfigboard.h | 57 ------------------- .../boards/CP_Sapling_m0/mpconfigboard.mk | 24 -------- ports/atmel-samd/boards/CP_Sapling_m0/pins.c | 38 ------------- 4 files changed, 159 deletions(-) delete mode 100644 ports/atmel-samd/boards/CP_Sapling_m0/board.c delete mode 100644 ports/atmel-samd/boards/CP_Sapling_m0/mpconfigboard.h delete mode 100644 ports/atmel-samd/boards/CP_Sapling_m0/mpconfigboard.mk delete mode 100644 ports/atmel-samd/boards/CP_Sapling_m0/pins.c diff --git a/ports/atmel-samd/boards/CP_Sapling_m0/board.c b/ports/atmel-samd/boards/CP_Sapling_m0/board.c deleted file mode 100644 index ce56366762..0000000000 --- a/ports/atmel-samd/boards/CP_Sapling_m0/board.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2017 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 "boards/board.h" -#include "common-hal/microcontroller/Pin.h" -#include "supervisor/shared/board.h" -#include "hal/include/hal_gpio.h" - -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} diff --git a/ports/atmel-samd/boards/CP_Sapling_m0/mpconfigboard.h b/ports/atmel-samd/boards/CP_Sapling_m0/mpconfigboard.h deleted file mode 100644 index c67f022eb8..0000000000 --- a/ports/atmel-samd/boards/CP_Sapling_m0/mpconfigboard.h +++ /dev/null @@ -1,57 +0,0 @@ -#define MICROPY_HW_BOARD_NAME "CP Sapling M0" -#define MICROPY_HW_MCU_NAME "samd21e18" - -#define MICROPY_HW_NEOPIXEL (&pin_PA15) - -#define MICROPY_PORT_A (0) -#define MICROPY_PORT_B (0) -#define MICROPY_PORT_C (0) - -#define IGNORE_PIN_PA02 1 -#define IGNORE_PIN_PA03 1 -#define IGNORE_PIN_PA04 1 -#define IGNORE_PIN_PA05 1 -#define IGNORE_PIN_PA06 1 -#define IGNORE_PIN_PA07 1 -#define IGNORE_PIN_PA12 1 -#define IGNORE_PIN_PA13 1 -#define IGNORE_PIN_PA14 1 -#define IGNORE_PIN_PA20 1 -#define IGNORE_PIN_PA21 1 -// USB is always used internally so skip the pin objects for it. -#define IGNORE_PIN_PA24 1 -#define IGNORE_PIN_PA25 1 -#define IGNORE_PIN_PA27 1 -#define IGNORE_PIN_PA28 1 -#define IGNORE_PIN_PA30 1 -#define IGNORE_PIN_PA31 1 -#define IGNORE_PIN_PB01 1 -#define IGNORE_PIN_PB02 1 -#define IGNORE_PIN_PB03 1 -#define IGNORE_PIN_PB04 1 -#define IGNORE_PIN_PB05 1 -#define IGNORE_PIN_PB06 1 -#define IGNORE_PIN_PB07 1 -#define IGNORE_PIN_PB08 1 -#define IGNORE_PIN_PB09 1 -#define IGNORE_PIN_PB10 1 -#define IGNORE_PIN_PB11 1 -#define IGNORE_PIN_PB12 1 -#define IGNORE_PIN_PB13 1 -#define IGNORE_PIN_PB14 1 -#define IGNORE_PIN_PB15 1 -#define IGNORE_PIN_PB16 1 -#define IGNORE_PIN_PB17 1 -#define IGNORE_PIN_PB22 1 -#define IGNORE_PIN_PB23 1 -#define IGNORE_PIN_PB30 1 -#define IGNORE_PIN_PB31 1 -#define IGNORE_PIN_PB00 1 - -#define DEFAULT_I2C_BUS_SCL (&pin_PA09) -#define DEFAULT_I2C_BUS_SDA (&pin_PA08) - -#define DEFAULT_SPI_BUS_SS (&pin_PA22) -#define DEFAULT_SPI_BUS_SCK (&pin_PA19) -#define DEFAULT_SPI_BUS_MOSI (&pin_PA18) -#define DEFAULT_SPI_BUS_MISO (&pin_PA17) diff --git a/ports/atmel-samd/boards/CP_Sapling_m0/mpconfigboard.mk b/ports/atmel-samd/boards/CP_Sapling_m0/mpconfigboard.mk deleted file mode 100644 index 861a0a5f7d..0000000000 --- a/ports/atmel-samd/boards/CP_Sapling_m0/mpconfigboard.mk +++ /dev/null @@ -1,24 +0,0 @@ -USB_VID = 0x1209 -USB_PID = 0x4DDD -USB_PRODUCT = "CP Sapling" -USB_MANUFACTURER = "Oak Development Technologies" - -CHIP_VARIANT = SAMD21E18A -CHIP_FAMILY = samd21 - -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = NONE -CIRCUITPY_FULL_BUILD = 0 - -SUPEROPT_GC = 0 - -CFLAGS_BOARD = --param max-inline-insns-auto=15 -ifeq ($(TRANSLATION), zh_Latn_pinyin) -RELEASE_NEEDS_CLEAN_BUILD = 1 -CFLAGS_INLINE_LIMIT = 35 -endif -ifeq ($(TRANSLATION), de_DE) -RELEASE_NEEDS_CLEAN_BUILD = 1 -CFLAGS_INLINE_LIMIT = 35 -SUPEROPT_VM = 0 -endif diff --git a/ports/atmel-samd/boards/CP_Sapling_m0/pins.c b/ports/atmel-samd/boards/CP_Sapling_m0/pins.c deleted file mode 100644 index d527aaddcb..0000000000 --- a/ports/atmel-samd/boards/CP_Sapling_m0/pins.c +++ /dev/null @@ -1,38 +0,0 @@ -#include "shared-bindings/board/__init__.h" - -STATIC const mp_rom_map_elem_t board_global_dict_table[] = { - - { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA08) }, - { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA08) }, - - { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA00) }, - { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA00) }, - - { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA01) }, - { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PA01) }, - - { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA09) }, - { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA09) }, - - { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA22) }, - { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA22) }, - { MP_ROM_QSTR(MP_QSTR_SS), MP_ROM_PTR(&pin_PA22) }, - - { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA19) }, - { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA19) }, - { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA19) }, - - { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA17) }, - { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA17) }, - { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA17) }, - - { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA18) }, - { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA18) }, - { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA18) }, - - { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA15) }, - - { 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_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); From c4f4cdd8c15ef54ed05533b3f4c9d28bf9f9c46f Mon Sep 17 00:00:00 2001 From: Seth Kerr Date: Fri, 20 Nov 2020 15:31:49 -0500 Subject: [PATCH 138/148] readding cp_sapling directory --- ports/atmel-samd/boards/cp_sapling_m0/board.c | 40 +++++++++++++ .../boards/cp_sapling_m0/mpconfigboard.h | 57 +++++++++++++++++++ .../boards/cp_sapling_m0/mpconfigboard.mk | 24 ++++++++ ports/atmel-samd/boards/cp_sapling_m0/pins.c | 38 +++++++++++++ 4 files changed, 159 insertions(+) create mode 100644 ports/atmel-samd/boards/cp_sapling_m0/board.c create mode 100644 ports/atmel-samd/boards/cp_sapling_m0/mpconfigboard.h create mode 100644 ports/atmel-samd/boards/cp_sapling_m0/mpconfigboard.mk create mode 100644 ports/atmel-samd/boards/cp_sapling_m0/pins.c diff --git a/ports/atmel-samd/boards/cp_sapling_m0/board.c b/ports/atmel-samd/boards/cp_sapling_m0/board.c new file mode 100644 index 0000000000..b745bd9060 --- /dev/null +++ b/ports/atmel-samd/boards/cp_sapling_m0/board.c @@ -0,0 +1,40 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2017 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 "boards/board.h" +#include "common-hal/microcontroller/Pin.h" +#include "supervisor/shared/board.h" +#include "hal/include/hal_gpio.h" + +void board_init(void) { +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { +} diff --git a/ports/atmel-samd/boards/cp_sapling_m0/mpconfigboard.h b/ports/atmel-samd/boards/cp_sapling_m0/mpconfigboard.h new file mode 100644 index 0000000000..c67f022eb8 --- /dev/null +++ b/ports/atmel-samd/boards/cp_sapling_m0/mpconfigboard.h @@ -0,0 +1,57 @@ +#define MICROPY_HW_BOARD_NAME "CP Sapling M0" +#define MICROPY_HW_MCU_NAME "samd21e18" + +#define MICROPY_HW_NEOPIXEL (&pin_PA15) + +#define MICROPY_PORT_A (0) +#define MICROPY_PORT_B (0) +#define MICROPY_PORT_C (0) + +#define IGNORE_PIN_PA02 1 +#define IGNORE_PIN_PA03 1 +#define IGNORE_PIN_PA04 1 +#define IGNORE_PIN_PA05 1 +#define IGNORE_PIN_PA06 1 +#define IGNORE_PIN_PA07 1 +#define IGNORE_PIN_PA12 1 +#define IGNORE_PIN_PA13 1 +#define IGNORE_PIN_PA14 1 +#define IGNORE_PIN_PA20 1 +#define IGNORE_PIN_PA21 1 +// USB is always used internally so skip the pin objects for it. +#define IGNORE_PIN_PA24 1 +#define IGNORE_PIN_PA25 1 +#define IGNORE_PIN_PA27 1 +#define IGNORE_PIN_PA28 1 +#define IGNORE_PIN_PA30 1 +#define IGNORE_PIN_PA31 1 +#define IGNORE_PIN_PB01 1 +#define IGNORE_PIN_PB02 1 +#define IGNORE_PIN_PB03 1 +#define IGNORE_PIN_PB04 1 +#define IGNORE_PIN_PB05 1 +#define IGNORE_PIN_PB06 1 +#define IGNORE_PIN_PB07 1 +#define IGNORE_PIN_PB08 1 +#define IGNORE_PIN_PB09 1 +#define IGNORE_PIN_PB10 1 +#define IGNORE_PIN_PB11 1 +#define IGNORE_PIN_PB12 1 +#define IGNORE_PIN_PB13 1 +#define IGNORE_PIN_PB14 1 +#define IGNORE_PIN_PB15 1 +#define IGNORE_PIN_PB16 1 +#define IGNORE_PIN_PB17 1 +#define IGNORE_PIN_PB22 1 +#define IGNORE_PIN_PB23 1 +#define IGNORE_PIN_PB30 1 +#define IGNORE_PIN_PB31 1 +#define IGNORE_PIN_PB00 1 + +#define DEFAULT_I2C_BUS_SCL (&pin_PA09) +#define DEFAULT_I2C_BUS_SDA (&pin_PA08) + +#define DEFAULT_SPI_BUS_SS (&pin_PA22) +#define DEFAULT_SPI_BUS_SCK (&pin_PA19) +#define DEFAULT_SPI_BUS_MOSI (&pin_PA18) +#define DEFAULT_SPI_BUS_MISO (&pin_PA17) diff --git a/ports/atmel-samd/boards/cp_sapling_m0/mpconfigboard.mk b/ports/atmel-samd/boards/cp_sapling_m0/mpconfigboard.mk new file mode 100644 index 0000000000..861a0a5f7d --- /dev/null +++ b/ports/atmel-samd/boards/cp_sapling_m0/mpconfigboard.mk @@ -0,0 +1,24 @@ +USB_VID = 0x1209 +USB_PID = 0x4DDD +USB_PRODUCT = "CP Sapling" +USB_MANUFACTURER = "Oak Development Technologies" + +CHIP_VARIANT = SAMD21E18A +CHIP_FAMILY = samd21 + +INTERNAL_FLASH_FILESYSTEM = 1 +LONGINT_IMPL = NONE +CIRCUITPY_FULL_BUILD = 0 + +SUPEROPT_GC = 0 + +CFLAGS_BOARD = --param max-inline-insns-auto=15 +ifeq ($(TRANSLATION), zh_Latn_pinyin) +RELEASE_NEEDS_CLEAN_BUILD = 1 +CFLAGS_INLINE_LIMIT = 35 +endif +ifeq ($(TRANSLATION), de_DE) +RELEASE_NEEDS_CLEAN_BUILD = 1 +CFLAGS_INLINE_LIMIT = 35 +SUPEROPT_VM = 0 +endif diff --git a/ports/atmel-samd/boards/cp_sapling_m0/pins.c b/ports/atmel-samd/boards/cp_sapling_m0/pins.c new file mode 100644 index 0000000000..ccffe2b3a1 --- /dev/null +++ b/ports/atmel-samd/boards/cp_sapling_m0/pins.c @@ -0,0 +1,38 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_global_dict_table[] = { + + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA08) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA08) }, + + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA00) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA00) }, + + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA01) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PA01) }, + + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA09) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA09) }, + + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA22) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA22) }, + { MP_ROM_QSTR(MP_QSTR_SS), MP_ROM_PTR(&pin_PA22) }, + + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA19) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA19) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA19) }, + + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA17) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA17) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA17) }, + + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA18) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA18) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA18) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA15) }, + + { 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_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); From 1c92b1bf61cb0625a6ff7114623cd1cfdc6d5d75 Mon Sep 17 00:00:00 2001 From: Seth Kerr Date: Fri, 20 Nov 2020 15:35:52 -0500 Subject: [PATCH 139/148] forgot to run pre-commit local --- ports/atmel-samd/boards/cp_sapling_m0/board.c | 2 +- ports/atmel-samd/boards/cp_sapling_m0/pins.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ports/atmel-samd/boards/cp_sapling_m0/board.c b/ports/atmel-samd/boards/cp_sapling_m0/board.c index b745bd9060..ce56366762 100644 --- a/ports/atmel-samd/boards/cp_sapling_m0/board.c +++ b/ports/atmel-samd/boards/cp_sapling_m0/board.c @@ -29,7 +29,7 @@ #include "supervisor/shared/board.h" #include "hal/include/hal_gpio.h" -void board_init(void) { +void board_init(void) { } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/cp_sapling_m0/pins.c b/ports/atmel-samd/boards/cp_sapling_m0/pins.c index ccffe2b3a1..d527aaddcb 100644 --- a/ports/atmel-samd/boards/cp_sapling_m0/pins.c +++ b/ports/atmel-samd/boards/cp_sapling_m0/pins.c @@ -7,7 +7,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA00) }, { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA00) }, - + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA01) }, { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PA01) }, @@ -31,7 +31,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA18) }, { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA15) }, - + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, }; From b34e36d1db127f84f4448f015406fa835cde48da Mon Sep 17 00:00:00 2001 From: Seth Kerr Date: Fri, 20 Nov 2020 15:44:53 -0500 Subject: [PATCH 140/148] fixing build.yml --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f3e728a05c..fa60332112 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -197,6 +197,7 @@ jobs: - "circuitplayground_express_crickit" - "circuitplayground_express_displayio" - "clue_nrf52840_express" + - "cp_sapling_m0" - "cp32-m4" - "datalore_ip_m4" - "datum_distance" From 0fb075ab7e55b9cb7b84ece6a0247fd0b73dedb2 Mon Sep 17 00:00:00 2001 From: Seth Kerr Date: Fri, 20 Nov 2020 16:15:50 -0500 Subject: [PATCH 141/148] changed tab to spaces in build.yml, passes local pre-commit --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fa60332112..4d04e3f93b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -197,7 +197,7 @@ jobs: - "circuitplayground_express_crickit" - "circuitplayground_express_displayio" - "clue_nrf52840_express" - - "cp_sapling_m0" + - "cp_sapling_m0" - "cp32-m4" - "datalore_ip_m4" - "datum_distance" From 8301dcada00bdc63ac70de39ec5a0bdb6ae502ba Mon Sep 17 00:00:00 2001 From: Seth Kerr Date: Fri, 20 Nov 2020 16:26:33 -0500 Subject: [PATCH 142/148] I need to revisit the alphabet... --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4d04e3f93b..8e72a40219 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -197,8 +197,8 @@ jobs: - "circuitplayground_express_crickit" - "circuitplayground_express_displayio" - "clue_nrf52840_express" - - "cp_sapling_m0" - "cp32-m4" + - "cp_sapling_m0" - "datalore_ip_m4" - "datum_distance" - "datum_imu" From f25ac45534c6bc00c4eb0d5aedb8fcdbb673a310 Mon Sep 17 00:00:00 2001 From: Noel Gaetan Date: Thu, 19 Nov 2020 17:19:09 +0000 Subject: [PATCH 143/148] Translated using Weblate (French) Currently translated at 100.0% (848 of 848 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/fr/ --- locale/fr.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/locale/fr.po b/locale/fr.po index a15bbb8d50..b58ca6560b 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -8,8 +8,8 @@ msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-10 15:30+0530\n" -"PO-Revision-Date: 2020-11-15 16:28+0000\n" -"Last-Translator: Antonin ENFRUN \n" +"PO-Revision-Date: 2020-11-20 22:28+0000\n" +"Last-Translator: Noel Gaetan \n" "Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" @@ -1027,7 +1027,7 @@ msgstr "Taille de tampon incorrecte" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "Initialization failed due to lack of memory" -msgstr "" +msgstr "L'initialisation a échoué par manque de mémoire" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" @@ -3715,7 +3715,7 @@ msgstr "les vecteurs doivent avoir la même longueur" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "watchdog not initialized" -msgstr "" +msgstr "chien de garde non initialisé" #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" From 7b5e826b18d8777e5dcc994ea41b29e099cc9fa1 Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Thu, 19 Nov 2020 22:11:10 +0000 Subject: [PATCH 144/148] Translated using Weblate (Swedish) Currently translated at 100.0% (848 of 848 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/ --- locale/sv.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/sv.po b/locale/sv.po index 55e6368ae5..cc6fe8ad00 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: 2020-11-10 15:30+0530\n" -"PO-Revision-Date: 2020-11-15 16:28+0000\n" +"PO-Revision-Date: 2020-11-20 22:28+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" "Language: sv\n" @@ -1014,7 +1014,7 @@ msgstr "Fel buffertstorlek" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "Initialization failed due to lack of memory" -msgstr "" +msgstr "Initieringen misslyckades på grund av minnesbrist" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" @@ -3672,7 +3672,7 @@ msgstr "vektorer måste ha samma längd" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "watchdog not initialized" -msgstr "" +msgstr "watchdog är inte initierad" #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" From f3b5ca5f01058cb1d50be09838bc55b22d3aae69 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Sun, 22 Nov 2020 19:20:21 +0530 Subject: [PATCH 145/148] replace goto with conditional break --- ports/esp32s2/peripherals/timer.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ports/esp32s2/peripherals/timer.c b/ports/esp32s2/peripherals/timer.c index 3aee33dc50..0ae1403874 100644 --- a/ports/esp32s2/peripherals/timer.c +++ b/ports/esp32s2/peripherals/timer.c @@ -46,6 +46,8 @@ void peripherals_timer_reset(void) { } void peripherals_timer_init(const timer_config_t * config, timer_index_t * timer) { + bool break_loop = false; + // get free timer for (uint8_t i = 0; i < 2; i++) { for (uint8_t j = 0; j < 2; j++) { @@ -53,16 +55,17 @@ void peripherals_timer_init(const timer_config_t * config, timer_index_t * timer timer->idx = (timer_idx_t)j; timer->group = (timer_group_t)i; timer_state[i][j] = TIMER_BUSY; - goto init_timer; + break_loop = true; + break; } else if (i == 1 && j == 1) { timer->idx = TIMER_MAX; timer->group = TIMER_GROUP_MAX; return; } } + if (break_loop) {break;} } -init_timer: // initialize timer module timer_init(timer->group, timer->idx, config); timer_set_counter_value(timer->group, timer->idx, 0); From f62ea25331678cc400c6149bbe3102c371540c6e Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Sun, 22 Nov 2020 19:08:27 -0500 Subject: [PATCH 146/148] ESP32S2: common_hal_mcu_delay_us() now calls mp_hal_delay_us() --- ports/esp32s2/common-hal/microcontroller/__init__.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/esp32s2/common-hal/microcontroller/__init__.c b/ports/esp32s2/common-hal/microcontroller/__init__.c index e5cfc7eef0..dba12b88b2 100644 --- a/ports/esp32s2/common-hal/microcontroller/__init__.c +++ b/ports/esp32s2/common-hal/microcontroller/__init__.c @@ -42,7 +42,7 @@ #include "freertos/FreeRTOS.h" void common_hal_mcu_delay_us(uint32_t delay) { - + mp_hal_delay_us(delay); } volatile uint32_t nesting_count = 0; From 9d8be648eec70c36b3a461c4ff45064357d11693 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sun, 15 Nov 2020 11:48:53 -0600 Subject: [PATCH 147/148] ulab: Update to release tag 1.1.0 Disable certain classes of diagnostic when building ulab. We should submit patches upstream to (A) fix these errors and (B) upgrade their CI so that the problems are caught before we want to integrate with CircuitPython, but not right now. --- extmod/ulab | 2 +- locale/circuitpython.pot | 147 +++++++++++++++++++++++++++------------ py/py.mk | 2 +- 3 files changed, 106 insertions(+), 45 deletions(-) diff --git a/extmod/ulab b/extmod/ulab index 8242b84753..aa7e741530 160000 --- a/extmod/ulab +++ b/extmod/ulab @@ -1 +1 @@ -Subproject commit 8242b84753355433b61230ab6631c06e5ac77f35 +Subproject commit aa7e741530df471d206a4a321823a37a913a0eb8 diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index ec232615d1..c184d69313 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-10 15:30+0530\n" +"POT-Creation-Date: 2020-11-23 10:10-0600\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -855,6 +855,10 @@ msgstr "" msgid "FFT is defined for ndarrays only" msgstr "" +#: extmod/ulab/code/fft/fft.c +msgid "FFT is implemented for linear arrays only" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Failed SSL handshake" msgstr "" @@ -1951,7 +1955,7 @@ msgstr "" msgid "WARNING: Your code filename has two extensions\n" msgstr "" -#: shared-bindings/watchdog/WatchDogTimer.c +#: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "WatchDogTimer cannot be deinitialized once mode is set to RESET" msgstr "" @@ -2030,10 +2034,6 @@ msgstr "" msgid "addresses is empty" msgstr "" -#: extmod/ulab/code/vector/vectorise.c -msgid "arctan2 is implemented for scalars and ndarrays only" -msgstr "" - #: py/modbuiltins.c msgid "arg is an empty sequence" msgstr "" @@ -2042,6 +2042,10 @@ msgstr "" msgid "argsort argument must be an ndarray" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "argsort is not implemented for flattened arrays" +msgstr "" + #: py/runtime.c msgid "argument has wrong type" msgstr "" @@ -2059,14 +2063,22 @@ msgstr "" msgid "argument should be a '%q' not a '%q'" msgstr "" -#: extmod/ulab/code/linalg/linalg.c +#: extmod/ulab/code/linalg/linalg.c extmod/ulab/code/numerical/numerical.c msgid "arguments must be ndarrays" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array and index length must be equal" +msgstr "" + #: py/objarray.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "attempt to get (arg)min/(arg)max of empty sequence" +msgstr "" + #: extmod/ulab/code/numerical/numerical.c msgid "attempt to get argmin/argmax of an empty sequence" msgstr "" @@ -2076,15 +2088,15 @@ msgid "attributes not supported yet" msgstr "" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be -1, 0, None, or 1" +msgid "axis is out of bounds" msgstr "" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be -1, 0, or 1" +msgid "axis must be None, or an integer" msgstr "" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be None, 0, or 1" +msgid "axis too long" msgstr "" #: py/builtinevex.c @@ -2288,6 +2300,10 @@ msgid "" "can't switch from manual field specification to automatic field numbering" msgstr "" +#: extmod/ulab/code/ndarray_operators.c +msgid "cannot cast output with casting rule" +msgstr "" + #: py/objtype.c msgid "cannot create '%q' instances" msgstr "" @@ -2304,10 +2320,6 @@ msgstr "" msgid "cannot perform relative import" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "cannot reshape array (incompatible input/output shape)" -msgstr "" - #: py/emitnative.c msgid "casting" msgstr "" @@ -2380,10 +2392,6 @@ msgstr "" msgid "convolve arguments must not be empty" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "could not broadast input array from shape" -msgstr "" - #: extmod/ulab/code/poly/poly.c msgid "could not invert Vandermonde matrix" msgstr "" @@ -2392,6 +2400,10 @@ msgstr "" msgid "couldn't determine SD card version" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "cross is defined for 1D arrays of length 3" +msgstr "" + #: extmod/ulab/code/approx/approx.c msgid "data must be iterable" msgstr "" @@ -2400,10 +2412,6 @@ msgstr "" msgid "data must be of equal length" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "ddof must be smaller than length of data set" -msgstr "" - #: py/parsenum.c msgid "decimal numbers not supported" msgstr "" @@ -2433,6 +2441,10 @@ msgstr "" msgid "diff argument must be an ndarray" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "differentiation order out of range" +msgstr "" + #: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c #: shared-bindings/math/__init__.c msgid "division by zero" @@ -2548,6 +2560,10 @@ msgstr "" msgid "first argument must be a function" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "first argument must be a tuple of ndarrays" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "first argument must be an iterable" msgstr "" @@ -2601,8 +2617,8 @@ msgstr "" msgid "function has the same sign at the ends of interval" msgstr "" -#: extmod/ulab/code/compare/compare.c -msgid "function is implemented for scalars and ndarrays only" +#: extmod/ulab/code/ndarray.c +msgid "function is defined for ndarrays only" msgstr "" #: py/argcheck.c @@ -2672,6 +2688,7 @@ msgstr "" msgid "index is out of bounds" msgstr "" +#: extmod/ulab/code/numerical/numerical.c #: ports/esp32s2/common-hal/pulseio/PulseIn.c py/obj.c msgid "index out of range" msgstr "" @@ -2696,6 +2713,10 @@ msgstr "" msgid "inline assembler must be a function" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "input and output shapes are not compatible" +msgstr "" + #: extmod/ulab/code/ulab_create.c msgid "input argument must be an integer or a 2-tuple" msgstr "" @@ -2704,6 +2725,10 @@ msgstr "" msgid "input array length must be power of 2" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "input arrays are not compatible" +msgstr "" + #: extmod/ulab/code/poly/poly.c msgid "input data must be an iterable" msgstr "" @@ -2716,6 +2741,22 @@ msgstr "" msgid "input matrix is singular" msgstr "" +#: extmod/ulab/code/user/user.c +msgid "input must be a dense ndarray" +msgstr "" + +#: extmod/ulab/code/ulab_create.c +msgid "input must be a tensor of rank 2" +msgstr "" + +#: extmod/ulab/code/ulab_create.c extmod/ulab/code/user/user.c +msgid "input must be an ndarray" +msgstr "" + +#: extmod/ulab/code/filter/filter.c +msgid "input must be one-dimensional" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "input must be square matrix" msgstr "" @@ -2728,6 +2769,10 @@ msgstr "" msgid "input vectors must be of equal length" msgstr "" +#: extmod/ulab/code/poly/poly.c +msgid "inputs are not iterable" +msgstr "" + #: py/parsenum.c msgid "int() arg 2 must be >= 2 and <= 36" msgstr "" @@ -2896,6 +2941,10 @@ msgstr "" msgid "max_length must be > 0" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "maximum number of dimensions is 4" +msgstr "" + #: py/runtime.c msgid "maximum recursion depth exceeded" msgstr "" @@ -2945,10 +2994,6 @@ msgstr "" msgid "must use keyword argument for key function" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "n must be between 0, and 9" -msgstr "" - #: py/runtime.c msgid "name '%q' is not defined" msgstr "" @@ -3031,6 +3076,10 @@ msgstr "" msgid "non-keyword arg after keyword arg" msgstr "" +#: extmod/ulab/code/linalg/linalg.c +msgid "norm is defined for 1D and 2D arrays" +msgstr "" + #: shared-bindings/_bleio/UUID.c msgid "not a 128-bit UUID" msgstr "" @@ -3043,10 +3092,6 @@ msgstr "" msgid "not enough arguments for format string" msgstr "" -#: extmod/ulab/code/poly/poly.c -msgid "number of arguments must be 2, or 3" -msgstr "" - #: extmod/ulab/code/ulab_create.c msgid "number of points must be at least 2" msgstr "" @@ -3099,6 +3144,10 @@ msgstr "" msgid "odd-length string" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "offset is too large" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "" @@ -3121,6 +3170,14 @@ msgstr "" msgid "operands could not be broadcast together" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "operation is implemented for 1D Boolean arrays only" +msgstr "" + +#: extmod/ulab/code/numerical/numerical.c +msgid "operation is not implemented for flattened array" +msgstr "" + #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented on ndarrays" msgstr "" @@ -3255,6 +3312,10 @@ msgstr "" msgid "requested length %d but object has length %d" msgstr "" +#: extmod/ulab/code/ndarray_operators.c +msgid "results cannot be cast to specified type" +msgstr "" + #: py/compile.c msgid "return annotation must be an identifier" msgstr "" @@ -3273,8 +3334,8 @@ msgstr "" msgid "rgb_pins[%d] is not on the same port as clock" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "right hand side must be an ndarray, or a scalar" +#: extmod/ulab/code/numerical/numerical.c +msgid "roll argument must be an ndarray" msgstr "" #: py/objstr.c @@ -3300,7 +3361,7 @@ msgid "script compilation not supported" msgstr "" #: extmod/ulab/code/ndarray.c -msgid "shape must be a 2-tuple" +msgid "shape must be a tuple" msgstr "" #: py/objstr.c @@ -3343,10 +3404,6 @@ msgstr "" msgid "sort argument must be an ndarray" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "sorted axis can't be longer than 65535" -msgstr "" - #: extmod/ulab/code/filter/filter.c msgid "sos array must be of shape (n_section, 6)" msgstr "" @@ -3452,6 +3509,10 @@ msgstr "" msgid "timestamp out of range for platform time_t" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "tobytes can be invoked for dense arrays only" +msgstr "" + #: shared-module/struct/__init__.c msgid "too many arguments provided with the given format" msgstr "" @@ -3627,12 +3688,12 @@ msgstr "" msgid "window must be <= interval" msgstr "" -#: extmod/ulab/code/linalg/linalg.c -msgid "wrong argument type" +#: extmod/ulab/code/numerical/numerical.c +msgid "wrong axis index" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "wrong index type" +#: extmod/ulab/code/ulab_create.c +msgid "wrong axis specified" msgstr "" #: extmod/ulab/code/vector/vectorise.c diff --git a/py/py.mk b/py/py.mk index acf5d127bc..eb3ba27acb 100644 --- a/py/py.mk +++ b/py/py.mk @@ -109,7 +109,7 @@ ifeq ($(CIRCUITPY_ULAB),1) SRC_MOD += $(patsubst $(TOP)/%,%,$(wildcard $(TOP)/extmod/ulab/code/*.c)) SRC_MOD += $(patsubst $(TOP)/%,%,$(wildcard $(TOP)/extmod/ulab/code/*/*.c)) CFLAGS_MOD += -DCIRCUITPY_ULAB=1 -DMODULE_ULAB_ENABLED=1 -$(BUILD)/extmod/ulab/code/%.o: CFLAGS += -Wno-float-equal -Wno-sign-compare -DCIRCUITPY +$(BUILD)/extmod/ulab/code/%.o: CFLAGS += -Wno-missing-declarations -Wno-missing-prototypes -Wno-unused-parameter -Wno-float-equal -Wno-sign-compare -Wno-cast-align -Wno-shadow -DCIRCUITPY endif # External modules written in C. From 70e978f48b587620bb1407d9717f0a8fc3d4cf26 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 16 Nov 2020 16:57:01 -0600 Subject: [PATCH 148/148] stm: disable ulab on two resource-constrained boards --- ports/stm/boards/meowbit_v121/mpconfigboard.mk | 2 ++ ports/stm/boards/thunderpack/mpconfigboard.mk | 2 ++ 2 files changed, 4 insertions(+) diff --git a/ports/stm/boards/meowbit_v121/mpconfigboard.mk b/ports/stm/boards/meowbit_v121/mpconfigboard.mk index c416700e3c..86b0cb5ab4 100644 --- a/ports/stm/boards/meowbit_v121/mpconfigboard.mk +++ b/ports/stm/boards/meowbit_v121/mpconfigboard.mk @@ -20,3 +20,5 @@ LD_COMMON = boards/common_default.ld LD_FILE = boards/STM32F401xe_boot.ld # For debugging - also comment BOOTLOADER_OFFSET and BOARD_VTOR_DEFER # LD_FILE = boards/STM32F401xe_fs.ld + +CIRCUITPY_ULAB = 0 diff --git a/ports/stm/boards/thunderpack/mpconfigboard.mk b/ports/stm/boards/thunderpack/mpconfigboard.mk index d303582e0e..8f645068d7 100644 --- a/ports/stm/boards/thunderpack/mpconfigboard.mk +++ b/ports/stm/boards/thunderpack/mpconfigboard.mk @@ -15,3 +15,5 @@ MCU_PACKAGE = UFQFPN48 LD_COMMON = boards/common_nvm.ld LD_FILE = boards/STM32F411_nvm.ld + +CIRCUITPY_ULAB = 0